diff --git a/staging/src/github.com/kcp-dev/apimachinery/go.mod b/staging/src/github.com/kcp-dev/apimachinery/go.mod index 6ac9bc8cbcc..e3b810cc209 100644 --- a/staging/src/github.com/kcp-dev/apimachinery/go.mod +++ b/staging/src/github.com/kcp-dev/apimachinery/go.mod @@ -6,42 +6,37 @@ require ( github.com/google/go-cmp v0.7.0 github.com/kcp-dev/logicalcluster/v3 v3.0.5 github.com/stretchr/testify v1.11.1 - k8s.io/api v0.36.0 - k8s.io/apimachinery v0.36.0 - k8s.io/client-go v0.36.0 + k8s.io/api v0.37.0 + k8s.io/apimachinery v0.37.0 + k8s.io/client-go v0.37.0 k8s.io/klog/v2 v2.140.0 - k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 + k8s.io/utils v0.0.0-20260626114624-be93311217bd ) require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fxamacker/cbor/v2 v2.9.1 // indirect github.com/go-logr/logr v1.4.3 // 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/google/gnostic-models v0.7.1 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/kr/text v0.2.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/spf13/pflag v1.0.10 // indirect github.com/x448/float16 v0.8.4 // indirect go.uber.org/goleak v1.3.1-0.20251210191316-2b7fd8a0d244 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - golang.org/x/net v0.53.0 // indirect + golang.org/x/net v0.57.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect - golang.org/x/sys v0.43.0 // indirect - golang.org/x/term v0.42.0 // indirect - golang.org/x/text v0.36.0 // indirect + golang.org/x/sys v0.47.0 // indirect + golang.org/x/term v0.45.0 // indirect + golang.org/x/text v0.40.0 // indirect golang.org/x/time v0.15.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/kube-openapi v0.0.0-20260414162039-ec9c827d403f // indirect + k8s.io/kube-openapi v0.0.0-20260721132016-d427ff9ee9ad // 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/staging/src/github.com/kcp-dev/apimachinery/go.sum b/staging/src/github.com/kcp-dev/apimachinery/go.sum index 4691eb308e9..c7c0c01c759 100644 --- a/staging/src/github.com/kcp-dev/apimachinery/go.sum +++ b/staging/src/github.com/kcp-dev/apimachinery/go.sum @@ -1,4 +1,3 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -9,34 +8,34 @@ github.com/fxamacker/cbor/v2 v2.9.1 h1:2rWm8B193Ll4VdjsJY28jxs70IdDsHRWgQYAI80+r github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -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/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/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/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/google/gnostic-models v0.7.1 h1:SisTfuFKJSKM5CPZkffwi6coztzzeYUhc3v4yxLWH8c= github.com/google/gnostic-models v0.7.1/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= @@ -68,8 +67,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7 github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= +github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= @@ -81,16 +80,16 @@ go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= -golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= +golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= +golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= -golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= -golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= -golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= -golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= -golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= +golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= +golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= +golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI= @@ -104,23 +103,23 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.36.0 h1:SgqDhZzHdOtMk40xVSvCXkP9ME0H05hPM3p9AB1kL80= -k8s.io/api v0.36.0/go.mod h1:m1LVrGPNYax5NBHdO+QuAedXyuzTt4RryI/qnmNvs34= -k8s.io/apimachinery v0.36.0 h1:jZyPzhd5Z+3h9vJLt0z9XdzW9VzNzWAUw+P1xZ9PXtQ= -k8s.io/apimachinery v0.36.0/go.mod h1:FklypaRJt6n5wUIwWXIP6GJlIpUizTgfo1T/As+Tyxc= -k8s.io/client-go v0.36.0 h1:pOYi7C4RHChYjMiHpZSpSbIM6ZxVbRXBy7CuiIwqA3c= -k8s.io/client-go v0.36.0/go.mod h1:ZKKcpwF0aLYfkHFCjillCKaTK/yBkEDHTDXCFY6AS9Y= +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/apimachinery v0.37.0 h1:Np2AbDtf8x6RDHiD8T9LbKJ9gaegeVNa8yNm5FuGKm0= +k8s.io/apimachinery v0.37.0/go.mod h1:RN3nhprFSCxOi5Selxd7oMTXOe/c+ZbcE7Im+TS2zkE= +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/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= -k8s.io/kube-openapi v0.0.0-20260414162039-ec9c827d403f h1:4Qiq0YAoQATdgmHALJWz9rJ4fj20pB3xebpB4CFNhYM= -k8s.io/kube-openapi v0.0.0-20260414162039-ec9c827d403f/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0= -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/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/utils v0.0.0-20260626114624-be93311217bd h1:Ea7fgQ5we8Y9T0OX5o0dAHzQOBRI07D/dEYRaB9ZZEs= +k8s.io/utils v0.0.0-20260626114624-be93311217bd/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= 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/staging/src/github.com/kcp-dev/apimachinery/third_party/informers/shared_informer.go b/staging/src/github.com/kcp-dev/apimachinery/third_party/informers/shared_informer.go index b8667c8013f..5c5000f9a09 100644 --- a/staging/src/github.com/kcp-dev/apimachinery/third_party/informers/shared_informer.go +++ b/staging/src/github.com/kcp-dev/apimachinery/third_party/informers/shared_informer.go @@ -15,6 +15,17 @@ See the License for the specific language governing permissions and limitations under the License. */ +// This file is a mixed fork of k8s.io/client-go/tools/cache/shared_informer.go +// with some transplanted code from controller.go and the_real_fifo.go. +// Generally it follows these rules: +// 1. Upstream interfaces (e.g. SharedInformer, SharedIndexInformer, ...) +// are taken directly from cache package +// 2. Non-exported functions which are not methods of our custom type at the bottom of +// this file (e.g. processDeltas, processDeltasInBatch, processReplacedAllInfo, +// reconcileReplacement) are taken from upstream controller.go and the_real_fifo.go +// and need to be checked and transplanted manually. Any package-level types need +// to be aliased (see start of this file). + package informers import ( @@ -45,6 +56,42 @@ import ( "github.com/kcp-dev/logicalcluster/v3" ) +// Our custom type and var aliases. These make subsequent merges of upstream code easier. +// Use these instead of modifying upstream functions with cache.xyz to keep surface as small +// as possible +type ( + ResourceEventHandler = cache.ResourceEventHandler + SharedInformer = cache.SharedInformer + ResourceEventHandlerRegistration = cache.ResourceEventHandlerRegistration + DoneChecker = cache.DoneChecker + Store = cache.Store + Deltas = cache.Deltas + KeyFunc = cache.KeyFunc + BookmarkInfo = cache.BookmarkInfo + SyncAllInfo = cache.SyncAllInfo + ReplacedAllInfo = cache.ReplacedAllInfo + Transaction = cache.Transaction + TransactionStore = cache.TransactionStore + DeletedFinalStateUnknown = cache.DeletedFinalStateUnknown + KeyError = cache.KeyError + Delta = cache.Delta + KeyListerGetter = cache.KeyListerGetter +) + +var ( + Sync = cache.Sync + Replaced = cache.Replaced + Added = cache.Added + Updated = cache.Updated + Deleted = cache.Deleted + Bookmark = cache.Bookmark + ReplacedAll = cache.ReplacedAll + SyncAll = cache.SyncAll + TransactionTypeAdd = cache.TransactionTypeAdd + TransactionTypeUpdate = cache.TransactionTypeUpdate + TransactionTypeDelete = cache.TransactionTypeDelete +) + // Optional configuration options for [SharedInformer.AddEventHandlerWithOptions]. // May be left empty. type HandlerOptions struct { @@ -730,6 +777,26 @@ func (s *sharedIndexInformer) RemoveEventHandler(handle cache.ResourceEventHandl return s.processor.removeListener(handle) } +// TODO TBD: Do we actually need this function? + +// 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 @@ -802,6 +869,8 @@ func (p *sharedProcessor) removeListener(handle cache.ResourceEventHandlerRegist if p.listenersStarted { close(listener.addCh) + } else { + close(listener.runFinished) } return nil @@ -925,10 +994,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 cache.ResourceEventHandler handlerName string @@ -981,13 +1051,18 @@ func (p *processorListener) HasSyncedChecker() cache.DoneChecker { return p.syncTracker } -func newProcessListener(logger klog.Logger, handler cache.ResourceEventHandler, requestedResyncPeriod, resyncPeriod time.Duration, now time.Time, bufferSize int, hasSynced cache.DoneChecker) *processorListener { +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{ logger: logger, nextCh: make(chan interface{}), addCh: make(chan interface{}), done: make(chan struct{}), + runFinished: make(chan struct{}), upstreamHasSynced: hasSynced, handler: handler, handlerName: handlerName, @@ -1044,6 +1119,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 @@ -1131,27 +1207,27 @@ func (p *processorListener) setResyncPeriod(resyncPeriod time.Duration) { func processDeltas( logger klog.Logger, // Object which receives event notifications from the given deltas - handler cache.ResourceEventHandler, - clientState cache.Store, - deltas cache.Deltas, + handler ResourceEventHandler, + clientState Store, + deltas Deltas, isInInitialList bool, - keyFunc cache.KeyFunc, + keyFunc KeyFunc, ) error { // from oldest to newest for _, d := range deltas { obj := d.Object switch d.Type { - case cache.ReplacedAll: - info, ok := obj.(cache.ReplacedAllInfo) + case ReplacedAll: + info, ok := obj.(ReplacedAllInfo) if !ok { return fmt.Errorf("ReplacedAll did not contain ReplacedAllInfo: %T", obj) } if err := processReplacedAllInfo(logger, handler, info, clientState, isInInitialList, keyFunc); err != nil { return err } - case cache.SyncAll: - _, ok := obj.(cache.SyncAllInfo) + case SyncAll: + _, ok := obj.(SyncAllInfo) if !ok { return fmt.Errorf("SyncAll did not contain SyncAllInfo: %T", obj) } @@ -1160,7 +1236,7 @@ func processDeltas( handler.OnUpdate(obj, obj) } return nil - case cache.Sync, cache.Replaced, cache.Added, cache.Updated: + case Sync, Replaced, Added, Updated: if old, exists, err := clientState.Get(obj); err == nil && exists { if err := clientState.Update(obj); err != nil { return err @@ -1172,13 +1248,13 @@ func processDeltas( } handler.OnAdd(obj, isInInitialList) } - case cache.Deleted: + case Deleted: if err := clientState.Delete(obj); err != nil { return err } handler.OnDelete(obj) - case cache.Bookmark: - info, ok := obj.(cache.BookmarkInfo) + case Bookmark: + info, ok := obj.(BookmarkInfo) if !ok { return fmt.Errorf("bookmark delta did not contain BookmarkInfo: %T", obj) } @@ -1199,20 +1275,20 @@ func processDeltas( // only successful operations trigger callbacks. func processDeltasInBatch( logger klog.Logger, - handler cache.ResourceEventHandler, - clientState cache.Store, - deltas []cache.Delta, + handler ResourceEventHandler, + clientState Store, + deltas []Delta, isInInitialList bool, - keyFunc cache.KeyFunc, + keyFunc KeyFunc, ) error { // from oldest to newest - txns := make([]cache.Transaction, 0) + txns := make([]Transaction, 0) callbacks := make([]func(), 0) - txnStore, txnSupported := clientState.(cache.TransactionStore) + txnStore, txnSupported := clientState.(TransactionStore) if !txnSupported { var errs []error for _, delta := range deltas { - if err := processDeltas(logger, handler, clientState, cache.Deltas{delta}, isInInitialList, keyFunc); err != nil { + if err := processDeltas(logger, handler, clientState, Deltas{delta}, isInInitialList, keyFunc); err != nil { errs = append(errs, err) } } @@ -1225,11 +1301,11 @@ func processDeltasInBatch( for _, d := range deltas { obj := d.Object switch d.Type { - case cache.Sync, cache.Replaced, cache.Added, cache.Updated: + case Sync, Replaced, Added, Updated: // it will only return one old object for each because items are unique if old, exists, err := clientState.Get(obj); err == nil && exists { - txn := cache.Transaction{ - Type: cache.TransactionTypeUpdate, + txn := Transaction{ + Type: TransactionTypeUpdate, Object: obj, } txns = append(txns, txn) @@ -1237,8 +1313,8 @@ func processDeltasInBatch( handler.OnUpdate(old, obj) }) } else { - txn := cache.Transaction{ - Type: cache.TransactionTypeAdd, + txn := Transaction{ + Type: TransactionTypeAdd, Object: obj, } txns = append(txns, txn) @@ -1246,9 +1322,9 @@ func processDeltasInBatch( handler.OnAdd(obj, isInInitialList) }) } - case cache.Deleted: - txn := cache.Transaction{ - Type: cache.TransactionTypeDelete, + case Deleted: + txn := Transaction{ + Type: TransactionTypeDelete, Object: obj, } txns = append(txns, txn) @@ -1277,8 +1353,8 @@ func processDeltasInBatch( return nil } -func processReplacedAllInfo(logger klog.Logger, handler cache.ResourceEventHandler, info cache.ReplacedAllInfo, clientState cache.Store, isInInitialList bool, keyFunc cache.KeyFunc) error { - var deletions []cache.DeletedFinalStateUnknown +func processReplacedAllInfo(logger klog.Logger, handler ResourceEventHandler, info ReplacedAllInfo, clientState Store, isInInitialList bool, keyFunc KeyFunc) error { + var deletions []DeletedFinalStateUnknown type replacement struct { oldObj interface{} newObj interface{} @@ -1286,7 +1362,7 @@ func processReplacedAllInfo(logger klog.Logger, handler cache.ResourceEventHandl replacements := make([]replacement, 0, len(info.Objects)) err := reconcileReplacement(logger, nil, clientState, info.Objects, keyFunc, - func(obj cache.DeletedFinalStateUnknown) error { + func(obj DeletedFinalStateUnknown) error { deletions = append(deletions, obj) return nil }, @@ -1329,11 +1405,11 @@ func processReplacedAllInfo(logger klog.Logger, handler cache.ResourceEventHandl // kcp: This is taken from the_real_fifo.go func reconcileReplacement( logger klog.Logger, - queuedItems []cache.Delta, - knownObjects cache.KeyListerGetter, + queuedItems []Delta, + knownObjects KeyListerGetter, newItems []interface{}, keyOf func(obj interface{}) (string, error), - onDelete func(obj cache.DeletedFinalStateUnknown) error, + onDelete func(obj DeletedFinalStateUnknown) error, onReplace func(obj interface{}) error, ) error { // determine the keys of everything we're adding. We cannot add the items until after the synthetic deletes have been @@ -1342,17 +1418,17 @@ func reconcileReplacement( for _, obj := range newItems { key, err := keyOf(obj) if err != nil { - return cache.KeyError{Obj: obj, Err: err} + return KeyError{obj, err} } newKeys.Insert(key) } queuedKeys := []string{} - lastQueuedItemForKey := map[string]cache.Delta{} + lastQueuedItemForKey := map[string]Delta{} for _, queuedItem := range queuedItems { queuedKey, err := keyOf(queuedItem.Object) if err != nil { - return cache.KeyError{Obj: queuedItem.Object, Err: err} + return KeyError{queuedItem.Object, err} } if _, seen := lastQueuedItemForKey[queuedKey]; !seen { @@ -1375,14 +1451,14 @@ func reconcileReplacement( // disconnected from apiserver. lastQueuedItem := lastQueuedItemForKey[queuedKey] // if we've already got the item marked as deleted, no need to add another delete - if lastQueuedItem.Type == cache.Deleted { + if lastQueuedItem.Type == Deleted { continue } // if we got here, then the last entry we have for the queued item is *not* a deletion and we need to add a delete deletedObj := lastQueuedItem.Object - retErr := onDelete(cache.DeletedFinalStateUnknown{ + retErr := onDelete(DeletedFinalStateUnknown{ Key: queuedKey, Obj: deletedObj, }) @@ -1409,7 +1485,7 @@ func reconcileReplacement( deletedObj = nil utilruntime.HandleErrorWithLogger(logger, nil, "Key does not exist in known objects store, placing DeleteFinalStateUnknown marker without object", "key", knownKey) } - retErr := onDelete(cache.DeletedFinalStateUnknown{ + retErr := onDelete(DeletedFinalStateUnknown{ Key: knownKey, Obj: deletedObj, }) diff --git a/staging/src/github.com/kcp-dev/apimachinery/third_party/reflector/controller.go b/staging/src/github.com/kcp-dev/apimachinery/third_party/reflector/controller.go index e28259dafba..b38d4457535 100644 --- a/staging/src/github.com/kcp-dev/apimachinery/third_party/reflector/controller.go +++ b/staging/src/github.com/kcp-dev/apimachinery/third_party/reflector/controller.go @@ -15,6 +15,16 @@ See the License for the specific language governing permissions and limitations under the License. */ +// This file is a trimmed fork of k8s.io/client-go/tools/cache/controller.go. +// +// It intentionally carries only the declarations needed to wire up the +// cluster-aware Reflector in this package, which are `Config` and `controller`. +// +// Everything else in the upstream file (ResourceEventHandler and its +// variants, DeletedObject, the NewInformer* constructors, processDeltas, +// ...) is NOT forked here; use k8s.io/client-go/tools/cache directly. +// Do not copy such code back into this file during a rebase. + package reflector import ( diff --git a/staging/src/github.com/kcp-dev/apimachinery/third_party/reflector/reflector.go b/staging/src/github.com/kcp-dev/apimachinery/third_party/reflector/reflector.go index ae48ba34d77..f2b6b20cf88 100644 --- a/staging/src/github.com/kcp-dev/apimachinery/third_party/reflector/reflector.go +++ b/staging/src/github.com/kcp-dev/apimachinery/third_party/reflector/reflector.go @@ -15,6 +15,25 @@ See the License for the specific language governing permissions and limitations under the License. */ +// This file is a full fork of k8s.io/client-go/tools/cache/reflector.go +// and is kept textually as close to upstream as possible so it can be +// updated with a three way merge (see the rebase instructions in +// https://github.com/kcp-dev/kubernetes-patches). +// +// kcp modifications, marked inline with "kcp modification" comments: +// +// - Reflector carries a keyFunction (ReflectorOptions.KeyFunction, +// defaulting to kcpcache.DeletionHandlingMetaClusterNamespaceKeyFunc) +// that is used for the temporary store during WatchList streaming, so +// objects from different clusters with the same namespace/name do not +// collide. +// - WatchErrorHandlerWithContext is a local type taking this package's +// *Reflector instead of *cache.Reflector. +// - ForceRelist (activeWatch, relistRequested) allows forcing a full +// relist on the next list/watch cycle; this does not exist upstream. +// - The Reflector*Store/TransformingStore interfaces are not duplicated; +// the exported ones from k8s.io/client-go/tools/cache are used instead. + package reflector import ( @@ -739,7 +758,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/staging/src/github.com/kcp-dev/client-go/apiextensions/client/clientset.go b/staging/src/github.com/kcp-dev/client-go/apiextensions/client/clientset.go index 503540ea52e..105aef2bbb3 100644 --- a/staging/src/github.com/kcp-dev/client-go/apiextensions/client/clientset.go +++ b/staging/src/github.com/kcp-dev/client-go/apiextensions/client/clientset.go @@ -35,7 +35,7 @@ import ( type ClusterInterface interface { Cluster(logicalcluster.Path) client.Interface - Discovery() discovery.DiscoveryInterface + Discovery() discovery.DiscoveryInterfaces ApiextensionsV1() apiextensionsv1.ApiextensionsV1ClusterInterface ApiextensionsV1beta1() apiextensionsv1beta1.ApiextensionsV1beta1ClusterInterface } @@ -49,7 +49,7 @@ type ClusterClientset struct { } // Discovery retrieves the DiscoveryClient. -func (c *ClusterClientset) Discovery() discovery.DiscoveryInterface { +func (c *ClusterClientset) Discovery() discovery.DiscoveryInterfaces { if c == nil { return nil } diff --git a/staging/src/github.com/kcp-dev/client-go/apiextensions/client/fake/clientset.go b/staging/src/github.com/kcp-dev/client-go/apiextensions/client/fake/clientset.go index 75294c3182a..bbea931b30d 100644 --- a/staging/src/github.com/kcp-dev/client-go/apiextensions/client/fake/clientset.go +++ b/staging/src/github.com/kcp-dev/client-go/apiextensions/client/fake/clientset.go @@ -67,7 +67,7 @@ type ClusterClientset struct { var _ kcpclientset.ClusterInterface = (*ClusterClientset)(nil) // Discovery retrieves the DiscoveryClient -func (c *ClusterClientset) Discovery() discovery.DiscoveryInterface { +func (c *ClusterClientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } @@ -135,7 +135,7 @@ var ( _ kcptesting.FakeScopedClient = &Clientset{} ) -func (c *Clientset) Discovery() discovery.DiscoveryInterface { +func (c *Clientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } diff --git a/staging/src/github.com/kcp-dev/client-go/apiextensions/informers/factory.go b/staging/src/github.com/kcp-dev/client-go/apiextensions/informers/factory.go index 150f4dc2437..d859c41916b 100644 --- a/staging/src/github.com/kcp-dev/client-go/apiextensions/informers/factory.go +++ b/staging/src/github.com/kcp-dev/client-go/apiextensions/informers/factory.go @@ -227,7 +227,7 @@ type ScopedDynamicSharedInformerFactory interface { // 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() // factory.Start(ctx.Done()) // Start processing these informers. diff --git a/staging/src/github.com/kcp-dev/client-go/go.mod b/staging/src/github.com/kcp-dev/client-go/go.mod index 7c47d6e97e0..0dc3d8acc3c 100644 --- a/staging/src/github.com/kcp-dev/client-go/go.mod +++ b/staging/src/github.com/kcp-dev/client-go/go.mod @@ -8,12 +8,12 @@ require ( github.com/kcp-dev/code-generator/v3 v3.0.0-00010101000000-000000000000 github.com/kcp-dev/logicalcluster/v3 v3.0.5 gopkg.in/evanphx/json-patch.v4 v4.13.0 - k8s.io/api v0.36.0 - k8s.io/apiextensions-apiserver v0.36.0 - k8s.io/apimachinery v0.36.0 - k8s.io/client-go v0.36.0 + k8s.io/api v0.37.0 + k8s.io/apiextensions-apiserver v0.37.0 + k8s.io/apimachinery v0.37.0 + k8s.io/client-go v0.37.0 k8s.io/klog/v2 v2.140.0 - sigs.k8s.io/structured-merge-diff/v6 v6.4.0 + sigs.k8s.io/structured-merge-diff/v6 v6.4.2 sigs.k8s.io/yaml v1.6.0 ) @@ -24,80 +24,102 @@ replace ( require ( cel.dev/expr v0.25.1 // indirect + github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/coreos/go-semver v0.3.1 // indirect + github.com/coreos/go-systemd/v22 v22.7.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/go-restful/v3 v3.13.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/fxamacker/cbor/v2 v2.9.1 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // 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/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/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/google/cel-go v0.28.0 // 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/golang/protobuf v1.5.4 // indirect + github.com/google/cel-go v0.29.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect + github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // 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.29.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/moby/spdystream v0.5.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.23.2 // indirect + github.com/prometheus/client_golang v1.24.0 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.5 // indirect - github.com/prometheus/procfs v0.20.1 // indirect + github.com/prometheus/common v0.70.0 // indirect + github.com/prometheus/procfs v0.21.1 // indirect github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/x448/float16 v0.8.4 // 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.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect - go.opentelemetry.io/otel v1.43.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 // indirect - go.opentelemetry.io/otel/metric v1.43.0 // indirect - go.opentelemetry.io/otel/sdk v1.43.0 // indirect - go.opentelemetry.io/otel/trace v1.43.0 // indirect - go.opentelemetry.io/proto/otlp v1.9.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.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 + go.opentelemetry.io/proto/otlp v1.10.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.1 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/crypto v0.54.0 // indirect golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f // indirect - golang.org/x/mod v0.35.0 // indirect - golang.org/x/net v0.53.0 // indirect + golang.org/x/mod v0.37.0 // indirect + golang.org/x/net v0.57.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect - golang.org/x/sync v0.20.0 // indirect - golang.org/x/sys v0.43.0 // indirect - golang.org/x/term v0.42.0 // indirect - golang.org/x/text v0.36.0 // indirect + golang.org/x/sync v0.22.0 // indirect + golang.org/x/sys v0.47.0 // indirect + golang.org/x/term v0.45.0 // indirect + golang.org/x/text v0.40.0 // indirect golang.org/x/time v0.15.0 // indirect - golang.org/x/tools v0.44.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 // indirect - google.golang.org/grpc v1.80.0 // indirect + golang.org/x/tools v0.47.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect + google.golang.org/grpc v1.82.1 // indirect google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect gopkg.in/inf.v0 v0.9.1 // indirect - k8s.io/apiserver v0.36.0 // indirect - k8s.io/code-generator v0.36.0 // indirect - k8s.io/component-base v0.36.0 // indirect - k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b // indirect - k8s.io/kube-openapi v0.0.0-20260414162039-ec9c827d403f // indirect - k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + k8s.io/apiserver v0.37.0 // indirect + k8s.io/code-generator v0.37.0 // indirect + k8s.io/component-base v0.37.0 // indirect + k8s.io/gengo/v2 v2.0.0-20260408192533-25e2208e0dc3 // indirect + k8s.io/kms v0.37.0 // indirect + k8s.io/kube-openapi v0.0.0-20260721132016-d427ff9ee9ad // indirect + k8s.io/streaming v0.37.0 // indirect + k8s.io/utils v0.0.0-20260626114624-be93311217bd // 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 ) diff --git a/staging/src/github.com/kcp-dev/client-go/go.sum b/staging/src/github.com/kcp-dev/client-go/go.sum index 5c5ef529d62..f1529bef7cf 100644 --- a/staging/src/github.com/kcp-dev/client-go/go.sum +++ b/staging/src/github.com/kcp-dev/client-go/go.sum @@ -1,5 +1,7 @@ cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4= cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= +github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -23,6 +25,8 @@ github.com/emicklei/go-restful/v3 v3.13.0 h1:C4Bl2xDndpU6nJ4bc1jXd+uTmYPVUwkD6bF github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/fxamacker/cbor/v2 v2.9.1 h1:2rWm8B193Ll4VdjsJY28jxs70IdDsHRWgQYAI80+rMQ= github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -32,34 +36,62 @@ 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-openapi/jsonpointer v0.23.1 h1:1HBACs7XIwR2RcmItfdSFlALhGbe6S92p0ry4d1GWg4= github.com/go-openapi/jsonpointer v0.23.1/go.mod h1:iWRmZTrGn7XwYhtPt/fvdSFj1OfNBngqRT2UG3BxSqY= +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 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/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.26.0 h1:GVDXCmfvhfu1BxiHo8/FA+BbKmhecHnG3varjON5/RI= github.com/go-openapi/swag v0.26.0/go.mod h1:82g3193sZJRbocs7bNCqGfIgq8pkuwVwCfhKIRlEQF0= +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.26.0 h1:iowihOcvq7y4egO8cOq0dmfohz6wfeQ63U1EnuhO2TU= github.com/go-openapi/swag/cmdutils v0.26.0/go.mod h1:Sm1MVFMkF6guJJ+pQqHnQA3N0j9qALV3NxzDSv6bETM= +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.26.0 h1:5yGGsPYI1ZCva93U0AoKi/iZrNhaJEjr324YVsiD89I= github.com/go-openapi/swag/conv v0.26.0/go.mod h1:tpAmIL7X58VPnHHiSO4uE3jBeRamGsFsfdDeDtb5ECE= +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.26.0 h1:WJoPRvsA7QRiiWluowkLJa9jaYR7FCuxmDvnCgaRRxU= github.com/go-openapi/swag/fileutils v0.26.0/go.mod h1:0WDJ7lp67eNjPMO50wAWYlKvhOb6CQ37rzR7wrgI8Tc= +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/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 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.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/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.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/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.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/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.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/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.26.0 h1:2kdEwdiNWy+JJdOvu5MA2IIg2SylWAFuuyQIKYybfq4= github.com/go-openapi/swag/typeutils v0.26.0/go.mod h1:oovDuIUvTrEHVMqWilQzKzV4YlSKgyZmFh7AlfABNVE= +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.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/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.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= @@ -70,6 +102,8 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/cel-go v0.28.0 h1:KjSWstCpz/MN5t4a8gnGJNIYUsJRpdi/r97xWDphIQc= github.com/google/cel-go v0.28.0/go.mod h1:X0bD6iVNR8pkROSOoHVdgTkzmRcosof7WQqCD6wcMc8= +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= github.com/google/gnostic-models v0.7.1/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= @@ -77,12 +111,16 @@ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo= +github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA= github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 h1:QGLs/O40yoNK9vmy4rhUGBVyMf1lISBGtXRpsu/Qu/o= 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.27.7 h1:X+2YciYSxvMQK0UZ7sg45ZVabVZBeBuvMkmuI2V3Fak= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7/go.mod h1:lW34nIZuQ8UDPdkon5fmfp2l3+ZkQ2me/+oecHYLOII= +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/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -91,12 +129,15 @@ github.com/kcp-dev/logicalcluster/v3 v3.0.5 h1:JbYakokb+5Uinz09oTXomSUJVQsqfxEvU github.com/kcp-dev/logicalcluster/v3 v3.0.5/go.mod h1:EWBUBxdr49fUB1cLMO4nOdBWmYifLbP1LfoL20KkXYY= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/klauspost/compress v1.19.0 h1:sXLILfc9jV2QYWkzFOPWStmcUVH2RHEB1JCdY2oVvCQ= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/moby/spdystream v0.5.1 h1:9sNYeYZUcci9R6/w7KDaFWEWeV4LStVG78Mpyq/Zm/Y= +github.com/moby/spdystream v0.5.1/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -105,17 +146,25 @@ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFd github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= +github.com/prometheus/client_golang v1.24.0 h1:5XStIklKuAtJSNpdD3s8XJj/Yv78IQmE1kbNk87JrAI= +github.com/prometheus/client_golang v1.24.0/go.mod h1:QcsNdotprC2nS4BTM2ucbcqxd2CeXTEa9jW7zHO9iDE= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= +github.com/prometheus/common v0.70.0 h1:bcpru3tWPVnxGnETLgOV5jbp/JRXgYEyv65CuBLAMMI= +github.com/prometheus/common v0.70.0/go.mod h1:S/SFasQmgGiYH6C81LKCtYa8QACgthGg5zxL2udV7SY= github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= +github.com/prometheus/procfs v0.21.1 h1:GljZCt+zSTS+NZq88cyQ1LjZ+RCHp3uVuabBWA5+OJI= +github.com/prometheus/procfs v0.21.1/go.mod h1:aB55Cww9pdSJVHk0hUf0inxWyyjPogFIjmHKYgMKmtY= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -134,32 +183,57 @@ github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= 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/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.6.8 h1:Qs/5C0LNFiqXxYf2GU8MVjYUEXJ6sZaYOz0zEqQgy50= go.etcd.io/etcd/client/pkg/v3 v3.6.8/go.mod h1:GsiTRUZE2318PggZkAo6sWb6l8JLVrnckTNfbG8PWtw= +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.6.8 h1:B3G76t1UykqAOrbio7s/EPatixQDkQBevN8/mwiplrY= go.etcd.io/etcd/client/v3 v3.6.8/go.mod h1:MVG4BpSIuumPi+ELF7wYtySETmoTWBHVcDoHdVupwt8= +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.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= 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.65.0 h1:7iP2uCb7sGddAr30RRS6xjKy7AZ2JtTOPA3oolgVSw8= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0/go.mod h1:c7hN3ddxs/z6q9xwvfLPk+UHlWRQyaeR1LdgfL/66l0= +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.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU= +go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 h1:QKdN8ly8zEMrByybbQgv8cWBcdAarwmIPZ6FThrWXJs= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0/go.mod h1:bTdK1nhqF76qiPoCCdyFIV+N/sRHYXYCTQc+3VCi3MI= +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.40.0 h1:DvJDOPmSWQHWywQS6lKL+pb8s3gBLOZUtw4N+mavW1I= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0/go.mod h1:EtekO9DEJb4/jRyN4v4Qjc2yA7AtfCBuz2FynRUWTXs= +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/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= +go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc= +go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo= go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= +go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58= +go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0= go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= +go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI= go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= +go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk= +go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE= go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= +go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpuCSL2g= +go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk= go.uber.org/goleak v1.3.1-0.20251210191316-2b7fd8a0d244 h1:OdZ8e4E9yDUGiis9x2ta/Ec5yhMAKT6ZivRvakyxC7E= go.uber.org/goleak v1.3.1-0.20251210191316-2b7fd8a0d244/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -170,34 +244,54 @@ go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= +golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM= golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80= golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= +golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0= golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= +golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= +golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= +golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= +golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= +golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= +golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c= golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI= +golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 h1:yQugLulqltosq0B/f8l4w9VryjV+N/5gcW0jQ3N8Qec= google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478/go.mod h1:C6ADNqOxbgdUUeRTU+LCHDPB9ttAMCTff6auwCVa4uc= +google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa h1:Kjn0N0tCrDgiAFW+lGO4JZ3ck44CehvJQMAwj9QF0G8= +google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:q4lMZS6kskjT5HvCPrnnypcDPVJqT/f4nfxmkE7gryY= google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 h1:RmoJA1ujG+/lRGNfUnOMfhCy5EipVMyvUE+KNbPbTlw= google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa h1:mZHHdPZl0dbGHCflZgAq/Q468DWVFcU2whhB2KAo8fk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM= google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4= +google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE= +google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA= google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI= google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -207,37 +301,65 @@ gopkg.in/evanphx/json-patch.v4 v4.13.0 h1:czT3CmqEaQ1aanPc5SdlgQrrEIb8w/wwCvWWnf gopkg.in/evanphx/json-patch.v4 v4.13.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.36.0 h1:SgqDhZzHdOtMk40xVSvCXkP9ME0H05hPM3p9AB1kL80= k8s.io/api v0.36.0/go.mod h1:m1LVrGPNYax5NBHdO+QuAedXyuzTt4RryI/qnmNvs34= +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.36.0 h1:Wt7E8J+VBCbj4FjiBfDTK/neXDDjyJVJc7xfuOHImZ0= k8s.io/apiextensions-apiserver v0.36.0/go.mod h1:kGDjH0msuiIB3tgsYRV0kS9GqpMYMUsQ3GHv7TApyug= +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.36.0 h1:jZyPzhd5Z+3h9vJLt0z9XdzW9VzNzWAUw+P1xZ9PXtQ= k8s.io/apimachinery v0.36.0/go.mod h1:FklypaRJt6n5wUIwWXIP6GJlIpUizTgfo1T/As+Tyxc= +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.36.0 h1:Jg5OFAENUACByUCg15CmhZAYrr5ZyJ+jodyA1mHl3YE= k8s.io/apiserver v0.36.0/go.mod h1:mHvwdHf+qKEm+1/hYm756SV+oREOKSPnsjagOpx6Vho= +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.36.0 h1:pOYi7C4RHChYjMiHpZSpSbIM6ZxVbRXBy7CuiIwqA3c= k8s.io/client-go v0.36.0/go.mod h1:ZKKcpwF0aLYfkHFCjillCKaTK/yBkEDHTDXCFY6AS9Y= +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.36.0 h1:XWAkrhnArm0VWMmSFO7kyB+wE2LROwep7hEH0GPGkqA= k8s.io/code-generator v0.36.0/go.mod h1:Tr2UhfBRdlyRoadfob9aPCmmGe8PUs5XPK9MEJ2nx+w= +k8s.io/code-generator v0.37.0/go.mod h1:qg7E/uDlyvevVRL1V8+h2z9UWmi/8gxaRka/lVXUBdk= k8s.io/component-base v0.36.0 h1:hFjEktssxiJhrK1zfybkH4kJOi8iZuF+mIDCqS5+jRo= k8s.io/component-base v0.36.0/go.mod h1:JZvIfcNHk+uck+8LhJzhSBtydWXaZNQwX2OdL+Mnwsk= +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-20250922181213-ec3ebc5fd46b h1:gMplByicHV/TJBizHd9aVEsTYoJBnnUAT5MHlTkbjhQ= k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM= +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.37.0 h1:WDW3pSc5yFB1Od4YXXL3i5oK+vXI2v++LAV82+Ks1Z0= +k8s.io/kms v0.37.0/go.mod h1:0U6zfwLkfJr9O/jLgz2GARnKLh2uIhkq2EeaU66J5ow= k8s.io/kube-openapi v0.0.0-20260414162039-ec9c827d403f h1:4Qiq0YAoQATdgmHALJWz9rJ4fj20pB3xebpB4CFNhYM= k8s.io/kube-openapi v0.0.0-20260414162039-ec9c827d403f/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0= +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-20260319190234-28399d86e0b5 h1:kBawHLSnx/mYHmRnNUf9d4CpjREbeZuxoSGOX/J+aYM= k8s.io/utils v0.0.0-20260319190234-28399d86e0b5/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= +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= 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/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= 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/staging/src/github.com/kcp-dev/client-go/informers/certificates/v1/clustertrustbundle.go b/staging/src/github.com/kcp-dev/client-go/informers/certificates/v1/clustertrustbundle.go new file mode 100644 index 00000000000..6787a0aca5e --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/informers/certificates/v1/clustertrustbundle.go @@ -0,0 +1,127 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-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" + watch "k8s.io/apimachinery/pkg/watch" + certificatesv1 "k8s.io/client-go/informers/certificates/v1" + listerscertificatesv1 "k8s.io/client-go/listers/certificates/v1" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" + kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" + kcpkubernetes "github.com/kcp-dev/client-go/kubernetes" + kcpv1 "github.com/kcp-dev/client-go/listers/certificates/v1" + logicalcluster "github.com/kcp-dev/logicalcluster/v3" +) + +// ClusterTrustBundleClusterInformer provides access to a shared informer and lister for +// ClusterTrustBundles. +type ClusterTrustBundleClusterInformer interface { + Cluster(logicalcluster.Name) certificatesv1.ClusterTrustBundleInformer + ClusterWithContext(context.Context, logicalcluster.Name) certificatesv1.ClusterTrustBundleInformer + Informer() kcpcache.ScopeableSharedIndexInformer + Lister() kcpv1.ClusterTrustBundleClusterLister +} + +type clusterTrustBundleClusterInformer struct { + factory kcpinternalinterfaces.SharedInformerFactory + tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc +} + +// NewClusterTrustBundleClusterInformer 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 NewClusterTrustBundleClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredClusterTrustBundleClusterInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterTrustBundleClusterInformer 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 NewFilteredClusterTrustBundleClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1().ClusterTrustBundles().List(context.Background(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1().ClusterTrustBundles().Watch(context.Background(), options) + }, + }, client), + &apicertificatesv1.ClusterTrustBundle{}, + resyncPeriod, + indexers, + ) +} + +func (i *clusterTrustBundleClusterInformer) defaultInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredClusterTrustBundleClusterInformer(client, resyncPeriod, cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc, + }, i.tweakListOptions) +} + +func (i *clusterTrustBundleClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { + return i.factory.InformerFor(&apicertificatesv1.ClusterTrustBundle{}, i.defaultInformer) +} + +func (i *clusterTrustBundleClusterInformer) Lister() kcpv1.ClusterTrustBundleClusterLister { + return kcpv1.NewClusterTrustBundleClusterLister(i.Informer().GetIndexer()) +} + +func (i *clusterTrustBundleClusterInformer) Cluster(clusterName logicalcluster.Name) certificatesv1.ClusterTrustBundleInformer { + return &clusterTrustBundleInformer{ + informer: i.Informer().Cluster(clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +func (i *clusterTrustBundleClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) certificatesv1.ClusterTrustBundleInformer { + return &clusterTrustBundleInformer{ + informer: i.Informer().ClusterWithContext(ctx, clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +type clusterTrustBundleInformer struct { + informer cache.SharedIndexInformer + lister listerscertificatesv1.ClusterTrustBundleLister +} + +func (i *clusterTrustBundleInformer) Informer() cache.SharedIndexInformer { + return i.informer +} + +func (i *clusterTrustBundleInformer) Lister() listerscertificatesv1.ClusterTrustBundleLister { + return i.lister +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/certificates/v1/interface.go b/staging/src/github.com/kcp-dev/client-go/informers/certificates/v1/interface.go index e45df916f45..67f7da59d5e 100644 --- a/staging/src/github.com/kcp-dev/client-go/informers/certificates/v1/interface.go +++ b/staging/src/github.com/kcp-dev/client-go/informers/certificates/v1/interface.go @@ -25,6 +25,10 @@ import ( type ClusterInterface interface { // CertificateSigningRequests returns a CertificateSigningRequestClusterInformer. CertificateSigningRequests() CertificateSigningRequestClusterInformer + // ClusterTrustBundles returns a ClusterTrustBundleClusterInformer. + ClusterTrustBundles() ClusterTrustBundleClusterInformer + // PodCertificateRequests returns a PodCertificateRequestClusterInformer. + PodCertificateRequests() PodCertificateRequestClusterInformer } type version struct { @@ -41,3 +45,13 @@ func New(f kcpinternalinterfaces.SharedInformerFactory, tweakListOptions kcpinte func (v *version) CertificateSigningRequests() CertificateSigningRequestClusterInformer { return &certificateSigningRequestClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } + +// ClusterTrustBundles returns a ClusterTrustBundleClusterInformer. +func (v *version) ClusterTrustBundles() ClusterTrustBundleClusterInformer { + return &clusterTrustBundleClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PodCertificateRequests returns a PodCertificateRequestClusterInformer. +func (v *version) PodCertificateRequests() PodCertificateRequestClusterInformer { + return &podCertificateRequestClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/certificates/v1/podcertificaterequest.go b/staging/src/github.com/kcp-dev/client-go/informers/certificates/v1/podcertificaterequest.go new file mode 100644 index 00000000000..a7a61695836 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/informers/certificates/v1/podcertificaterequest.go @@ -0,0 +1,127 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-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" + watch "k8s.io/apimachinery/pkg/watch" + certificatesv1 "k8s.io/client-go/informers/certificates/v1" + listerscertificatesv1 "k8s.io/client-go/listers/certificates/v1" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" + kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" + kcpkubernetes "github.com/kcp-dev/client-go/kubernetes" + kcpv1 "github.com/kcp-dev/client-go/listers/certificates/v1" + logicalcluster "github.com/kcp-dev/logicalcluster/v3" +) + +// PodCertificateRequestClusterInformer provides access to a shared informer and lister for +// PodCertificateRequests. +type PodCertificateRequestClusterInformer interface { + Cluster(logicalcluster.Name) certificatesv1.PodCertificateRequestInformer + ClusterWithContext(context.Context, logicalcluster.Name) certificatesv1.PodCertificateRequestInformer + Informer() kcpcache.ScopeableSharedIndexInformer + Lister() kcpv1.PodCertificateRequestClusterLister +} + +type podCertificateRequestClusterInformer struct { + factory kcpinternalinterfaces.SharedInformerFactory + tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc +} + +// NewPodCertificateRequestClusterInformer 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 NewPodCertificateRequestClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredPodCertificateRequestClusterInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPodCertificateRequestClusterInformer 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 NewFilteredPodCertificateRequestClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1().PodCertificateRequests().List(context.Background(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1().PodCertificateRequests().Watch(context.Background(), options) + }, + }, client), + &apicertificatesv1.PodCertificateRequest{}, + resyncPeriod, + indexers, + ) +} + +func (i *podCertificateRequestClusterInformer) defaultInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredPodCertificateRequestClusterInformer(client, resyncPeriod, cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc, + }, i.tweakListOptions) +} + +func (i *podCertificateRequestClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { + return i.factory.InformerFor(&apicertificatesv1.PodCertificateRequest{}, i.defaultInformer) +} + +func (i *podCertificateRequestClusterInformer) Lister() kcpv1.PodCertificateRequestClusterLister { + return kcpv1.NewPodCertificateRequestClusterLister(i.Informer().GetIndexer()) +} + +func (i *podCertificateRequestClusterInformer) Cluster(clusterName logicalcluster.Name) certificatesv1.PodCertificateRequestInformer { + return &podCertificateRequestInformer{ + informer: i.Informer().Cluster(clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +func (i *podCertificateRequestClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) certificatesv1.PodCertificateRequestInformer { + return &podCertificateRequestInformer{ + informer: i.Informer().ClusterWithContext(ctx, clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +type podCertificateRequestInformer struct { + informer cache.SharedIndexInformer + lister listerscertificatesv1.PodCertificateRequestLister +} + +func (i *podCertificateRequestInformer) Informer() cache.SharedIndexInformer { + return i.informer +} + +func (i *podCertificateRequestInformer) Lister() listerscertificatesv1.PodCertificateRequestLister { + return i.lister +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/factory.go b/staging/src/github.com/kcp-dev/client-go/informers/factory.go index 76eed09e717..2f29bf6208c 100644 --- a/staging/src/github.com/kcp-dev/client-go/informers/factory.go +++ b/staging/src/github.com/kcp-dev/client-go/informers/factory.go @@ -43,6 +43,7 @@ import ( kcpextensions "github.com/kcp-dev/client-go/informers/extensions" kcpflowcontrol "github.com/kcp-dev/client-go/informers/flowcontrol" kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" + kcplifecycle "github.com/kcp-dev/client-go/informers/lifecycle" kcpnetworking "github.com/kcp-dev/client-go/informers/networking" kcpnode "github.com/kcp-dev/client-go/informers/node" kcppolicy "github.com/kcp-dev/client-go/informers/policy" @@ -246,7 +247,7 @@ type ScopedDynamicSharedInformerFactory interface { // 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() // factory.Start(ctx.Done()) // Start processing these informers. @@ -307,6 +308,7 @@ type SharedInformerFactory interface { Events() kcpevents.ClusterInterface Extensions() kcpextensions.ClusterInterface Flowcontrol() kcpflowcontrol.ClusterInterface + Lifecycle() kcplifecycle.ClusterInterface Networking() kcpnetworking.ClusterInterface Node() kcpnode.ClusterInterface Policy() kcppolicy.ClusterInterface @@ -365,6 +367,10 @@ func (f *sharedInformerFactory) Flowcontrol() kcpflowcontrol.ClusterInterface { return kcpflowcontrol.New(f, f.tweakListOptions) } +func (f *sharedInformerFactory) Lifecycle() kcplifecycle.ClusterInterface { + return kcplifecycle.New(f, f.tweakListOptions) +} + func (f *sharedInformerFactory) Networking() kcpnetworking.ClusterInterface { return kcpnetworking.New(f, f.tweakListOptions) } diff --git a/staging/src/github.com/kcp-dev/client-go/informers/generic.go b/staging/src/github.com/kcp-dev/client-go/informers/generic.go index 48aa208fb74..352421b2d2f 100644 --- a/staging/src/github.com/kcp-dev/client-go/informers/generic.go +++ b/staging/src/github.com/kcp-dev/client-go/informers/generic.go @@ -49,6 +49,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" @@ -64,11 +65,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" clientgoinformers "k8s.io/client-go/informers" @@ -227,6 +229,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=certificates.k8s.io, Version=v1 case certificatesv1.SchemeGroupVersion.WithResource("certificatesigningrequests"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Certificates().V1().CertificateSigningRequests().Informer()}, nil + case certificatesv1.SchemeGroupVersion.WithResource("clustertrustbundles"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Certificates().V1().ClusterTrustBundles().Informer()}, nil + case certificatesv1.SchemeGroupVersion.WithResource("podcertificaterequests"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Certificates().V1().PodCertificateRequests().Informer()}, nil // Group=certificates.k8s.io, Version=v1alpha1 case certificatesv1alpha1.SchemeGroupVersion.WithResource("clustertrustbundles"): @@ -344,6 +350,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case apiserverinternalv1alpha1.SchemeGroupVersion.WithResource("storageversions"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Internal().V1alpha1().StorageVersions().Informer()}, nil + // Group=lifecycle.k8s.io, Version=v1alpha1 + case lifecyclev1alpha1.SchemeGroupVersion.WithResource("evictions"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Lifecycle().V1alpha1().Evictions().Informer()}, nil + case lifecyclev1alpha1.SchemeGroupVersion.WithResource("evictionrequests"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Lifecycle().V1alpha1().EvictionRequests().Informer()}, nil + // Group=networking.k8s.io, Version=v1 case networkingv1.SchemeGroupVersion.WithResource("ipaddresses"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Networking().V1().IPAddresses().Informer()}, nil @@ -419,6 +431,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=resource.k8s.io, Version=v1 case resourcev1.SchemeGroupVersion.WithResource("deviceclasses"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Resource().V1().DeviceClasses().Informer()}, nil + case resourcev1.SchemeGroupVersion.WithResource("devicetaintrules"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Resource().V1().DeviceTaintRules().Informer()}, nil case resourcev1.SchemeGroupVersion.WithResource("resourceclaims"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Resource().V1().ResourceClaims().Informer()}, nil case resourcev1.SchemeGroupVersion.WithResource("resourceclaimtemplates"): @@ -458,15 +472,21 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case schedulingv1.SchemeGroupVersion.WithResource("priorityclasses"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1().PriorityClasses().Informer()}, nil - // Group=scheduling.k8s.io, Version=v1alpha2 - case schedulingv1alpha2.SchemeGroupVersion.WithResource("podgroups"): - return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha2().PodGroups().Informer()}, nil - case schedulingv1alpha2.SchemeGroupVersion.WithResource("workloads"): - return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha2().Workloads().Informer()}, nil + // Group=scheduling.k8s.io, Version=v1alpha3 + case schedulingv1alpha3.SchemeGroupVersion.WithResource("compositepodgroups"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha3().CompositePodGroups().Informer()}, nil + case schedulingv1alpha3.SchemeGroupVersion.WithResource("podgroups"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha3().PodGroups().Informer()}, nil + case schedulingv1alpha3.SchemeGroupVersion.WithResource("workloads"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha3().Workloads().Informer()}, nil // Group=scheduling.k8s.io, Version=v1beta1 + case schedulingv1beta1.SchemeGroupVersion.WithResource("podgroups"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().PodGroups().Informer()}, nil case schedulingv1beta1.SchemeGroupVersion.WithResource("priorityclasses"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().PriorityClasses().Informer()}, nil + case schedulingv1beta1.SchemeGroupVersion.WithResource("workloads"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().Workloads().Informer()}, nil // Group=storage.k8s.io, Version=v1 case storagev1.SchemeGroupVersion.WithResource("csidrivers"): @@ -504,6 +524,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case storagev1beta1.SchemeGroupVersion.WithResource("volumeattributesclasses"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().VolumeAttributesClasses().Informer()}, nil + // Group=storagemigration.k8s.io, Version=v1 + case storagemigrationv1.SchemeGroupVersion.WithResource("storageversionmigrations"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Storagemigration().V1().StorageVersionMigrations().Informer()}, nil + // Group=storagemigration.k8s.io, Version=v1beta1 case storagemigrationv1beta1.SchemeGroupVersion.WithResource("storageversionmigrations"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Storagemigration().V1beta1().StorageVersionMigrations().Informer()}, nil diff --git a/staging/src/github.com/kcp-dev/client-go/informers/lifecycle/interface.go b/staging/src/github.com/kcp-dev/client-go/informers/lifecycle/interface.go new file mode 100644 index 00000000000..fa79a92be3a --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/informers/lifecycle/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-informer-gen. DO NOT EDIT. + +package lifecycle + +import ( + kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" + kcpv1alpha1 "github.com/kcp-dev/client-go/informers/lifecycle/v1alpha1" +) + +// ClusterInterface provides access to each of this group's versions. +type ClusterInterface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() kcpv1alpha1.ClusterInterface +} + +type group struct { + factory kcpinternalinterfaces.SharedInformerFactory + tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc +} + +// New returns a new ClusterInterface. +func New(f kcpinternalinterfaces.SharedInformerFactory, tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc) ClusterInterface { + return &group{factory: f, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new kcpv1alpha1.ClusterInterface. +func (g *group) V1alpha1() kcpv1alpha1.ClusterInterface { + return kcpv1alpha1.New(g.factory, g.tweakListOptions) +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/lifecycle/v1alpha1/eviction.go b/staging/src/github.com/kcp-dev/client-go/informers/lifecycle/v1alpha1/eviction.go new file mode 100644 index 00000000000..450da8df3ea --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/informers/lifecycle/v1alpha1/eviction.go @@ -0,0 +1,127 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-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" + watch "k8s.io/apimachinery/pkg/watch" + lifecyclev1alpha1 "k8s.io/client-go/informers/lifecycle/v1alpha1" + listerslifecyclev1alpha1 "k8s.io/client-go/listers/lifecycle/v1alpha1" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" + kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" + kcpkubernetes "github.com/kcp-dev/client-go/kubernetes" + kcpv1alpha1 "github.com/kcp-dev/client-go/listers/lifecycle/v1alpha1" + logicalcluster "github.com/kcp-dev/logicalcluster/v3" +) + +// EvictionClusterInformer provides access to a shared informer and lister for +// Evictions. +type EvictionClusterInformer interface { + Cluster(logicalcluster.Name) lifecyclev1alpha1.EvictionInformer + ClusterWithContext(context.Context, logicalcluster.Name) lifecyclev1alpha1.EvictionInformer + Informer() kcpcache.ScopeableSharedIndexInformer + Lister() kcpv1alpha1.EvictionClusterLister +} + +type evictionClusterInformer struct { + factory kcpinternalinterfaces.SharedInformerFactory + tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc +} + +// NewEvictionClusterInformer 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 NewEvictionClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredEvictionClusterInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredEvictionClusterInformer 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 NewFilteredEvictionClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.LifecycleV1alpha1().Evictions().List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.LifecycleV1alpha1().Evictions().Watch(context.Background(), options) + }, + }, client), + &apilifecyclev1alpha1.Eviction{}, + resyncPeriod, + indexers, + ) +} + +func (i *evictionClusterInformer) defaultInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredEvictionClusterInformer(client, resyncPeriod, cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc, + }, i.tweakListOptions) +} + +func (i *evictionClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { + return i.factory.InformerFor(&apilifecyclev1alpha1.Eviction{}, i.defaultInformer) +} + +func (i *evictionClusterInformer) Lister() kcpv1alpha1.EvictionClusterLister { + return kcpv1alpha1.NewEvictionClusterLister(i.Informer().GetIndexer()) +} + +func (i *evictionClusterInformer) Cluster(clusterName logicalcluster.Name) lifecyclev1alpha1.EvictionInformer { + return &evictionInformer{ + informer: i.Informer().Cluster(clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +func (i *evictionClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) lifecyclev1alpha1.EvictionInformer { + return &evictionInformer{ + informer: i.Informer().ClusterWithContext(ctx, clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +type evictionInformer struct { + informer cache.SharedIndexInformer + lister listerslifecyclev1alpha1.EvictionLister +} + +func (i *evictionInformer) Informer() cache.SharedIndexInformer { + return i.informer +} + +func (i *evictionInformer) Lister() listerslifecyclev1alpha1.EvictionLister { + return i.lister +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/lifecycle/v1alpha1/evictionrequest.go b/staging/src/github.com/kcp-dev/client-go/informers/lifecycle/v1alpha1/evictionrequest.go new file mode 100644 index 00000000000..f6a13760b69 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/informers/lifecycle/v1alpha1/evictionrequest.go @@ -0,0 +1,127 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-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" + watch "k8s.io/apimachinery/pkg/watch" + lifecyclev1alpha1 "k8s.io/client-go/informers/lifecycle/v1alpha1" + listerslifecyclev1alpha1 "k8s.io/client-go/listers/lifecycle/v1alpha1" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" + kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" + kcpkubernetes "github.com/kcp-dev/client-go/kubernetes" + kcpv1alpha1 "github.com/kcp-dev/client-go/listers/lifecycle/v1alpha1" + logicalcluster "github.com/kcp-dev/logicalcluster/v3" +) + +// EvictionRequestClusterInformer provides access to a shared informer and lister for +// EvictionRequests. +type EvictionRequestClusterInformer interface { + Cluster(logicalcluster.Name) lifecyclev1alpha1.EvictionRequestInformer + ClusterWithContext(context.Context, logicalcluster.Name) lifecyclev1alpha1.EvictionRequestInformer + Informer() kcpcache.ScopeableSharedIndexInformer + Lister() kcpv1alpha1.EvictionRequestClusterLister +} + +type evictionRequestClusterInformer struct { + factory kcpinternalinterfaces.SharedInformerFactory + tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc +} + +// NewEvictionRequestClusterInformer 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 NewEvictionRequestClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredEvictionRequestClusterInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredEvictionRequestClusterInformer 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 NewFilteredEvictionRequestClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.LifecycleV1alpha1().EvictionRequests().List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.LifecycleV1alpha1().EvictionRequests().Watch(context.Background(), options) + }, + }, client), + &apilifecyclev1alpha1.EvictionRequest{}, + resyncPeriod, + indexers, + ) +} + +func (i *evictionRequestClusterInformer) defaultInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredEvictionRequestClusterInformer(client, resyncPeriod, cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc, + }, i.tweakListOptions) +} + +func (i *evictionRequestClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { + return i.factory.InformerFor(&apilifecyclev1alpha1.EvictionRequest{}, i.defaultInformer) +} + +func (i *evictionRequestClusterInformer) Lister() kcpv1alpha1.EvictionRequestClusterLister { + return kcpv1alpha1.NewEvictionRequestClusterLister(i.Informer().GetIndexer()) +} + +func (i *evictionRequestClusterInformer) Cluster(clusterName logicalcluster.Name) lifecyclev1alpha1.EvictionRequestInformer { + return &evictionRequestInformer{ + informer: i.Informer().Cluster(clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +func (i *evictionRequestClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) lifecyclev1alpha1.EvictionRequestInformer { + return &evictionRequestInformer{ + informer: i.Informer().ClusterWithContext(ctx, clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +type evictionRequestInformer struct { + informer cache.SharedIndexInformer + lister listerslifecyclev1alpha1.EvictionRequestLister +} + +func (i *evictionRequestInformer) Informer() cache.SharedIndexInformer { + return i.informer +} + +func (i *evictionRequestInformer) Lister() listerslifecyclev1alpha1.EvictionRequestLister { + return i.lister +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/lifecycle/v1alpha1/interface.go b/staging/src/github.com/kcp-dev/client-go/informers/lifecycle/v1alpha1/interface.go new file mode 100644 index 00000000000..14a66b568f7 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/informers/lifecycle/v1alpha1/interface.go @@ -0,0 +1,50 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" +) + +type ClusterInterface interface { + // Evictions returns a EvictionClusterInformer. + Evictions() EvictionClusterInformer + // EvictionRequests returns a EvictionRequestClusterInformer. + EvictionRequests() EvictionRequestClusterInformer +} + +type version struct { + factory kcpinternalinterfaces.SharedInformerFactory + tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f kcpinternalinterfaces.SharedInformerFactory, tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc) ClusterInterface { + return &version{factory: f, tweakListOptions: tweakListOptions} +} + +// Evictions returns a EvictionClusterInformer. +func (v *version) Evictions() EvictionClusterInformer { + return &evictionClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// EvictionRequests returns a EvictionRequestClusterInformer. +func (v *version) EvictionRequests() EvictionRequestClusterInformer { + return &evictionRequestClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/resource/v1/devicetaintrule.go b/staging/src/github.com/kcp-dev/client-go/informers/resource/v1/devicetaintrule.go new file mode 100644 index 00000000000..500fc3ad10e --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/informers/resource/v1/devicetaintrule.go @@ -0,0 +1,127 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-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" + watch "k8s.io/apimachinery/pkg/watch" + resourcev1 "k8s.io/client-go/informers/resource/v1" + listersresourcev1 "k8s.io/client-go/listers/resource/v1" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" + kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" + kcpkubernetes "github.com/kcp-dev/client-go/kubernetes" + kcpv1 "github.com/kcp-dev/client-go/listers/resource/v1" + logicalcluster "github.com/kcp-dev/logicalcluster/v3" +) + +// DeviceTaintRuleClusterInformer provides access to a shared informer and lister for +// DeviceTaintRules. +type DeviceTaintRuleClusterInformer interface { + Cluster(logicalcluster.Name) resourcev1.DeviceTaintRuleInformer + ClusterWithContext(context.Context, logicalcluster.Name) resourcev1.DeviceTaintRuleInformer + Informer() kcpcache.ScopeableSharedIndexInformer + Lister() kcpv1.DeviceTaintRuleClusterLister +} + +type deviceTaintRuleClusterInformer struct { + factory kcpinternalinterfaces.SharedInformerFactory + tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc +} + +// NewDeviceTaintRuleClusterInformer 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 NewDeviceTaintRuleClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredDeviceTaintRuleClusterInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredDeviceTaintRuleClusterInformer 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 NewFilteredDeviceTaintRuleClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ResourceV1().DeviceTaintRules().List(context.Background(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ResourceV1().DeviceTaintRules().Watch(context.Background(), options) + }, + }, client), + &apiresourcev1.DeviceTaintRule{}, + resyncPeriod, + indexers, + ) +} + +func (i *deviceTaintRuleClusterInformer) defaultInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredDeviceTaintRuleClusterInformer(client, resyncPeriod, cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc, + }, i.tweakListOptions) +} + +func (i *deviceTaintRuleClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { + return i.factory.InformerFor(&apiresourcev1.DeviceTaintRule{}, i.defaultInformer) +} + +func (i *deviceTaintRuleClusterInformer) Lister() kcpv1.DeviceTaintRuleClusterLister { + return kcpv1.NewDeviceTaintRuleClusterLister(i.Informer().GetIndexer()) +} + +func (i *deviceTaintRuleClusterInformer) Cluster(clusterName logicalcluster.Name) resourcev1.DeviceTaintRuleInformer { + return &deviceTaintRuleInformer{ + informer: i.Informer().Cluster(clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +func (i *deviceTaintRuleClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) resourcev1.DeviceTaintRuleInformer { + return &deviceTaintRuleInformer{ + informer: i.Informer().ClusterWithContext(ctx, clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +type deviceTaintRuleInformer struct { + informer cache.SharedIndexInformer + lister listersresourcev1.DeviceTaintRuleLister +} + +func (i *deviceTaintRuleInformer) Informer() cache.SharedIndexInformer { + return i.informer +} + +func (i *deviceTaintRuleInformer) Lister() listersresourcev1.DeviceTaintRuleLister { + return i.lister +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/resource/v1/interface.go b/staging/src/github.com/kcp-dev/client-go/informers/resource/v1/interface.go index aa33e195ca3..e0e74f5ff99 100644 --- a/staging/src/github.com/kcp-dev/client-go/informers/resource/v1/interface.go +++ b/staging/src/github.com/kcp-dev/client-go/informers/resource/v1/interface.go @@ -25,6 +25,8 @@ import ( type ClusterInterface interface { // DeviceClasses returns a DeviceClassClusterInformer. DeviceClasses() DeviceClassClusterInformer + // DeviceTaintRules returns a DeviceTaintRuleClusterInformer. + DeviceTaintRules() DeviceTaintRuleClusterInformer // ResourceClaims returns a ResourceClaimClusterInformer. ResourceClaims() ResourceClaimClusterInformer // ResourceClaimTemplates returns a ResourceClaimTemplateClusterInformer. @@ -48,6 +50,11 @@ func (v *version) DeviceClasses() DeviceClassClusterInformer { return &deviceClassClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } +// DeviceTaintRules returns a DeviceTaintRuleClusterInformer. +func (v *version) DeviceTaintRules() DeviceTaintRuleClusterInformer { + return &deviceTaintRuleClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // ResourceClaims returns a ResourceClaimClusterInformer. func (v *version) ResourceClaims() ResourceClaimClusterInformer { return &resourceClaimClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/interface.go b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/interface.go index c267209dfe7..63dc30e6f8c 100644 --- a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/interface.go +++ b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/interface.go @@ -21,7 +21,7 @@ package scheduling import ( kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" kcpv1 "github.com/kcp-dev/client-go/informers/scheduling/v1" - kcpv1alpha2 "github.com/kcp-dev/client-go/informers/scheduling/v1alpha2" + kcpv1alpha3 "github.com/kcp-dev/client-go/informers/scheduling/v1alpha3" kcpv1beta1 "github.com/kcp-dev/client-go/informers/scheduling/v1beta1" ) @@ -29,8 +29,8 @@ import ( type ClusterInterface interface { // V1 provides access to shared informers for resources in V1. V1() kcpv1.ClusterInterface - // V1alpha2 provides access to shared informers for resources in V1alpha2. - V1alpha2() kcpv1alpha2.ClusterInterface + // V1alpha3 provides access to shared informers for resources in V1alpha3. + V1alpha3() kcpv1alpha3.ClusterInterface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() kcpv1beta1.ClusterInterface } @@ -50,9 +50,9 @@ func (g *group) V1() kcpv1.ClusterInterface { return kcpv1.New(g.factory, g.tweakListOptions) } -// V1alpha2 returns a new kcpv1alpha2.ClusterInterface. -func (g *group) V1alpha2() kcpv1alpha2.ClusterInterface { - return kcpv1alpha2.New(g.factory, g.tweakListOptions) +// V1alpha3 returns a new kcpv1alpha3.ClusterInterface. +func (g *group) V1alpha3() kcpv1alpha3.ClusterInterface { + return kcpv1alpha3.New(g.factory, g.tweakListOptions) } // V1beta1 returns a new kcpv1beta1.ClusterInterface. diff --git a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha3/compositepodgroup.go b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha3/compositepodgroup.go new file mode 100644 index 00000000000..3decb95b42d --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha3/compositepodgroup.go @@ -0,0 +1,127 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-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" + watch "k8s.io/apimachinery/pkg/watch" + schedulingv1alpha3 "k8s.io/client-go/informers/scheduling/v1alpha3" + listersschedulingv1alpha3 "k8s.io/client-go/listers/scheduling/v1alpha3" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" + kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" + kcpkubernetes "github.com/kcp-dev/client-go/kubernetes" + kcpv1alpha3 "github.com/kcp-dev/client-go/listers/scheduling/v1alpha3" + logicalcluster "github.com/kcp-dev/logicalcluster/v3" +) + +// CompositePodGroupClusterInformer provides access to a shared informer and lister for +// CompositePodGroups. +type CompositePodGroupClusterInformer interface { + Cluster(logicalcluster.Name) schedulingv1alpha3.CompositePodGroupInformer + ClusterWithContext(context.Context, logicalcluster.Name) schedulingv1alpha3.CompositePodGroupInformer + Informer() kcpcache.ScopeableSharedIndexInformer + Lister() kcpv1alpha3.CompositePodGroupClusterLister +} + +type compositePodGroupClusterInformer struct { + factory kcpinternalinterfaces.SharedInformerFactory + tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc +} + +// NewCompositePodGroupClusterInformer 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 NewCompositePodGroupClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredCompositePodGroupClusterInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCompositePodGroupClusterInformer 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 NewFilteredCompositePodGroupClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1alpha3().CompositePodGroups().List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1alpha3().CompositePodGroups().Watch(context.Background(), options) + }, + }, client), + &apischedulingv1alpha3.CompositePodGroup{}, + resyncPeriod, + indexers, + ) +} + +func (i *compositePodGroupClusterInformer) defaultInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredCompositePodGroupClusterInformer(client, resyncPeriod, cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc, + }, i.tweakListOptions) +} + +func (i *compositePodGroupClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { + return i.factory.InformerFor(&apischedulingv1alpha3.CompositePodGroup{}, i.defaultInformer) +} + +func (i *compositePodGroupClusterInformer) Lister() kcpv1alpha3.CompositePodGroupClusterLister { + return kcpv1alpha3.NewCompositePodGroupClusterLister(i.Informer().GetIndexer()) +} + +func (i *compositePodGroupClusterInformer) Cluster(clusterName logicalcluster.Name) schedulingv1alpha3.CompositePodGroupInformer { + return &compositePodGroupInformer{ + informer: i.Informer().Cluster(clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +func (i *compositePodGroupClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) schedulingv1alpha3.CompositePodGroupInformer { + return &compositePodGroupInformer{ + informer: i.Informer().ClusterWithContext(ctx, clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +type compositePodGroupInformer struct { + informer cache.SharedIndexInformer + lister listersschedulingv1alpha3.CompositePodGroupLister +} + +func (i *compositePodGroupInformer) Informer() cache.SharedIndexInformer { + return i.informer +} + +func (i *compositePodGroupInformer) Lister() listersschedulingv1alpha3.CompositePodGroupLister { + return i.lister +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha2/interface.go b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha3/interface.go similarity index 81% rename from staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha2/interface.go rename to staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha3/interface.go index a846152b647..dec56b40b6d 100644 --- a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha2/interface.go +++ b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha3/interface.go @@ -16,13 +16,15 @@ limitations under the License. // Code generated by cluster-informer-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" ) type ClusterInterface interface { + // CompositePodGroups returns a CompositePodGroupClusterInformer. + CompositePodGroups() CompositePodGroupClusterInformer // PodGroups returns a PodGroupClusterInformer. PodGroups() PodGroupClusterInformer // Workloads returns a WorkloadClusterInformer. @@ -39,6 +41,11 @@ func New(f kcpinternalinterfaces.SharedInformerFactory, tweakListOptions kcpinte return &version{factory: f, tweakListOptions: tweakListOptions} } +// CompositePodGroups returns a CompositePodGroupClusterInformer. +func (v *version) CompositePodGroups() CompositePodGroupClusterInformer { + return &compositePodGroupClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // PodGroups returns a PodGroupClusterInformer. func (v *version) PodGroups() PodGroupClusterInformer { return &podGroupClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha2/podgroup.go b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha3/podgroup.go similarity index 80% rename from staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha2/podgroup.go rename to staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha3/podgroup.go index 671af038ce5..51a15474603 100644 --- a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha2/podgroup.go +++ b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha3/podgroup.go @@ -16,35 +16,35 @@ limitations under the License. // Code generated by cluster-informer-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( context "context" time "time" - apischedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + apischedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" - schedulingv1alpha2 "k8s.io/client-go/informers/scheduling/v1alpha2" - listersschedulingv1alpha2 "k8s.io/client-go/listers/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/client-go/informers/scheduling/v1alpha3" + listersschedulingv1alpha3 "k8s.io/client-go/listers/scheduling/v1alpha3" cache "k8s.io/client-go/tools/cache" kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" kcpkubernetes "github.com/kcp-dev/client-go/kubernetes" - kcpv1alpha2 "github.com/kcp-dev/client-go/listers/scheduling/v1alpha2" + kcpv1alpha3 "github.com/kcp-dev/client-go/listers/scheduling/v1alpha3" logicalcluster "github.com/kcp-dev/logicalcluster/v3" ) // PodGroupClusterInformer provides access to a shared informer and lister for // PodGroups. type PodGroupClusterInformer interface { - Cluster(logicalcluster.Name) schedulingv1alpha2.PodGroupInformer - ClusterWithContext(context.Context, logicalcluster.Name) schedulingv1alpha2.PodGroupInformer + Cluster(logicalcluster.Name) schedulingv1alpha3.PodGroupInformer + ClusterWithContext(context.Context, logicalcluster.Name) schedulingv1alpha3.PodGroupInformer Informer() kcpcache.ScopeableSharedIndexInformer - Lister() kcpv1alpha2.PodGroupClusterLister + Lister() kcpv1alpha3.PodGroupClusterLister } type podGroupClusterInformer struct { @@ -69,16 +69,16 @@ func NewFilteredPodGroupClusterInformer(client kcpkubernetes.ClusterInterface, r if tweakListOptions != nil { tweakListOptions(&options) } - return client.SchedulingV1alpha2().PodGroups().List(context.Background(), options) + return client.SchedulingV1alpha3().PodGroups().List(context.Background(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.SchedulingV1alpha2().PodGroups().Watch(context.Background(), options) + return client.SchedulingV1alpha3().PodGroups().Watch(context.Background(), options) }, }, client), - &apischedulingv1alpha2.PodGroup{}, + &apischedulingv1alpha3.PodGroup{}, resyncPeriod, indexers, ) @@ -92,21 +92,21 @@ func (i *podGroupClusterInformer) defaultInformer(client kcpkubernetes.ClusterIn } func (i *podGroupClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { - return i.factory.InformerFor(&apischedulingv1alpha2.PodGroup{}, i.defaultInformer) + return i.factory.InformerFor(&apischedulingv1alpha3.PodGroup{}, i.defaultInformer) } -func (i *podGroupClusterInformer) Lister() kcpv1alpha2.PodGroupClusterLister { - return kcpv1alpha2.NewPodGroupClusterLister(i.Informer().GetIndexer()) +func (i *podGroupClusterInformer) Lister() kcpv1alpha3.PodGroupClusterLister { + return kcpv1alpha3.NewPodGroupClusterLister(i.Informer().GetIndexer()) } -func (i *podGroupClusterInformer) Cluster(clusterName logicalcluster.Name) schedulingv1alpha2.PodGroupInformer { +func (i *podGroupClusterInformer) Cluster(clusterName logicalcluster.Name) schedulingv1alpha3.PodGroupInformer { return &podGroupInformer{ informer: i.Informer().Cluster(clusterName), lister: i.Lister().Cluster(clusterName), } } -func (i *podGroupClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) schedulingv1alpha2.PodGroupInformer { +func (i *podGroupClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) schedulingv1alpha3.PodGroupInformer { return &podGroupInformer{ informer: i.Informer().ClusterWithContext(ctx, clusterName), lister: i.Lister().Cluster(clusterName), @@ -115,13 +115,13 @@ func (i *podGroupClusterInformer) ClusterWithContext(ctx context.Context, cluste type podGroupInformer struct { informer cache.SharedIndexInformer - lister listersschedulingv1alpha2.PodGroupLister + lister listersschedulingv1alpha3.PodGroupLister } func (i *podGroupInformer) Informer() cache.SharedIndexInformer { return i.informer } -func (i *podGroupInformer) Lister() listersschedulingv1alpha2.PodGroupLister { +func (i *podGroupInformer) Lister() listersschedulingv1alpha3.PodGroupLister { return i.lister } diff --git a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha2/workload.go b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha3/workload.go similarity index 80% rename from staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha2/workload.go rename to staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha3/workload.go index 6fac5a60a6c..f02315bb86d 100644 --- a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha2/workload.go +++ b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1alpha3/workload.go @@ -16,35 +16,35 @@ limitations under the License. // Code generated by cluster-informer-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( context "context" time "time" - apischedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + apischedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" - schedulingv1alpha2 "k8s.io/client-go/informers/scheduling/v1alpha2" - listersschedulingv1alpha2 "k8s.io/client-go/listers/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/client-go/informers/scheduling/v1alpha3" + listersschedulingv1alpha3 "k8s.io/client-go/listers/scheduling/v1alpha3" cache "k8s.io/client-go/tools/cache" kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" kcpkubernetes "github.com/kcp-dev/client-go/kubernetes" - kcpv1alpha2 "github.com/kcp-dev/client-go/listers/scheduling/v1alpha2" + kcpv1alpha3 "github.com/kcp-dev/client-go/listers/scheduling/v1alpha3" logicalcluster "github.com/kcp-dev/logicalcluster/v3" ) // WorkloadClusterInformer provides access to a shared informer and lister for // Workloads. type WorkloadClusterInformer interface { - Cluster(logicalcluster.Name) schedulingv1alpha2.WorkloadInformer - ClusterWithContext(context.Context, logicalcluster.Name) schedulingv1alpha2.WorkloadInformer + Cluster(logicalcluster.Name) schedulingv1alpha3.WorkloadInformer + ClusterWithContext(context.Context, logicalcluster.Name) schedulingv1alpha3.WorkloadInformer Informer() kcpcache.ScopeableSharedIndexInformer - Lister() kcpv1alpha2.WorkloadClusterLister + Lister() kcpv1alpha3.WorkloadClusterLister } type workloadClusterInformer struct { @@ -69,16 +69,16 @@ func NewFilteredWorkloadClusterInformer(client kcpkubernetes.ClusterInterface, r if tweakListOptions != nil { tweakListOptions(&options) } - return client.SchedulingV1alpha2().Workloads().List(context.Background(), options) + return client.SchedulingV1alpha3().Workloads().List(context.Background(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.SchedulingV1alpha2().Workloads().Watch(context.Background(), options) + return client.SchedulingV1alpha3().Workloads().Watch(context.Background(), options) }, }, client), - &apischedulingv1alpha2.Workload{}, + &apischedulingv1alpha3.Workload{}, resyncPeriod, indexers, ) @@ -92,21 +92,21 @@ func (i *workloadClusterInformer) defaultInformer(client kcpkubernetes.ClusterIn } func (i *workloadClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { - return i.factory.InformerFor(&apischedulingv1alpha2.Workload{}, i.defaultInformer) + return i.factory.InformerFor(&apischedulingv1alpha3.Workload{}, i.defaultInformer) } -func (i *workloadClusterInformer) Lister() kcpv1alpha2.WorkloadClusterLister { - return kcpv1alpha2.NewWorkloadClusterLister(i.Informer().GetIndexer()) +func (i *workloadClusterInformer) Lister() kcpv1alpha3.WorkloadClusterLister { + return kcpv1alpha3.NewWorkloadClusterLister(i.Informer().GetIndexer()) } -func (i *workloadClusterInformer) Cluster(clusterName logicalcluster.Name) schedulingv1alpha2.WorkloadInformer { +func (i *workloadClusterInformer) Cluster(clusterName logicalcluster.Name) schedulingv1alpha3.WorkloadInformer { return &workloadInformer{ informer: i.Informer().Cluster(clusterName), lister: i.Lister().Cluster(clusterName), } } -func (i *workloadClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) schedulingv1alpha2.WorkloadInformer { +func (i *workloadClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) schedulingv1alpha3.WorkloadInformer { return &workloadInformer{ informer: i.Informer().ClusterWithContext(ctx, clusterName), lister: i.Lister().Cluster(clusterName), @@ -115,13 +115,13 @@ func (i *workloadClusterInformer) ClusterWithContext(ctx context.Context, cluste type workloadInformer struct { informer cache.SharedIndexInformer - lister listersschedulingv1alpha2.WorkloadLister + lister listersschedulingv1alpha3.WorkloadLister } func (i *workloadInformer) Informer() cache.SharedIndexInformer { return i.informer } -func (i *workloadInformer) Lister() listersschedulingv1alpha2.WorkloadLister { +func (i *workloadInformer) Lister() listersschedulingv1alpha3.WorkloadLister { return i.lister } diff --git a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1beta1/interface.go b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1beta1/interface.go index 5e37a16cec7..4a02c00860d 100644 --- a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1beta1/interface.go +++ b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1beta1/interface.go @@ -23,8 +23,12 @@ import ( ) type ClusterInterface interface { + // PodGroups returns a PodGroupClusterInformer. + PodGroups() PodGroupClusterInformer // PriorityClasses returns a PriorityClassClusterInformer. PriorityClasses() PriorityClassClusterInformer + // Workloads returns a WorkloadClusterInformer. + Workloads() WorkloadClusterInformer } type version struct { @@ -37,7 +41,17 @@ func New(f kcpinternalinterfaces.SharedInformerFactory, tweakListOptions kcpinte return &version{factory: f, tweakListOptions: tweakListOptions} } +// PodGroups returns a PodGroupClusterInformer. +func (v *version) PodGroups() PodGroupClusterInformer { + return &podGroupClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // PriorityClasses returns a PriorityClassClusterInformer. func (v *version) PriorityClasses() PriorityClassClusterInformer { return &priorityClassClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } + +// Workloads returns a WorkloadClusterInformer. +func (v *version) Workloads() WorkloadClusterInformer { + return &workloadClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1beta1/podgroup.go b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1beta1/podgroup.go new file mode 100644 index 00000000000..a007018e79e --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1beta1/podgroup.go @@ -0,0 +1,127 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-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" + watch "k8s.io/apimachinery/pkg/watch" + schedulingv1beta1 "k8s.io/client-go/informers/scheduling/v1beta1" + listersschedulingv1beta1 "k8s.io/client-go/listers/scheduling/v1beta1" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" + kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" + kcpkubernetes "github.com/kcp-dev/client-go/kubernetes" + kcpv1beta1 "github.com/kcp-dev/client-go/listers/scheduling/v1beta1" + logicalcluster "github.com/kcp-dev/logicalcluster/v3" +) + +// PodGroupClusterInformer provides access to a shared informer and lister for +// PodGroups. +type PodGroupClusterInformer interface { + Cluster(logicalcluster.Name) schedulingv1beta1.PodGroupInformer + ClusterWithContext(context.Context, logicalcluster.Name) schedulingv1beta1.PodGroupInformer + Informer() kcpcache.ScopeableSharedIndexInformer + Lister() kcpv1beta1.PodGroupClusterLister +} + +type podGroupClusterInformer struct { + factory kcpinternalinterfaces.SharedInformerFactory + tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc +} + +// NewPodGroupClusterInformer 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 NewPodGroupClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredPodGroupClusterInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPodGroupClusterInformer 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 NewFilteredPodGroupClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1beta1().PodGroups().List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1beta1().PodGroups().Watch(context.Background(), options) + }, + }, client), + &apischedulingv1beta1.PodGroup{}, + resyncPeriod, + indexers, + ) +} + +func (i *podGroupClusterInformer) defaultInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredPodGroupClusterInformer(client, resyncPeriod, cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc, + }, i.tweakListOptions) +} + +func (i *podGroupClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { + return i.factory.InformerFor(&apischedulingv1beta1.PodGroup{}, i.defaultInformer) +} + +func (i *podGroupClusterInformer) Lister() kcpv1beta1.PodGroupClusterLister { + return kcpv1beta1.NewPodGroupClusterLister(i.Informer().GetIndexer()) +} + +func (i *podGroupClusterInformer) Cluster(clusterName logicalcluster.Name) schedulingv1beta1.PodGroupInformer { + return &podGroupInformer{ + informer: i.Informer().Cluster(clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +func (i *podGroupClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) schedulingv1beta1.PodGroupInformer { + return &podGroupInformer{ + informer: i.Informer().ClusterWithContext(ctx, clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +type podGroupInformer struct { + informer cache.SharedIndexInformer + lister listersschedulingv1beta1.PodGroupLister +} + +func (i *podGroupInformer) Informer() cache.SharedIndexInformer { + return i.informer +} + +func (i *podGroupInformer) Lister() listersschedulingv1beta1.PodGroupLister { + return i.lister +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1beta1/workload.go b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1beta1/workload.go new file mode 100644 index 00000000000..b9738de98e3 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/informers/scheduling/v1beta1/workload.go @@ -0,0 +1,127 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-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" + watch "k8s.io/apimachinery/pkg/watch" + schedulingv1beta1 "k8s.io/client-go/informers/scheduling/v1beta1" + listersschedulingv1beta1 "k8s.io/client-go/listers/scheduling/v1beta1" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" + kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" + kcpkubernetes "github.com/kcp-dev/client-go/kubernetes" + kcpv1beta1 "github.com/kcp-dev/client-go/listers/scheduling/v1beta1" + logicalcluster "github.com/kcp-dev/logicalcluster/v3" +) + +// WorkloadClusterInformer provides access to a shared informer and lister for +// Workloads. +type WorkloadClusterInformer interface { + Cluster(logicalcluster.Name) schedulingv1beta1.WorkloadInformer + ClusterWithContext(context.Context, logicalcluster.Name) schedulingv1beta1.WorkloadInformer + Informer() kcpcache.ScopeableSharedIndexInformer + Lister() kcpv1beta1.WorkloadClusterLister +} + +type workloadClusterInformer struct { + factory kcpinternalinterfaces.SharedInformerFactory + tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc +} + +// NewWorkloadClusterInformer 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 NewWorkloadClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredWorkloadClusterInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredWorkloadClusterInformer 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 NewFilteredWorkloadClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1beta1().Workloads().List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1beta1().Workloads().Watch(context.Background(), options) + }, + }, client), + &apischedulingv1beta1.Workload{}, + resyncPeriod, + indexers, + ) +} + +func (i *workloadClusterInformer) defaultInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredWorkloadClusterInformer(client, resyncPeriod, cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc, + }, i.tweakListOptions) +} + +func (i *workloadClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { + return i.factory.InformerFor(&apischedulingv1beta1.Workload{}, i.defaultInformer) +} + +func (i *workloadClusterInformer) Lister() kcpv1beta1.WorkloadClusterLister { + return kcpv1beta1.NewWorkloadClusterLister(i.Informer().GetIndexer()) +} + +func (i *workloadClusterInformer) Cluster(clusterName logicalcluster.Name) schedulingv1beta1.WorkloadInformer { + return &workloadInformer{ + informer: i.Informer().Cluster(clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +func (i *workloadClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) schedulingv1beta1.WorkloadInformer { + return &workloadInformer{ + informer: i.Informer().ClusterWithContext(ctx, clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +type workloadInformer struct { + informer cache.SharedIndexInformer + lister listersschedulingv1beta1.WorkloadLister +} + +func (i *workloadInformer) Informer() cache.SharedIndexInformer { + return i.informer +} + +func (i *workloadInformer) Lister() listersschedulingv1beta1.WorkloadLister { + return i.lister +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/storagemigration/interface.go b/staging/src/github.com/kcp-dev/client-go/informers/storagemigration/interface.go index 94ebd02ce74..e88b0258f70 100644 --- a/staging/src/github.com/kcp-dev/client-go/informers/storagemigration/interface.go +++ b/staging/src/github.com/kcp-dev/client-go/informers/storagemigration/interface.go @@ -20,11 +20,14 @@ package storagemigration import ( kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" + kcpv1 "github.com/kcp-dev/client-go/informers/storagemigration/v1" kcpv1beta1 "github.com/kcp-dev/client-go/informers/storagemigration/v1beta1" ) // ClusterInterface provides access to each of this group's versions. type ClusterInterface interface { + // V1 provides access to shared informers for resources in V1. + V1() kcpv1.ClusterInterface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() kcpv1beta1.ClusterInterface } @@ -39,6 +42,11 @@ func New(f kcpinternalinterfaces.SharedInformerFactory, tweakListOptions kcpinte return &group{factory: f, tweakListOptions: tweakListOptions} } +// V1 returns a new kcpv1.ClusterInterface. +func (g *group) V1() kcpv1.ClusterInterface { + return kcpv1.New(g.factory, g.tweakListOptions) +} + // V1beta1 returns a new kcpv1beta1.ClusterInterface. func (g *group) V1beta1() kcpv1beta1.ClusterInterface { return kcpv1beta1.New(g.factory, g.tweakListOptions) diff --git a/staging/src/github.com/kcp-dev/client-go/informers/storagemigration/v1/interface.go b/staging/src/github.com/kcp-dev/client-go/informers/storagemigration/v1/interface.go new file mode 100644 index 00000000000..887ba32ea2e --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/informers/storagemigration/v1/interface.go @@ -0,0 +1,43 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-informer-gen. DO NOT EDIT. + +package v1 + +import ( + kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" +) + +type ClusterInterface interface { + // StorageVersionMigrations returns a StorageVersionMigrationClusterInformer. + StorageVersionMigrations() StorageVersionMigrationClusterInformer +} + +type version struct { + factory kcpinternalinterfaces.SharedInformerFactory + tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f kcpinternalinterfaces.SharedInformerFactory, tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc) ClusterInterface { + return &version{factory: f, tweakListOptions: tweakListOptions} +} + +// StorageVersionMigrations returns a StorageVersionMigrationClusterInformer. +func (v *version) StorageVersionMigrations() StorageVersionMigrationClusterInformer { + return &storageVersionMigrationClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/github.com/kcp-dev/client-go/informers/storagemigration/v1/storageversionmigration.go b/staging/src/github.com/kcp-dev/client-go/informers/storagemigration/v1/storageversionmigration.go new file mode 100644 index 00000000000..b429e8d3a87 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/informers/storagemigration/v1/storageversionmigration.go @@ -0,0 +1,127 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-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" + watch "k8s.io/apimachinery/pkg/watch" + storagemigrationv1 "k8s.io/client-go/informers/storagemigration/v1" + listersstoragemigrationv1 "k8s.io/client-go/listers/storagemigration/v1" + cache "k8s.io/client-go/tools/cache" + + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" + kcpinternalinterfaces "github.com/kcp-dev/client-go/informers/internalinterfaces" + kcpkubernetes "github.com/kcp-dev/client-go/kubernetes" + kcpv1 "github.com/kcp-dev/client-go/listers/storagemigration/v1" + logicalcluster "github.com/kcp-dev/logicalcluster/v3" +) + +// StorageVersionMigrationClusterInformer provides access to a shared informer and lister for +// StorageVersionMigrations. +type StorageVersionMigrationClusterInformer interface { + Cluster(logicalcluster.Name) storagemigrationv1.StorageVersionMigrationInformer + ClusterWithContext(context.Context, logicalcluster.Name) storagemigrationv1.StorageVersionMigrationInformer + Informer() kcpcache.ScopeableSharedIndexInformer + Lister() kcpv1.StorageVersionMigrationClusterLister +} + +type storageVersionMigrationClusterInformer struct { + factory kcpinternalinterfaces.SharedInformerFactory + tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc +} + +// NewStorageVersionMigrationClusterInformer 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 NewStorageVersionMigrationClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredStorageVersionMigrationClusterInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStorageVersionMigrationClusterInformer 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 NewFilteredStorageVersionMigrationClusterInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions kcpinternalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StoragemigrationV1().StorageVersionMigrations().List(context.Background(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StoragemigrationV1().StorageVersionMigrations().Watch(context.Background(), options) + }, + }, client), + &apistoragemigrationv1.StorageVersionMigration{}, + resyncPeriod, + indexers, + ) +} + +func (i *storageVersionMigrationClusterInformer) defaultInformer(client kcpkubernetes.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredStorageVersionMigrationClusterInformer(client, resyncPeriod, cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc, + }, i.tweakListOptions) +} + +func (i *storageVersionMigrationClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { + return i.factory.InformerFor(&apistoragemigrationv1.StorageVersionMigration{}, i.defaultInformer) +} + +func (i *storageVersionMigrationClusterInformer) Lister() kcpv1.StorageVersionMigrationClusterLister { + return kcpv1.NewStorageVersionMigrationClusterLister(i.Informer().GetIndexer()) +} + +func (i *storageVersionMigrationClusterInformer) Cluster(clusterName logicalcluster.Name) storagemigrationv1.StorageVersionMigrationInformer { + return &storageVersionMigrationInformer{ + informer: i.Informer().Cluster(clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +func (i *storageVersionMigrationClusterInformer) ClusterWithContext(ctx context.Context, clusterName logicalcluster.Name) storagemigrationv1.StorageVersionMigrationInformer { + return &storageVersionMigrationInformer{ + informer: i.Informer().ClusterWithContext(ctx, clusterName), + lister: i.Lister().Cluster(clusterName), + } +} + +type storageVersionMigrationInformer struct { + informer cache.SharedIndexInformer + lister listersstoragemigrationv1.StorageVersionMigrationLister +} + +func (i *storageVersionMigrationInformer) Informer() cache.SharedIndexInformer { + return i.informer +} + +func (i *storageVersionMigrationInformer) Lister() listersstoragemigrationv1.StorageVersionMigrationLister { + return i.lister +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/clientset.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/clientset.go index 9d5f745e112..e9f1ec3da79 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/clientset.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/clientset.go @@ -60,6 +60,7 @@ import ( flowcontrolv1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/flowcontrol/v1beta1" flowcontrolv1beta2 "github.com/kcp-dev/client-go/kubernetes/typed/flowcontrol/v1beta2" flowcontrolv1beta3 "github.com/kcp-dev/client-go/kubernetes/typed/flowcontrol/v1beta3" + lifecyclev1alpha1 "github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1" networkingv1 "github.com/kcp-dev/client-go/kubernetes/typed/networking/v1" networkingv1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/networking/v1beta1" nodev1 "github.com/kcp-dev/client-go/kubernetes/typed/node/v1" @@ -75,18 +76,19 @@ import ( resourcev1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/resource/v1beta1" resourcev1beta2 "github.com/kcp-dev/client-go/kubernetes/typed/resource/v1beta2" schedulingv1 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1" - schedulingv1alpha2 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2" + schedulingv1alpha3 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3" schedulingv1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1" storagev1 "github.com/kcp-dev/client-go/kubernetes/typed/storage/v1" storagev1alpha1 "github.com/kcp-dev/client-go/kubernetes/typed/storage/v1alpha1" storagev1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/storage/v1beta1" + storagemigrationv1 "github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1" storagemigrationv1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1beta1" "github.com/kcp-dev/logicalcluster/v3" ) type ClusterInterface interface { Cluster(logicalcluster.Path) client.Interface - Discovery() discovery.DiscoveryInterface + Discovery() discovery.DiscoveryInterfaces AdmissionregistrationV1() admissionregistrationv1.AdmissionregistrationV1ClusterInterface AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1ClusterInterface AdmissionregistrationV1beta1() admissionregistrationv1beta1.AdmissionregistrationV1beta1ClusterInterface @@ -119,6 +121,7 @@ type ClusterInterface interface { FlowcontrolV1beta1() flowcontrolv1beta1.FlowcontrolV1beta1ClusterInterface FlowcontrolV1beta2() flowcontrolv1beta2.FlowcontrolV1beta2ClusterInterface FlowcontrolV1beta3() flowcontrolv1beta3.FlowcontrolV1beta3ClusterInterface + LifecycleV1alpha1() lifecyclev1alpha1.LifecycleV1alpha1ClusterInterface NetworkingV1() networkingv1.NetworkingV1ClusterInterface NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1ClusterInterface NodeV1() nodev1.NodeV1ClusterInterface @@ -134,11 +137,12 @@ type ClusterInterface interface { ResourceV1beta1() resourcev1beta1.ResourceV1beta1ClusterInterface ResourceV1beta2() resourcev1beta2.ResourceV1beta2ClusterInterface SchedulingV1() schedulingv1.SchedulingV1ClusterInterface - SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2ClusterInterface + SchedulingV1alpha3() schedulingv1alpha3.SchedulingV1alpha3ClusterInterface SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1ClusterInterface StorageV1() storagev1.StorageV1ClusterInterface StorageV1alpha1() storagev1alpha1.StorageV1alpha1ClusterInterface StorageV1beta1() storagev1beta1.StorageV1beta1ClusterInterface + StoragemigrationV1() storagemigrationv1.StoragemigrationV1ClusterInterface StoragemigrationV1beta1() storagemigrationv1beta1.StoragemigrationV1beta1ClusterInterface } @@ -178,6 +182,7 @@ type ClusterClientset struct { flowcontrolV1beta1 *flowcontrolv1beta1.FlowcontrolV1beta1ClusterClient flowcontrolV1beta2 *flowcontrolv1beta2.FlowcontrolV1beta2ClusterClient flowcontrolV1beta3 *flowcontrolv1beta3.FlowcontrolV1beta3ClusterClient + lifecycleV1alpha1 *lifecyclev1alpha1.LifecycleV1alpha1ClusterClient networkingV1 *networkingv1.NetworkingV1ClusterClient networkingV1beta1 *networkingv1beta1.NetworkingV1beta1ClusterClient nodeV1 *nodev1.NodeV1ClusterClient @@ -193,16 +198,17 @@ type ClusterClientset struct { resourceV1beta1 *resourcev1beta1.ResourceV1beta1ClusterClient resourceV1beta2 *resourcev1beta2.ResourceV1beta2ClusterClient schedulingV1 *schedulingv1.SchedulingV1ClusterClient - schedulingV1alpha2 *schedulingv1alpha2.SchedulingV1alpha2ClusterClient + schedulingV1alpha3 *schedulingv1alpha3.SchedulingV1alpha3ClusterClient schedulingV1beta1 *schedulingv1beta1.SchedulingV1beta1ClusterClient storageV1 *storagev1.StorageV1ClusterClient storageV1alpha1 *storagev1alpha1.StorageV1alpha1ClusterClient storageV1beta1 *storagev1beta1.StorageV1beta1ClusterClient + storagemigrationV1 *storagemigrationv1.StoragemigrationV1ClusterClient storagemigrationV1beta1 *storagemigrationv1beta1.StoragemigrationV1beta1ClusterClient } // Discovery retrieves the DiscoveryClient. -func (c *ClusterClientset) Discovery() discovery.DiscoveryInterface { +func (c *ClusterClientset) Discovery() discovery.DiscoveryInterfaces { if c == nil { return nil } @@ -369,6 +375,11 @@ func (c *ClusterClientset) FlowcontrolV1beta3() flowcontrolv1beta3.FlowcontrolV1 return c.flowcontrolV1beta3 } +// LifecycleV1alpha1 retrieves the LifecycleV1alpha1ClusterClient. +func (c *ClusterClientset) LifecycleV1alpha1() lifecyclev1alpha1.LifecycleV1alpha1ClusterInterface { + return c.lifecycleV1alpha1 +} + // NetworkingV1 retrieves the NetworkingV1ClusterClient. func (c *ClusterClientset) NetworkingV1() networkingv1.NetworkingV1ClusterInterface { return c.networkingV1 @@ -444,9 +455,9 @@ func (c *ClusterClientset) SchedulingV1() schedulingv1.SchedulingV1ClusterInterf return c.schedulingV1 } -// SchedulingV1alpha2 retrieves the SchedulingV1alpha2ClusterClient. -func (c *ClusterClientset) SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2ClusterInterface { - return c.schedulingV1alpha2 +// SchedulingV1alpha3 retrieves the SchedulingV1alpha3ClusterClient. +func (c *ClusterClientset) SchedulingV1alpha3() schedulingv1alpha3.SchedulingV1alpha3ClusterInterface { + return c.schedulingV1alpha3 } // SchedulingV1beta1 retrieves the SchedulingV1beta1ClusterClient. @@ -469,6 +480,11 @@ func (c *ClusterClientset) StorageV1beta1() storagev1beta1.StorageV1beta1Cluster return c.storageV1beta1 } +// StoragemigrationV1 retrieves the StoragemigrationV1ClusterClient. +func (c *ClusterClientset) StoragemigrationV1() storagemigrationv1.StoragemigrationV1ClusterInterface { + return c.storagemigrationV1 +} + // StoragemigrationV1beta1 retrieves the StoragemigrationV1beta1ClusterClient. func (c *ClusterClientset) StoragemigrationV1beta1() storagemigrationv1beta1.StoragemigrationV1beta1ClusterInterface { return c.storagemigrationV1beta1 @@ -654,6 +670,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*ClusterCli 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 @@ -714,7 +734,7 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*ClusterCli 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 } @@ -734,6 +754,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*ClusterCli 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 @@ -791,6 +815,7 @@ func New(c *rest.Config) *ClusterClientset { cs.flowcontrolV1beta1 = flowcontrolv1beta1.NewForConfigOrDie(c) cs.flowcontrolV1beta2 = flowcontrolv1beta2.NewForConfigOrDie(c) cs.flowcontrolV1beta3 = flowcontrolv1beta3.NewForConfigOrDie(c) + cs.lifecycleV1alpha1 = lifecyclev1alpha1.NewForConfigOrDie(c) cs.networkingV1 = networkingv1.NewForConfigOrDie(c) cs.networkingV1beta1 = networkingv1beta1.NewForConfigOrDie(c) cs.nodeV1 = nodev1.NewForConfigOrDie(c) @@ -806,11 +831,12 @@ func New(c *rest.Config) *ClusterClientset { cs.resourceV1beta1 = resourcev1beta1.NewForConfigOrDie(c) cs.resourceV1beta2 = resourcev1beta2.NewForConfigOrDie(c) cs.schedulingV1 = schedulingv1.NewForConfigOrDie(c) - cs.schedulingV1alpha2 = schedulingv1alpha2.NewForConfigOrDie(c) + cs.schedulingV1alpha3 = schedulingv1alpha3.NewForConfigOrDie(c) cs.schedulingV1beta1 = schedulingv1beta1.NewForConfigOrDie(c) cs.storageV1 = storagev1.NewForConfigOrDie(c) cs.storageV1alpha1 = storagev1alpha1.NewForConfigOrDie(c) cs.storageV1beta1 = storagev1beta1.NewForConfigOrDie(c) + cs.storagemigrationV1 = storagemigrationv1.NewForConfigOrDie(c) cs.storagemigrationV1beta1 = storagemigrationv1beta1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/fake/clientset.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/fake/clientset.go index d6955db2276..6247c88ea53 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/fake/clientset.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/fake/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,11 +71,12 @@ 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" kcpclientset "github.com/kcp-dev/client-go/kubernetes" @@ -143,6 +145,8 @@ import ( kcpfakeflowcontrolv1beta2 "github.com/kcp-dev/client-go/kubernetes/typed/flowcontrol/v1beta2/fake" kcpflowcontrolv1beta3 "github.com/kcp-dev/client-go/kubernetes/typed/flowcontrol/v1beta3" kcpfakeflowcontrolv1beta3 "github.com/kcp-dev/client-go/kubernetes/typed/flowcontrol/v1beta3/fake" + kcplifecyclev1alpha1 "github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1" + kcpfakelifecyclev1alpha1 "github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/fake" kcpnetworkingv1 "github.com/kcp-dev/client-go/kubernetes/typed/networking/v1" kcpfakenetworkingv1 "github.com/kcp-dev/client-go/kubernetes/typed/networking/v1/fake" kcpnetworkingv1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/networking/v1beta1" @@ -173,8 +177,8 @@ import ( kcpfakeresourcev1beta2 "github.com/kcp-dev/client-go/kubernetes/typed/resource/v1beta2/fake" kcpschedulingv1 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1" kcpfakeschedulingv1 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1/fake" - kcpschedulingv1alpha2 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2" - kcpfakeschedulingv1alpha2 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/fake" + kcpschedulingv1alpha3 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3" + kcpfakeschedulingv1alpha3 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake" kcpschedulingv1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1" kcpfakeschedulingv1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/fake" kcpstoragev1 "github.com/kcp-dev/client-go/kubernetes/typed/storage/v1" @@ -183,6 +187,8 @@ import ( kcpfakestoragev1alpha1 "github.com/kcp-dev/client-go/kubernetes/typed/storage/v1alpha1/fake" kcpstoragev1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/storage/v1beta1" kcpfakestoragev1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/storage/v1beta1/fake" + kcpstoragemigrationv1 "github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1" + kcpfakestoragemigrationv1 "github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/fake" kcpstoragemigrationv1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1beta1" kcpfakestoragemigrationv1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1beta1/fake" kcpfakediscovery "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/discovery/fake" @@ -220,7 +226,7 @@ type ClusterClientset struct { var _ kcpclientset.ClusterInterface = (*ClusterClientset)(nil) // Discovery retrieves the DiscoveryClient -func (c *ClusterClientset) Discovery() discovery.DiscoveryInterface { +func (c *ClusterClientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } @@ -423,6 +429,11 @@ func (c *ClusterClientset) FlowcontrolV1beta3() kcpflowcontrolv1beta3.Flowcontro return &kcpfakeflowcontrolv1beta3.FlowcontrolV1beta3ClusterClient{Fake: &c.Fake} } +// LifecycleV1alpha1 retrieves the LifecycleV1alpha1ClusterClient +func (c *ClusterClientset) LifecycleV1alpha1() kcplifecyclev1alpha1.LifecycleV1alpha1ClusterInterface { + return &kcpfakelifecyclev1alpha1.LifecycleV1alpha1ClusterClient{Fake: &c.Fake} +} + // NetworkingV1 retrieves the NetworkingV1ClusterClient func (c *ClusterClientset) NetworkingV1() kcpnetworkingv1.NetworkingV1ClusterInterface { return &kcpfakenetworkingv1.NetworkingV1ClusterClient{Fake: &c.Fake} @@ -498,9 +509,9 @@ func (c *ClusterClientset) SchedulingV1() kcpschedulingv1.SchedulingV1ClusterInt return &kcpfakeschedulingv1.SchedulingV1ClusterClient{Fake: &c.Fake} } -// SchedulingV1alpha2 retrieves the SchedulingV1alpha2ClusterClient -func (c *ClusterClientset) SchedulingV1alpha2() kcpschedulingv1alpha2.SchedulingV1alpha2ClusterInterface { - return &kcpfakeschedulingv1alpha2.SchedulingV1alpha2ClusterClient{Fake: &c.Fake} +// SchedulingV1alpha3 retrieves the SchedulingV1alpha3ClusterClient +func (c *ClusterClientset) SchedulingV1alpha3() kcpschedulingv1alpha3.SchedulingV1alpha3ClusterInterface { + return &kcpfakeschedulingv1alpha3.SchedulingV1alpha3ClusterClient{Fake: &c.Fake} } // SchedulingV1beta1 retrieves the SchedulingV1beta1ClusterClient @@ -523,6 +534,11 @@ func (c *ClusterClientset) StorageV1beta1() kcpstoragev1beta1.StorageV1beta1Clus return &kcpfakestoragev1beta1.StorageV1beta1ClusterClient{Fake: &c.Fake} } +// StoragemigrationV1 retrieves the StoragemigrationV1ClusterClient +func (c *ClusterClientset) StoragemigrationV1() kcpstoragemigrationv1.StoragemigrationV1ClusterInterface { + return &kcpfakestoragemigrationv1.StoragemigrationV1ClusterClient{Fake: &c.Fake} +} + // StoragemigrationV1beta1 retrieves the StoragemigrationV1beta1ClusterClient func (c *ClusterClientset) StoragemigrationV1beta1() kcpstoragemigrationv1beta1.StoragemigrationV1beta1ClusterInterface { return &kcpfakestoragemigrationv1beta1.StoragemigrationV1beta1ClusterClient{Fake: &c.Fake} @@ -543,7 +559,7 @@ var ( _ kcptesting.FakeScopedClient = &Clientset{} ) -func (c *Clientset) Discovery() discovery.DiscoveryInterface { +func (c *Clientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } @@ -731,6 +747,11 @@ func (c *Clientset) FlowcontrolV1beta3() flowcontrolv1beta3.FlowcontrolV1beta3In return &kcpfakeflowcontrolv1beta3.FlowcontrolV1beta3Client{Fake: c.Fake, ClusterPath: c.clusterPath} } +// LifecycleV1alpha1 retrieves the LifecycleV1alpha1Client +func (c *Clientset) LifecycleV1alpha1() lifecyclev1alpha1.LifecycleV1alpha1Interface { + return &kcpfakelifecyclev1alpha1.LifecycleV1alpha1Client{Fake: c.Fake, ClusterPath: c.clusterPath} +} + // NetworkingV1 retrieves the NetworkingV1Client func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface { return &kcpfakenetworkingv1.NetworkingV1Client{Fake: c.Fake, ClusterPath: c.clusterPath} @@ -806,9 +827,9 @@ func (c *Clientset) SchedulingV1() schedulingv1.SchedulingV1Interface { return &kcpfakeschedulingv1.SchedulingV1Client{Fake: c.Fake, ClusterPath: c.clusterPath} } -// SchedulingV1alpha2 retrieves the SchedulingV1alpha2Client -func (c *Clientset) SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2Interface { - return &kcpfakeschedulingv1alpha2.SchedulingV1alpha2Client{Fake: c.Fake, ClusterPath: c.clusterPath} +// SchedulingV1alpha3 retrieves the SchedulingV1alpha3Client +func (c *Clientset) SchedulingV1alpha3() schedulingv1alpha3.SchedulingV1alpha3Interface { + return &kcpfakeschedulingv1alpha3.SchedulingV1alpha3Client{Fake: c.Fake, ClusterPath: c.clusterPath} } // SchedulingV1beta1 retrieves the SchedulingV1beta1Client @@ -831,6 +852,11 @@ func (c *Clientset) StorageV1beta1() storagev1beta1.StorageV1beta1Interface { return &kcpfakestoragev1beta1.StorageV1beta1Client{Fake: c.Fake, ClusterPath: c.clusterPath} } +// StoragemigrationV1 retrieves the StoragemigrationV1Client +func (c *Clientset) StoragemigrationV1() storagemigrationv1.StoragemigrationV1Interface { + return &kcpfakestoragemigrationv1.StoragemigrationV1Client{Fake: c.Fake, ClusterPath: c.clusterPath} +} + // StoragemigrationV1beta1 retrieves the StoragemigrationV1beta1Client func (c *Clientset) StoragemigrationV1beta1() storagemigrationv1beta1.StoragemigrationV1beta1Interface { return &kcpfakestoragemigrationv1beta1.StoragemigrationV1beta1Client{Fake: c.Fake, ClusterPath: c.clusterPath} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/fake/register.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/fake/register.go index c3e314576cd..fadff7709e6 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/fake/register.go +++ b/staging/src/github.com/kcp-dev/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, @@ -130,11 +133,12 @@ var localSchemeBuilder = runtime.SchemeBuilder{ resourcev1beta1.AddToScheme, resourcev1beta2.AddToScheme, schedulingv1.AddToScheme, - schedulingv1alpha2.AddToScheme, + schedulingv1alpha3.AddToScheme, schedulingv1beta1.AddToScheme, storagev1.AddToScheme, storagev1alpha1.AddToScheme, storagev1beta1.AddToScheme, + storagemigrationv1.AddToScheme, storagemigrationv1beta1.AddToScheme, } diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/scheme/register.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/scheme/register.go index 9371745de3e..8483edb506b 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/scheme/register.go +++ b/staging/src/github.com/kcp-dev/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, @@ -130,11 +133,12 @@ var localSchemeBuilder = runtime.SchemeBuilder{ resourcev1beta1.AddToScheme, resourcev1beta2.AddToScheme, schedulingv1.AddToScheme, - schedulingv1alpha2.AddToScheme, + schedulingv1alpha3.AddToScheme, schedulingv1beta1.AddToScheme, storagev1.AddToScheme, storagev1alpha1.AddToScheme, storagev1beta1.AddToScheme, + storagemigrationv1.AddToScheme, storagemigrationv1beta1.AddToScheme, } diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/certificates_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/certificates_client.go index 32a577168ad..412ff7df0fe 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/certificates_client.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/certificates_client.go @@ -33,6 +33,8 @@ import ( type CertificatesV1ClusterInterface interface { CertificatesV1ClusterScoper CertificateSigningRequestsClusterGetter + ClusterTrustBundlesClusterGetter + PodCertificateRequestsClusterGetter } type CertificatesV1ClusterScoper interface { @@ -55,6 +57,14 @@ func (c *CertificatesV1ClusterClient) CertificateSigningRequests() CertificateSi return &certificateSigningRequestsClusterInterface{clientCache: c.clientCache} } +func (c *CertificatesV1ClusterClient) ClusterTrustBundles() ClusterTrustBundleClusterInterface { + return &clusterTrustBundlesClusterInterface{clientCache: c.clientCache} +} + +func (c *CertificatesV1ClusterClient) PodCertificateRequests() PodCertificateRequestClusterInterface { + return &podCertificateRequestsClusterInterface{clientCache: c.clientCache} +} + // NewForConfig creates a new CertificatesV1ClusterClient for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/clustertrustbundle.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/clustertrustbundle.go new file mode 100644 index 00000000000..3468b93cd92 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/clustertrustbundle.go @@ -0,0 +1,69 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + apicertificatesv1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" + certificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + "github.com/kcp-dev/logicalcluster/v3" +) + +// ClusterTrustBundlesClusterGetter has a method to return a ClusterTrustBundleClusterInterface. +// A group's cluster client should implement this interface. +type ClusterTrustBundlesClusterGetter interface { + ClusterTrustBundles() ClusterTrustBundleClusterInterface +} + +// ClusterTrustBundleClusterInterface can operate on ClusterTrustBundles across all clusters, +// or scope down to one cluster and return a certificatesv1.ClusterTrustBundleInterface. +type ClusterTrustBundleClusterInterface interface { + Cluster(logicalcluster.Path) certificatesv1.ClusterTrustBundleInterface + List(ctx context.Context, opts metav1.ListOptions) (*apicertificatesv1.ClusterTrustBundleList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + ClusterTrustBundleClusterExpansion +} + +type clusterTrustBundlesClusterInterface struct { + clientCache kcpclient.Cache[*certificatesv1.CertificatesV1Client] +} + +// Cluster scopes the client down to a particular cluster. +func (c *clusterTrustBundlesClusterInterface) Cluster(clusterPath logicalcluster.Path) certificatesv1.ClusterTrustBundleInterface { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + + return c.clientCache.ClusterOrDie(clusterPath).ClusterTrustBundles() +} + +// List returns the entire collection of all ClusterTrustBundles across all clusters. +func (c *clusterTrustBundlesClusterInterface) List(ctx context.Context, opts metav1.ListOptions) (*apicertificatesv1.ClusterTrustBundleList, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).ClusterTrustBundles().List(ctx, opts) +} + +// Watch begins to watch all ClusterTrustBundles across all clusters. +func (c *clusterTrustBundlesClusterInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).ClusterTrustBundles().Watch(ctx, opts) +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/fake/certificates_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/fake/certificates_client.go index 7e3b82d3490..384208bb542 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/fake/certificates_client.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/fake/certificates_client.go @@ -44,6 +44,14 @@ func (c *CertificatesV1ClusterClient) CertificateSigningRequests() kcpcertificat return newFakeCertificateSigningRequestClusterClient(c) } +func (c *CertificatesV1ClusterClient) ClusterTrustBundles() kcpcertificatesv1.ClusterTrustBundleClusterInterface { + return newFakeClusterTrustBundleClusterClient(c) +} + +func (c *CertificatesV1ClusterClient) PodCertificateRequests() kcpcertificatesv1.PodCertificateRequestClusterInterface { + return newFakePodCertificateRequestClusterClient(c) +} + type CertificatesV1Client struct { *kcptesting.Fake ClusterPath logicalcluster.Path @@ -53,6 +61,14 @@ func (c *CertificatesV1Client) CertificateSigningRequests() certificatesv1.Certi return newFakeCertificateSigningRequestClient(c.Fake, c.ClusterPath) } +func (c *CertificatesV1Client) ClusterTrustBundles() certificatesv1.ClusterTrustBundleInterface { + return newFakeClusterTrustBundleClient(c.Fake, c.ClusterPath) +} + +func (c *CertificatesV1Client) PodCertificateRequests(namespace string) certificatesv1.PodCertificateRequestInterface { + return newFakePodCertificateRequestClient(c.Fake, namespace, c.ClusterPath) +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *CertificatesV1Client) RESTClient() rest.Interface { diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/fake/clustertrustbundle.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/fake/clustertrustbundle.go new file mode 100644 index 00000000000..07cecf8445f --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/fake/clustertrustbundle.go @@ -0,0 +1,90 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + certificatesv1 "k8s.io/api/certificates/v1" + v1 "k8s.io/client-go/applyconfigurations/certificates/v1" + typedcertificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1" + + typedkcpcertificatesv1 "github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1" + kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +// clusterTrustBundleClusterClient implements ClusterTrustBundleClusterInterface +type clusterTrustBundleClusterClient struct { + *kcpgentype.FakeClusterClientWithList[*certificatesv1.ClusterTrustBundle, *certificatesv1.ClusterTrustBundleList] + Fake *kcptesting.Fake +} + +func newFakeClusterTrustBundleClusterClient(fake *CertificatesV1ClusterClient) typedkcpcertificatesv1.ClusterTrustBundleClusterInterface { + return &clusterTrustBundleClusterClient{ + kcpgentype.NewFakeClusterClientWithList[*certificatesv1.ClusterTrustBundle, *certificatesv1.ClusterTrustBundleList]( + fake.Fake, + certificatesv1.SchemeGroupVersion.WithResource("clustertrustbundles"), + certificatesv1.SchemeGroupVersion.WithKind("ClusterTrustBundle"), + func() *certificatesv1.ClusterTrustBundle { return &certificatesv1.ClusterTrustBundle{} }, + func() *certificatesv1.ClusterTrustBundleList { return &certificatesv1.ClusterTrustBundleList{} }, + func(dst, src *certificatesv1.ClusterTrustBundleList) { dst.ListMeta = src.ListMeta }, + func(list *certificatesv1.ClusterTrustBundleList) []*certificatesv1.ClusterTrustBundle { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *certificatesv1.ClusterTrustBundleList, items []*certificatesv1.ClusterTrustBundle) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake.Fake, + } +} + +func (c *clusterTrustBundleClusterClient) Cluster(cluster logicalcluster.Path) typedcertificatesv1.ClusterTrustBundleInterface { + return newFakeClusterTrustBundleClient(c.Fake, cluster) +} + +// clusterTrustBundleScopedClient implements ClusterTrustBundleInterface +type clusterTrustBundleScopedClient struct { + *kcpgentype.FakeClientWithListAndApply[*certificatesv1.ClusterTrustBundle, *certificatesv1.ClusterTrustBundleList, *v1.ClusterTrustBundleApplyConfiguration] + Fake *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func newFakeClusterTrustBundleClient(fake *kcptesting.Fake, clusterPath logicalcluster.Path) typedcertificatesv1.ClusterTrustBundleInterface { + return &clusterTrustBundleScopedClient{ + kcpgentype.NewFakeClientWithListAndApply[*certificatesv1.ClusterTrustBundle, *certificatesv1.ClusterTrustBundleList, *v1.ClusterTrustBundleApplyConfiguration]( + fake, + clusterPath, + "", + certificatesv1.SchemeGroupVersion.WithResource("clustertrustbundles"), + certificatesv1.SchemeGroupVersion.WithKind("ClusterTrustBundle"), + func() *certificatesv1.ClusterTrustBundle { return &certificatesv1.ClusterTrustBundle{} }, + func() *certificatesv1.ClusterTrustBundleList { return &certificatesv1.ClusterTrustBundleList{} }, + func(dst, src *certificatesv1.ClusterTrustBundleList) { dst.ListMeta = src.ListMeta }, + func(list *certificatesv1.ClusterTrustBundleList) []*certificatesv1.ClusterTrustBundle { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *certificatesv1.ClusterTrustBundleList, items []*certificatesv1.ClusterTrustBundle) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake, + clusterPath, + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/fake/podcertificaterequest.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/fake/podcertificaterequest.go new file mode 100644 index 00000000000..bbde83a45c6 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/fake/podcertificaterequest.go @@ -0,0 +1,99 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + certificatesv1 "k8s.io/api/certificates/v1" + v1 "k8s.io/client-go/applyconfigurations/certificates/v1" + typedcertificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1" + + typedkcpcertificatesv1 "github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1" + kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +// podCertificateRequestClusterClient implements PodCertificateRequestClusterInterface +type podCertificateRequestClusterClient struct { + *kcpgentype.FakeClusterClientWithList[*certificatesv1.PodCertificateRequest, *certificatesv1.PodCertificateRequestList] + Fake *kcptesting.Fake +} + +func newFakePodCertificateRequestClusterClient(fake *CertificatesV1ClusterClient) typedkcpcertificatesv1.PodCertificateRequestClusterInterface { + return &podCertificateRequestClusterClient{ + kcpgentype.NewFakeClusterClientWithList[*certificatesv1.PodCertificateRequest, *certificatesv1.PodCertificateRequestList]( + fake.Fake, + certificatesv1.SchemeGroupVersion.WithResource("podcertificaterequests"), + certificatesv1.SchemeGroupVersion.WithKind("PodCertificateRequest"), + func() *certificatesv1.PodCertificateRequest { return &certificatesv1.PodCertificateRequest{} }, + func() *certificatesv1.PodCertificateRequestList { return &certificatesv1.PodCertificateRequestList{} }, + func(dst, src *certificatesv1.PodCertificateRequestList) { dst.ListMeta = src.ListMeta }, + func(list *certificatesv1.PodCertificateRequestList) []*certificatesv1.PodCertificateRequest { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *certificatesv1.PodCertificateRequestList, items []*certificatesv1.PodCertificateRequest) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake.Fake, + } +} + +func (c *podCertificateRequestClusterClient) Cluster(cluster logicalcluster.Path) typedkcpcertificatesv1.PodCertificateRequestsNamespacer { + return &podCertificateRequestNamespacer{Fake: c.Fake, ClusterPath: cluster} +} + +type podCertificateRequestNamespacer struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (n *podCertificateRequestNamespacer) Namespace(namespace string) typedcertificatesv1.PodCertificateRequestInterface { + return newFakePodCertificateRequestClient(n.Fake, namespace, n.ClusterPath) +} + +// podCertificateRequestScopedClient implements PodCertificateRequestInterface +type podCertificateRequestScopedClient struct { + *kcpgentype.FakeClientWithListAndApply[*certificatesv1.PodCertificateRequest, *certificatesv1.PodCertificateRequestList, *v1.PodCertificateRequestApplyConfiguration] + Fake *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func newFakePodCertificateRequestClient(fake *kcptesting.Fake, namespace string, clusterPath logicalcluster.Path) typedcertificatesv1.PodCertificateRequestInterface { + return &podCertificateRequestScopedClient{ + kcpgentype.NewFakeClientWithListAndApply[*certificatesv1.PodCertificateRequest, *certificatesv1.PodCertificateRequestList, *v1.PodCertificateRequestApplyConfiguration]( + fake, + clusterPath, + namespace, + certificatesv1.SchemeGroupVersion.WithResource("podcertificaterequests"), + certificatesv1.SchemeGroupVersion.WithKind("PodCertificateRequest"), + func() *certificatesv1.PodCertificateRequest { return &certificatesv1.PodCertificateRequest{} }, + func() *certificatesv1.PodCertificateRequestList { return &certificatesv1.PodCertificateRequestList{} }, + func(dst, src *certificatesv1.PodCertificateRequestList) { dst.ListMeta = src.ListMeta }, + func(list *certificatesv1.PodCertificateRequestList) []*certificatesv1.PodCertificateRequest { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *certificatesv1.PodCertificateRequestList, items []*certificatesv1.PodCertificateRequest) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake, + clusterPath, + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/generated_expansion.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/generated_expansion.go index e9bb0954703..064517b7482 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/generated_expansion.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/generated_expansion.go @@ -19,3 +19,7 @@ limitations under the License. package v1 type CertificateSigningRequestClusterExpansion interface{} + +type ClusterTrustBundleClusterExpansion interface{} + +type PodCertificateRequestClusterExpansion interface{} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/podcertificaterequest.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/podcertificaterequest.go new file mode 100644 index 00000000000..5622c87614a --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/certificates/v1/podcertificaterequest.go @@ -0,0 +1,83 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + certificatesv1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" + typedcertificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + "github.com/kcp-dev/logicalcluster/v3" +) + +// PodCertificateRequestsClusterGetter has a method to return a PodCertificateRequestClusterInterface. +// A group's cluster client should implement this interface. +type PodCertificateRequestsClusterGetter interface { + PodCertificateRequests() PodCertificateRequestClusterInterface +} + +// PodCertificateRequestClusterInterface can operate on PodCertificateRequests across all clusters, +// or scope down to one cluster and return a PodCertificateRequestsNamespacer. +type PodCertificateRequestClusterInterface interface { + Cluster(logicalcluster.Path) PodCertificateRequestsNamespacer + List(ctx context.Context, opts metav1.ListOptions) (*certificatesv1.PodCertificateRequestList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + PodCertificateRequestClusterExpansion +} + +type podCertificateRequestsClusterInterface struct { + clientCache kcpclient.Cache[*typedcertificatesv1.CertificatesV1Client] +} + +// Cluster scopes the client down to a particular cluster. +func (c *podCertificateRequestsClusterInterface) Cluster(clusterPath logicalcluster.Path) PodCertificateRequestsNamespacer { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + + return &podCertificateRequestsNamespacer{clientCache: c.clientCache, clusterPath: clusterPath} +} + +// List returns the entire collection of all PodCertificateRequests across all clusters. +func (c *podCertificateRequestsClusterInterface) List(ctx context.Context, opts metav1.ListOptions) (*certificatesv1.PodCertificateRequestList, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).PodCertificateRequests(metav1.NamespaceAll).List(ctx, opts) +} + +// Watch begins to watch all PodCertificateRequests across all clusters. +func (c *podCertificateRequestsClusterInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).PodCertificateRequests(metav1.NamespaceAll).Watch(ctx, opts) +} + +// PodCertificateRequestsNamespacer can scope to objects within a namespace, returning a typedcertificatesv1.PodCertificateRequestInterface. +type PodCertificateRequestsNamespacer interface { + Namespace(string) typedcertificatesv1.PodCertificateRequestInterface +} + +type podCertificateRequestsNamespacer struct { + clientCache kcpclient.Cache[*typedcertificatesv1.CertificatesV1Client] + clusterPath logicalcluster.Path +} + +func (n *podCertificateRequestsNamespacer) Namespace(namespace string) typedcertificatesv1.PodCertificateRequestInterface { + return n.clientCache.ClusterOrDie(n.clusterPath).PodCertificateRequests(namespace) +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/doc.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/doc.go similarity index 97% rename from staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/doc.go rename to staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/doc.go index 6c19e1b62cf..3e873237924 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/doc.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by cluster-client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v1alpha2 +package v1alpha1 diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/eviction.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/eviction.go new file mode 100644 index 00000000000..ef0bd68797a --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/eviction.go @@ -0,0 +1,83 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" + typedlifecyclev1alpha1 "k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + "github.com/kcp-dev/logicalcluster/v3" +) + +// EvictionsClusterGetter has a method to return a EvictionClusterInterface. +// A group's cluster client should implement this interface. +type EvictionsClusterGetter interface { + Evictions() EvictionClusterInterface +} + +// EvictionClusterInterface can operate on Evictions across all clusters, +// or scope down to one cluster and return a EvictionsNamespacer. +type EvictionClusterInterface interface { + Cluster(logicalcluster.Path) EvictionsNamespacer + List(ctx context.Context, opts v1.ListOptions) (*lifecyclev1alpha1.EvictionList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + EvictionClusterExpansion +} + +type evictionsClusterInterface struct { + clientCache kcpclient.Cache[*typedlifecyclev1alpha1.LifecycleV1alpha1Client] +} + +// Cluster scopes the client down to a particular cluster. +func (c *evictionsClusterInterface) Cluster(clusterPath logicalcluster.Path) EvictionsNamespacer { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + + return &evictionsNamespacer{clientCache: c.clientCache, clusterPath: clusterPath} +} + +// List returns the entire collection of all Evictions across all clusters. +func (c *evictionsClusterInterface) List(ctx context.Context, opts v1.ListOptions) (*lifecyclev1alpha1.EvictionList, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).Evictions(v1.NamespaceAll).List(ctx, opts) +} + +// Watch begins to watch all Evictions across all clusters. +func (c *evictionsClusterInterface) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).Evictions(v1.NamespaceAll).Watch(ctx, opts) +} + +// EvictionsNamespacer can scope to objects within a namespace, returning a typedlifecyclev1alpha1.EvictionInterface. +type EvictionsNamespacer interface { + Namespace(string) typedlifecyclev1alpha1.EvictionInterface +} + +type evictionsNamespacer struct { + clientCache kcpclient.Cache[*typedlifecyclev1alpha1.LifecycleV1alpha1Client] + clusterPath logicalcluster.Path +} + +func (n *evictionsNamespacer) Namespace(namespace string) typedlifecyclev1alpha1.EvictionInterface { + return n.clientCache.ClusterOrDie(n.clusterPath).Evictions(namespace) +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/evictionrequest.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/evictionrequest.go new file mode 100644 index 00000000000..08bbc7ba13f --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/evictionrequest.go @@ -0,0 +1,83 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" + typedlifecyclev1alpha1 "k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + "github.com/kcp-dev/logicalcluster/v3" +) + +// EvictionRequestsClusterGetter has a method to return a EvictionRequestClusterInterface. +// A group's cluster client should implement this interface. +type EvictionRequestsClusterGetter interface { + EvictionRequests() EvictionRequestClusterInterface +} + +// EvictionRequestClusterInterface can operate on EvictionRequests across all clusters, +// or scope down to one cluster and return a EvictionRequestsNamespacer. +type EvictionRequestClusterInterface interface { + Cluster(logicalcluster.Path) EvictionRequestsNamespacer + List(ctx context.Context, opts v1.ListOptions) (*lifecyclev1alpha1.EvictionRequestList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + EvictionRequestClusterExpansion +} + +type evictionRequestsClusterInterface struct { + clientCache kcpclient.Cache[*typedlifecyclev1alpha1.LifecycleV1alpha1Client] +} + +// Cluster scopes the client down to a particular cluster. +func (c *evictionRequestsClusterInterface) Cluster(clusterPath logicalcluster.Path) EvictionRequestsNamespacer { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + + return &evictionRequestsNamespacer{clientCache: c.clientCache, clusterPath: clusterPath} +} + +// List returns the entire collection of all EvictionRequests across all clusters. +func (c *evictionRequestsClusterInterface) List(ctx context.Context, opts v1.ListOptions) (*lifecyclev1alpha1.EvictionRequestList, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).EvictionRequests(v1.NamespaceAll).List(ctx, opts) +} + +// Watch begins to watch all EvictionRequests across all clusters. +func (c *evictionRequestsClusterInterface) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).EvictionRequests(v1.NamespaceAll).Watch(ctx, opts) +} + +// EvictionRequestsNamespacer can scope to objects within a namespace, returning a typedlifecyclev1alpha1.EvictionRequestInterface. +type EvictionRequestsNamespacer interface { + Namespace(string) typedlifecyclev1alpha1.EvictionRequestInterface +} + +type evictionRequestsNamespacer struct { + clientCache kcpclient.Cache[*typedlifecyclev1alpha1.LifecycleV1alpha1Client] + clusterPath logicalcluster.Path +} + +func (n *evictionRequestsNamespacer) Namespace(namespace string) typedlifecyclev1alpha1.EvictionRequestInterface { + return n.clientCache.ClusterOrDie(n.clusterPath).EvictionRequests(namespace) +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/fake/doc.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/doc.go similarity index 100% rename from staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/fake/doc.go rename to staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/doc.go diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/eviction.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/eviction.go new file mode 100644 index 00000000000..4422dff600c --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/eviction.go @@ -0,0 +1,99 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + v1alpha1 "k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1" + typedlifecyclev1alpha1 "k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1" + + typedkcplifecyclev1alpha1 "github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1" + kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +// evictionClusterClient implements EvictionClusterInterface +type evictionClusterClient struct { + *kcpgentype.FakeClusterClientWithList[*lifecyclev1alpha1.Eviction, *lifecyclev1alpha1.EvictionList] + Fake *kcptesting.Fake +} + +func newFakeEvictionClusterClient(fake *LifecycleV1alpha1ClusterClient) typedkcplifecyclev1alpha1.EvictionClusterInterface { + return &evictionClusterClient{ + kcpgentype.NewFakeClusterClientWithList[*lifecyclev1alpha1.Eviction, *lifecyclev1alpha1.EvictionList]( + fake.Fake, + lifecyclev1alpha1.SchemeGroupVersion.WithResource("evictions"), + lifecyclev1alpha1.SchemeGroupVersion.WithKind("Eviction"), + func() *lifecyclev1alpha1.Eviction { return &lifecyclev1alpha1.Eviction{} }, + func() *lifecyclev1alpha1.EvictionList { return &lifecyclev1alpha1.EvictionList{} }, + func(dst, src *lifecyclev1alpha1.EvictionList) { dst.ListMeta = src.ListMeta }, + func(list *lifecyclev1alpha1.EvictionList) []*lifecyclev1alpha1.Eviction { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *lifecyclev1alpha1.EvictionList, items []*lifecyclev1alpha1.Eviction) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake.Fake, + } +} + +func (c *evictionClusterClient) Cluster(cluster logicalcluster.Path) typedkcplifecyclev1alpha1.EvictionsNamespacer { + return &evictionNamespacer{Fake: c.Fake, ClusterPath: cluster} +} + +type evictionNamespacer struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (n *evictionNamespacer) Namespace(namespace string) typedlifecyclev1alpha1.EvictionInterface { + return newFakeEvictionClient(n.Fake, namespace, n.ClusterPath) +} + +// evictionScopedClient implements EvictionInterface +type evictionScopedClient struct { + *kcpgentype.FakeClientWithListAndApply[*lifecyclev1alpha1.Eviction, *lifecyclev1alpha1.EvictionList, *v1alpha1.EvictionApplyConfiguration] + Fake *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func newFakeEvictionClient(fake *kcptesting.Fake, namespace string, clusterPath logicalcluster.Path) typedlifecyclev1alpha1.EvictionInterface { + return &evictionScopedClient{ + kcpgentype.NewFakeClientWithListAndApply[*lifecyclev1alpha1.Eviction, *lifecyclev1alpha1.EvictionList, *v1alpha1.EvictionApplyConfiguration]( + fake, + clusterPath, + namespace, + lifecyclev1alpha1.SchemeGroupVersion.WithResource("evictions"), + lifecyclev1alpha1.SchemeGroupVersion.WithKind("Eviction"), + func() *lifecyclev1alpha1.Eviction { return &lifecyclev1alpha1.Eviction{} }, + func() *lifecyclev1alpha1.EvictionList { return &lifecyclev1alpha1.EvictionList{} }, + func(dst, src *lifecyclev1alpha1.EvictionList) { dst.ListMeta = src.ListMeta }, + func(list *lifecyclev1alpha1.EvictionList) []*lifecyclev1alpha1.Eviction { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *lifecyclev1alpha1.EvictionList, items []*lifecyclev1alpha1.Eviction) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake, + clusterPath, + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/evictionrequest.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/evictionrequest.go new file mode 100644 index 00000000000..7c6fff50c63 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/evictionrequest.go @@ -0,0 +1,99 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + v1alpha1 "k8s.io/client-go/applyconfigurations/lifecycle/v1alpha1" + typedlifecyclev1alpha1 "k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1" + + typedkcplifecyclev1alpha1 "github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1" + kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +// evictionRequestClusterClient implements EvictionRequestClusterInterface +type evictionRequestClusterClient struct { + *kcpgentype.FakeClusterClientWithList[*lifecyclev1alpha1.EvictionRequest, *lifecyclev1alpha1.EvictionRequestList] + Fake *kcptesting.Fake +} + +func newFakeEvictionRequestClusterClient(fake *LifecycleV1alpha1ClusterClient) typedkcplifecyclev1alpha1.EvictionRequestClusterInterface { + return &evictionRequestClusterClient{ + kcpgentype.NewFakeClusterClientWithList[*lifecyclev1alpha1.EvictionRequest, *lifecyclev1alpha1.EvictionRequestList]( + fake.Fake, + lifecyclev1alpha1.SchemeGroupVersion.WithResource("evictionrequests"), + lifecyclev1alpha1.SchemeGroupVersion.WithKind("EvictionRequest"), + func() *lifecyclev1alpha1.EvictionRequest { return &lifecyclev1alpha1.EvictionRequest{} }, + func() *lifecyclev1alpha1.EvictionRequestList { return &lifecyclev1alpha1.EvictionRequestList{} }, + func(dst, src *lifecyclev1alpha1.EvictionRequestList) { dst.ListMeta = src.ListMeta }, + func(list *lifecyclev1alpha1.EvictionRequestList) []*lifecyclev1alpha1.EvictionRequest { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *lifecyclev1alpha1.EvictionRequestList, items []*lifecyclev1alpha1.EvictionRequest) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake.Fake, + } +} + +func (c *evictionRequestClusterClient) Cluster(cluster logicalcluster.Path) typedkcplifecyclev1alpha1.EvictionRequestsNamespacer { + return &evictionRequestNamespacer{Fake: c.Fake, ClusterPath: cluster} +} + +type evictionRequestNamespacer struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (n *evictionRequestNamespacer) Namespace(namespace string) typedlifecyclev1alpha1.EvictionRequestInterface { + return newFakeEvictionRequestClient(n.Fake, namespace, n.ClusterPath) +} + +// evictionRequestScopedClient implements EvictionRequestInterface +type evictionRequestScopedClient struct { + *kcpgentype.FakeClientWithListAndApply[*lifecyclev1alpha1.EvictionRequest, *lifecyclev1alpha1.EvictionRequestList, *v1alpha1.EvictionRequestApplyConfiguration] + Fake *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func newFakeEvictionRequestClient(fake *kcptesting.Fake, namespace string, clusterPath logicalcluster.Path) typedlifecyclev1alpha1.EvictionRequestInterface { + return &evictionRequestScopedClient{ + kcpgentype.NewFakeClientWithListAndApply[*lifecyclev1alpha1.EvictionRequest, *lifecyclev1alpha1.EvictionRequestList, *v1alpha1.EvictionRequestApplyConfiguration]( + fake, + clusterPath, + namespace, + lifecyclev1alpha1.SchemeGroupVersion.WithResource("evictionrequests"), + lifecyclev1alpha1.SchemeGroupVersion.WithKind("EvictionRequest"), + func() *lifecyclev1alpha1.EvictionRequest { return &lifecyclev1alpha1.EvictionRequest{} }, + func() *lifecyclev1alpha1.EvictionRequestList { return &lifecyclev1alpha1.EvictionRequestList{} }, + func(dst, src *lifecyclev1alpha1.EvictionRequestList) { dst.ListMeta = src.ListMeta }, + func(list *lifecyclev1alpha1.EvictionRequestList) []*lifecyclev1alpha1.EvictionRequest { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *lifecyclev1alpha1.EvictionRequestList, items []*lifecyclev1alpha1.EvictionRequest) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake, + clusterPath, + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/lifecycle_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/lifecycle_client.go new file mode 100644 index 00000000000..e9dd96c8b8a --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/fake/lifecycle_client.go @@ -0,0 +1,69 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + lifecyclev1alpha1 "k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1" + rest "k8s.io/client-go/rest" + + kcplifecyclev1alpha1 "github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +var _ kcplifecyclev1alpha1.LifecycleV1alpha1ClusterInterface = (*LifecycleV1alpha1ClusterClient)(nil) + +type LifecycleV1alpha1ClusterClient struct { + *kcptesting.Fake +} + +func (c *LifecycleV1alpha1ClusterClient) Cluster(clusterPath logicalcluster.Path) lifecyclev1alpha1.LifecycleV1alpha1Interface { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + return &LifecycleV1alpha1Client{Fake: c.Fake, ClusterPath: clusterPath} +} + +func (c *LifecycleV1alpha1ClusterClient) Evictions() kcplifecyclev1alpha1.EvictionClusterInterface { + return newFakeEvictionClusterClient(c) +} + +func (c *LifecycleV1alpha1ClusterClient) EvictionRequests() kcplifecyclev1alpha1.EvictionRequestClusterInterface { + return newFakeEvictionRequestClusterClient(c) +} + +type LifecycleV1alpha1Client struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (c *LifecycleV1alpha1Client) Evictions(namespace string) lifecyclev1alpha1.EvictionInterface { + return newFakeEvictionClient(c.Fake, namespace, c.ClusterPath) +} + +func (c *LifecycleV1alpha1Client) EvictionRequests(namespace string) lifecyclev1alpha1.EvictionRequestInterface { + return newFakeEvictionRequestClient(c.Fake, namespace, c.ClusterPath) +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *LifecycleV1alpha1Client) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/generated_expansion.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/generated_expansion.go new file mode 100644 index 00000000000..3748fac2f27 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/generated_expansion.go @@ -0,0 +1,23 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1alpha1 + +type EvictionClusterExpansion interface{} + +type EvictionRequestClusterExpansion interface{} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/lifecycle_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/lifecycle_client.go new file mode 100644 index 00000000000..05e3dcd0734 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/lifecycle/v1alpha1/lifecycle_client.go @@ -0,0 +1,108 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + http "net/http" + + apilifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + lifecyclev1alpha1 "k8s.io/client-go/kubernetes/typed/lifecycle/v1alpha1" + rest "k8s.io/client-go/rest" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + kcpscheme "github.com/kcp-dev/client-go/kubernetes/scheme" + "github.com/kcp-dev/logicalcluster/v3" +) + +type LifecycleV1alpha1ClusterInterface interface { + LifecycleV1alpha1ClusterScoper + EvictionsClusterGetter + EvictionRequestsClusterGetter +} + +type LifecycleV1alpha1ClusterScoper interface { + Cluster(logicalcluster.Path) lifecyclev1alpha1.LifecycleV1alpha1Interface +} + +// LifecycleV1alpha1ClusterClient is used to interact with features provided by the lifecycle.k8s.io group. +type LifecycleV1alpha1ClusterClient struct { + clientCache kcpclient.Cache[*lifecyclev1alpha1.LifecycleV1alpha1Client] +} + +func (c *LifecycleV1alpha1ClusterClient) Cluster(clusterPath logicalcluster.Path) lifecyclev1alpha1.LifecycleV1alpha1Interface { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + return c.clientCache.ClusterOrDie(clusterPath) +} + +func (c *LifecycleV1alpha1ClusterClient) Evictions() EvictionClusterInterface { + return &evictionsClusterInterface{clientCache: c.clientCache} +} + +func (c *LifecycleV1alpha1ClusterClient) EvictionRequests() EvictionRequestClusterInterface { + return &evictionRequestsClusterInterface{clientCache: c.clientCache} +} + +// NewForConfig creates a new LifecycleV1alpha1ClusterClient for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*LifecycleV1alpha1ClusterClient, error) { + config := *c + setConfigDefaults(&config) + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new LifecycleV1alpha1ClusterClient 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) (*LifecycleV1alpha1ClusterClient, error) { + cache := kcpclient.NewCache(c, h, &kcpclient.Constructor[*lifecyclev1alpha1.LifecycleV1alpha1Client]{ + NewForConfigAndClient: lifecyclev1alpha1.NewForConfigAndClient, + }) + if _, err := cache.Cluster(logicalcluster.Name("root").Path()); err != nil { + return nil, err + } + + return &LifecycleV1alpha1ClusterClient{clientCache: cache}, nil +} + +// NewForConfigOrDie creates a new LifecycleV1alpha1ClusterClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *LifecycleV1alpha1ClusterClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +func setConfigDefaults(config *rest.Config) { + gv := apilifecyclev1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(kcpscheme.Scheme, kcpscheme.Codecs).WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/devicetaintrule.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/devicetaintrule.go new file mode 100644 index 00000000000..b9a0d6086c7 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/devicetaintrule.go @@ -0,0 +1,69 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + apiresourcev1 "k8s.io/api/resource/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" + resourcev1 "k8s.io/client-go/kubernetes/typed/resource/v1" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + "github.com/kcp-dev/logicalcluster/v3" +) + +// DeviceTaintRulesClusterGetter has a method to return a DeviceTaintRuleClusterInterface. +// A group's cluster client should implement this interface. +type DeviceTaintRulesClusterGetter interface { + DeviceTaintRules() DeviceTaintRuleClusterInterface +} + +// DeviceTaintRuleClusterInterface can operate on DeviceTaintRules across all clusters, +// or scope down to one cluster and return a resourcev1.DeviceTaintRuleInterface. +type DeviceTaintRuleClusterInterface interface { + Cluster(logicalcluster.Path) resourcev1.DeviceTaintRuleInterface + List(ctx context.Context, opts metav1.ListOptions) (*apiresourcev1.DeviceTaintRuleList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + DeviceTaintRuleClusterExpansion +} + +type deviceTaintRulesClusterInterface struct { + clientCache kcpclient.Cache[*resourcev1.ResourceV1Client] +} + +// Cluster scopes the client down to a particular cluster. +func (c *deviceTaintRulesClusterInterface) Cluster(clusterPath logicalcluster.Path) resourcev1.DeviceTaintRuleInterface { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + + return c.clientCache.ClusterOrDie(clusterPath).DeviceTaintRules() +} + +// List returns the entire collection of all DeviceTaintRules across all clusters. +func (c *deviceTaintRulesClusterInterface) List(ctx context.Context, opts metav1.ListOptions) (*apiresourcev1.DeviceTaintRuleList, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).DeviceTaintRules().List(ctx, opts) +} + +// Watch begins to watch all DeviceTaintRules across all clusters. +func (c *deviceTaintRulesClusterInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).DeviceTaintRules().Watch(ctx, opts) +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/fake/devicetaintrule.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/fake/devicetaintrule.go new file mode 100644 index 00000000000..bcc77b4335d --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/fake/devicetaintrule.go @@ -0,0 +1,90 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + resourcev1 "k8s.io/api/resource/v1" + v1 "k8s.io/client-go/applyconfigurations/resource/v1" + typedresourcev1 "k8s.io/client-go/kubernetes/typed/resource/v1" + + typedkcpresourcev1 "github.com/kcp-dev/client-go/kubernetes/typed/resource/v1" + kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +// deviceTaintRuleClusterClient implements DeviceTaintRuleClusterInterface +type deviceTaintRuleClusterClient struct { + *kcpgentype.FakeClusterClientWithList[*resourcev1.DeviceTaintRule, *resourcev1.DeviceTaintRuleList] + Fake *kcptesting.Fake +} + +func newFakeDeviceTaintRuleClusterClient(fake *ResourceV1ClusterClient) typedkcpresourcev1.DeviceTaintRuleClusterInterface { + return &deviceTaintRuleClusterClient{ + kcpgentype.NewFakeClusterClientWithList[*resourcev1.DeviceTaintRule, *resourcev1.DeviceTaintRuleList]( + fake.Fake, + resourcev1.SchemeGroupVersion.WithResource("devicetaintrules"), + resourcev1.SchemeGroupVersion.WithKind("DeviceTaintRule"), + func() *resourcev1.DeviceTaintRule { return &resourcev1.DeviceTaintRule{} }, + func() *resourcev1.DeviceTaintRuleList { return &resourcev1.DeviceTaintRuleList{} }, + func(dst, src *resourcev1.DeviceTaintRuleList) { dst.ListMeta = src.ListMeta }, + func(list *resourcev1.DeviceTaintRuleList) []*resourcev1.DeviceTaintRule { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *resourcev1.DeviceTaintRuleList, items []*resourcev1.DeviceTaintRule) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake.Fake, + } +} + +func (c *deviceTaintRuleClusterClient) Cluster(cluster logicalcluster.Path) typedresourcev1.DeviceTaintRuleInterface { + return newFakeDeviceTaintRuleClient(c.Fake, cluster) +} + +// deviceTaintRuleScopedClient implements DeviceTaintRuleInterface +type deviceTaintRuleScopedClient struct { + *kcpgentype.FakeClientWithListAndApply[*resourcev1.DeviceTaintRule, *resourcev1.DeviceTaintRuleList, *v1.DeviceTaintRuleApplyConfiguration] + Fake *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func newFakeDeviceTaintRuleClient(fake *kcptesting.Fake, clusterPath logicalcluster.Path) typedresourcev1.DeviceTaintRuleInterface { + return &deviceTaintRuleScopedClient{ + kcpgentype.NewFakeClientWithListAndApply[*resourcev1.DeviceTaintRule, *resourcev1.DeviceTaintRuleList, *v1.DeviceTaintRuleApplyConfiguration]( + fake, + clusterPath, + "", + resourcev1.SchemeGroupVersion.WithResource("devicetaintrules"), + resourcev1.SchemeGroupVersion.WithKind("DeviceTaintRule"), + func() *resourcev1.DeviceTaintRule { return &resourcev1.DeviceTaintRule{} }, + func() *resourcev1.DeviceTaintRuleList { return &resourcev1.DeviceTaintRuleList{} }, + func(dst, src *resourcev1.DeviceTaintRuleList) { dst.ListMeta = src.ListMeta }, + func(list *resourcev1.DeviceTaintRuleList) []*resourcev1.DeviceTaintRule { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *resourcev1.DeviceTaintRuleList, items []*resourcev1.DeviceTaintRule) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake, + clusterPath, + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/fake/resource_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/fake/resource_client.go index c0616d7b0ae..33c2345746a 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/fake/resource_client.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/fake/resource_client.go @@ -44,6 +44,10 @@ func (c *ResourceV1ClusterClient) DeviceClasses() kcpresourcev1.DeviceClassClust return newFakeDeviceClassClusterClient(c) } +func (c *ResourceV1ClusterClient) DeviceTaintRules() kcpresourcev1.DeviceTaintRuleClusterInterface { + return newFakeDeviceTaintRuleClusterClient(c) +} + func (c *ResourceV1ClusterClient) ResourceClaims() kcpresourcev1.ResourceClaimClusterInterface { return newFakeResourceClaimClusterClient(c) } @@ -65,6 +69,10 @@ func (c *ResourceV1Client) DeviceClasses() resourcev1.DeviceClassInterface { return newFakeDeviceClassClient(c.Fake, c.ClusterPath) } +func (c *ResourceV1Client) DeviceTaintRules() resourcev1.DeviceTaintRuleInterface { + return newFakeDeviceTaintRuleClient(c.Fake, c.ClusterPath) +} + func (c *ResourceV1Client) ResourceClaims(namespace string) resourcev1.ResourceClaimInterface { return newFakeResourceClaimClient(c.Fake, namespace, c.ClusterPath) } diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/generated_expansion.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/generated_expansion.go index 27b95ef109c..d222a57ad2a 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/generated_expansion.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/generated_expansion.go @@ -20,6 +20,8 @@ package v1 type DeviceClassClusterExpansion interface{} +type DeviceTaintRuleClusterExpansion interface{} + type ResourceClaimClusterExpansion interface{} type ResourceClaimTemplateClusterExpansion interface{} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/resource_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/resource_client.go index 2f92cb7da5f..765213f3ea1 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/resource_client.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/resource/v1/resource_client.go @@ -33,6 +33,7 @@ import ( type ResourceV1ClusterInterface interface { ResourceV1ClusterScoper DeviceClassesClusterGetter + DeviceTaintRulesClusterGetter ResourceClaimsClusterGetter ResourceClaimTemplatesClusterGetter ResourceSlicesClusterGetter @@ -58,6 +59,10 @@ func (c *ResourceV1ClusterClient) DeviceClasses() DeviceClassClusterInterface { return &deviceClassesClusterInterface{clientCache: c.clientCache} } +func (c *ResourceV1ClusterClient) DeviceTaintRules() DeviceTaintRuleClusterInterface { + return &deviceTaintRulesClusterInterface{clientCache: c.clientCache} +} + func (c *ResourceV1ClusterClient) ResourceClaims() ResourceClaimClusterInterface { return &resourceClaimsClusterInterface{clientCache: c.clientCache} } diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/fake/podgroup.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/fake/podgroup.go deleted file mode 100644 index 4a2b0802541..00000000000 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/fake/podgroup.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright The kcp Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 cluster-client-gen. DO NOT EDIT. - -package fake - -import ( - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" - v1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2" - typedschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" - - typedkcpschedulingv1alpha2 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2" - kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" - kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" - "github.com/kcp-dev/logicalcluster/v3" -) - -// podGroupClusterClient implements PodGroupClusterInterface -type podGroupClusterClient struct { - *kcpgentype.FakeClusterClientWithList[*schedulingv1alpha2.PodGroup, *schedulingv1alpha2.PodGroupList] - Fake *kcptesting.Fake -} - -func newFakePodGroupClusterClient(fake *SchedulingV1alpha2ClusterClient) typedkcpschedulingv1alpha2.PodGroupClusterInterface { - return &podGroupClusterClient{ - kcpgentype.NewFakeClusterClientWithList[*schedulingv1alpha2.PodGroup, *schedulingv1alpha2.PodGroupList]( - fake.Fake, - schedulingv1alpha2.SchemeGroupVersion.WithResource("podgroups"), - schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroup"), - func() *schedulingv1alpha2.PodGroup { return &schedulingv1alpha2.PodGroup{} }, - func() *schedulingv1alpha2.PodGroupList { return &schedulingv1alpha2.PodGroupList{} }, - func(dst, src *schedulingv1alpha2.PodGroupList) { dst.ListMeta = src.ListMeta }, - func(list *schedulingv1alpha2.PodGroupList) []*schedulingv1alpha2.PodGroup { - return kcpgentype.ToPointerSlice(list.Items) - }, - func(list *schedulingv1alpha2.PodGroupList, items []*schedulingv1alpha2.PodGroup) { - list.Items = kcpgentype.FromPointerSlice(items) - }, - ), - fake.Fake, - } -} - -func (c *podGroupClusterClient) Cluster(cluster logicalcluster.Path) typedkcpschedulingv1alpha2.PodGroupsNamespacer { - return &podGroupNamespacer{Fake: c.Fake, ClusterPath: cluster} -} - -type podGroupNamespacer struct { - *kcptesting.Fake - ClusterPath logicalcluster.Path -} - -func (n *podGroupNamespacer) Namespace(namespace string) typedschedulingv1alpha2.PodGroupInterface { - return newFakePodGroupClient(n.Fake, namespace, n.ClusterPath) -} - -// podGroupScopedClient implements PodGroupInterface -type podGroupScopedClient struct { - *kcpgentype.FakeClientWithListAndApply[*schedulingv1alpha2.PodGroup, *schedulingv1alpha2.PodGroupList, *v1alpha2.PodGroupApplyConfiguration] - Fake *kcptesting.Fake - ClusterPath logicalcluster.Path -} - -func newFakePodGroupClient(fake *kcptesting.Fake, namespace string, clusterPath logicalcluster.Path) typedschedulingv1alpha2.PodGroupInterface { - return &podGroupScopedClient{ - kcpgentype.NewFakeClientWithListAndApply[*schedulingv1alpha2.PodGroup, *schedulingv1alpha2.PodGroupList, *v1alpha2.PodGroupApplyConfiguration]( - fake, - clusterPath, - namespace, - schedulingv1alpha2.SchemeGroupVersion.WithResource("podgroups"), - schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroup"), - func() *schedulingv1alpha2.PodGroup { return &schedulingv1alpha2.PodGroup{} }, - func() *schedulingv1alpha2.PodGroupList { return &schedulingv1alpha2.PodGroupList{} }, - func(dst, src *schedulingv1alpha2.PodGroupList) { dst.ListMeta = src.ListMeta }, - func(list *schedulingv1alpha2.PodGroupList) []*schedulingv1alpha2.PodGroup { - return kcpgentype.ToPointerSlice(list.Items) - }, - func(list *schedulingv1alpha2.PodGroupList, items []*schedulingv1alpha2.PodGroup) { - list.Items = kcpgentype.FromPointerSlice(items) - }, - ), - fake, - clusterPath, - } -} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/fake/scheduling_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/fake/scheduling_client.go deleted file mode 100644 index 65ee93e7001..00000000000 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/fake/scheduling_client.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright The kcp Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 cluster-client-gen. DO NOT EDIT. - -package fake - -import ( - schedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" - rest "k8s.io/client-go/rest" - - kcpschedulingv1alpha2 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2" - kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" - "github.com/kcp-dev/logicalcluster/v3" -) - -var _ kcpschedulingv1alpha2.SchedulingV1alpha2ClusterInterface = (*SchedulingV1alpha2ClusterClient)(nil) - -type SchedulingV1alpha2ClusterClient struct { - *kcptesting.Fake -} - -func (c *SchedulingV1alpha2ClusterClient) Cluster(clusterPath logicalcluster.Path) schedulingv1alpha2.SchedulingV1alpha2Interface { - if clusterPath == logicalcluster.Wildcard { - panic("A specific cluster must be provided when scoping, not the wildcard.") - } - return &SchedulingV1alpha2Client{Fake: c.Fake, ClusterPath: clusterPath} -} - -func (c *SchedulingV1alpha2ClusterClient) PodGroups() kcpschedulingv1alpha2.PodGroupClusterInterface { - return newFakePodGroupClusterClient(c) -} - -func (c *SchedulingV1alpha2ClusterClient) Workloads() kcpschedulingv1alpha2.WorkloadClusterInterface { - return newFakeWorkloadClusterClient(c) -} - -type SchedulingV1alpha2Client struct { - *kcptesting.Fake - ClusterPath logicalcluster.Path -} - -func (c *SchedulingV1alpha2Client) PodGroups(namespace string) schedulingv1alpha2.PodGroupInterface { - return newFakePodGroupClient(c.Fake, namespace, c.ClusterPath) -} - -func (c *SchedulingV1alpha2Client) Workloads(namespace string) schedulingv1alpha2.WorkloadInterface { - return newFakeWorkloadClient(c.Fake, namespace, c.ClusterPath) -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *SchedulingV1alpha2Client) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/fake/workload.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/fake/workload.go deleted file mode 100644 index 4f270fbe301..00000000000 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/fake/workload.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright The kcp Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 cluster-client-gen. DO NOT EDIT. - -package fake - -import ( - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" - v1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2" - typedschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" - - typedkcpschedulingv1alpha2 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2" - kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" - kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" - "github.com/kcp-dev/logicalcluster/v3" -) - -// workloadClusterClient implements WorkloadClusterInterface -type workloadClusterClient struct { - *kcpgentype.FakeClusterClientWithList[*schedulingv1alpha2.Workload, *schedulingv1alpha2.WorkloadList] - Fake *kcptesting.Fake -} - -func newFakeWorkloadClusterClient(fake *SchedulingV1alpha2ClusterClient) typedkcpschedulingv1alpha2.WorkloadClusterInterface { - return &workloadClusterClient{ - kcpgentype.NewFakeClusterClientWithList[*schedulingv1alpha2.Workload, *schedulingv1alpha2.WorkloadList]( - fake.Fake, - schedulingv1alpha2.SchemeGroupVersion.WithResource("workloads"), - schedulingv1alpha2.SchemeGroupVersion.WithKind("Workload"), - func() *schedulingv1alpha2.Workload { return &schedulingv1alpha2.Workload{} }, - func() *schedulingv1alpha2.WorkloadList { return &schedulingv1alpha2.WorkloadList{} }, - func(dst, src *schedulingv1alpha2.WorkloadList) { dst.ListMeta = src.ListMeta }, - func(list *schedulingv1alpha2.WorkloadList) []*schedulingv1alpha2.Workload { - return kcpgentype.ToPointerSlice(list.Items) - }, - func(list *schedulingv1alpha2.WorkloadList, items []*schedulingv1alpha2.Workload) { - list.Items = kcpgentype.FromPointerSlice(items) - }, - ), - fake.Fake, - } -} - -func (c *workloadClusterClient) Cluster(cluster logicalcluster.Path) typedkcpschedulingv1alpha2.WorkloadsNamespacer { - return &workloadNamespacer{Fake: c.Fake, ClusterPath: cluster} -} - -type workloadNamespacer struct { - *kcptesting.Fake - ClusterPath logicalcluster.Path -} - -func (n *workloadNamespacer) Namespace(namespace string) typedschedulingv1alpha2.WorkloadInterface { - return newFakeWorkloadClient(n.Fake, namespace, n.ClusterPath) -} - -// workloadScopedClient implements WorkloadInterface -type workloadScopedClient struct { - *kcpgentype.FakeClientWithListAndApply[*schedulingv1alpha2.Workload, *schedulingv1alpha2.WorkloadList, *v1alpha2.WorkloadApplyConfiguration] - Fake *kcptesting.Fake - ClusterPath logicalcluster.Path -} - -func newFakeWorkloadClient(fake *kcptesting.Fake, namespace string, clusterPath logicalcluster.Path) typedschedulingv1alpha2.WorkloadInterface { - return &workloadScopedClient{ - kcpgentype.NewFakeClientWithListAndApply[*schedulingv1alpha2.Workload, *schedulingv1alpha2.WorkloadList, *v1alpha2.WorkloadApplyConfiguration]( - fake, - clusterPath, - namespace, - schedulingv1alpha2.SchemeGroupVersion.WithResource("workloads"), - schedulingv1alpha2.SchemeGroupVersion.WithKind("Workload"), - func() *schedulingv1alpha2.Workload { return &schedulingv1alpha2.Workload{} }, - func() *schedulingv1alpha2.WorkloadList { return &schedulingv1alpha2.WorkloadList{} }, - func(dst, src *schedulingv1alpha2.WorkloadList) { dst.ListMeta = src.ListMeta }, - func(list *schedulingv1alpha2.WorkloadList) []*schedulingv1alpha2.Workload { - return kcpgentype.ToPointerSlice(list.Items) - }, - func(list *schedulingv1alpha2.WorkloadList, items []*schedulingv1alpha2.Workload) { - list.Items = kcpgentype.FromPointerSlice(items) - }, - ), - fake, - clusterPath, - } -} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/compositepodgroup.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/compositepodgroup.go new file mode 100644 index 00000000000..463f44a1338 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/compositepodgroup.go @@ -0,0 +1,83 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + context "context" + + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" + typedschedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + "github.com/kcp-dev/logicalcluster/v3" +) + +// CompositePodGroupsClusterGetter has a method to return a CompositePodGroupClusterInterface. +// A group's cluster client should implement this interface. +type CompositePodGroupsClusterGetter interface { + CompositePodGroups() CompositePodGroupClusterInterface +} + +// CompositePodGroupClusterInterface can operate on CompositePodGroups across all clusters, +// or scope down to one cluster and return a CompositePodGroupsNamespacer. +type CompositePodGroupClusterInterface interface { + Cluster(logicalcluster.Path) CompositePodGroupsNamespacer + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha3.CompositePodGroupList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + CompositePodGroupClusterExpansion +} + +type compositePodGroupsClusterInterface struct { + clientCache kcpclient.Cache[*typedschedulingv1alpha3.SchedulingV1alpha3Client] +} + +// Cluster scopes the client down to a particular cluster. +func (c *compositePodGroupsClusterInterface) Cluster(clusterPath logicalcluster.Path) CompositePodGroupsNamespacer { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + + return &compositePodGroupsNamespacer{clientCache: c.clientCache, clusterPath: clusterPath} +} + +// List returns the entire collection of all CompositePodGroups across all clusters. +func (c *compositePodGroupsClusterInterface) List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha3.CompositePodGroupList, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).CompositePodGroups(v1.NamespaceAll).List(ctx, opts) +} + +// Watch begins to watch all CompositePodGroups across all clusters. +func (c *compositePodGroupsClusterInterface) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).CompositePodGroups(v1.NamespaceAll).Watch(ctx, opts) +} + +// CompositePodGroupsNamespacer can scope to objects within a namespace, returning a typedschedulingv1alpha3.CompositePodGroupInterface. +type CompositePodGroupsNamespacer interface { + Namespace(string) typedschedulingv1alpha3.CompositePodGroupInterface +} + +type compositePodGroupsNamespacer struct { + clientCache kcpclient.Cache[*typedschedulingv1alpha3.SchedulingV1alpha3Client] + clusterPath logicalcluster.Path +} + +func (n *compositePodGroupsNamespacer) Namespace(namespace string) typedschedulingv1alpha3.CompositePodGroupInterface { + return n.clientCache.ClusterOrDie(n.clusterPath).CompositePodGroups(namespace) +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/doc.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/doc.go new file mode 100644 index 00000000000..58e0c701a92 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha3 diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/compositepodgroup.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/compositepodgroup.go new file mode 100644 index 00000000000..74f47869f6b --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/compositepodgroup.go @@ -0,0 +1,99 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + v1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" + typedschedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" + + typedkcpschedulingv1alpha3 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3" + kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +// compositePodGroupClusterClient implements CompositePodGroupClusterInterface +type compositePodGroupClusterClient struct { + *kcpgentype.FakeClusterClientWithList[*schedulingv1alpha3.CompositePodGroup, *schedulingv1alpha3.CompositePodGroupList] + Fake *kcptesting.Fake +} + +func newFakeCompositePodGroupClusterClient(fake *SchedulingV1alpha3ClusterClient) typedkcpschedulingv1alpha3.CompositePodGroupClusterInterface { + return &compositePodGroupClusterClient{ + kcpgentype.NewFakeClusterClientWithList[*schedulingv1alpha3.CompositePodGroup, *schedulingv1alpha3.CompositePodGroupList]( + fake.Fake, + schedulingv1alpha3.SchemeGroupVersion.WithResource("compositepodgroups"), + schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroup"), + func() *schedulingv1alpha3.CompositePodGroup { return &schedulingv1alpha3.CompositePodGroup{} }, + func() *schedulingv1alpha3.CompositePodGroupList { return &schedulingv1alpha3.CompositePodGroupList{} }, + func(dst, src *schedulingv1alpha3.CompositePodGroupList) { dst.ListMeta = src.ListMeta }, + func(list *schedulingv1alpha3.CompositePodGroupList) []*schedulingv1alpha3.CompositePodGroup { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *schedulingv1alpha3.CompositePodGroupList, items []*schedulingv1alpha3.CompositePodGroup) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake.Fake, + } +} + +func (c *compositePodGroupClusterClient) Cluster(cluster logicalcluster.Path) typedkcpschedulingv1alpha3.CompositePodGroupsNamespacer { + return &compositePodGroupNamespacer{Fake: c.Fake, ClusterPath: cluster} +} + +type compositePodGroupNamespacer struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (n *compositePodGroupNamespacer) Namespace(namespace string) typedschedulingv1alpha3.CompositePodGroupInterface { + return newFakeCompositePodGroupClient(n.Fake, namespace, n.ClusterPath) +} + +// compositePodGroupScopedClient implements CompositePodGroupInterface +type compositePodGroupScopedClient struct { + *kcpgentype.FakeClientWithListAndApply[*schedulingv1alpha3.CompositePodGroup, *schedulingv1alpha3.CompositePodGroupList, *v1alpha3.CompositePodGroupApplyConfiguration] + Fake *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func newFakeCompositePodGroupClient(fake *kcptesting.Fake, namespace string, clusterPath logicalcluster.Path) typedschedulingv1alpha3.CompositePodGroupInterface { + return &compositePodGroupScopedClient{ + kcpgentype.NewFakeClientWithListAndApply[*schedulingv1alpha3.CompositePodGroup, *schedulingv1alpha3.CompositePodGroupList, *v1alpha3.CompositePodGroupApplyConfiguration]( + fake, + clusterPath, + namespace, + schedulingv1alpha3.SchemeGroupVersion.WithResource("compositepodgroups"), + schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroup"), + func() *schedulingv1alpha3.CompositePodGroup { return &schedulingv1alpha3.CompositePodGroup{} }, + func() *schedulingv1alpha3.CompositePodGroupList { return &schedulingv1alpha3.CompositePodGroupList{} }, + func(dst, src *schedulingv1alpha3.CompositePodGroupList) { dst.ListMeta = src.ListMeta }, + func(list *schedulingv1alpha3.CompositePodGroupList) []*schedulingv1alpha3.CompositePodGroup { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *schedulingv1alpha3.CompositePodGroupList, items []*schedulingv1alpha3.CompositePodGroup) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake, + clusterPath, + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/doc.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/doc.go new file mode 100644 index 00000000000..100cd63c05b --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +// Package fake has the automatically generated cluster clients. +package fake diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/podgroup.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/podgroup.go new file mode 100644 index 00000000000..4fe96186f59 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/podgroup.go @@ -0,0 +1,99 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + v1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" + typedschedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" + + typedkcpschedulingv1alpha3 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3" + kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +// podGroupClusterClient implements PodGroupClusterInterface +type podGroupClusterClient struct { + *kcpgentype.FakeClusterClientWithList[*schedulingv1alpha3.PodGroup, *schedulingv1alpha3.PodGroupList] + Fake *kcptesting.Fake +} + +func newFakePodGroupClusterClient(fake *SchedulingV1alpha3ClusterClient) typedkcpschedulingv1alpha3.PodGroupClusterInterface { + return &podGroupClusterClient{ + kcpgentype.NewFakeClusterClientWithList[*schedulingv1alpha3.PodGroup, *schedulingv1alpha3.PodGroupList]( + fake.Fake, + schedulingv1alpha3.SchemeGroupVersion.WithResource("podgroups"), + schedulingv1alpha3.SchemeGroupVersion.WithKind("PodGroup"), + func() *schedulingv1alpha3.PodGroup { return &schedulingv1alpha3.PodGroup{} }, + func() *schedulingv1alpha3.PodGroupList { return &schedulingv1alpha3.PodGroupList{} }, + func(dst, src *schedulingv1alpha3.PodGroupList) { dst.ListMeta = src.ListMeta }, + func(list *schedulingv1alpha3.PodGroupList) []*schedulingv1alpha3.PodGroup { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *schedulingv1alpha3.PodGroupList, items []*schedulingv1alpha3.PodGroup) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake.Fake, + } +} + +func (c *podGroupClusterClient) Cluster(cluster logicalcluster.Path) typedkcpschedulingv1alpha3.PodGroupsNamespacer { + return &podGroupNamespacer{Fake: c.Fake, ClusterPath: cluster} +} + +type podGroupNamespacer struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (n *podGroupNamespacer) Namespace(namespace string) typedschedulingv1alpha3.PodGroupInterface { + return newFakePodGroupClient(n.Fake, namespace, n.ClusterPath) +} + +// podGroupScopedClient implements PodGroupInterface +type podGroupScopedClient struct { + *kcpgentype.FakeClientWithListAndApply[*schedulingv1alpha3.PodGroup, *schedulingv1alpha3.PodGroupList, *v1alpha3.PodGroupApplyConfiguration] + Fake *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func newFakePodGroupClient(fake *kcptesting.Fake, namespace string, clusterPath logicalcluster.Path) typedschedulingv1alpha3.PodGroupInterface { + return &podGroupScopedClient{ + kcpgentype.NewFakeClientWithListAndApply[*schedulingv1alpha3.PodGroup, *schedulingv1alpha3.PodGroupList, *v1alpha3.PodGroupApplyConfiguration]( + fake, + clusterPath, + namespace, + schedulingv1alpha3.SchemeGroupVersion.WithResource("podgroups"), + schedulingv1alpha3.SchemeGroupVersion.WithKind("PodGroup"), + func() *schedulingv1alpha3.PodGroup { return &schedulingv1alpha3.PodGroup{} }, + func() *schedulingv1alpha3.PodGroupList { return &schedulingv1alpha3.PodGroupList{} }, + func(dst, src *schedulingv1alpha3.PodGroupList) { dst.ListMeta = src.ListMeta }, + func(list *schedulingv1alpha3.PodGroupList) []*schedulingv1alpha3.PodGroup { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *schedulingv1alpha3.PodGroupList, items []*schedulingv1alpha3.PodGroup) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake, + clusterPath, + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/scheduling_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/scheduling_client.go new file mode 100644 index 00000000000..08957207c45 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/scheduling_client.go @@ -0,0 +1,77 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + schedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" + rest "k8s.io/client-go/rest" + + kcpschedulingv1alpha3 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +var _ kcpschedulingv1alpha3.SchedulingV1alpha3ClusterInterface = (*SchedulingV1alpha3ClusterClient)(nil) + +type SchedulingV1alpha3ClusterClient struct { + *kcptesting.Fake +} + +func (c *SchedulingV1alpha3ClusterClient) Cluster(clusterPath logicalcluster.Path) schedulingv1alpha3.SchedulingV1alpha3Interface { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + return &SchedulingV1alpha3Client{Fake: c.Fake, ClusterPath: clusterPath} +} + +func (c *SchedulingV1alpha3ClusterClient) CompositePodGroups() kcpschedulingv1alpha3.CompositePodGroupClusterInterface { + return newFakeCompositePodGroupClusterClient(c) +} + +func (c *SchedulingV1alpha3ClusterClient) PodGroups() kcpschedulingv1alpha3.PodGroupClusterInterface { + return newFakePodGroupClusterClient(c) +} + +func (c *SchedulingV1alpha3ClusterClient) Workloads() kcpschedulingv1alpha3.WorkloadClusterInterface { + return newFakeWorkloadClusterClient(c) +} + +type SchedulingV1alpha3Client struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (c *SchedulingV1alpha3Client) CompositePodGroups(namespace string) schedulingv1alpha3.CompositePodGroupInterface { + return newFakeCompositePodGroupClient(c.Fake, namespace, c.ClusterPath) +} + +func (c *SchedulingV1alpha3Client) PodGroups(namespace string) schedulingv1alpha3.PodGroupInterface { + return newFakePodGroupClient(c.Fake, namespace, c.ClusterPath) +} + +func (c *SchedulingV1alpha3Client) Workloads(namespace string) schedulingv1alpha3.WorkloadInterface { + return newFakeWorkloadClient(c.Fake, namespace, c.ClusterPath) +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *SchedulingV1alpha3Client) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/workload.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/workload.go new file mode 100644 index 00000000000..b21e2a256a8 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/fake/workload.go @@ -0,0 +1,99 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + v1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" + typedschedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" + + typedkcpschedulingv1alpha3 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3" + kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +// workloadClusterClient implements WorkloadClusterInterface +type workloadClusterClient struct { + *kcpgentype.FakeClusterClientWithList[*schedulingv1alpha3.Workload, *schedulingv1alpha3.WorkloadList] + Fake *kcptesting.Fake +} + +func newFakeWorkloadClusterClient(fake *SchedulingV1alpha3ClusterClient) typedkcpschedulingv1alpha3.WorkloadClusterInterface { + return &workloadClusterClient{ + kcpgentype.NewFakeClusterClientWithList[*schedulingv1alpha3.Workload, *schedulingv1alpha3.WorkloadList]( + fake.Fake, + schedulingv1alpha3.SchemeGroupVersion.WithResource("workloads"), + schedulingv1alpha3.SchemeGroupVersion.WithKind("Workload"), + func() *schedulingv1alpha3.Workload { return &schedulingv1alpha3.Workload{} }, + func() *schedulingv1alpha3.WorkloadList { return &schedulingv1alpha3.WorkloadList{} }, + func(dst, src *schedulingv1alpha3.WorkloadList) { dst.ListMeta = src.ListMeta }, + func(list *schedulingv1alpha3.WorkloadList) []*schedulingv1alpha3.Workload { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *schedulingv1alpha3.WorkloadList, items []*schedulingv1alpha3.Workload) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake.Fake, + } +} + +func (c *workloadClusterClient) Cluster(cluster logicalcluster.Path) typedkcpschedulingv1alpha3.WorkloadsNamespacer { + return &workloadNamespacer{Fake: c.Fake, ClusterPath: cluster} +} + +type workloadNamespacer struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (n *workloadNamespacer) Namespace(namespace string) typedschedulingv1alpha3.WorkloadInterface { + return newFakeWorkloadClient(n.Fake, namespace, n.ClusterPath) +} + +// workloadScopedClient implements WorkloadInterface +type workloadScopedClient struct { + *kcpgentype.FakeClientWithListAndApply[*schedulingv1alpha3.Workload, *schedulingv1alpha3.WorkloadList, *v1alpha3.WorkloadApplyConfiguration] + Fake *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func newFakeWorkloadClient(fake *kcptesting.Fake, namespace string, clusterPath logicalcluster.Path) typedschedulingv1alpha3.WorkloadInterface { + return &workloadScopedClient{ + kcpgentype.NewFakeClientWithListAndApply[*schedulingv1alpha3.Workload, *schedulingv1alpha3.WorkloadList, *v1alpha3.WorkloadApplyConfiguration]( + fake, + clusterPath, + namespace, + schedulingv1alpha3.SchemeGroupVersion.WithResource("workloads"), + schedulingv1alpha3.SchemeGroupVersion.WithKind("Workload"), + func() *schedulingv1alpha3.Workload { return &schedulingv1alpha3.Workload{} }, + func() *schedulingv1alpha3.WorkloadList { return &schedulingv1alpha3.WorkloadList{} }, + func(dst, src *schedulingv1alpha3.WorkloadList) { dst.ListMeta = src.ListMeta }, + func(list *schedulingv1alpha3.WorkloadList) []*schedulingv1alpha3.Workload { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *schedulingv1alpha3.WorkloadList, items []*schedulingv1alpha3.Workload) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake, + clusterPath, + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/generated_expansion.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/generated_expansion.go similarity index 91% rename from staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/generated_expansion.go rename to staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/generated_expansion.go index c70cd45a3f0..a5bf3baf96a 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/generated_expansion.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/generated_expansion.go @@ -16,7 +16,9 @@ limitations under the License. // Code generated by cluster-client-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 + +type CompositePodGroupClusterExpansion interface{} type PodGroupClusterExpansion interface{} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/podgroup.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/podgroup.go similarity index 82% rename from staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/podgroup.go rename to staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/podgroup.go index ca9d150b8e3..f7c84862c87 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/podgroup.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/podgroup.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by cluster-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" watch "k8s.io/apimachinery/pkg/watch" - typedschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" + typedschedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" "github.com/kcp-dev/logicalcluster/v3" @@ -40,13 +40,13 @@ type PodGroupsClusterGetter interface { // or scope down to one cluster and return a PodGroupsNamespacer. type PodGroupClusterInterface interface { Cluster(logicalcluster.Path) PodGroupsNamespacer - List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha2.PodGroupList, error) + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha3.PodGroupList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) PodGroupClusterExpansion } type podGroupsClusterInterface struct { - clientCache kcpclient.Cache[*typedschedulingv1alpha2.SchedulingV1alpha2Client] + clientCache kcpclient.Cache[*typedschedulingv1alpha3.SchedulingV1alpha3Client] } // Cluster scopes the client down to a particular cluster. @@ -59,7 +59,7 @@ func (c *podGroupsClusterInterface) Cluster(clusterPath logicalcluster.Path) Pod } // List returns the entire collection of all PodGroups across all clusters. -func (c *podGroupsClusterInterface) List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha2.PodGroupList, error) { +func (c *podGroupsClusterInterface) List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha3.PodGroupList, error) { return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).PodGroups(v1.NamespaceAll).List(ctx, opts) } @@ -68,16 +68,16 @@ func (c *podGroupsClusterInterface) Watch(ctx context.Context, opts v1.ListOptio return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).PodGroups(v1.NamespaceAll).Watch(ctx, opts) } -// PodGroupsNamespacer can scope to objects within a namespace, returning a typedschedulingv1alpha2.PodGroupInterface. +// PodGroupsNamespacer can scope to objects within a namespace, returning a typedschedulingv1alpha3.PodGroupInterface. type PodGroupsNamespacer interface { - Namespace(string) typedschedulingv1alpha2.PodGroupInterface + Namespace(string) typedschedulingv1alpha3.PodGroupInterface } type podGroupsNamespacer struct { - clientCache kcpclient.Cache[*typedschedulingv1alpha2.SchedulingV1alpha2Client] + clientCache kcpclient.Cache[*typedschedulingv1alpha3.SchedulingV1alpha3Client] clusterPath logicalcluster.Path } -func (n *podGroupsNamespacer) Namespace(namespace string) typedschedulingv1alpha2.PodGroupInterface { +func (n *podGroupsNamespacer) Namespace(namespace string) typedschedulingv1alpha3.PodGroupInterface { return n.clientCache.ClusterOrDie(n.clusterPath).PodGroups(namespace) } diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/scheduling_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/scheduling_client.go similarity index 61% rename from staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/scheduling_client.go rename to staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/scheduling_client.go index 55880e31b07..6949a39c9c5 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/scheduling_client.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/scheduling_client.go @@ -16,13 +16,13 @@ limitations under the License. // Code generated by cluster-client-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( http "net/http" - apischedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" - schedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" + apischedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + schedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" rest "k8s.io/client-go/rest" kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" @@ -30,40 +30,45 @@ import ( "github.com/kcp-dev/logicalcluster/v3" ) -type SchedulingV1alpha2ClusterInterface interface { - SchedulingV1alpha2ClusterScoper +type SchedulingV1alpha3ClusterInterface interface { + SchedulingV1alpha3ClusterScoper + CompositePodGroupsClusterGetter PodGroupsClusterGetter WorkloadsClusterGetter } -type SchedulingV1alpha2ClusterScoper interface { - Cluster(logicalcluster.Path) schedulingv1alpha2.SchedulingV1alpha2Interface +type SchedulingV1alpha3ClusterScoper interface { + Cluster(logicalcluster.Path) schedulingv1alpha3.SchedulingV1alpha3Interface } -// SchedulingV1alpha2ClusterClient is used to interact with features provided by the scheduling.k8s.io group. -type SchedulingV1alpha2ClusterClient struct { - clientCache kcpclient.Cache[*schedulingv1alpha2.SchedulingV1alpha2Client] +// SchedulingV1alpha3ClusterClient is used to interact with features provided by the scheduling.k8s.io group. +type SchedulingV1alpha3ClusterClient struct { + clientCache kcpclient.Cache[*schedulingv1alpha3.SchedulingV1alpha3Client] } -func (c *SchedulingV1alpha2ClusterClient) Cluster(clusterPath logicalcluster.Path) schedulingv1alpha2.SchedulingV1alpha2Interface { +func (c *SchedulingV1alpha3ClusterClient) Cluster(clusterPath logicalcluster.Path) schedulingv1alpha3.SchedulingV1alpha3Interface { if clusterPath == logicalcluster.Wildcard { panic("A specific cluster must be provided when scoping, not the wildcard.") } return c.clientCache.ClusterOrDie(clusterPath) } -func (c *SchedulingV1alpha2ClusterClient) PodGroups() PodGroupClusterInterface { +func (c *SchedulingV1alpha3ClusterClient) CompositePodGroups() CompositePodGroupClusterInterface { + return &compositePodGroupsClusterInterface{clientCache: c.clientCache} +} + +func (c *SchedulingV1alpha3ClusterClient) PodGroups() PodGroupClusterInterface { return &podGroupsClusterInterface{clientCache: c.clientCache} } -func (c *SchedulingV1alpha2ClusterClient) Workloads() WorkloadClusterInterface { +func (c *SchedulingV1alpha3ClusterClient) Workloads() WorkloadClusterInterface { return &workloadsClusterInterface{clientCache: c.clientCache} } -// NewForConfig creates a new SchedulingV1alpha2ClusterClient for the given config. +// NewForConfig creates a new SchedulingV1alpha3ClusterClient for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*SchedulingV1alpha2ClusterClient, error) { +func NewForConfig(c *rest.Config) (*SchedulingV1alpha3ClusterClient, error) { config := *c setConfigDefaults(&config) httpClient, err := rest.HTTPClientFor(&config) @@ -73,22 +78,22 @@ func NewForConfig(c *rest.Config) (*SchedulingV1alpha2ClusterClient, error) { return NewForConfigAndClient(&config, httpClient) } -// NewForConfigAndClient creates a new SchedulingV1alpha2ClusterClient for the given config and http client. +// NewForConfigAndClient creates a new SchedulingV1alpha3ClusterClient 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) (*SchedulingV1alpha2ClusterClient, error) { - cache := kcpclient.NewCache(c, h, &kcpclient.Constructor[*schedulingv1alpha2.SchedulingV1alpha2Client]{ - NewForConfigAndClient: schedulingv1alpha2.NewForConfigAndClient, +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SchedulingV1alpha3ClusterClient, error) { + cache := kcpclient.NewCache(c, h, &kcpclient.Constructor[*schedulingv1alpha3.SchedulingV1alpha3Client]{ + NewForConfigAndClient: schedulingv1alpha3.NewForConfigAndClient, }) if _, err := cache.Cluster(logicalcluster.Name("root").Path()); err != nil { return nil, err } - return &SchedulingV1alpha2ClusterClient{clientCache: cache}, nil + return &SchedulingV1alpha3ClusterClient{clientCache: cache}, nil } -// NewForConfigOrDie creates a new SchedulingV1alpha2ClusterClient for the given config and +// NewForConfigOrDie creates a new SchedulingV1alpha3ClusterClient for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *SchedulingV1alpha2ClusterClient { +func NewForConfigOrDie(c *rest.Config) *SchedulingV1alpha3ClusterClient { client, err := NewForConfig(c) if err != nil { panic(err) @@ -97,7 +102,7 @@ func NewForConfigOrDie(c *rest.Config) *SchedulingV1alpha2ClusterClient { } func setConfigDefaults(config *rest.Config) { - gv := apischedulingv1alpha2.SchemeGroupVersion + gv := apischedulingv1alpha3.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(kcpscheme.Scheme, kcpscheme.Codecs).WithoutConversion() diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/workload.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/workload.go similarity index 82% rename from staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/workload.go rename to staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/workload.go index fcd24ddb2c8..94cf39cd126 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha2/workload.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1alpha3/workload.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by cluster-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" watch "k8s.io/apimachinery/pkg/watch" - typedschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" + typedschedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" "github.com/kcp-dev/logicalcluster/v3" @@ -40,13 +40,13 @@ type WorkloadsClusterGetter interface { // or scope down to one cluster and return a WorkloadsNamespacer. type WorkloadClusterInterface interface { Cluster(logicalcluster.Path) WorkloadsNamespacer - List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha2.WorkloadList, error) + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha3.WorkloadList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) WorkloadClusterExpansion } type workloadsClusterInterface struct { - clientCache kcpclient.Cache[*typedschedulingv1alpha2.SchedulingV1alpha2Client] + clientCache kcpclient.Cache[*typedschedulingv1alpha3.SchedulingV1alpha3Client] } // Cluster scopes the client down to a particular cluster. @@ -59,7 +59,7 @@ func (c *workloadsClusterInterface) Cluster(clusterPath logicalcluster.Path) Wor } // List returns the entire collection of all Workloads across all clusters. -func (c *workloadsClusterInterface) List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha2.WorkloadList, error) { +func (c *workloadsClusterInterface) List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha3.WorkloadList, error) { return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).Workloads(v1.NamespaceAll).List(ctx, opts) } @@ -68,16 +68,16 @@ func (c *workloadsClusterInterface) Watch(ctx context.Context, opts v1.ListOptio return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).Workloads(v1.NamespaceAll).Watch(ctx, opts) } -// WorkloadsNamespacer can scope to objects within a namespace, returning a typedschedulingv1alpha2.WorkloadInterface. +// WorkloadsNamespacer can scope to objects within a namespace, returning a typedschedulingv1alpha3.WorkloadInterface. type WorkloadsNamespacer interface { - Namespace(string) typedschedulingv1alpha2.WorkloadInterface + Namespace(string) typedschedulingv1alpha3.WorkloadInterface } type workloadsNamespacer struct { - clientCache kcpclient.Cache[*typedschedulingv1alpha2.SchedulingV1alpha2Client] + clientCache kcpclient.Cache[*typedschedulingv1alpha3.SchedulingV1alpha3Client] clusterPath logicalcluster.Path } -func (n *workloadsNamespacer) Namespace(namespace string) typedschedulingv1alpha2.WorkloadInterface { +func (n *workloadsNamespacer) Namespace(namespace string) typedschedulingv1alpha3.WorkloadInterface { return n.clientCache.ClusterOrDie(n.clusterPath).Workloads(namespace) } diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/fake/podgroup.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/fake/podgroup.go new file mode 100644 index 00000000000..4966d84f039 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/fake/podgroup.go @@ -0,0 +1,99 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1" + typedschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" + + typedkcpschedulingv1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1" + kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +// podGroupClusterClient implements PodGroupClusterInterface +type podGroupClusterClient struct { + *kcpgentype.FakeClusterClientWithList[*schedulingv1beta1.PodGroup, *schedulingv1beta1.PodGroupList] + Fake *kcptesting.Fake +} + +func newFakePodGroupClusterClient(fake *SchedulingV1beta1ClusterClient) typedkcpschedulingv1beta1.PodGroupClusterInterface { + return &podGroupClusterClient{ + kcpgentype.NewFakeClusterClientWithList[*schedulingv1beta1.PodGroup, *schedulingv1beta1.PodGroupList]( + fake.Fake, + schedulingv1beta1.SchemeGroupVersion.WithResource("podgroups"), + schedulingv1beta1.SchemeGroupVersion.WithKind("PodGroup"), + func() *schedulingv1beta1.PodGroup { return &schedulingv1beta1.PodGroup{} }, + func() *schedulingv1beta1.PodGroupList { return &schedulingv1beta1.PodGroupList{} }, + func(dst, src *schedulingv1beta1.PodGroupList) { dst.ListMeta = src.ListMeta }, + func(list *schedulingv1beta1.PodGroupList) []*schedulingv1beta1.PodGroup { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *schedulingv1beta1.PodGroupList, items []*schedulingv1beta1.PodGroup) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake.Fake, + } +} + +func (c *podGroupClusterClient) Cluster(cluster logicalcluster.Path) typedkcpschedulingv1beta1.PodGroupsNamespacer { + return &podGroupNamespacer{Fake: c.Fake, ClusterPath: cluster} +} + +type podGroupNamespacer struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (n *podGroupNamespacer) Namespace(namespace string) typedschedulingv1beta1.PodGroupInterface { + return newFakePodGroupClient(n.Fake, namespace, n.ClusterPath) +} + +// podGroupScopedClient implements PodGroupInterface +type podGroupScopedClient struct { + *kcpgentype.FakeClientWithListAndApply[*schedulingv1beta1.PodGroup, *schedulingv1beta1.PodGroupList, *v1beta1.PodGroupApplyConfiguration] + Fake *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func newFakePodGroupClient(fake *kcptesting.Fake, namespace string, clusterPath logicalcluster.Path) typedschedulingv1beta1.PodGroupInterface { + return &podGroupScopedClient{ + kcpgentype.NewFakeClientWithListAndApply[*schedulingv1beta1.PodGroup, *schedulingv1beta1.PodGroupList, *v1beta1.PodGroupApplyConfiguration]( + fake, + clusterPath, + namespace, + schedulingv1beta1.SchemeGroupVersion.WithResource("podgroups"), + schedulingv1beta1.SchemeGroupVersion.WithKind("PodGroup"), + func() *schedulingv1beta1.PodGroup { return &schedulingv1beta1.PodGroup{} }, + func() *schedulingv1beta1.PodGroupList { return &schedulingv1beta1.PodGroupList{} }, + func(dst, src *schedulingv1beta1.PodGroupList) { dst.ListMeta = src.ListMeta }, + func(list *schedulingv1beta1.PodGroupList) []*schedulingv1beta1.PodGroup { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *schedulingv1beta1.PodGroupList, items []*schedulingv1beta1.PodGroup) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake, + clusterPath, + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/fake/scheduling_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/fake/scheduling_client.go index 3dd82ab1ecc..d896b3469dc 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/fake/scheduling_client.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/fake/scheduling_client.go @@ -40,19 +40,35 @@ func (c *SchedulingV1beta1ClusterClient) Cluster(clusterPath logicalcluster.Path return &SchedulingV1beta1Client{Fake: c.Fake, ClusterPath: clusterPath} } +func (c *SchedulingV1beta1ClusterClient) PodGroups() kcpschedulingv1beta1.PodGroupClusterInterface { + return newFakePodGroupClusterClient(c) +} + func (c *SchedulingV1beta1ClusterClient) PriorityClasses() kcpschedulingv1beta1.PriorityClassClusterInterface { return newFakePriorityClassClusterClient(c) } +func (c *SchedulingV1beta1ClusterClient) Workloads() kcpschedulingv1beta1.WorkloadClusterInterface { + return newFakeWorkloadClusterClient(c) +} + type SchedulingV1beta1Client struct { *kcptesting.Fake ClusterPath logicalcluster.Path } +func (c *SchedulingV1beta1Client) PodGroups(namespace string) schedulingv1beta1.PodGroupInterface { + return newFakePodGroupClient(c.Fake, namespace, c.ClusterPath) +} + func (c *SchedulingV1beta1Client) PriorityClasses() schedulingv1beta1.PriorityClassInterface { return newFakePriorityClassClient(c.Fake, c.ClusterPath) } +func (c *SchedulingV1beta1Client) Workloads(namespace string) schedulingv1beta1.WorkloadInterface { + return newFakeWorkloadClient(c.Fake, namespace, c.ClusterPath) +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *SchedulingV1beta1Client) RESTClient() rest.Interface { diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/fake/workload.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/fake/workload.go new file mode 100644 index 00000000000..a7a900429e7 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/fake/workload.go @@ -0,0 +1,99 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1" + typedschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" + + typedkcpschedulingv1beta1 "github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1" + kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +// workloadClusterClient implements WorkloadClusterInterface +type workloadClusterClient struct { + *kcpgentype.FakeClusterClientWithList[*schedulingv1beta1.Workload, *schedulingv1beta1.WorkloadList] + Fake *kcptesting.Fake +} + +func newFakeWorkloadClusterClient(fake *SchedulingV1beta1ClusterClient) typedkcpschedulingv1beta1.WorkloadClusterInterface { + return &workloadClusterClient{ + kcpgentype.NewFakeClusterClientWithList[*schedulingv1beta1.Workload, *schedulingv1beta1.WorkloadList]( + fake.Fake, + schedulingv1beta1.SchemeGroupVersion.WithResource("workloads"), + schedulingv1beta1.SchemeGroupVersion.WithKind("Workload"), + func() *schedulingv1beta1.Workload { return &schedulingv1beta1.Workload{} }, + func() *schedulingv1beta1.WorkloadList { return &schedulingv1beta1.WorkloadList{} }, + func(dst, src *schedulingv1beta1.WorkloadList) { dst.ListMeta = src.ListMeta }, + func(list *schedulingv1beta1.WorkloadList) []*schedulingv1beta1.Workload { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *schedulingv1beta1.WorkloadList, items []*schedulingv1beta1.Workload) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake.Fake, + } +} + +func (c *workloadClusterClient) Cluster(cluster logicalcluster.Path) typedkcpschedulingv1beta1.WorkloadsNamespacer { + return &workloadNamespacer{Fake: c.Fake, ClusterPath: cluster} +} + +type workloadNamespacer struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (n *workloadNamespacer) Namespace(namespace string) typedschedulingv1beta1.WorkloadInterface { + return newFakeWorkloadClient(n.Fake, namespace, n.ClusterPath) +} + +// workloadScopedClient implements WorkloadInterface +type workloadScopedClient struct { + *kcpgentype.FakeClientWithListAndApply[*schedulingv1beta1.Workload, *schedulingv1beta1.WorkloadList, *v1beta1.WorkloadApplyConfiguration] + Fake *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func newFakeWorkloadClient(fake *kcptesting.Fake, namespace string, clusterPath logicalcluster.Path) typedschedulingv1beta1.WorkloadInterface { + return &workloadScopedClient{ + kcpgentype.NewFakeClientWithListAndApply[*schedulingv1beta1.Workload, *schedulingv1beta1.WorkloadList, *v1beta1.WorkloadApplyConfiguration]( + fake, + clusterPath, + namespace, + schedulingv1beta1.SchemeGroupVersion.WithResource("workloads"), + schedulingv1beta1.SchemeGroupVersion.WithKind("Workload"), + func() *schedulingv1beta1.Workload { return &schedulingv1beta1.Workload{} }, + func() *schedulingv1beta1.WorkloadList { return &schedulingv1beta1.WorkloadList{} }, + func(dst, src *schedulingv1beta1.WorkloadList) { dst.ListMeta = src.ListMeta }, + func(list *schedulingv1beta1.WorkloadList) []*schedulingv1beta1.Workload { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *schedulingv1beta1.WorkloadList, items []*schedulingv1beta1.Workload) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake, + clusterPath, + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/generated_expansion.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/generated_expansion.go index 6a30fc33fc9..6edae6a6f3d 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/generated_expansion.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/generated_expansion.go @@ -18,4 +18,8 @@ limitations under the License. package v1beta1 +type PodGroupClusterExpansion interface{} + type PriorityClassClusterExpansion interface{} + +type WorkloadClusterExpansion interface{} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/podgroup.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/podgroup.go new file mode 100644 index 00000000000..4066f0e2427 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/podgroup.go @@ -0,0 +1,83 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + context "context" + + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" + typedschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + "github.com/kcp-dev/logicalcluster/v3" +) + +// PodGroupsClusterGetter has a method to return a PodGroupClusterInterface. +// A group's cluster client should implement this interface. +type PodGroupsClusterGetter interface { + PodGroups() PodGroupClusterInterface +} + +// PodGroupClusterInterface can operate on PodGroups across all clusters, +// or scope down to one cluster and return a PodGroupsNamespacer. +type PodGroupClusterInterface interface { + Cluster(logicalcluster.Path) PodGroupsNamespacer + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1beta1.PodGroupList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + PodGroupClusterExpansion +} + +type podGroupsClusterInterface struct { + clientCache kcpclient.Cache[*typedschedulingv1beta1.SchedulingV1beta1Client] +} + +// Cluster scopes the client down to a particular cluster. +func (c *podGroupsClusterInterface) Cluster(clusterPath logicalcluster.Path) PodGroupsNamespacer { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + + return &podGroupsNamespacer{clientCache: c.clientCache, clusterPath: clusterPath} +} + +// List returns the entire collection of all PodGroups across all clusters. +func (c *podGroupsClusterInterface) List(ctx context.Context, opts v1.ListOptions) (*schedulingv1beta1.PodGroupList, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).PodGroups(v1.NamespaceAll).List(ctx, opts) +} + +// Watch begins to watch all PodGroups across all clusters. +func (c *podGroupsClusterInterface) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).PodGroups(v1.NamespaceAll).Watch(ctx, opts) +} + +// PodGroupsNamespacer can scope to objects within a namespace, returning a typedschedulingv1beta1.PodGroupInterface. +type PodGroupsNamespacer interface { + Namespace(string) typedschedulingv1beta1.PodGroupInterface +} + +type podGroupsNamespacer struct { + clientCache kcpclient.Cache[*typedschedulingv1beta1.SchedulingV1beta1Client] + clusterPath logicalcluster.Path +} + +func (n *podGroupsNamespacer) Namespace(namespace string) typedschedulingv1beta1.PodGroupInterface { + return n.clientCache.ClusterOrDie(n.clusterPath).PodGroups(namespace) +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/scheduling_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/scheduling_client.go index e58402506b4..1b0d95a3d70 100644 --- a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/scheduling_client.go +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/scheduling_client.go @@ -32,7 +32,9 @@ import ( type SchedulingV1beta1ClusterInterface interface { SchedulingV1beta1ClusterScoper + PodGroupsClusterGetter PriorityClassesClusterGetter + WorkloadsClusterGetter } type SchedulingV1beta1ClusterScoper interface { @@ -51,10 +53,18 @@ func (c *SchedulingV1beta1ClusterClient) Cluster(clusterPath logicalcluster.Path return c.clientCache.ClusterOrDie(clusterPath) } +func (c *SchedulingV1beta1ClusterClient) PodGroups() PodGroupClusterInterface { + return &podGroupsClusterInterface{clientCache: c.clientCache} +} + func (c *SchedulingV1beta1ClusterClient) PriorityClasses() PriorityClassClusterInterface { return &priorityClassesClusterInterface{clientCache: c.clientCache} } +func (c *SchedulingV1beta1ClusterClient) Workloads() WorkloadClusterInterface { + return &workloadsClusterInterface{clientCache: c.clientCache} +} + // NewForConfig creates a new SchedulingV1beta1ClusterClient for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/workload.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/workload.go new file mode 100644 index 00000000000..707a902ae2b --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/scheduling/v1beta1/workload.go @@ -0,0 +1,83 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + context "context" + + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" + typedschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + "github.com/kcp-dev/logicalcluster/v3" +) + +// WorkloadsClusterGetter has a method to return a WorkloadClusterInterface. +// A group's cluster client should implement this interface. +type WorkloadsClusterGetter interface { + Workloads() WorkloadClusterInterface +} + +// WorkloadClusterInterface can operate on Workloads across all clusters, +// or scope down to one cluster and return a WorkloadsNamespacer. +type WorkloadClusterInterface interface { + Cluster(logicalcluster.Path) WorkloadsNamespacer + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1beta1.WorkloadList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + WorkloadClusterExpansion +} + +type workloadsClusterInterface struct { + clientCache kcpclient.Cache[*typedschedulingv1beta1.SchedulingV1beta1Client] +} + +// Cluster scopes the client down to a particular cluster. +func (c *workloadsClusterInterface) Cluster(clusterPath logicalcluster.Path) WorkloadsNamespacer { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + + return &workloadsNamespacer{clientCache: c.clientCache, clusterPath: clusterPath} +} + +// List returns the entire collection of all Workloads across all clusters. +func (c *workloadsClusterInterface) List(ctx context.Context, opts v1.ListOptions) (*schedulingv1beta1.WorkloadList, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).Workloads(v1.NamespaceAll).List(ctx, opts) +} + +// Watch begins to watch all Workloads across all clusters. +func (c *workloadsClusterInterface) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).Workloads(v1.NamespaceAll).Watch(ctx, opts) +} + +// WorkloadsNamespacer can scope to objects within a namespace, returning a typedschedulingv1beta1.WorkloadInterface. +type WorkloadsNamespacer interface { + Namespace(string) typedschedulingv1beta1.WorkloadInterface +} + +type workloadsNamespacer struct { + clientCache kcpclient.Cache[*typedschedulingv1beta1.SchedulingV1beta1Client] + clusterPath logicalcluster.Path +} + +func (n *workloadsNamespacer) Namespace(namespace string) typedschedulingv1beta1.WorkloadInterface { + return n.clientCache.ClusterOrDie(n.clusterPath).Workloads(namespace) +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/doc.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/doc.go new file mode 100644 index 00000000000..339ee1803d7 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/fake/doc.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/fake/doc.go new file mode 100644 index 00000000000..100cd63c05b --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +// Package fake has the automatically generated cluster clients. +package fake diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/fake/storagemigration_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/fake/storagemigration_client.go new file mode 100644 index 00000000000..d77456a1ed9 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/fake/storagemigration_client.go @@ -0,0 +1,61 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + storagemigrationv1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1" + rest "k8s.io/client-go/rest" + + kcpstoragemigrationv1 "github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +var _ kcpstoragemigrationv1.StoragemigrationV1ClusterInterface = (*StoragemigrationV1ClusterClient)(nil) + +type StoragemigrationV1ClusterClient struct { + *kcptesting.Fake +} + +func (c *StoragemigrationV1ClusterClient) Cluster(clusterPath logicalcluster.Path) storagemigrationv1.StoragemigrationV1Interface { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + return &StoragemigrationV1Client{Fake: c.Fake, ClusterPath: clusterPath} +} + +func (c *StoragemigrationV1ClusterClient) StorageVersionMigrations() kcpstoragemigrationv1.StorageVersionMigrationClusterInterface { + return newFakeStorageVersionMigrationClusterClient(c) +} + +type StoragemigrationV1Client struct { + *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func (c *StoragemigrationV1Client) StorageVersionMigrations() storagemigrationv1.StorageVersionMigrationInterface { + return newFakeStorageVersionMigrationClient(c.Fake, c.ClusterPath) +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *StoragemigrationV1Client) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/fake/storageversionmigration.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/fake/storageversionmigration.go new file mode 100644 index 00000000000..838697a329f --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/fake/storageversionmigration.go @@ -0,0 +1,98 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package fake + +import ( + storagemigrationv1 "k8s.io/api/storagemigration/v1" + v1 "k8s.io/client-go/applyconfigurations/storagemigration/v1" + typedstoragemigrationv1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1" + + typedkcpstoragemigrationv1 "github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1" + kcpgentype "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype" + kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" + "github.com/kcp-dev/logicalcluster/v3" +) + +// storageVersionMigrationClusterClient implements StorageVersionMigrationClusterInterface +type storageVersionMigrationClusterClient struct { + *kcpgentype.FakeClusterClientWithList[*storagemigrationv1.StorageVersionMigration, *storagemigrationv1.StorageVersionMigrationList] + Fake *kcptesting.Fake +} + +func newFakeStorageVersionMigrationClusterClient(fake *StoragemigrationV1ClusterClient) typedkcpstoragemigrationv1.StorageVersionMigrationClusterInterface { + return &storageVersionMigrationClusterClient{ + kcpgentype.NewFakeClusterClientWithList[*storagemigrationv1.StorageVersionMigration, *storagemigrationv1.StorageVersionMigrationList]( + fake.Fake, + storagemigrationv1.SchemeGroupVersion.WithResource("storageversionmigrations"), + storagemigrationv1.SchemeGroupVersion.WithKind("StorageVersionMigration"), + func() *storagemigrationv1.StorageVersionMigration { + return &storagemigrationv1.StorageVersionMigration{} + }, + func() *storagemigrationv1.StorageVersionMigrationList { + return &storagemigrationv1.StorageVersionMigrationList{} + }, + func(dst, src *storagemigrationv1.StorageVersionMigrationList) { dst.ListMeta = src.ListMeta }, + func(list *storagemigrationv1.StorageVersionMigrationList) []*storagemigrationv1.StorageVersionMigration { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *storagemigrationv1.StorageVersionMigrationList, items []*storagemigrationv1.StorageVersionMigration) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake.Fake, + } +} + +func (c *storageVersionMigrationClusterClient) Cluster(cluster logicalcluster.Path) typedstoragemigrationv1.StorageVersionMigrationInterface { + return newFakeStorageVersionMigrationClient(c.Fake, cluster) +} + +// storageVersionMigrationScopedClient implements StorageVersionMigrationInterface +type storageVersionMigrationScopedClient struct { + *kcpgentype.FakeClientWithListAndApply[*storagemigrationv1.StorageVersionMigration, *storagemigrationv1.StorageVersionMigrationList, *v1.StorageVersionMigrationApplyConfiguration] + Fake *kcptesting.Fake + ClusterPath logicalcluster.Path +} + +func newFakeStorageVersionMigrationClient(fake *kcptesting.Fake, clusterPath logicalcluster.Path) typedstoragemigrationv1.StorageVersionMigrationInterface { + return &storageVersionMigrationScopedClient{ + kcpgentype.NewFakeClientWithListAndApply[*storagemigrationv1.StorageVersionMigration, *storagemigrationv1.StorageVersionMigrationList, *v1.StorageVersionMigrationApplyConfiguration]( + fake, + clusterPath, + "", + storagemigrationv1.SchemeGroupVersion.WithResource("storageversionmigrations"), + storagemigrationv1.SchemeGroupVersion.WithKind("StorageVersionMigration"), + func() *storagemigrationv1.StorageVersionMigration { + return &storagemigrationv1.StorageVersionMigration{} + }, + func() *storagemigrationv1.StorageVersionMigrationList { + return &storagemigrationv1.StorageVersionMigrationList{} + }, + func(dst, src *storagemigrationv1.StorageVersionMigrationList) { dst.ListMeta = src.ListMeta }, + func(list *storagemigrationv1.StorageVersionMigrationList) []*storagemigrationv1.StorageVersionMigration { + return kcpgentype.ToPointerSlice(list.Items) + }, + func(list *storagemigrationv1.StorageVersionMigrationList, items []*storagemigrationv1.StorageVersionMigration) { + list.Items = kcpgentype.FromPointerSlice(items) + }, + ), + fake, + clusterPath, + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/generated_expansion.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/generated_expansion.go new file mode 100644 index 00000000000..dd34a1d1eee --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1 + +type StorageVersionMigrationClusterExpansion interface{} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/storagemigration_client.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/storagemigration_client.go new file mode 100644 index 00000000000..de7db72b5dc --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/storagemigration_client.go @@ -0,0 +1,103 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1 + +import ( + http "net/http" + + apistoragemigrationv1 "k8s.io/api/storagemigration/v1" + storagemigrationv1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1" + rest "k8s.io/client-go/rest" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + kcpscheme "github.com/kcp-dev/client-go/kubernetes/scheme" + "github.com/kcp-dev/logicalcluster/v3" +) + +type StoragemigrationV1ClusterInterface interface { + StoragemigrationV1ClusterScoper + StorageVersionMigrationsClusterGetter +} + +type StoragemigrationV1ClusterScoper interface { + Cluster(logicalcluster.Path) storagemigrationv1.StoragemigrationV1Interface +} + +// StoragemigrationV1ClusterClient is used to interact with features provided by the storagemigration.k8s.io group. +type StoragemigrationV1ClusterClient struct { + clientCache kcpclient.Cache[*storagemigrationv1.StoragemigrationV1Client] +} + +func (c *StoragemigrationV1ClusterClient) Cluster(clusterPath logicalcluster.Path) storagemigrationv1.StoragemigrationV1Interface { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + return c.clientCache.ClusterOrDie(clusterPath) +} + +func (c *StoragemigrationV1ClusterClient) StorageVersionMigrations() StorageVersionMigrationClusterInterface { + return &storageVersionMigrationsClusterInterface{clientCache: c.clientCache} +} + +// NewForConfig creates a new StoragemigrationV1ClusterClient for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*StoragemigrationV1ClusterClient, error) { + config := *c + setConfigDefaults(&config) + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new StoragemigrationV1ClusterClient 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) (*StoragemigrationV1ClusterClient, error) { + cache := kcpclient.NewCache(c, h, &kcpclient.Constructor[*storagemigrationv1.StoragemigrationV1Client]{ + NewForConfigAndClient: storagemigrationv1.NewForConfigAndClient, + }) + if _, err := cache.Cluster(logicalcluster.Name("root").Path()); err != nil { + return nil, err + } + + return &StoragemigrationV1ClusterClient{clientCache: cache}, nil +} + +// NewForConfigOrDie creates a new StoragemigrationV1ClusterClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *StoragemigrationV1ClusterClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +func setConfigDefaults(config *rest.Config) { + gv := apistoragemigrationv1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(kcpscheme.Scheme, kcpscheme.Codecs).WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/storageversionmigration.go b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/storageversionmigration.go new file mode 100644 index 00000000000..6a52217d425 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/kubernetes/typed/storagemigration/v1/storageversionmigration.go @@ -0,0 +1,69 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + apistoragemigrationv1 "k8s.io/api/storagemigration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" + storagemigrationv1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1" + + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" + "github.com/kcp-dev/logicalcluster/v3" +) + +// StorageVersionMigrationsClusterGetter has a method to return a StorageVersionMigrationClusterInterface. +// A group's cluster client should implement this interface. +type StorageVersionMigrationsClusterGetter interface { + StorageVersionMigrations() StorageVersionMigrationClusterInterface +} + +// StorageVersionMigrationClusterInterface can operate on StorageVersionMigrations across all clusters, +// or scope down to one cluster and return a storagemigrationv1.StorageVersionMigrationInterface. +type StorageVersionMigrationClusterInterface interface { + Cluster(logicalcluster.Path) storagemigrationv1.StorageVersionMigrationInterface + List(ctx context.Context, opts metav1.ListOptions) (*apistoragemigrationv1.StorageVersionMigrationList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + StorageVersionMigrationClusterExpansion +} + +type storageVersionMigrationsClusterInterface struct { + clientCache kcpclient.Cache[*storagemigrationv1.StoragemigrationV1Client] +} + +// Cluster scopes the client down to a particular cluster. +func (c *storageVersionMigrationsClusterInterface) Cluster(clusterPath logicalcluster.Path) storagemigrationv1.StorageVersionMigrationInterface { + if clusterPath == logicalcluster.Wildcard { + panic("A specific cluster must be provided when scoping, not the wildcard.") + } + + return c.clientCache.ClusterOrDie(clusterPath).StorageVersionMigrations() +} + +// List returns the entire collection of all StorageVersionMigrations across all clusters. +func (c *storageVersionMigrationsClusterInterface) List(ctx context.Context, opts metav1.ListOptions) (*apistoragemigrationv1.StorageVersionMigrationList, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).StorageVersionMigrations().List(ctx, opts) +} + +// Watch begins to watch all StorageVersionMigrations across all clusters. +func (c *storageVersionMigrationsClusterInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).StorageVersionMigrations().Watch(ctx, opts) +} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/certificates/v1/clustertrustbundle.go b/staging/src/github.com/kcp-dev/client-go/listers/certificates/v1/clustertrustbundle.go new file mode 100644 index 00000000000..0d70d0d1349 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/listers/certificates/v1/clustertrustbundle.go @@ -0,0 +1,91 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-lister-gen. DO NOT EDIT. + +package v1 + +import ( + certificatesv1 "k8s.io/api/certificates/v1" + "k8s.io/apimachinery/pkg/labels" + listerscertificatesv1 "k8s.io/client-go/listers/certificates/v1" + "k8s.io/client-go/tools/cache" + + kcplisters "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/listers" + "github.com/kcp-dev/logicalcluster/v3" +) + +// ClusterTrustBundleClusterLister helps list ClusterTrustBundles across all workspaces, +// or scope down to a ClusterTrustBundleLister for one workspace. +// All objects returned here must be treated as read-only. +type ClusterTrustBundleClusterLister 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) + // Cluster returns a lister that can list and get ClusterTrustBundles in one workspace. + Cluster(clusterName logicalcluster.Name) listerscertificatesv1.ClusterTrustBundleLister + ClusterTrustBundleClusterListerExpansion +} + +// clusterTrustBundleClusterLister implements the ClusterTrustBundleClusterLister interface. +type clusterTrustBundleClusterLister struct { + kcplisters.ResourceClusterIndexer[*certificatesv1.ClusterTrustBundle] +} + +var _ ClusterTrustBundleClusterLister = new(clusterTrustBundleClusterLister) + +// NewClusterTrustBundleClusterLister returns a new ClusterTrustBundleClusterLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +func NewClusterTrustBundleClusterLister(indexer cache.Indexer) ClusterTrustBundleClusterLister { + return &clusterTrustBundleClusterLister{ + kcplisters.NewCluster[*certificatesv1.ClusterTrustBundle](indexer, certificatesv1.Resource("clustertrustbundle")), + } +} + +// Cluster scopes the lister to one workspace, allowing users to list and get ClusterTrustBundles. +func (l *clusterTrustBundleClusterLister) Cluster(clusterName logicalcluster.Name) listerscertificatesv1.ClusterTrustBundleLister { + return &clusterTrustBundleLister{ + l.ResourceClusterIndexer.WithCluster(clusterName), + } +} + +// clusterTrustBundleLister can list all ClusterTrustBundles inside a workspace +// or scope down to a listerscertificatesv1.ClusterTrustBundleNamespaceLister for one namespace. +type clusterTrustBundleLister struct { + kcplisters.ResourceIndexer[*certificatesv1.ClusterTrustBundle] +} + +var _ listerscertificatesv1.ClusterTrustBundleLister = new(clusterTrustBundleLister) + +// NewClusterTrustBundleLister returns a new ClusterTrustBundleLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +func NewClusterTrustBundleLister(indexer cache.Indexer) listerscertificatesv1.ClusterTrustBundleLister { + return &clusterTrustBundleLister{ + kcplisters.New[*certificatesv1.ClusterTrustBundle](indexer, certificatesv1.Resource("clustertrustbundle")), + } +} + +// clusterTrustBundleScopedLister can list all ClusterTrustBundles inside a workspace +// or scope down to a listerscertificatesv1.ClusterTrustBundleNamespaceLister. +type clusterTrustBundleScopedLister struct { + kcplisters.ResourceIndexer[*certificatesv1.ClusterTrustBundle] +} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/certificates/v1/expansion_generated.go b/staging/src/github.com/kcp-dev/client-go/listers/certificates/v1/expansion_generated.go index ba9086ee526..c43a26417f9 100644 --- a/staging/src/github.com/kcp-dev/client-go/listers/certificates/v1/expansion_generated.go +++ b/staging/src/github.com/kcp-dev/client-go/listers/certificates/v1/expansion_generated.go @@ -21,3 +21,11 @@ package v1 // CertificateSigningRequestClusterListerExpansion allows custom methods to be added to // CertificateSigningRequestClusterLister. type CertificateSigningRequestClusterListerExpansion interface{} + +// ClusterTrustBundleClusterListerExpansion allows custom methods to be added to +// ClusterTrustBundleClusterLister. +type ClusterTrustBundleClusterListerExpansion interface{} + +// PodCertificateRequestClusterListerExpansion allows custom methods to be added to +// PodCertificateRequestClusterLister. +type PodCertificateRequestClusterListerExpansion interface{} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/certificates/v1/podcertificaterequest.go b/staging/src/github.com/kcp-dev/client-go/listers/certificates/v1/podcertificaterequest.go new file mode 100644 index 00000000000..d7c3e72d637 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/listers/certificates/v1/podcertificaterequest.go @@ -0,0 +1,115 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-lister-gen. DO NOT EDIT. + +package v1 + +import ( + certificatesv1 "k8s.io/api/certificates/v1" + "k8s.io/apimachinery/pkg/labels" + listerscertificatesv1 "k8s.io/client-go/listers/certificates/v1" + "k8s.io/client-go/tools/cache" + + kcplisters "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/listers" + "github.com/kcp-dev/logicalcluster/v3" +) + +// PodCertificateRequestClusterLister helps list PodCertificateRequests across all workspaces, +// or scope down to a PodCertificateRequestLister for one workspace. +// All objects returned here must be treated as read-only. +type PodCertificateRequestClusterLister 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) + // Cluster returns a lister that can list and get PodCertificateRequests in one workspace. + Cluster(clusterName logicalcluster.Name) listerscertificatesv1.PodCertificateRequestLister + PodCertificateRequestClusterListerExpansion +} + +// podCertificateRequestClusterLister implements the PodCertificateRequestClusterLister interface. +type podCertificateRequestClusterLister struct { + kcplisters.ResourceClusterIndexer[*certificatesv1.PodCertificateRequest] +} + +var _ PodCertificateRequestClusterLister = new(podCertificateRequestClusterLister) + +// NewPodCertificateRequestClusterLister returns a new PodCertificateRequestClusterLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewPodCertificateRequestClusterLister(indexer cache.Indexer) PodCertificateRequestClusterLister { + return &podCertificateRequestClusterLister{ + kcplisters.NewCluster[*certificatesv1.PodCertificateRequest](indexer, certificatesv1.Resource("podcertificaterequest")), + } +} + +// Cluster scopes the lister to one workspace, allowing users to list and get PodCertificateRequests. +func (l *podCertificateRequestClusterLister) Cluster(clusterName logicalcluster.Name) listerscertificatesv1.PodCertificateRequestLister { + return &podCertificateRequestLister{ + l.ResourceClusterIndexer.WithCluster(clusterName), + } +} + +// podCertificateRequestLister can list all PodCertificateRequests inside a workspace +// or scope down to a listerscertificatesv1.PodCertificateRequestNamespaceLister for one namespace. +type podCertificateRequestLister struct { + kcplisters.ResourceIndexer[*certificatesv1.PodCertificateRequest] +} + +var _ listerscertificatesv1.PodCertificateRequestLister = new(podCertificateRequestLister) + +// PodCertificateRequests returns an object that can list and get PodCertificateRequests in one namespace. +func (l *podCertificateRequestLister) PodCertificateRequests(namespace string) listerscertificatesv1.PodCertificateRequestNamespaceLister { + return &podCertificateRequestNamespaceLister{ + l.ResourceIndexer.WithNamespace(namespace), + } +} + +// podCertificateRequestNamespaceLister implements the listerscertificatesv1.PodCertificateRequestNamespaceLister +// interface. +type podCertificateRequestNamespaceLister struct { + kcplisters.ResourceIndexer[*certificatesv1.PodCertificateRequest] +} + +var _ listerscertificatesv1.PodCertificateRequestNamespaceLister = new(podCertificateRequestNamespaceLister) + +// NewPodCertificateRequestLister returns a new PodCertificateRequestLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewPodCertificateRequestLister(indexer cache.Indexer) listerscertificatesv1.PodCertificateRequestLister { + return &podCertificateRequestLister{ + kcplisters.New[*certificatesv1.PodCertificateRequest](indexer, certificatesv1.Resource("podcertificaterequest")), + } +} + +// podCertificateRequestScopedLister can list all PodCertificateRequests inside a workspace +// or scope down to a listerscertificatesv1.PodCertificateRequestNamespaceLister for one namespace. +type podCertificateRequestScopedLister struct { + kcplisters.ResourceIndexer[*certificatesv1.PodCertificateRequest] +} + +// PodCertificateRequests returns an object that can list and get PodCertificateRequests in one namespace. +func (l *podCertificateRequestScopedLister) PodCertificateRequests(namespace string) listerscertificatesv1.PodCertificateRequestLister { + return &podCertificateRequestLister{ + l.ResourceIndexer.WithNamespace(namespace), + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/lifecycle/v1alpha1/eviction.go b/staging/src/github.com/kcp-dev/client-go/listers/lifecycle/v1alpha1/eviction.go new file mode 100644 index 00000000000..b51495a9b85 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/listers/lifecycle/v1alpha1/eviction.go @@ -0,0 +1,115 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + listerslifecyclev1alpha1 "k8s.io/client-go/listers/lifecycle/v1alpha1" + "k8s.io/client-go/tools/cache" + + kcplisters "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/listers" + "github.com/kcp-dev/logicalcluster/v3" +) + +// EvictionClusterLister helps list Evictions across all workspaces, +// or scope down to a EvictionLister for one workspace. +// All objects returned here must be treated as read-only. +type EvictionClusterLister 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) + // Cluster returns a lister that can list and get Evictions in one workspace. + Cluster(clusterName logicalcluster.Name) listerslifecyclev1alpha1.EvictionLister + EvictionClusterListerExpansion +} + +// evictionClusterLister implements the EvictionClusterLister interface. +type evictionClusterLister struct { + kcplisters.ResourceClusterIndexer[*lifecyclev1alpha1.Eviction] +} + +var _ EvictionClusterLister = new(evictionClusterLister) + +// NewEvictionClusterLister returns a new EvictionClusterLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewEvictionClusterLister(indexer cache.Indexer) EvictionClusterLister { + return &evictionClusterLister{ + kcplisters.NewCluster[*lifecyclev1alpha1.Eviction](indexer, lifecyclev1alpha1.Resource("eviction")), + } +} + +// Cluster scopes the lister to one workspace, allowing users to list and get Evictions. +func (l *evictionClusterLister) Cluster(clusterName logicalcluster.Name) listerslifecyclev1alpha1.EvictionLister { + return &evictionLister{ + l.ResourceClusterIndexer.WithCluster(clusterName), + } +} + +// evictionLister can list all Evictions inside a workspace +// or scope down to a listerslifecyclev1alpha1.EvictionNamespaceLister for one namespace. +type evictionLister struct { + kcplisters.ResourceIndexer[*lifecyclev1alpha1.Eviction] +} + +var _ listerslifecyclev1alpha1.EvictionLister = new(evictionLister) + +// Evictions returns an object that can list and get Evictions in one namespace. +func (l *evictionLister) Evictions(namespace string) listerslifecyclev1alpha1.EvictionNamespaceLister { + return &evictionNamespaceLister{ + l.ResourceIndexer.WithNamespace(namespace), + } +} + +// evictionNamespaceLister implements the listerslifecyclev1alpha1.EvictionNamespaceLister +// interface. +type evictionNamespaceLister struct { + kcplisters.ResourceIndexer[*lifecyclev1alpha1.Eviction] +} + +var _ listerslifecyclev1alpha1.EvictionNamespaceLister = new(evictionNamespaceLister) + +// NewEvictionLister returns a new EvictionLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewEvictionLister(indexer cache.Indexer) listerslifecyclev1alpha1.EvictionLister { + return &evictionLister{ + kcplisters.New[*lifecyclev1alpha1.Eviction](indexer, lifecyclev1alpha1.Resource("eviction")), + } +} + +// evictionScopedLister can list all Evictions inside a workspace +// or scope down to a listerslifecyclev1alpha1.EvictionNamespaceLister for one namespace. +type evictionScopedLister struct { + kcplisters.ResourceIndexer[*lifecyclev1alpha1.Eviction] +} + +// Evictions returns an object that can list and get Evictions in one namespace. +func (l *evictionScopedLister) Evictions(namespace string) listerslifecyclev1alpha1.EvictionLister { + return &evictionLister{ + l.ResourceIndexer.WithNamespace(namespace), + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/lifecycle/v1alpha1/evictionrequest.go b/staging/src/github.com/kcp-dev/client-go/listers/lifecycle/v1alpha1/evictionrequest.go new file mode 100644 index 00000000000..71775d14a42 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/listers/lifecycle/v1alpha1/evictionrequest.go @@ -0,0 +1,115 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + listerslifecyclev1alpha1 "k8s.io/client-go/listers/lifecycle/v1alpha1" + "k8s.io/client-go/tools/cache" + + kcplisters "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/listers" + "github.com/kcp-dev/logicalcluster/v3" +) + +// EvictionRequestClusterLister helps list EvictionRequests across all workspaces, +// or scope down to a EvictionRequestLister for one workspace. +// All objects returned here must be treated as read-only. +type EvictionRequestClusterLister 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) + // Cluster returns a lister that can list and get EvictionRequests in one workspace. + Cluster(clusterName logicalcluster.Name) listerslifecyclev1alpha1.EvictionRequestLister + EvictionRequestClusterListerExpansion +} + +// evictionRequestClusterLister implements the EvictionRequestClusterLister interface. +type evictionRequestClusterLister struct { + kcplisters.ResourceClusterIndexer[*lifecyclev1alpha1.EvictionRequest] +} + +var _ EvictionRequestClusterLister = new(evictionRequestClusterLister) + +// NewEvictionRequestClusterLister returns a new EvictionRequestClusterLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewEvictionRequestClusterLister(indexer cache.Indexer) EvictionRequestClusterLister { + return &evictionRequestClusterLister{ + kcplisters.NewCluster[*lifecyclev1alpha1.EvictionRequest](indexer, lifecyclev1alpha1.Resource("evictionrequest")), + } +} + +// Cluster scopes the lister to one workspace, allowing users to list and get EvictionRequests. +func (l *evictionRequestClusterLister) Cluster(clusterName logicalcluster.Name) listerslifecyclev1alpha1.EvictionRequestLister { + return &evictionRequestLister{ + l.ResourceClusterIndexer.WithCluster(clusterName), + } +} + +// evictionRequestLister can list all EvictionRequests inside a workspace +// or scope down to a listerslifecyclev1alpha1.EvictionRequestNamespaceLister for one namespace. +type evictionRequestLister struct { + kcplisters.ResourceIndexer[*lifecyclev1alpha1.EvictionRequest] +} + +var _ listerslifecyclev1alpha1.EvictionRequestLister = new(evictionRequestLister) + +// EvictionRequests returns an object that can list and get EvictionRequests in one namespace. +func (l *evictionRequestLister) EvictionRequests(namespace string) listerslifecyclev1alpha1.EvictionRequestNamespaceLister { + return &evictionRequestNamespaceLister{ + l.ResourceIndexer.WithNamespace(namespace), + } +} + +// evictionRequestNamespaceLister implements the listerslifecyclev1alpha1.EvictionRequestNamespaceLister +// interface. +type evictionRequestNamespaceLister struct { + kcplisters.ResourceIndexer[*lifecyclev1alpha1.EvictionRequest] +} + +var _ listerslifecyclev1alpha1.EvictionRequestNamespaceLister = new(evictionRequestNamespaceLister) + +// NewEvictionRequestLister returns a new EvictionRequestLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewEvictionRequestLister(indexer cache.Indexer) listerslifecyclev1alpha1.EvictionRequestLister { + return &evictionRequestLister{ + kcplisters.New[*lifecyclev1alpha1.EvictionRequest](indexer, lifecyclev1alpha1.Resource("evictionrequest")), + } +} + +// evictionRequestScopedLister can list all EvictionRequests inside a workspace +// or scope down to a listerslifecyclev1alpha1.EvictionRequestNamespaceLister for one namespace. +type evictionRequestScopedLister struct { + kcplisters.ResourceIndexer[*lifecyclev1alpha1.EvictionRequest] +} + +// EvictionRequests returns an object that can list and get EvictionRequests in one namespace. +func (l *evictionRequestScopedLister) EvictionRequests(namespace string) listerslifecyclev1alpha1.EvictionRequestLister { + return &evictionRequestLister{ + l.ResourceIndexer.WithNamespace(namespace), + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/lifecycle/v1alpha1/expansion_generated.go b/staging/src/github.com/kcp-dev/client-go/listers/lifecycle/v1alpha1/expansion_generated.go new file mode 100644 index 00000000000..377c1bc8106 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/listers/lifecycle/v1alpha1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-lister-gen. DO NOT EDIT. + +package v1alpha1 + +// EvictionClusterListerExpansion allows custom methods to be added to +// EvictionClusterLister. +type EvictionClusterListerExpansion interface{} + +// EvictionRequestClusterListerExpansion allows custom methods to be added to +// EvictionRequestClusterLister. +type EvictionRequestClusterListerExpansion interface{} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/resource/v1/devicetaintrule.go b/staging/src/github.com/kcp-dev/client-go/listers/resource/v1/devicetaintrule.go new file mode 100644 index 00000000000..715d9bde4ab --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/listers/resource/v1/devicetaintrule.go @@ -0,0 +1,91 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-lister-gen. DO NOT EDIT. + +package v1 + +import ( + resourcev1 "k8s.io/api/resource/v1" + "k8s.io/apimachinery/pkg/labels" + listersresourcev1 "k8s.io/client-go/listers/resource/v1" + "k8s.io/client-go/tools/cache" + + kcplisters "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/listers" + "github.com/kcp-dev/logicalcluster/v3" +) + +// DeviceTaintRuleClusterLister helps list DeviceTaintRules across all workspaces, +// or scope down to a DeviceTaintRuleLister for one workspace. +// All objects returned here must be treated as read-only. +type DeviceTaintRuleClusterLister 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) + // Cluster returns a lister that can list and get DeviceTaintRules in one workspace. + Cluster(clusterName logicalcluster.Name) listersresourcev1.DeviceTaintRuleLister + DeviceTaintRuleClusterListerExpansion +} + +// deviceTaintRuleClusterLister implements the DeviceTaintRuleClusterLister interface. +type deviceTaintRuleClusterLister struct { + kcplisters.ResourceClusterIndexer[*resourcev1.DeviceTaintRule] +} + +var _ DeviceTaintRuleClusterLister = new(deviceTaintRuleClusterLister) + +// NewDeviceTaintRuleClusterLister returns a new DeviceTaintRuleClusterLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +func NewDeviceTaintRuleClusterLister(indexer cache.Indexer) DeviceTaintRuleClusterLister { + return &deviceTaintRuleClusterLister{ + kcplisters.NewCluster[*resourcev1.DeviceTaintRule](indexer, resourcev1.Resource("devicetaintrule")), + } +} + +// Cluster scopes the lister to one workspace, allowing users to list and get DeviceTaintRules. +func (l *deviceTaintRuleClusterLister) Cluster(clusterName logicalcluster.Name) listersresourcev1.DeviceTaintRuleLister { + return &deviceTaintRuleLister{ + l.ResourceClusterIndexer.WithCluster(clusterName), + } +} + +// deviceTaintRuleLister can list all DeviceTaintRules inside a workspace +// or scope down to a listersresourcev1.DeviceTaintRuleNamespaceLister for one namespace. +type deviceTaintRuleLister struct { + kcplisters.ResourceIndexer[*resourcev1.DeviceTaintRule] +} + +var _ listersresourcev1.DeviceTaintRuleLister = new(deviceTaintRuleLister) + +// NewDeviceTaintRuleLister returns a new DeviceTaintRuleLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +func NewDeviceTaintRuleLister(indexer cache.Indexer) listersresourcev1.DeviceTaintRuleLister { + return &deviceTaintRuleLister{ + kcplisters.New[*resourcev1.DeviceTaintRule](indexer, resourcev1.Resource("devicetaintrule")), + } +} + +// deviceTaintRuleScopedLister can list all DeviceTaintRules inside a workspace +// or scope down to a listersresourcev1.DeviceTaintRuleNamespaceLister. +type deviceTaintRuleScopedLister struct { + kcplisters.ResourceIndexer[*resourcev1.DeviceTaintRule] +} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/resource/v1/expansion_generated.go b/staging/src/github.com/kcp-dev/client-go/listers/resource/v1/expansion_generated.go index 2c13005538a..d6e9f4a58a0 100644 --- a/staging/src/github.com/kcp-dev/client-go/listers/resource/v1/expansion_generated.go +++ b/staging/src/github.com/kcp-dev/client-go/listers/resource/v1/expansion_generated.go @@ -22,6 +22,10 @@ package v1 // DeviceClassClusterLister. type DeviceClassClusterListerExpansion interface{} +// DeviceTaintRuleClusterListerExpansion allows custom methods to be added to +// DeviceTaintRuleClusterLister. +type DeviceTaintRuleClusterListerExpansion interface{} + // ResourceClaimClusterListerExpansion allows custom methods to be added to // ResourceClaimClusterLister. type ResourceClaimClusterListerExpansion interface{} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha3/compositepodgroup.go b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha3/compositepodgroup.go new file mode 100644 index 00000000000..9f6aa5fbb94 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha3/compositepodgroup.go @@ -0,0 +1,115 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-lister-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + "k8s.io/apimachinery/pkg/labels" + listersschedulingv1alpha3 "k8s.io/client-go/listers/scheduling/v1alpha3" + "k8s.io/client-go/tools/cache" + + kcplisters "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/listers" + "github.com/kcp-dev/logicalcluster/v3" +) + +// CompositePodGroupClusterLister helps list CompositePodGroups across all workspaces, +// or scope down to a CompositePodGroupLister for one workspace. +// All objects returned here must be treated as read-only. +type CompositePodGroupClusterLister 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) + // Cluster returns a lister that can list and get CompositePodGroups in one workspace. + Cluster(clusterName logicalcluster.Name) listersschedulingv1alpha3.CompositePodGroupLister + CompositePodGroupClusterListerExpansion +} + +// compositePodGroupClusterLister implements the CompositePodGroupClusterLister interface. +type compositePodGroupClusterLister struct { + kcplisters.ResourceClusterIndexer[*schedulingv1alpha3.CompositePodGroup] +} + +var _ CompositePodGroupClusterLister = new(compositePodGroupClusterLister) + +// NewCompositePodGroupClusterLister returns a new CompositePodGroupClusterLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewCompositePodGroupClusterLister(indexer cache.Indexer) CompositePodGroupClusterLister { + return &compositePodGroupClusterLister{ + kcplisters.NewCluster[*schedulingv1alpha3.CompositePodGroup](indexer, schedulingv1alpha3.Resource("compositepodgroup")), + } +} + +// Cluster scopes the lister to one workspace, allowing users to list and get CompositePodGroups. +func (l *compositePodGroupClusterLister) Cluster(clusterName logicalcluster.Name) listersschedulingv1alpha3.CompositePodGroupLister { + return &compositePodGroupLister{ + l.ResourceClusterIndexer.WithCluster(clusterName), + } +} + +// compositePodGroupLister can list all CompositePodGroups inside a workspace +// or scope down to a listersschedulingv1alpha3.CompositePodGroupNamespaceLister for one namespace. +type compositePodGroupLister struct { + kcplisters.ResourceIndexer[*schedulingv1alpha3.CompositePodGroup] +} + +var _ listersschedulingv1alpha3.CompositePodGroupLister = new(compositePodGroupLister) + +// CompositePodGroups returns an object that can list and get CompositePodGroups in one namespace. +func (l *compositePodGroupLister) CompositePodGroups(namespace string) listersschedulingv1alpha3.CompositePodGroupNamespaceLister { + return &compositePodGroupNamespaceLister{ + l.ResourceIndexer.WithNamespace(namespace), + } +} + +// compositePodGroupNamespaceLister implements the listersschedulingv1alpha3.CompositePodGroupNamespaceLister +// interface. +type compositePodGroupNamespaceLister struct { + kcplisters.ResourceIndexer[*schedulingv1alpha3.CompositePodGroup] +} + +var _ listersschedulingv1alpha3.CompositePodGroupNamespaceLister = new(compositePodGroupNamespaceLister) + +// NewCompositePodGroupLister returns a new CompositePodGroupLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewCompositePodGroupLister(indexer cache.Indexer) listersschedulingv1alpha3.CompositePodGroupLister { + return &compositePodGroupLister{ + kcplisters.New[*schedulingv1alpha3.CompositePodGroup](indexer, schedulingv1alpha3.Resource("compositepodgroup")), + } +} + +// compositePodGroupScopedLister can list all CompositePodGroups inside a workspace +// or scope down to a listersschedulingv1alpha3.CompositePodGroupNamespaceLister for one namespace. +type compositePodGroupScopedLister struct { + kcplisters.ResourceIndexer[*schedulingv1alpha3.CompositePodGroup] +} + +// CompositePodGroups returns an object that can list and get CompositePodGroups in one namespace. +func (l *compositePodGroupScopedLister) CompositePodGroups(namespace string) listersschedulingv1alpha3.CompositePodGroupLister { + return &compositePodGroupLister{ + l.ResourceIndexer.WithNamespace(namespace), + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha2/expansion_generated.go b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha3/expansion_generated.go similarity index 82% rename from staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha2/expansion_generated.go rename to staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha3/expansion_generated.go index 404c9dffad3..ceea912b69a 100644 --- a/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha2/expansion_generated.go +++ b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha3/expansion_generated.go @@ -16,7 +16,11 @@ limitations under the License. // Code generated by cluster-lister-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 + +// CompositePodGroupClusterListerExpansion allows custom methods to be added to +// CompositePodGroupClusterLister. +type CompositePodGroupClusterListerExpansion interface{} // PodGroupClusterListerExpansion allows custom methods to be added to // PodGroupClusterLister. diff --git a/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha2/podgroup.go b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha3/podgroup.go similarity index 75% rename from staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha2/podgroup.go rename to staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha3/podgroup.go index 5a30e045ed0..1ae61759d9f 100644 --- a/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha2/podgroup.go +++ b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha3/podgroup.go @@ -16,12 +16,12 @@ limitations under the License. // Code generated by cluster-lister-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" "k8s.io/apimachinery/pkg/labels" - listersschedulingv1alpha2 "k8s.io/client-go/listers/scheduling/v1alpha2" + listersschedulingv1alpha3 "k8s.io/client-go/listers/scheduling/v1alpha3" "k8s.io/client-go/tools/cache" kcplisters "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/listers" @@ -34,15 +34,15 @@ import ( type PodGroupClusterLister 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) // Cluster returns a lister that can list and get PodGroups in one workspace. - Cluster(clusterName logicalcluster.Name) listersschedulingv1alpha2.PodGroupLister + Cluster(clusterName logicalcluster.Name) listersschedulingv1alpha3.PodGroupLister PodGroupClusterListerExpansion } // podGroupClusterLister implements the PodGroupClusterLister interface. type podGroupClusterLister struct { - kcplisters.ResourceClusterIndexer[*schedulingv1alpha2.PodGroup] + kcplisters.ResourceClusterIndexer[*schedulingv1alpha3.PodGroup] } var _ PodGroupClusterLister = new(podGroupClusterLister) @@ -55,39 +55,39 @@ var _ PodGroupClusterLister = new(podGroupClusterLister) // - has the kcpcache.ClusterAndNamespaceIndex as an index func NewPodGroupClusterLister(indexer cache.Indexer) PodGroupClusterLister { return &podGroupClusterLister{ - kcplisters.NewCluster[*schedulingv1alpha2.PodGroup](indexer, schedulingv1alpha2.Resource("podgroup")), + kcplisters.NewCluster[*schedulingv1alpha3.PodGroup](indexer, schedulingv1alpha3.Resource("podgroup")), } } // Cluster scopes the lister to one workspace, allowing users to list and get PodGroups. -func (l *podGroupClusterLister) Cluster(clusterName logicalcluster.Name) listersschedulingv1alpha2.PodGroupLister { +func (l *podGroupClusterLister) Cluster(clusterName logicalcluster.Name) listersschedulingv1alpha3.PodGroupLister { return &podGroupLister{ l.ResourceClusterIndexer.WithCluster(clusterName), } } // podGroupLister can list all PodGroups inside a workspace -// or scope down to a listersschedulingv1alpha2.PodGroupNamespaceLister for one namespace. +// or scope down to a listersschedulingv1alpha3.PodGroupNamespaceLister for one namespace. type podGroupLister struct { - kcplisters.ResourceIndexer[*schedulingv1alpha2.PodGroup] + kcplisters.ResourceIndexer[*schedulingv1alpha3.PodGroup] } -var _ listersschedulingv1alpha2.PodGroupLister = new(podGroupLister) +var _ listersschedulingv1alpha3.PodGroupLister = new(podGroupLister) // PodGroups returns an object that can list and get PodGroups in one namespace. -func (l *podGroupLister) PodGroups(namespace string) listersschedulingv1alpha2.PodGroupNamespaceLister { +func (l *podGroupLister) PodGroups(namespace string) listersschedulingv1alpha3.PodGroupNamespaceLister { return &podGroupNamespaceLister{ l.ResourceIndexer.WithNamespace(namespace), } } -// podGroupNamespaceLister implements the listersschedulingv1alpha2.PodGroupNamespaceLister +// podGroupNamespaceLister implements the listersschedulingv1alpha3.PodGroupNamespaceLister // interface. type podGroupNamespaceLister struct { - kcplisters.ResourceIndexer[*schedulingv1alpha2.PodGroup] + kcplisters.ResourceIndexer[*schedulingv1alpha3.PodGroup] } -var _ listersschedulingv1alpha2.PodGroupNamespaceLister = new(podGroupNamespaceLister) +var _ listersschedulingv1alpha3.PodGroupNamespaceLister = new(podGroupNamespaceLister) // NewPodGroupLister returns a new PodGroupLister. // We assume that the indexer: @@ -95,20 +95,20 @@ var _ listersschedulingv1alpha2.PodGroupNamespaceLister = new(podGroupNamespaceL // - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function // - has the kcpcache.ClusterIndex as an index // - has the kcpcache.ClusterAndNamespaceIndex as an index -func NewPodGroupLister(indexer cache.Indexer) listersschedulingv1alpha2.PodGroupLister { +func NewPodGroupLister(indexer cache.Indexer) listersschedulingv1alpha3.PodGroupLister { return &podGroupLister{ - kcplisters.New[*schedulingv1alpha2.PodGroup](indexer, schedulingv1alpha2.Resource("podgroup")), + kcplisters.New[*schedulingv1alpha3.PodGroup](indexer, schedulingv1alpha3.Resource("podgroup")), } } // podGroupScopedLister can list all PodGroups inside a workspace -// or scope down to a listersschedulingv1alpha2.PodGroupNamespaceLister for one namespace. +// or scope down to a listersschedulingv1alpha3.PodGroupNamespaceLister for one namespace. type podGroupScopedLister struct { - kcplisters.ResourceIndexer[*schedulingv1alpha2.PodGroup] + kcplisters.ResourceIndexer[*schedulingv1alpha3.PodGroup] } // PodGroups returns an object that can list and get PodGroups in one namespace. -func (l *podGroupScopedLister) PodGroups(namespace string) listersschedulingv1alpha2.PodGroupLister { +func (l *podGroupScopedLister) PodGroups(namespace string) listersschedulingv1alpha3.PodGroupLister { return &podGroupLister{ l.ResourceIndexer.WithNamespace(namespace), } diff --git a/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha2/workload.go b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha3/workload.go similarity index 75% rename from staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha2/workload.go rename to staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha3/workload.go index 665ffd16ca8..dea4bd674b0 100644 --- a/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha2/workload.go +++ b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1alpha3/workload.go @@ -16,12 +16,12 @@ limitations under the License. // Code generated by cluster-lister-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha3 import ( - schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" "k8s.io/apimachinery/pkg/labels" - listersschedulingv1alpha2 "k8s.io/client-go/listers/scheduling/v1alpha2" + listersschedulingv1alpha3 "k8s.io/client-go/listers/scheduling/v1alpha3" "k8s.io/client-go/tools/cache" kcplisters "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/listers" @@ -34,15 +34,15 @@ import ( type WorkloadClusterLister 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) // Cluster returns a lister that can list and get Workloads in one workspace. - Cluster(clusterName logicalcluster.Name) listersschedulingv1alpha2.WorkloadLister + Cluster(clusterName logicalcluster.Name) listersschedulingv1alpha3.WorkloadLister WorkloadClusterListerExpansion } // workloadClusterLister implements the WorkloadClusterLister interface. type workloadClusterLister struct { - kcplisters.ResourceClusterIndexer[*schedulingv1alpha2.Workload] + kcplisters.ResourceClusterIndexer[*schedulingv1alpha3.Workload] } var _ WorkloadClusterLister = new(workloadClusterLister) @@ -55,39 +55,39 @@ var _ WorkloadClusterLister = new(workloadClusterLister) // - has the kcpcache.ClusterAndNamespaceIndex as an index func NewWorkloadClusterLister(indexer cache.Indexer) WorkloadClusterLister { return &workloadClusterLister{ - kcplisters.NewCluster[*schedulingv1alpha2.Workload](indexer, schedulingv1alpha2.Resource("workload")), + kcplisters.NewCluster[*schedulingv1alpha3.Workload](indexer, schedulingv1alpha3.Resource("workload")), } } // Cluster scopes the lister to one workspace, allowing users to list and get Workloads. -func (l *workloadClusterLister) Cluster(clusterName logicalcluster.Name) listersschedulingv1alpha2.WorkloadLister { +func (l *workloadClusterLister) Cluster(clusterName logicalcluster.Name) listersschedulingv1alpha3.WorkloadLister { return &workloadLister{ l.ResourceClusterIndexer.WithCluster(clusterName), } } // workloadLister can list all Workloads inside a workspace -// or scope down to a listersschedulingv1alpha2.WorkloadNamespaceLister for one namespace. +// or scope down to a listersschedulingv1alpha3.WorkloadNamespaceLister for one namespace. type workloadLister struct { - kcplisters.ResourceIndexer[*schedulingv1alpha2.Workload] + kcplisters.ResourceIndexer[*schedulingv1alpha3.Workload] } -var _ listersschedulingv1alpha2.WorkloadLister = new(workloadLister) +var _ listersschedulingv1alpha3.WorkloadLister = new(workloadLister) // Workloads returns an object that can list and get Workloads in one namespace. -func (l *workloadLister) Workloads(namespace string) listersschedulingv1alpha2.WorkloadNamespaceLister { +func (l *workloadLister) Workloads(namespace string) listersschedulingv1alpha3.WorkloadNamespaceLister { return &workloadNamespaceLister{ l.ResourceIndexer.WithNamespace(namespace), } } -// workloadNamespaceLister implements the listersschedulingv1alpha2.WorkloadNamespaceLister +// workloadNamespaceLister implements the listersschedulingv1alpha3.WorkloadNamespaceLister // interface. type workloadNamespaceLister struct { - kcplisters.ResourceIndexer[*schedulingv1alpha2.Workload] + kcplisters.ResourceIndexer[*schedulingv1alpha3.Workload] } -var _ listersschedulingv1alpha2.WorkloadNamespaceLister = new(workloadNamespaceLister) +var _ listersschedulingv1alpha3.WorkloadNamespaceLister = new(workloadNamespaceLister) // NewWorkloadLister returns a new WorkloadLister. // We assume that the indexer: @@ -95,20 +95,20 @@ var _ listersschedulingv1alpha2.WorkloadNamespaceLister = new(workloadNamespaceL // - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function // - has the kcpcache.ClusterIndex as an index // - has the kcpcache.ClusterAndNamespaceIndex as an index -func NewWorkloadLister(indexer cache.Indexer) listersschedulingv1alpha2.WorkloadLister { +func NewWorkloadLister(indexer cache.Indexer) listersschedulingv1alpha3.WorkloadLister { return &workloadLister{ - kcplisters.New[*schedulingv1alpha2.Workload](indexer, schedulingv1alpha2.Resource("workload")), + kcplisters.New[*schedulingv1alpha3.Workload](indexer, schedulingv1alpha3.Resource("workload")), } } // workloadScopedLister can list all Workloads inside a workspace -// or scope down to a listersschedulingv1alpha2.WorkloadNamespaceLister for one namespace. +// or scope down to a listersschedulingv1alpha3.WorkloadNamespaceLister for one namespace. type workloadScopedLister struct { - kcplisters.ResourceIndexer[*schedulingv1alpha2.Workload] + kcplisters.ResourceIndexer[*schedulingv1alpha3.Workload] } // Workloads returns an object that can list and get Workloads in one namespace. -func (l *workloadScopedLister) Workloads(namespace string) listersschedulingv1alpha2.WorkloadLister { +func (l *workloadScopedLister) Workloads(namespace string) listersschedulingv1alpha3.WorkloadLister { return &workloadLister{ l.ResourceIndexer.WithNamespace(namespace), } diff --git a/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1beta1/expansion_generated.go b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1beta1/expansion_generated.go index 031640e8414..f95b2bd1e9b 100644 --- a/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1beta1/expansion_generated.go +++ b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1beta1/expansion_generated.go @@ -18,6 +18,14 @@ limitations under the License. package v1beta1 +// PodGroupClusterListerExpansion allows custom methods to be added to +// PodGroupClusterLister. +type PodGroupClusterListerExpansion interface{} + // PriorityClassClusterListerExpansion allows custom methods to be added to // PriorityClassClusterLister. type PriorityClassClusterListerExpansion interface{} + +// WorkloadClusterListerExpansion allows custom methods to be added to +// WorkloadClusterLister. +type WorkloadClusterListerExpansion interface{} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1beta1/podgroup.go b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1beta1/podgroup.go new file mode 100644 index 00000000000..8c1b2e5c452 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1beta1/podgroup.go @@ -0,0 +1,115 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + "k8s.io/apimachinery/pkg/labels" + listersschedulingv1beta1 "k8s.io/client-go/listers/scheduling/v1beta1" + "k8s.io/client-go/tools/cache" + + kcplisters "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/listers" + "github.com/kcp-dev/logicalcluster/v3" +) + +// PodGroupClusterLister helps list PodGroups across all workspaces, +// or scope down to a PodGroupLister for one workspace. +// All objects returned here must be treated as read-only. +type PodGroupClusterLister 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) + // Cluster returns a lister that can list and get PodGroups in one workspace. + Cluster(clusterName logicalcluster.Name) listersschedulingv1beta1.PodGroupLister + PodGroupClusterListerExpansion +} + +// podGroupClusterLister implements the PodGroupClusterLister interface. +type podGroupClusterLister struct { + kcplisters.ResourceClusterIndexer[*schedulingv1beta1.PodGroup] +} + +var _ PodGroupClusterLister = new(podGroupClusterLister) + +// NewPodGroupClusterLister returns a new PodGroupClusterLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewPodGroupClusterLister(indexer cache.Indexer) PodGroupClusterLister { + return &podGroupClusterLister{ + kcplisters.NewCluster[*schedulingv1beta1.PodGroup](indexer, schedulingv1beta1.Resource("podgroup")), + } +} + +// Cluster scopes the lister to one workspace, allowing users to list and get PodGroups. +func (l *podGroupClusterLister) Cluster(clusterName logicalcluster.Name) listersschedulingv1beta1.PodGroupLister { + return &podGroupLister{ + l.ResourceClusterIndexer.WithCluster(clusterName), + } +} + +// podGroupLister can list all PodGroups inside a workspace +// or scope down to a listersschedulingv1beta1.PodGroupNamespaceLister for one namespace. +type podGroupLister struct { + kcplisters.ResourceIndexer[*schedulingv1beta1.PodGroup] +} + +var _ listersschedulingv1beta1.PodGroupLister = new(podGroupLister) + +// PodGroups returns an object that can list and get PodGroups in one namespace. +func (l *podGroupLister) PodGroups(namespace string) listersschedulingv1beta1.PodGroupNamespaceLister { + return &podGroupNamespaceLister{ + l.ResourceIndexer.WithNamespace(namespace), + } +} + +// podGroupNamespaceLister implements the listersschedulingv1beta1.PodGroupNamespaceLister +// interface. +type podGroupNamespaceLister struct { + kcplisters.ResourceIndexer[*schedulingv1beta1.PodGroup] +} + +var _ listersschedulingv1beta1.PodGroupNamespaceLister = new(podGroupNamespaceLister) + +// NewPodGroupLister returns a new PodGroupLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewPodGroupLister(indexer cache.Indexer) listersschedulingv1beta1.PodGroupLister { + return &podGroupLister{ + kcplisters.New[*schedulingv1beta1.PodGroup](indexer, schedulingv1beta1.Resource("podgroup")), + } +} + +// podGroupScopedLister can list all PodGroups inside a workspace +// or scope down to a listersschedulingv1beta1.PodGroupNamespaceLister for one namespace. +type podGroupScopedLister struct { + kcplisters.ResourceIndexer[*schedulingv1beta1.PodGroup] +} + +// PodGroups returns an object that can list and get PodGroups in one namespace. +func (l *podGroupScopedLister) PodGroups(namespace string) listersschedulingv1beta1.PodGroupLister { + return &podGroupLister{ + l.ResourceIndexer.WithNamespace(namespace), + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1beta1/workload.go b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1beta1/workload.go new file mode 100644 index 00000000000..c6fc28eace8 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/listers/scheduling/v1beta1/workload.go @@ -0,0 +1,115 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + "k8s.io/apimachinery/pkg/labels" + listersschedulingv1beta1 "k8s.io/client-go/listers/scheduling/v1beta1" + "k8s.io/client-go/tools/cache" + + kcplisters "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/listers" + "github.com/kcp-dev/logicalcluster/v3" +) + +// WorkloadClusterLister helps list Workloads across all workspaces, +// or scope down to a WorkloadLister for one workspace. +// All objects returned here must be treated as read-only. +type WorkloadClusterLister 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) + // Cluster returns a lister that can list and get Workloads in one workspace. + Cluster(clusterName logicalcluster.Name) listersschedulingv1beta1.WorkloadLister + WorkloadClusterListerExpansion +} + +// workloadClusterLister implements the WorkloadClusterLister interface. +type workloadClusterLister struct { + kcplisters.ResourceClusterIndexer[*schedulingv1beta1.Workload] +} + +var _ WorkloadClusterLister = new(workloadClusterLister) + +// NewWorkloadClusterLister returns a new WorkloadClusterLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewWorkloadClusterLister(indexer cache.Indexer) WorkloadClusterLister { + return &workloadClusterLister{ + kcplisters.NewCluster[*schedulingv1beta1.Workload](indexer, schedulingv1beta1.Resource("workload")), + } +} + +// Cluster scopes the lister to one workspace, allowing users to list and get Workloads. +func (l *workloadClusterLister) Cluster(clusterName logicalcluster.Name) listersschedulingv1beta1.WorkloadLister { + return &workloadLister{ + l.ResourceClusterIndexer.WithCluster(clusterName), + } +} + +// workloadLister can list all Workloads inside a workspace +// or scope down to a listersschedulingv1beta1.WorkloadNamespaceLister for one namespace. +type workloadLister struct { + kcplisters.ResourceIndexer[*schedulingv1beta1.Workload] +} + +var _ listersschedulingv1beta1.WorkloadLister = new(workloadLister) + +// Workloads returns an object that can list and get Workloads in one namespace. +func (l *workloadLister) Workloads(namespace string) listersschedulingv1beta1.WorkloadNamespaceLister { + return &workloadNamespaceLister{ + l.ResourceIndexer.WithNamespace(namespace), + } +} + +// workloadNamespaceLister implements the listersschedulingv1beta1.WorkloadNamespaceLister +// interface. +type workloadNamespaceLister struct { + kcplisters.ResourceIndexer[*schedulingv1beta1.Workload] +} + +var _ listersschedulingv1beta1.WorkloadNamespaceLister = new(workloadNamespaceLister) + +// NewWorkloadLister returns a new WorkloadLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewWorkloadLister(indexer cache.Indexer) listersschedulingv1beta1.WorkloadLister { + return &workloadLister{ + kcplisters.New[*schedulingv1beta1.Workload](indexer, schedulingv1beta1.Resource("workload")), + } +} + +// workloadScopedLister can list all Workloads inside a workspace +// or scope down to a listersschedulingv1beta1.WorkloadNamespaceLister for one namespace. +type workloadScopedLister struct { + kcplisters.ResourceIndexer[*schedulingv1beta1.Workload] +} + +// Workloads returns an object that can list and get Workloads in one namespace. +func (l *workloadScopedLister) Workloads(namespace string) listersschedulingv1beta1.WorkloadLister { + return &workloadLister{ + l.ResourceIndexer.WithNamespace(namespace), + } +} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/storagemigration/v1/expansion_generated.go b/staging/src/github.com/kcp-dev/client-go/listers/storagemigration/v1/expansion_generated.go new file mode 100644 index 00000000000..9adcb6fec7f --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/listers/storagemigration/v1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-lister-gen. DO NOT EDIT. + +package v1 + +// StorageVersionMigrationClusterListerExpansion allows custom methods to be added to +// StorageVersionMigrationClusterLister. +type StorageVersionMigrationClusterListerExpansion interface{} diff --git a/staging/src/github.com/kcp-dev/client-go/listers/storagemigration/v1/storageversionmigration.go b/staging/src/github.com/kcp-dev/client-go/listers/storagemigration/v1/storageversionmigration.go new file mode 100644 index 00000000000..b474dd673d6 --- /dev/null +++ b/staging/src/github.com/kcp-dev/client-go/listers/storagemigration/v1/storageversionmigration.go @@ -0,0 +1,91 @@ +/* +Copyright The kcp Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 cluster-lister-gen. DO NOT EDIT. + +package v1 + +import ( + storagemigrationv1 "k8s.io/api/storagemigration/v1" + "k8s.io/apimachinery/pkg/labels" + listersstoragemigrationv1 "k8s.io/client-go/listers/storagemigration/v1" + "k8s.io/client-go/tools/cache" + + kcplisters "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/listers" + "github.com/kcp-dev/logicalcluster/v3" +) + +// StorageVersionMigrationClusterLister helps list StorageVersionMigrations across all workspaces, +// or scope down to a StorageVersionMigrationLister for one workspace. +// All objects returned here must be treated as read-only. +type StorageVersionMigrationClusterLister 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) + // Cluster returns a lister that can list and get StorageVersionMigrations in one workspace. + Cluster(clusterName logicalcluster.Name) listersstoragemigrationv1.StorageVersionMigrationLister + StorageVersionMigrationClusterListerExpansion +} + +// storageVersionMigrationClusterLister implements the StorageVersionMigrationClusterLister interface. +type storageVersionMigrationClusterLister struct { + kcplisters.ResourceClusterIndexer[*storagemigrationv1.StorageVersionMigration] +} + +var _ StorageVersionMigrationClusterLister = new(storageVersionMigrationClusterLister) + +// NewStorageVersionMigrationClusterLister returns a new StorageVersionMigrationClusterLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +func NewStorageVersionMigrationClusterLister(indexer cache.Indexer) StorageVersionMigrationClusterLister { + return &storageVersionMigrationClusterLister{ + kcplisters.NewCluster[*storagemigrationv1.StorageVersionMigration](indexer, storagemigrationv1.Resource("storageversionmigration")), + } +} + +// Cluster scopes the lister to one workspace, allowing users to list and get StorageVersionMigrations. +func (l *storageVersionMigrationClusterLister) Cluster(clusterName logicalcluster.Name) listersstoragemigrationv1.StorageVersionMigrationLister { + return &storageVersionMigrationLister{ + l.ResourceClusterIndexer.WithCluster(clusterName), + } +} + +// storageVersionMigrationLister can list all StorageVersionMigrations inside a workspace +// or scope down to a listersstoragemigrationv1.StorageVersionMigrationNamespaceLister for one namespace. +type storageVersionMigrationLister struct { + kcplisters.ResourceIndexer[*storagemigrationv1.StorageVersionMigration] +} + +var _ listersstoragemigrationv1.StorageVersionMigrationLister = new(storageVersionMigrationLister) + +// NewStorageVersionMigrationLister returns a new StorageVersionMigrationLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +func NewStorageVersionMigrationLister(indexer cache.Indexer) listersstoragemigrationv1.StorageVersionMigrationLister { + return &storageVersionMigrationLister{ + kcplisters.New[*storagemigrationv1.StorageVersionMigration](indexer, storagemigrationv1.Resource("storageversionmigration")), + } +} + +// storageVersionMigrationScopedLister can list all StorageVersionMigrations inside a workspace +// or scope down to a listersstoragemigrationv1.StorageVersionMigrationNamespaceLister. +type storageVersionMigrationScopedLister struct { + kcplisters.ResourceIndexer[*storagemigrationv1.StorageVersionMigration] +} diff --git a/staging/src/github.com/kcp-dev/client-go/third_party/k8s.io/client-go/discovery/fake/discovery.go b/staging/src/github.com/kcp-dev/client-go/third_party/k8s.io/client-go/discovery/fake/discovery.go index dd8d5bf45fa..3b9f1803eb8 100644 --- a/staging/src/github.com/kcp-dev/client-go/third_party/k8s.io/client-go/discovery/fake/discovery.go +++ b/staging/src/github.com/kcp-dev/client-go/third_party/k8s.io/client-go/discovery/fake/discovery.go @@ -18,6 +18,7 @@ limitations under the License. package fake import ( + "context" "fmt" "net/http" @@ -36,7 +37,8 @@ import ( "github.com/kcp-dev/logicalcluster/v3" ) -// FakeDiscovery implements discovery.DiscoveryInterface and sometimes calls kcptesting.Fake.Invoke with an action, +// FakeDiscovery implements discovery.DiscoveryInterface and discovery.DiscoveryInterfaceWithContext. +// It sometimes calls kcptesting.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 { *kcptesting.Fake @@ -44,9 +46,21 @@ type FakeDiscovery struct { ClusterPath logicalcluster.Path } +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. 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 := kcptesting.ActionImpl{ Verb: "get", Resource: schema.GroupVersionResource{Resource: "resource"}, @@ -70,7 +84,16 @@ 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) { + 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.ServerGroups() if err != nil { return nil, nil, err @@ -93,19 +116,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 := kcptesting.ActionImpl{ Verb: "get", Resource: schema.GroupVersionResource{Resource: "group"}, @@ -150,7 +203,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 := kcptesting.ActionImpl{} action.Verb = "get" action.Resource = schema.GroupVersionResource{Resource: "version"} @@ -169,20 +231,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/staging/src/github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype/type.go b/staging/src/github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype/type.go index ab85d9efa18..1d3a0bf28e5 100644 --- a/staging/src/github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype/type.go +++ b/staging/src/github.com/kcp-dev/client-go/third_party/k8s.io/client-go/gentype/type.go @@ -1,5 +1,6 @@ /* Copyright 2024 The Kubernetes Authors. +Modifications Copyright 2025 The kcp 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/staging/src/github.com/kcp-dev/client-go/third_party/k8s.io/client-go/tools/cache/mutation_cache.go b/staging/src/github.com/kcp-dev/client-go/third_party/k8s.io/client-go/tools/cache/mutation_cache.go index 314cbffdb03..feeb67b241d 100644 --- a/staging/src/github.com/kcp-dev/client-go/third_party/k8s.io/client-go/tools/cache/mutation_cache.go +++ b/staging/src/github.com/kcp-dev/client-go/third_party/k8s.io/client-go/tools/cache/mutation_cache.go @@ -24,7 +24,10 @@ import ( "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/types" utilcache "k8s.io/apimachinery/pkg/util/cache" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/sets" @@ -32,15 +35,26 @@ import ( "k8s.io/klog/v2" ) +type Indexer = cache.Indexer +type Store = cache.Store + // MutationCache is able to take the result of update operations and stores them in an LRU // 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. @@ -48,7 +62,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 @@ -61,19 +96,56 @@ 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, keyFunc cache.KeyFunc, backingCache cache.Store, indexer cache.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, keyFunc cache.KeyFunc, 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{ keyFunc: keyFunc, 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, keyFunc cache.KeyFunc, backingCache Store, indexer Indexer, ttl time.Duration, includeAdds bool) MutationCache { + return NewIntegerResourceVersionMutationCacheWithOptions(logger, keyFunc, 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 @@ -81,8 +153,8 @@ type mutationCache struct { logger klog.Logger lock sync.Mutex keyFunc cache.KeyFunc - backingCache cache.Store - indexer cache.Indexer + backingCache Store + indexer Indexer mutationCache *utilcache.LRUExpireCache includeAdds bool ttl time.Duration @@ -111,11 +183,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 } @@ -160,6 +245,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) @@ -216,15 +304,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 := c.keyFunc(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 := c.keyFunc(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{} @@ -265,3 +452,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/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/args/args.go b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/args/args.go index d69a95577b1..e47eeea1efa 100644 --- a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/args/args.go +++ b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/args/args.go @@ -22,6 +22,8 @@ import ( "github.com/spf13/pflag" + "k8s.io/code-generator/pkg/apidefinitions" + "github.com/kcp-dev/code-generator/v3/cmd/cluster-client-gen/types" ) @@ -58,6 +60,8 @@ type Args struct { SingleClusterClientPackage string // Path to the generated Kubernetes single-cluster applyconfigurations package. SingleClusterApplyConfigurationsPackage string + + apidefinitions.LintArgs } func New() *Args { @@ -94,6 +98,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet, inputBase string) { "package path to the generated Kubernetes single-cluster clientset package") fs.StringVar(&args.SingleClusterApplyConfigurationsPackage, "single-cluster-applyconfigurations-pkg", args.SingleClusterApplyConfigurationsPackage, "package path to the generated Kubernetes single-cluster applyconfigurations package") + apidefinitions.AddFlags(&args.LintArgs, fs) } func (args *Args) Validate() error { @@ -113,7 +118,7 @@ func (args *Args) Validate() error { return fmt.Errorf("--single-cluster-applyconfigurations-pkg cannot be empty") } - return nil + return apidefinitions.ValidateFlags(args.LintRules) } // GroupVersionPackages returns a map from GroupVersion to the package with the types.go. diff --git a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/client_generator.go b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/client_generator.go index 70ea24145f6..fdd811e111b 100644 --- a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/client_generator.go +++ b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/client_generator.go @@ -24,6 +24,7 @@ import ( "path/filepath" "strings" + "k8s.io/code-generator/pkg/apidefinitions" codegennamer "k8s.io/code-generator/pkg/namer" "k8s.io/gengo/v2" "k8s.io/gengo/v2/generator" @@ -277,16 +278,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) { +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) - if override := gengo.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil { //nolint:staticcheck + override, ok, err := apidefinitions.GroupNameForPackage(p.Comments) + if err != nil { + return err + } + if ok { newGV := clientgentypes.GroupVersion{ - Group: clientgentypes.Group(override[0]), + Group: clientgentypes.Group(override), Version: gv.Version, } changes[gv] = newGV @@ -314,6 +317,7 @@ func applyGroupOverrides(universe types.Universe, args *args.Args) { } } args.Groups = newGroups + return nil } // Because we try to assemble inputs from an input-base and a set of @@ -357,13 +361,28 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target if err := sanitizePackagePaths(context, args); err != nil { klog.Fatalf("cannot sanitize inputs: %v", err) } - applyGroupOverrides(context.Universe, args) + if err := applyGroupOverrides(context.Universe, args); err != nil { + 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/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/fake/generator_fake_for_clientset.go b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/fake/generator_fake_for_clientset.go index 6db91a67508..b37930c3f31 100644 --- a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/fake/generator_fake_for_clientset.go +++ b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/fake/generator_fake_for_clientset.go @@ -191,7 +191,7 @@ type ClusterClientset struct { var _ kcpclientset.ClusterInterface = (*ClusterClientset)(nil) // Discovery retrieves the DiscoveryClient -func (c *ClusterClientset) Discovery() discovery.DiscoveryInterface { +func (c *ClusterClientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } @@ -258,7 +258,7 @@ var ( _ kcptesting.FakeScopedClient = &Clientset{} ) -func (c *Clientset) Discovery() discovery.DiscoveryInterface { +func (c *Clientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } diff --git a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/generator_for_clientset.go b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/generator_for_clientset.go index 6813e220d1e..44d034ec833 100644 --- a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/generator_for_clientset.go +++ b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/generator_for_clientset.go @@ -85,7 +85,7 @@ func (g *genClientset) GenerateType(c *generator.Context, _ *types.Type, w io.Wr "DefaultKubernetesUserAgent": c.Universe.Function(types.Name{Package: "k8s.io/client-go/rest", Name: "DefaultKubernetesUserAgent"}), "RESTConfig": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "Config"}), "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"}), @@ -112,7 +112,7 @@ func (g *genClientset) GenerateType(c *generator.Context, _ *types.Type, w io.Wr var clientsetInterface = ` type ClusterInterface interface { Cluster(logicalcluster.Path) client.Interface - Discovery() $.DiscoveryInterface|raw$ + Discovery() $.DiscoveryInterfaces|raw$ $range .allGroups$$.GroupGoName$$.Version$() $.PackageAlias$.$.GroupGoName$$.Version$ClusterInterface $end$ } @@ -137,7 +137,7 @@ func (c *ClusterClientset) $.GroupGoName$$.Version$() $.PackageAlias$.$.GroupGoN var getDiscoveryTemplate = ` // Discovery retrieves the DiscoveryClient. -func (c *ClusterClientset) Discovery() $.DiscoveryInterface|raw$ { +func (c *ClusterClientset) Discovery() $.DiscoveryInterfaces|raw$ { if c == nil { return nil } diff --git a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/generator_for_group.go b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/generator_for_group.go index 0ac0cc38c12..1234ded3beb 100644 --- a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/generator_for_group.go +++ b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-client-gen/generators/generator_for_group.go @@ -21,7 +21,7 @@ import ( "io" "path" - "k8s.io/gengo/v2" + "k8s.io/code-generator/pkg/apidefinitions" "k8s.io/gengo/v2/generator" "k8s.io/gengo/v2/namer" "k8s.io/gengo/v2/types" @@ -76,8 +76,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 - if override := gengo.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil { //nolint:staticcheck - groupName = override[0] + override, ok, err := apidefinitions.GroupNameForPackage(p.Comments) + if err != nil { + return err + } + if ok { + groupName = override } apiPath := `"` + g.apiPath + `"` diff --git a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-informer-gen/args/args.go b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-informer-gen/args/args.go index 532b47abd3b..fbaed663f96 100644 --- a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-informer-gen/args/args.go +++ b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-informer-gen/args/args.go @@ -21,6 +21,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. @@ -41,6 +43,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. @@ -68,6 +72,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet) { "package path to the generated Kubernetes single-cluster listers package (optional)") 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. @@ -87,5 +92,5 @@ func (args *Args) Validate() error { if len(args.SingleClusterVersionedClientSetPackage) == 0 { return fmt.Errorf("--single-cluster-versioned-clientset-pkg must be specified") } - return nil + return apidefinitions.ValidateFlags(args.LintRules) } diff --git a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-informer-gen/generators/factory.go b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-informer-gen/generators/factory.go index e8d5ee10e5e..81a790c3268 100644 --- a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-informer-gen/generators/factory.go +++ b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-informer-gen/generators/factory.go @@ -323,7 +323,7 @@ type ScopedDynamicSharedInformerFactory interface { // 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() // factory.Start(ctx.Done()) // Start processing these informers. diff --git a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-informer-gen/generators/targets.go b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-informer-gen/generators/targets.go index ccebbe04e1d..1e814e4ef41 100644 --- a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-informer-gen/generators/targets.go +++ b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-informer-gen/generators/targets.go @@ -23,6 +23,7 @@ import ( "path/filepath" "strings" + "k8s.io/code-generator/pkg/apidefinitions" "k8s.io/gengo/v2" "k8s.io/gengo/v2/generator" "k8s.io/gengo/v2/namer" @@ -104,9 +105,23 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target externalGroupVersions := make(map[string]clientgentypes.GroupVersions) groupGoNames := make(map[string]string) + + var idOpts []apidefinitions.Option + if len(args.LintRules) > 0 { + idOpts = append(idOpts, apidefinitions.WithLintRules(args.LintRules...)) + } + for _, inputPkg := range context.Inputs { pkg := context.Universe.Package(inputPkg) + info, err := apidefinitions.Identify(pkg, apidefinitions.Informer, idOpts...) + if err != nil { + klog.Fatal(err) + } + if !info.ShouldGenerate() { + continue + } + objectMeta, _, err := objectMetaForPackage(pkg) if err != nil { klog.Fatal(err) @@ -131,8 +146,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. - if override := gengo.ExtractCommentTags("+", pkg.Comments)["groupName"]; override != nil { //nolint:staticcheck - gv.Group = clientgentypes.Group(override[0]) + override, ok, err := apidefinitions.GroupNameForPackage(pkg.Comments) + if err != nil { + klog.Fatalf("error resolving group name: %v", err) + } + if ok { + gv.Group = clientgentypes.Group(override) } // If there's a comment of the form "// +groupGoName=SomeUniqueShortName", use that as diff --git a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-lister-gen/args/args.go b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-lister-gen/args/args.go index 6897c85a638..b190d9c043c 100644 --- a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-lister-gen/args/args.go +++ b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-lister-gen/args/args.go @@ -21,6 +21,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 { // Path to the generated Kubernetes single-cluster listers package. SingleClusterListersPackage string + + apidefinitions.LintArgs } // New returns default arguments for the generator. @@ -54,6 +58,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet) { "package path to the generated Kubernetes single-cluster listers package (optional)") 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. @@ -64,5 +69,5 @@ func (args *Args) Validate() error { if len(args.OutputPackage) == 0 { return fmt.Errorf("--output-pkg must be specified") } - return nil + return apidefinitions.ValidateFlags(args.LintRules) } diff --git a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-lister-gen/generators/lister.go b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-lister-gen/generators/lister.go index c5f99264fe6..17773f05389 100644 --- a/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-lister-gen/generators/lister.go +++ b/staging/src/github.com/kcp-dev/code-generator/cmd/cluster-lister-gen/generators/lister.go @@ -24,6 +24,7 @@ import ( "path/filepath" "strings" + "k8s.io/code-generator/pkg/apidefinitions" "k8s.io/gengo/v2" "k8s.io/gengo/v2/generator" "k8s.io/gengo/v2/namer" @@ -68,10 +69,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...)) + } + targetList := make([]generator.Target, 0) 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) @@ -99,8 +113,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. - if override := gengo.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil { //nolint:staticcheck - gv.Group = clientgentypes.Group(strings.SplitN(override[0], ".", 2)[0]) + override, ok, err := apidefinitions.GroupNameForPackage(p.Comments) + if err != nil { + klog.Fatalf("error resolving group name: %v", err) + } + if ok { + gv.Group = clientgentypes.Group(strings.SplitN(override, ".", 2)[0]) } var typesToGenerate []*types.Type diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/go.mod b/staging/src/github.com/kcp-dev/code-generator/examples/go.mod index 3e108ba1d10..7b168c2a90b 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/go.mod +++ b/staging/src/github.com/kcp-dev/code-generator/examples/go.mod @@ -8,9 +8,9 @@ require ( github.com/kcp-dev/apimachinery/v2 v2.0.0-00010101000000-000000000000 github.com/kcp-dev/client-go v0.0.0 github.com/kcp-dev/logicalcluster/v3 v3.0.5 - k8s.io/apimachinery v0.36.0 - k8s.io/client-go v0.36.0 - sigs.k8s.io/structured-merge-diff/v6 v6.4.0 + k8s.io/apimachinery v0.37.0 + k8s.io/client-go v0.37.0 + sigs.k8s.io/structured-merge-diff/v6 v6.4.2 ) replace ( @@ -24,20 +24,20 @@ require ( github.com/emicklei/go-restful/v3 v3.13.0 // indirect github.com/fxamacker/cbor/v2 v2.9.1 // indirect github.com/go-logr/logr v1.4.3 // 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/google/gnostic-models v0.7.1 // indirect github.com/google/uuid v1.6.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -48,19 +48,19 @@ require ( github.com/x448/float16 v0.8.4 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/net v0.55.0 // indirect + golang.org/x/net v0.57.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect - golang.org/x/sys v0.45.0 // indirect - golang.org/x/term v0.43.0 // indirect - golang.org/x/text v0.37.0 // indirect + golang.org/x/sys v0.47.0 // indirect + golang.org/x/term v0.45.0 // indirect + golang.org/x/text v0.40.0 // indirect golang.org/x/time v0.15.0 // indirect google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect - k8s.io/api v0.36.0 // indirect + k8s.io/api v0.37.0 // indirect k8s.io/klog/v2 v2.140.0 // indirect - k8s.io/kube-openapi v0.0.0-20260414162039-ec9c827d403f // indirect - k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 // indirect + k8s.io/kube-openapi v0.0.0-20260721132016-d427ff9ee9ad // indirect + k8s.io/utils v0.0.0-20260626114624-be93311217bd // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/randfill v1.0.0 // indirect sigs.k8s.io/yaml v1.6.0 // indirect diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/go.sum b/staging/src/github.com/kcp-dev/code-generator/examples/go.sum index df632474975..874cef4c8ad 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/go.sum +++ b/staging/src/github.com/kcp-dev/code-generator/examples/go.sum @@ -8,40 +8,40 @@ github.com/fxamacker/cbor/v2 v2.9.1 h1:2rWm8B193Ll4VdjsJY28jxs70IdDsHRWgQYAI80+r github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -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/google/gnostic-models v0.7.1 h1:SisTfuFKJSKM5CPZkffwi6coztzzeYUhc3v4yxLWH8c= github.com/google/gnostic-models v0.7.1/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= @@ -73,8 +73,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7 github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= +github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= @@ -86,16 +86,16 @@ go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= -golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= +golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= +golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= -golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY= -golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4= -golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk= -golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= -golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= +golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= +golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= +golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= +golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI= @@ -109,23 +109,23 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.36.0 h1:SgqDhZzHdOtMk40xVSvCXkP9ME0H05hPM3p9AB1kL80= -k8s.io/api v0.36.0/go.mod h1:m1LVrGPNYax5NBHdO+QuAedXyuzTt4RryI/qnmNvs34= -k8s.io/apimachinery v0.36.0 h1:jZyPzhd5Z+3h9vJLt0z9XdzW9VzNzWAUw+P1xZ9PXtQ= -k8s.io/apimachinery v0.36.0/go.mod h1:FklypaRJt6n5wUIwWXIP6GJlIpUizTgfo1T/As+Tyxc= -k8s.io/client-go v0.36.0 h1:pOYi7C4RHChYjMiHpZSpSbIM6ZxVbRXBy7CuiIwqA3c= -k8s.io/client-go v0.36.0/go.mod h1:ZKKcpwF0aLYfkHFCjillCKaTK/yBkEDHTDXCFY6AS9Y= +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/apimachinery v0.37.0 h1:Np2AbDtf8x6RDHiD8T9LbKJ9gaegeVNa8yNm5FuGKm0= +k8s.io/apimachinery v0.37.0/go.mod h1:RN3nhprFSCxOi5Selxd7oMTXOe/c+ZbcE7Im+TS2zkE= +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/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= -k8s.io/kube-openapi v0.0.0-20260414162039-ec9c827d403f h1:4Qiq0YAoQATdgmHALJWz9rJ4fj20pB3xebpB4CFNhYM= -k8s.io/kube-openapi v0.0.0-20260414162039-ec9c827d403f/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0= -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/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/utils v0.0.0-20260626114624-be93311217bd h1:Ea7fgQ5we8Y9T0OX5o0dAHzQOBRI07D/dEYRaB9ZZEs= +k8s.io/utils v0.0.0-20260626114624-be93311217bd/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= 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/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1/clustertesttype.go index 4432c65ca2d..5a1d90496f3 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1/clustertesttype.go @@ -27,7 +27,7 @@ import ( // ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // ObjectKind is the type of resource being referenced ObjectKind *string `json:"kind,omitempty"` diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1/testtype.go index 5c9a32f6059..65e561201da 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1/testtype.go @@ -29,7 +29,7 @@ import ( // // TestType is a top-level type. A client is created for it. type TestTypeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` APIGroups []string `json:"apiGroups,omitempty"` } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1/withoutverbtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1/withoutverbtype.go index 9444094d610..9d6324e571c 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1/withoutverbtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1/withoutverbtype.go @@ -27,7 +27,7 @@ import ( // WithoutVerbTypeApplyConfiguration represents a declarative configuration of the WithoutVerbType type for use // with apply. type WithoutVerbTypeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1alpha1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1alpha1/clustertesttype.go index 704489e2ac6..13b807c9a39 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1alpha1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1alpha1/clustertesttype.go @@ -27,7 +27,7 @@ import ( // ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // ObjectKind is the type of resource being referenced ObjectKind *string `json:"kind,omitempty"` diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1alpha1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1alpha1/testtype.go index 4ec25fb4a4b..c9f114a7028 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1alpha1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1alpha1/testtype.go @@ -29,7 +29,7 @@ import ( // // TestType is a top-level type. A client is created for it. type TestTypeApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` APIGroups []string `json:"apiGroups,omitempty"` } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1beta1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1beta1/clustertesttype.go index 5c1c5ef8952..fc04c79843b 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1beta1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1beta1/clustertesttype.go @@ -27,7 +27,7 @@ import ( // ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // ObjectKind is the type of resource being referenced ObjectKind *string `json:"kind,omitempty"` diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1beta1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1beta1/testtype.go index 68e64809e98..c9931d11a43 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1beta1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v1beta1/testtype.go @@ -29,7 +29,7 @@ import ( // // TestType is a top-level type. A client is created for it. type TestTypeApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` APIGroups []string `json:"apiGroups,omitempty"` } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v2/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v2/clustertesttype.go index 267118e8781..fed36384d09 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v2/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v2/clustertesttype.go @@ -27,7 +27,7 @@ import ( // ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // ObjectKind is the type of resource being referenced ObjectKind *string `json:"kind,omitempty"` diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v2/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v2/testtype.go index 127f72c3168..7780b061b68 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v2/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example/v2/testtype.go @@ -29,7 +29,7 @@ import ( // // TestType is a top-level type. A client is created for it. type TestTypeApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` + v1.TypeMetaApplyConfiguration `json:""` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` APIGroups []string `json:"apiGroups,omitempty"` } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example3/v1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example3/v1/clustertesttype.go index b7378f4a596..ab2b9fef839 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example3/v1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example3/v1/clustertesttype.go @@ -27,7 +27,7 @@ import ( // ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // ObjectKind is the type of resource being referenced ObjectKind *string `json:"kind,omitempty"` diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example3/v1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example3/v1/testtype.go index a9ea0f999b6..1441db9e2b7 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example3/v1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/example3/v1/testtype.go @@ -29,7 +29,7 @@ import ( // // TestType is a top-level type. A client is created for it. type TestTypeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` APIGroups []string `json:"apiGroups,omitempty"` } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/exampledashed/v1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/exampledashed/v1/clustertesttype.go index 2e0a75c87e6..75602fd20fa 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/exampledashed/v1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/exampledashed/v1/clustertesttype.go @@ -27,7 +27,7 @@ import ( // ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // ObjectKind is the type of resource being referenced ObjectKind *string `json:"kind,omitempty"` diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/exampledashed/v1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/exampledashed/v1/testtype.go index 50db82eeb24..ddfad4b399a 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/exampledashed/v1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/exampledashed/v1/testtype.go @@ -29,7 +29,7 @@ import ( // // TestType is a top-level type. A client is created for it. type TestTypeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` APIGroups []string `json:"apiGroups,omitempty"` } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/clustertesttype.go index 4be370e04f5..6a83f72f5fc 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/clustertesttype.go @@ -27,7 +27,7 @@ import ( // ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // ObjectKind is the type of resource being referenced ObjectKind *string `json:"kind,omitempty"` diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/testtype.go index 0e85038cd01..df55f4d0a8e 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/testtype.go @@ -29,7 +29,7 @@ import ( // // TestType is a top-level type. A client is created for it. type TestTypeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` APIGroups []string `json:"apiGroups,omitempty"` } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/secondexample/v1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/secondexample/v1/clustertesttype.go index 8d4dfb69b17..081e1c8b7f2 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/secondexample/v1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/secondexample/v1/clustertesttype.go @@ -27,7 +27,7 @@ import ( // ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // ObjectKind is the type of resource being referenced ObjectKind *string `json:"kind,omitempty"` diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/secondexample/v1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/secondexample/v1/testtype.go index ae9307bb40c..76492e336c3 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/secondexample/v1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/applyconfigurations/secondexample/v1/testtype.go @@ -29,7 +29,7 @@ import ( // // TestType is a top-level type. A client is created for it. type TestTypeApplyConfiguration struct { - metav1.TypeMetaApplyConfiguration `json:",inline"` + metav1.TypeMetaApplyConfiguration `json:""` *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` APIGroups []string `json:"apiGroups,omitempty"` } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/clientset/versioned/clientset.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/clientset/versioned/clientset.go index d4dd8519603..0b5c2549604 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/clientset/versioned/clientset.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/clientset/versioned/clientset.go @@ -37,7 +37,7 @@ import ( ) type Interface interface { - Discovery() discovery.DiscoveryInterface + Discovery() discovery.DiscoveryInterfaces ExampleV1() examplev1.ExampleV1Interface ExampleV1alpha1() examplev1alpha1.ExampleV1alpha1Interface ExampleV1beta1() examplev1beta1.ExampleV1beta1Interface @@ -102,7 +102,7 @@ func (c *Clientset) SecondexampleV1() secondexamplev1.SecondexampleV1Interface { } // Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { +func (c *Clientset) Discovery() discovery.DiscoveryInterfaces { if c == nil { return nil } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/clientset/versioned/fake/clientset_generated.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/clientset/versioned/fake/clientset_generated.go index 17daabe2dce..1367377a61b 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -87,7 +87,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/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1/clustertesttype.go index 74d5777fe37..119c0d42e70 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1/clustertesttype.go @@ -35,12 +35,40 @@ import ( ) // ClusterTestTypeInformer provides access to a shared informer and lister for -// ClusterTestTypes. +// ClusterTestTypes. Prefer using the type-safe variant (see [TypedClusterTestTypeInformer]). type ClusterTestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() examplev1.ClusterTestTypeLister } +// TypedClusterTestTypeInformer provides access to a shared informer and lister for +// ClusterTestTypes, including the type-safe TypedInformer variant. +// It is a superset of ClusterTestTypeInformer. +type TypedClusterTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterTestTypeIndexInformer + Lister() examplev1.ClusterTestTypeLister +} + +// ClusterTestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterTestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexamplev1.ClusterTestType] + +// ClusterTestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterTestType. +type ClusterTestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexamplev1.ClusterTestType] + +// ClusterTestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterTestType. +type ClusterTestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexamplev1.ClusterTestType] + +// ClusterTestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterTestType. +type ClusterTestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexamplev1.ClusterTestType] + +// ClusterTestTypeIndexers is a specialization of [cache.TypedIndexers] for ClusterTestType. +type ClusterTestTypeIndexers = cache.TypedIndexers[*apisexamplev1.ClusterTestType] + +// DeletedClusterTestType is a specialization of [cache.DeletedObject] for ClusterTestType. +type DeletedClusterTestType = cache.DeletedObject[*apisexamplev1.ClusterTestType] + type clusterTestTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type clusterTestTypeInformer struct { // NewClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformer]). func NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterTestTypeInformer]). func NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformerWithOptions]). func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, options) +} + +// NewTypedClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) ClusterTestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "example.dev", Version: "v1", Resource: "clustertesttypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexamplev1.ClusterTestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options i Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexamplev1.ClusterTestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterTestTypeInformer) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev1.ClusterTestType](f.factory.InformerFor(&apisexamplev1.ClusterTestType{}, f.defaultInformer)) } func (f *clusterTestTypeInformer) Lister() examplev1.ClusterTestTypeLister { return examplev1.NewClusterTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedClusterTestTypeInformer converts an untyped informer into a TypedClusterTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// TypedClusterTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterTestTypeInformer(informer ClusterTestTypeInformer) TypedClusterTestTypeInformer { + if informer, ok := informer.(TypedClusterTestTypeInformer); ok { + return informer + } + return &clusterTestTypeTypedInformerAdapter{informer} +} + +type clusterTestTypeTypedInformerAdapter struct { + ClusterTestTypeInformer +} + +func (a *clusterTestTypeTypedInformerAdapter) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev1.ClusterTestType](a.Informer()) +} + +// ToClusterTestTypeIndexInformer converts an untyped informer into a ClusterTestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// ClusterTestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterTestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterTestTypeIndexInformer(informer cache.SharedIndexInformer) ClusterTestTypeIndexInformer { + if informer, ok := informer.(ClusterTestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexamplev1.ClusterTestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1/interface.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1/interface.go index 3b27ed16aa8..80a0582af08 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1/interface.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ClusterTestTypes returns a ClusterTestTypeInformer. - ClusterTestTypes() ClusterTestTypeInformer + ClusterTestTypes() TypedClusterTestTypeInformer // TestTypes returns a TestTypeInformer. - TestTypes() TestTypeInformer + TestTypes() TypedTestTypeInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ClusterTestTypes returns a ClusterTestTypeInformer. -func (v *version) ClusterTestTypes() ClusterTestTypeInformer { +// ClusterTestTypes returns a TypedClusterTestTypeInformer. +func (v *version) ClusterTestTypes() TypedClusterTestTypeInformer { return &clusterTestTypeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// TestTypes returns a TestTypeInformer. -func (v *version) TestTypes() TestTypeInformer { +// TestTypes returns a TypedTestTypeInformer. +func (v *version) TestTypes() TypedTestTypeInformer { return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1/testtype.go index 8bfd139c5be..ed8d4af560d 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1/testtype.go @@ -35,12 +35,40 @@ import ( ) // TestTypeInformer provides access to a shared informer and lister for -// TestTypes. +// TestTypes. Prefer using the type-safe variant (see [TypedTestTypeInformer]). type TestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() examplev1.TestTypeLister } +// TypedTestTypeInformer provides access to a shared informer and lister for +// TestTypes, including the type-safe TypedInformer variant. +// It is a superset of TestTypeInformer. +type TypedTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() TestTypeIndexInformer + Lister() examplev1.TestTypeLister +} + +// TestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type TestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexamplev1.TestType] + +// TestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for TestType. +type TestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexamplev1.TestType] + +// TestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for TestType. +type TestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexamplev1.TestType] + +// TestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for TestType. +type TestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexamplev1.TestType] + +// TestTypeIndexers is a specialization of [cache.TypedIndexers] for TestType. +type TestTypeIndexers = cache.TypedIndexers[*apisexamplev1.TestType] + +// DeletedTestType is a specialization of [cache.DeletedObject] for TestType. +type DeletedTestType = cache.DeletedObject[*apisexamplev1.TestType] + type testTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -50,25 +78,49 @@ type testTypeInformer struct { // NewTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformer]). func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredTestTypeInformer]). func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformerWithOptions]). func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, options) +} + +// NewTypedTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) TestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "example.dev", Version: "v1", Resource: "testtypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexamplev1.TestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -101,17 +153,57 @@ func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexamplev1.TestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *testTypeInformer) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev1.TestType](f.factory.InformerFor(&apisexamplev1.TestType{}, f.defaultInformer)) } func (f *testTypeInformer) Lister() examplev1.TestTypeLister { return examplev1.NewTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedTestTypeInformer converts an untyped informer into a TypedTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TypedTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedTestTypeInformer(informer TestTypeInformer) TypedTestTypeInformer { + if informer, ok := informer.(TypedTestTypeInformer); ok { + return informer + } + return &testTypeTypedInformerAdapter{informer} +} + +type testTypeTypedInformerAdapter struct { + TestTypeInformer +} + +func (a *testTypeTypedInformerAdapter) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev1.TestType](a.Informer()) +} + +// ToTestTypeIndexInformer converts an untyped informer into a TestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a TestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToTestTypeIndexInformer(informer cache.SharedIndexInformer) TestTypeIndexInformer { + if informer, ok := informer.(TestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexamplev1.TestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1alpha1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1alpha1/clustertesttype.go index 95811dd75e0..38bc590314a 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1alpha1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1alpha1/clustertesttype.go @@ -35,12 +35,40 @@ import ( ) // ClusterTestTypeInformer provides access to a shared informer and lister for -// ClusterTestTypes. +// ClusterTestTypes. Prefer using the type-safe variant (see [TypedClusterTestTypeInformer]). type ClusterTestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() examplev1alpha1.ClusterTestTypeLister } +// TypedClusterTestTypeInformer provides access to a shared informer and lister for +// ClusterTestTypes, including the type-safe TypedInformer variant. +// It is a superset of ClusterTestTypeInformer. +type TypedClusterTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterTestTypeIndexInformer + Lister() examplev1alpha1.ClusterTestTypeLister +} + +// ClusterTestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterTestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexamplev1alpha1.ClusterTestType] + +// ClusterTestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterTestType. +type ClusterTestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexamplev1alpha1.ClusterTestType] + +// ClusterTestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterTestType. +type ClusterTestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexamplev1alpha1.ClusterTestType] + +// ClusterTestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterTestType. +type ClusterTestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexamplev1alpha1.ClusterTestType] + +// ClusterTestTypeIndexers is a specialization of [cache.TypedIndexers] for ClusterTestType. +type ClusterTestTypeIndexers = cache.TypedIndexers[*apisexamplev1alpha1.ClusterTestType] + +// DeletedClusterTestType is a specialization of [cache.DeletedObject] for ClusterTestType. +type DeletedClusterTestType = cache.DeletedObject[*apisexamplev1alpha1.ClusterTestType] + type clusterTestTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type clusterTestTypeInformer struct { // NewClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformer]). func NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterTestTypeInformer]). func NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformerWithOptions]). func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, options) +} + +// NewTypedClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) ClusterTestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "example.dev", Version: "v1alpha1", Resource: "clustertesttypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexamplev1alpha1.ClusterTestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options i Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexamplev1alpha1.ClusterTestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterTestTypeInformer) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev1alpha1.ClusterTestType](f.factory.InformerFor(&apisexamplev1alpha1.ClusterTestType{}, f.defaultInformer)) } func (f *clusterTestTypeInformer) Lister() examplev1alpha1.ClusterTestTypeLister { return examplev1alpha1.NewClusterTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedClusterTestTypeInformer converts an untyped informer into a TypedClusterTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// TypedClusterTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterTestTypeInformer(informer ClusterTestTypeInformer) TypedClusterTestTypeInformer { + if informer, ok := informer.(TypedClusterTestTypeInformer); ok { + return informer + } + return &clusterTestTypeTypedInformerAdapter{informer} +} + +type clusterTestTypeTypedInformerAdapter struct { + ClusterTestTypeInformer +} + +func (a *clusterTestTypeTypedInformerAdapter) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev1alpha1.ClusterTestType](a.Informer()) +} + +// ToClusterTestTypeIndexInformer converts an untyped informer into a ClusterTestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// ClusterTestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterTestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterTestTypeIndexInformer(informer cache.SharedIndexInformer) ClusterTestTypeIndexInformer { + if informer, ok := informer.(ClusterTestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexamplev1alpha1.ClusterTestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1alpha1/interface.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1alpha1/interface.go index ad69e5d7f81..e84b988aae3 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1alpha1/interface.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1alpha1/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ClusterTestTypes returns a ClusterTestTypeInformer. - ClusterTestTypes() ClusterTestTypeInformer + ClusterTestTypes() TypedClusterTestTypeInformer // TestTypes returns a TestTypeInformer. - TestTypes() TestTypeInformer + TestTypes() TypedTestTypeInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ClusterTestTypes returns a ClusterTestTypeInformer. -func (v *version) ClusterTestTypes() ClusterTestTypeInformer { +// ClusterTestTypes returns a TypedClusterTestTypeInformer. +func (v *version) ClusterTestTypes() TypedClusterTestTypeInformer { return &clusterTestTypeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// TestTypes returns a TestTypeInformer. -func (v *version) TestTypes() TestTypeInformer { +// TestTypes returns a TypedTestTypeInformer. +func (v *version) TestTypes() TypedTestTypeInformer { return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1alpha1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1alpha1/testtype.go index 4c791a9421e..b2aa53cd868 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1alpha1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1alpha1/testtype.go @@ -35,12 +35,40 @@ import ( ) // TestTypeInformer provides access to a shared informer and lister for -// TestTypes. +// TestTypes. Prefer using the type-safe variant (see [TypedTestTypeInformer]). type TestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() examplev1alpha1.TestTypeLister } +// TypedTestTypeInformer provides access to a shared informer and lister for +// TestTypes, including the type-safe TypedInformer variant. +// It is a superset of TestTypeInformer. +type TypedTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() TestTypeIndexInformer + Lister() examplev1alpha1.TestTypeLister +} + +// TestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type TestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexamplev1alpha1.TestType] + +// TestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for TestType. +type TestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexamplev1alpha1.TestType] + +// TestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for TestType. +type TestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexamplev1alpha1.TestType] + +// TestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for TestType. +type TestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexamplev1alpha1.TestType] + +// TestTypeIndexers is a specialization of [cache.TypedIndexers] for TestType. +type TestTypeIndexers = cache.TypedIndexers[*apisexamplev1alpha1.TestType] + +// DeletedTestType is a specialization of [cache.DeletedObject] for TestType. +type DeletedTestType = cache.DeletedObject[*apisexamplev1alpha1.TestType] + type testTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -50,25 +78,49 @@ type testTypeInformer struct { // NewTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformer]). func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredTestTypeInformer]). func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformerWithOptions]). func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, options) +} + +// NewTypedTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) TestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "example.dev", Version: "v1alpha1", Resource: "testtypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexamplev1alpha1.TestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -101,17 +153,57 @@ func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexamplev1alpha1.TestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *testTypeInformer) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev1alpha1.TestType](f.factory.InformerFor(&apisexamplev1alpha1.TestType{}, f.defaultInformer)) } func (f *testTypeInformer) Lister() examplev1alpha1.TestTypeLister { return examplev1alpha1.NewTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedTestTypeInformer converts an untyped informer into a TypedTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TypedTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedTestTypeInformer(informer TestTypeInformer) TypedTestTypeInformer { + if informer, ok := informer.(TypedTestTypeInformer); ok { + return informer + } + return &testTypeTypedInformerAdapter{informer} +} + +type testTypeTypedInformerAdapter struct { + TestTypeInformer +} + +func (a *testTypeTypedInformerAdapter) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev1alpha1.TestType](a.Informer()) +} + +// ToTestTypeIndexInformer converts an untyped informer into a TestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a TestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToTestTypeIndexInformer(informer cache.SharedIndexInformer) TestTypeIndexInformer { + if informer, ok := informer.(TestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexamplev1alpha1.TestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1beta1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1beta1/clustertesttype.go index 4c866b397de..cf0687c8e00 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1beta1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1beta1/clustertesttype.go @@ -35,12 +35,40 @@ import ( ) // ClusterTestTypeInformer provides access to a shared informer and lister for -// ClusterTestTypes. +// ClusterTestTypes. Prefer using the type-safe variant (see [TypedClusterTestTypeInformer]). type ClusterTestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() examplev1beta1.ClusterTestTypeLister } +// TypedClusterTestTypeInformer provides access to a shared informer and lister for +// ClusterTestTypes, including the type-safe TypedInformer variant. +// It is a superset of ClusterTestTypeInformer. +type TypedClusterTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterTestTypeIndexInformer + Lister() examplev1beta1.ClusterTestTypeLister +} + +// ClusterTestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterTestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexamplev1beta1.ClusterTestType] + +// ClusterTestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterTestType. +type ClusterTestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexamplev1beta1.ClusterTestType] + +// ClusterTestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterTestType. +type ClusterTestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexamplev1beta1.ClusterTestType] + +// ClusterTestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterTestType. +type ClusterTestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexamplev1beta1.ClusterTestType] + +// ClusterTestTypeIndexers is a specialization of [cache.TypedIndexers] for ClusterTestType. +type ClusterTestTypeIndexers = cache.TypedIndexers[*apisexamplev1beta1.ClusterTestType] + +// DeletedClusterTestType is a specialization of [cache.DeletedObject] for ClusterTestType. +type DeletedClusterTestType = cache.DeletedObject[*apisexamplev1beta1.ClusterTestType] + type clusterTestTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type clusterTestTypeInformer struct { // NewClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformer]). func NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterTestTypeInformer]). func NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformerWithOptions]). func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, options) +} + +// NewTypedClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) ClusterTestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "example.dev", Version: "v1beta1", Resource: "clustertesttypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexamplev1beta1.ClusterTestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options i Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexamplev1beta1.ClusterTestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterTestTypeInformer) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev1beta1.ClusterTestType](f.factory.InformerFor(&apisexamplev1beta1.ClusterTestType{}, f.defaultInformer)) } func (f *clusterTestTypeInformer) Lister() examplev1beta1.ClusterTestTypeLister { return examplev1beta1.NewClusterTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedClusterTestTypeInformer converts an untyped informer into a TypedClusterTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// TypedClusterTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterTestTypeInformer(informer ClusterTestTypeInformer) TypedClusterTestTypeInformer { + if informer, ok := informer.(TypedClusterTestTypeInformer); ok { + return informer + } + return &clusterTestTypeTypedInformerAdapter{informer} +} + +type clusterTestTypeTypedInformerAdapter struct { + ClusterTestTypeInformer +} + +func (a *clusterTestTypeTypedInformerAdapter) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev1beta1.ClusterTestType](a.Informer()) +} + +// ToClusterTestTypeIndexInformer converts an untyped informer into a ClusterTestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// ClusterTestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterTestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterTestTypeIndexInformer(informer cache.SharedIndexInformer) ClusterTestTypeIndexInformer { + if informer, ok := informer.(ClusterTestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexamplev1beta1.ClusterTestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1beta1/interface.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1beta1/interface.go index 6b6c0170286..bf58b589913 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1beta1/interface.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1beta1/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ClusterTestTypes returns a ClusterTestTypeInformer. - ClusterTestTypes() ClusterTestTypeInformer + ClusterTestTypes() TypedClusterTestTypeInformer // TestTypes returns a TestTypeInformer. - TestTypes() TestTypeInformer + TestTypes() TypedTestTypeInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ClusterTestTypes returns a ClusterTestTypeInformer. -func (v *version) ClusterTestTypes() ClusterTestTypeInformer { +// ClusterTestTypes returns a TypedClusterTestTypeInformer. +func (v *version) ClusterTestTypes() TypedClusterTestTypeInformer { return &clusterTestTypeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// TestTypes returns a TestTypeInformer. -func (v *version) TestTypes() TestTypeInformer { +// TestTypes returns a TypedTestTypeInformer. +func (v *version) TestTypes() TypedTestTypeInformer { return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1beta1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1beta1/testtype.go index ea148b32d48..5ecf027474f 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1beta1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v1beta1/testtype.go @@ -35,12 +35,40 @@ import ( ) // TestTypeInformer provides access to a shared informer and lister for -// TestTypes. +// TestTypes. Prefer using the type-safe variant (see [TypedTestTypeInformer]). type TestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() examplev1beta1.TestTypeLister } +// TypedTestTypeInformer provides access to a shared informer and lister for +// TestTypes, including the type-safe TypedInformer variant. +// It is a superset of TestTypeInformer. +type TypedTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() TestTypeIndexInformer + Lister() examplev1beta1.TestTypeLister +} + +// TestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type TestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexamplev1beta1.TestType] + +// TestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for TestType. +type TestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexamplev1beta1.TestType] + +// TestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for TestType. +type TestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexamplev1beta1.TestType] + +// TestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for TestType. +type TestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexamplev1beta1.TestType] + +// TestTypeIndexers is a specialization of [cache.TypedIndexers] for TestType. +type TestTypeIndexers = cache.TypedIndexers[*apisexamplev1beta1.TestType] + +// DeletedTestType is a specialization of [cache.DeletedObject] for TestType. +type DeletedTestType = cache.DeletedObject[*apisexamplev1beta1.TestType] + type testTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -50,25 +78,49 @@ type testTypeInformer struct { // NewTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformer]). func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredTestTypeInformer]). func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformerWithOptions]). func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, options) +} + +// NewTypedTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) TestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "example.dev", Version: "v1beta1", Resource: "testtypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexamplev1beta1.TestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -101,17 +153,57 @@ func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexamplev1beta1.TestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *testTypeInformer) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev1beta1.TestType](f.factory.InformerFor(&apisexamplev1beta1.TestType{}, f.defaultInformer)) } func (f *testTypeInformer) Lister() examplev1beta1.TestTypeLister { return examplev1beta1.NewTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedTestTypeInformer converts an untyped informer into a TypedTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TypedTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedTestTypeInformer(informer TestTypeInformer) TypedTestTypeInformer { + if informer, ok := informer.(TypedTestTypeInformer); ok { + return informer + } + return &testTypeTypedInformerAdapter{informer} +} + +type testTypeTypedInformerAdapter struct { + TestTypeInformer +} + +func (a *testTypeTypedInformerAdapter) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev1beta1.TestType](a.Informer()) +} + +// ToTestTypeIndexInformer converts an untyped informer into a TestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a TestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToTestTypeIndexInformer(informer cache.SharedIndexInformer) TestTypeIndexInformer { + if informer, ok := informer.(TestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexamplev1beta1.TestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v2/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v2/clustertesttype.go index a1e11ac70e5..d9ab52086db 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v2/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v2/clustertesttype.go @@ -35,12 +35,40 @@ import ( ) // ClusterTestTypeInformer provides access to a shared informer and lister for -// ClusterTestTypes. +// ClusterTestTypes. Prefer using the type-safe variant (see [TypedClusterTestTypeInformer]). type ClusterTestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() examplev2.ClusterTestTypeLister } +// TypedClusterTestTypeInformer provides access to a shared informer and lister for +// ClusterTestTypes, including the type-safe TypedInformer variant. +// It is a superset of ClusterTestTypeInformer. +type TypedClusterTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterTestTypeIndexInformer + Lister() examplev2.ClusterTestTypeLister +} + +// ClusterTestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterTestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexamplev2.ClusterTestType] + +// ClusterTestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterTestType. +type ClusterTestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexamplev2.ClusterTestType] + +// ClusterTestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterTestType. +type ClusterTestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexamplev2.ClusterTestType] + +// ClusterTestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterTestType. +type ClusterTestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexamplev2.ClusterTestType] + +// ClusterTestTypeIndexers is a specialization of [cache.TypedIndexers] for ClusterTestType. +type ClusterTestTypeIndexers = cache.TypedIndexers[*apisexamplev2.ClusterTestType] + +// DeletedClusterTestType is a specialization of [cache.DeletedObject] for ClusterTestType. +type DeletedClusterTestType = cache.DeletedObject[*apisexamplev2.ClusterTestType] + type clusterTestTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type clusterTestTypeInformer struct { // NewClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformer]). func NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterTestTypeInformer]). func NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformerWithOptions]). func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, options) +} + +// NewTypedClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) ClusterTestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "example.dev", Version: "v2", Resource: "clustertesttypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexamplev2.ClusterTestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options i Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexamplev2.ClusterTestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterTestTypeInformer) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev2.ClusterTestType](f.factory.InformerFor(&apisexamplev2.ClusterTestType{}, f.defaultInformer)) } func (f *clusterTestTypeInformer) Lister() examplev2.ClusterTestTypeLister { return examplev2.NewClusterTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedClusterTestTypeInformer converts an untyped informer into a TypedClusterTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// TypedClusterTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterTestTypeInformer(informer ClusterTestTypeInformer) TypedClusterTestTypeInformer { + if informer, ok := informer.(TypedClusterTestTypeInformer); ok { + return informer + } + return &clusterTestTypeTypedInformerAdapter{informer} +} + +type clusterTestTypeTypedInformerAdapter struct { + ClusterTestTypeInformer +} + +func (a *clusterTestTypeTypedInformerAdapter) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev2.ClusterTestType](a.Informer()) +} + +// ToClusterTestTypeIndexInformer converts an untyped informer into a ClusterTestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// ClusterTestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterTestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterTestTypeIndexInformer(informer cache.SharedIndexInformer) ClusterTestTypeIndexInformer { + if informer, ok := informer.(ClusterTestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexamplev2.ClusterTestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v2/interface.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v2/interface.go index 7c2786aa408..32bc9843917 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v2/interface.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v2/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ClusterTestTypes returns a ClusterTestTypeInformer. - ClusterTestTypes() ClusterTestTypeInformer + ClusterTestTypes() TypedClusterTestTypeInformer // TestTypes returns a TestTypeInformer. - TestTypes() TestTypeInformer + TestTypes() TypedTestTypeInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ClusterTestTypes returns a ClusterTestTypeInformer. -func (v *version) ClusterTestTypes() ClusterTestTypeInformer { +// ClusterTestTypes returns a TypedClusterTestTypeInformer. +func (v *version) ClusterTestTypes() TypedClusterTestTypeInformer { return &clusterTestTypeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// TestTypes returns a TestTypeInformer. -func (v *version) TestTypes() TestTypeInformer { +// TestTypes returns a TypedTestTypeInformer. +func (v *version) TestTypes() TypedTestTypeInformer { return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v2/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v2/testtype.go index b3c3b7f13bd..b1b757810d2 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v2/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example/v2/testtype.go @@ -35,12 +35,40 @@ import ( ) // TestTypeInformer provides access to a shared informer and lister for -// TestTypes. +// TestTypes. Prefer using the type-safe variant (see [TypedTestTypeInformer]). type TestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() examplev2.TestTypeLister } +// TypedTestTypeInformer provides access to a shared informer and lister for +// TestTypes, including the type-safe TypedInformer variant. +// It is a superset of TestTypeInformer. +type TypedTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() TestTypeIndexInformer + Lister() examplev2.TestTypeLister +} + +// TestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type TestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexamplev2.TestType] + +// TestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for TestType. +type TestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexamplev2.TestType] + +// TestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for TestType. +type TestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexamplev2.TestType] + +// TestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for TestType. +type TestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexamplev2.TestType] + +// TestTypeIndexers is a specialization of [cache.TypedIndexers] for TestType. +type TestTypeIndexers = cache.TypedIndexers[*apisexamplev2.TestType] + +// DeletedTestType is a specialization of [cache.DeletedObject] for TestType. +type DeletedTestType = cache.DeletedObject[*apisexamplev2.TestType] + type testTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -50,25 +78,49 @@ type testTypeInformer struct { // NewTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformer]). func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredTestTypeInformer]). func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformerWithOptions]). func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, options) +} + +// NewTypedTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) TestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "example.dev", Version: "v2", Resource: "testtypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexamplev2.TestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -101,17 +153,57 @@ func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexamplev2.TestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *testTypeInformer) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev2.TestType](f.factory.InformerFor(&apisexamplev2.TestType{}, f.defaultInformer)) } func (f *testTypeInformer) Lister() examplev2.TestTypeLister { return examplev2.NewTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedTestTypeInformer converts an untyped informer into a TypedTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TypedTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedTestTypeInformer(informer TestTypeInformer) TypedTestTypeInformer { + if informer, ok := informer.(TypedTestTypeInformer); ok { + return informer + } + return &testTypeTypedInformerAdapter{informer} +} + +type testTypeTypedInformerAdapter struct { + TestTypeInformer +} + +func (a *testTypeTypedInformerAdapter) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexamplev2.TestType](a.Informer()) +} + +// ToTestTypeIndexInformer converts an untyped informer into a TestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a TestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToTestTypeIndexInformer(informer cache.SharedIndexInformer) TestTypeIndexInformer { + if informer, ok := informer.(TestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexamplev2.TestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example3/v1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example3/v1/clustertesttype.go index 3882172a7fb..6cce4e1187d 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example3/v1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example3/v1/clustertesttype.go @@ -35,12 +35,40 @@ import ( ) // ClusterTestTypeInformer provides access to a shared informer and lister for -// ClusterTestTypes. +// ClusterTestTypes. Prefer using the type-safe variant (see [TypedClusterTestTypeInformer]). type ClusterTestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() example3v1.ClusterTestTypeLister } +// TypedClusterTestTypeInformer provides access to a shared informer and lister for +// ClusterTestTypes, including the type-safe TypedInformer variant. +// It is a superset of ClusterTestTypeInformer. +type TypedClusterTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterTestTypeIndexInformer + Lister() example3v1.ClusterTestTypeLister +} + +// ClusterTestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterTestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexample3v1.ClusterTestType] + +// ClusterTestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterTestType. +type ClusterTestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexample3v1.ClusterTestType] + +// ClusterTestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterTestType. +type ClusterTestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexample3v1.ClusterTestType] + +// ClusterTestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterTestType. +type ClusterTestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexample3v1.ClusterTestType] + +// ClusterTestTypeIndexers is a specialization of [cache.TypedIndexers] for ClusterTestType. +type ClusterTestTypeIndexers = cache.TypedIndexers[*apisexample3v1.ClusterTestType] + +// DeletedClusterTestType is a specialization of [cache.DeletedObject] for ClusterTestType. +type DeletedClusterTestType = cache.DeletedObject[*apisexample3v1.ClusterTestType] + type clusterTestTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type clusterTestTypeInformer struct { // NewClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformer]). func NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterTestTypeInformer]). func NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformerWithOptions]). func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, options) +} + +// NewTypedClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) ClusterTestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "example3.some.corp", Version: "v1", Resource: "clustertesttypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexample3v1.ClusterTestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options i Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexample3v1.ClusterTestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterTestTypeInformer) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexample3v1.ClusterTestType](f.factory.InformerFor(&apisexample3v1.ClusterTestType{}, f.defaultInformer)) } func (f *clusterTestTypeInformer) Lister() example3v1.ClusterTestTypeLister { return example3v1.NewClusterTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedClusterTestTypeInformer converts an untyped informer into a TypedClusterTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// TypedClusterTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterTestTypeInformer(informer ClusterTestTypeInformer) TypedClusterTestTypeInformer { + if informer, ok := informer.(TypedClusterTestTypeInformer); ok { + return informer + } + return &clusterTestTypeTypedInformerAdapter{informer} +} + +type clusterTestTypeTypedInformerAdapter struct { + ClusterTestTypeInformer +} + +func (a *clusterTestTypeTypedInformerAdapter) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexample3v1.ClusterTestType](a.Informer()) +} + +// ToClusterTestTypeIndexInformer converts an untyped informer into a ClusterTestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// ClusterTestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterTestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterTestTypeIndexInformer(informer cache.SharedIndexInformer) ClusterTestTypeIndexInformer { + if informer, ok := informer.(ClusterTestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexample3v1.ClusterTestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example3/v1/interface.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example3/v1/interface.go index 3b27ed16aa8..80a0582af08 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example3/v1/interface.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example3/v1/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ClusterTestTypes returns a ClusterTestTypeInformer. - ClusterTestTypes() ClusterTestTypeInformer + ClusterTestTypes() TypedClusterTestTypeInformer // TestTypes returns a TestTypeInformer. - TestTypes() TestTypeInformer + TestTypes() TypedTestTypeInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ClusterTestTypes returns a ClusterTestTypeInformer. -func (v *version) ClusterTestTypes() ClusterTestTypeInformer { +// ClusterTestTypes returns a TypedClusterTestTypeInformer. +func (v *version) ClusterTestTypes() TypedClusterTestTypeInformer { return &clusterTestTypeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// TestTypes returns a TestTypeInformer. -func (v *version) TestTypes() TestTypeInformer { +// TestTypes returns a TypedTestTypeInformer. +func (v *version) TestTypes() TypedTestTypeInformer { return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example3/v1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example3/v1/testtype.go index 8762e2ee0d5..a8a7cde0349 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example3/v1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/example3/v1/testtype.go @@ -35,12 +35,40 @@ import ( ) // TestTypeInformer provides access to a shared informer and lister for -// TestTypes. +// TestTypes. Prefer using the type-safe variant (see [TypedTestTypeInformer]). type TestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() example3v1.TestTypeLister } +// TypedTestTypeInformer provides access to a shared informer and lister for +// TestTypes, including the type-safe TypedInformer variant. +// It is a superset of TestTypeInformer. +type TypedTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() TestTypeIndexInformer + Lister() example3v1.TestTypeLister +} + +// TestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type TestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexample3v1.TestType] + +// TestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for TestType. +type TestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexample3v1.TestType] + +// TestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for TestType. +type TestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexample3v1.TestType] + +// TestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for TestType. +type TestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexample3v1.TestType] + +// TestTypeIndexers is a specialization of [cache.TypedIndexers] for TestType. +type TestTypeIndexers = cache.TypedIndexers[*apisexample3v1.TestType] + +// DeletedTestType is a specialization of [cache.DeletedObject] for TestType. +type DeletedTestType = cache.DeletedObject[*apisexample3v1.TestType] + type testTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -50,25 +78,49 @@ type testTypeInformer struct { // NewTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformer]). func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredTestTypeInformer]). func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformerWithOptions]). func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, options) +} + +// NewTypedTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) TestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "example3.some.corp", Version: "v1", Resource: "testtypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexample3v1.TestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -101,17 +153,57 @@ func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexample3v1.TestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *testTypeInformer) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexample3v1.TestType](f.factory.InformerFor(&apisexample3v1.TestType{}, f.defaultInformer)) } func (f *testTypeInformer) Lister() example3v1.TestTypeLister { return example3v1.NewTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedTestTypeInformer converts an untyped informer into a TypedTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TypedTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedTestTypeInformer(informer TestTypeInformer) TypedTestTypeInformer { + if informer, ok := informer.(TypedTestTypeInformer); ok { + return informer + } + return &testTypeTypedInformerAdapter{informer} +} + +type testTypeTypedInformerAdapter struct { + TestTypeInformer +} + +func (a *testTypeTypedInformerAdapter) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexample3v1.TestType](a.Informer()) +} + +// ToTestTypeIndexInformer converts an untyped informer into a TestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a TestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToTestTypeIndexInformer(informer cache.SharedIndexInformer) TestTypeIndexInformer { + if informer, ok := informer.(TestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexample3v1.TestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/exampledashed/v1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/exampledashed/v1/clustertesttype.go index f246686119a..80a78a0bce9 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/exampledashed/v1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/exampledashed/v1/clustertesttype.go @@ -35,12 +35,40 @@ import ( ) // ClusterTestTypeInformer provides access to a shared informer and lister for -// ClusterTestTypes. +// ClusterTestTypes. Prefer using the type-safe variant (see [TypedClusterTestTypeInformer]). type ClusterTestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() exampledashedv1.ClusterTestTypeLister } +// TypedClusterTestTypeInformer provides access to a shared informer and lister for +// ClusterTestTypes, including the type-safe TypedInformer variant. +// It is a superset of ClusterTestTypeInformer. +type TypedClusterTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterTestTypeIndexInformer + Lister() exampledashedv1.ClusterTestTypeLister +} + +// ClusterTestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterTestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexampledashedv1.ClusterTestType] + +// ClusterTestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterTestType. +type ClusterTestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexampledashedv1.ClusterTestType] + +// ClusterTestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterTestType. +type ClusterTestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexampledashedv1.ClusterTestType] + +// ClusterTestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterTestType. +type ClusterTestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexampledashedv1.ClusterTestType] + +// ClusterTestTypeIndexers is a specialization of [cache.TypedIndexers] for ClusterTestType. +type ClusterTestTypeIndexers = cache.TypedIndexers[*apisexampledashedv1.ClusterTestType] + +// DeletedClusterTestType is a specialization of [cache.DeletedObject] for ClusterTestType. +type DeletedClusterTestType = cache.DeletedObject[*apisexampledashedv1.ClusterTestType] + type clusterTestTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type clusterTestTypeInformer struct { // NewClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformer]). func NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterTestTypeInformer]). func NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformerWithOptions]). func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, options) +} + +// NewTypedClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) ClusterTestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "example-dashed.some.corp", Version: "v1", Resource: "clustertesttypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexampledashedv1.ClusterTestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options i Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexampledashedv1.ClusterTestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterTestTypeInformer) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexampledashedv1.ClusterTestType](f.factory.InformerFor(&apisexampledashedv1.ClusterTestType{}, f.defaultInformer)) } func (f *clusterTestTypeInformer) Lister() exampledashedv1.ClusterTestTypeLister { return exampledashedv1.NewClusterTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedClusterTestTypeInformer converts an untyped informer into a TypedClusterTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// TypedClusterTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterTestTypeInformer(informer ClusterTestTypeInformer) TypedClusterTestTypeInformer { + if informer, ok := informer.(TypedClusterTestTypeInformer); ok { + return informer + } + return &clusterTestTypeTypedInformerAdapter{informer} +} + +type clusterTestTypeTypedInformerAdapter struct { + ClusterTestTypeInformer +} + +func (a *clusterTestTypeTypedInformerAdapter) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexampledashedv1.ClusterTestType](a.Informer()) +} + +// ToClusterTestTypeIndexInformer converts an untyped informer into a ClusterTestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// ClusterTestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterTestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterTestTypeIndexInformer(informer cache.SharedIndexInformer) ClusterTestTypeIndexInformer { + if informer, ok := informer.(ClusterTestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexampledashedv1.ClusterTestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/exampledashed/v1/interface.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/exampledashed/v1/interface.go index 3b27ed16aa8..80a0582af08 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/exampledashed/v1/interface.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/exampledashed/v1/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ClusterTestTypes returns a ClusterTestTypeInformer. - ClusterTestTypes() ClusterTestTypeInformer + ClusterTestTypes() TypedClusterTestTypeInformer // TestTypes returns a TestTypeInformer. - TestTypes() TestTypeInformer + TestTypes() TypedTestTypeInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ClusterTestTypes returns a ClusterTestTypeInformer. -func (v *version) ClusterTestTypes() ClusterTestTypeInformer { +// ClusterTestTypes returns a TypedClusterTestTypeInformer. +func (v *version) ClusterTestTypes() TypedClusterTestTypeInformer { return &clusterTestTypeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// TestTypes returns a TestTypeInformer. -func (v *version) TestTypes() TestTypeInformer { +// TestTypes returns a TypedTestTypeInformer. +func (v *version) TestTypes() TypedTestTypeInformer { return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/exampledashed/v1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/exampledashed/v1/testtype.go index d9a97b78b74..227dc507291 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/exampledashed/v1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/exampledashed/v1/testtype.go @@ -35,12 +35,40 @@ import ( ) // TestTypeInformer provides access to a shared informer and lister for -// TestTypes. +// TestTypes. Prefer using the type-safe variant (see [TypedTestTypeInformer]). type TestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() exampledashedv1.TestTypeLister } +// TypedTestTypeInformer provides access to a shared informer and lister for +// TestTypes, including the type-safe TypedInformer variant. +// It is a superset of TestTypeInformer. +type TypedTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() TestTypeIndexInformer + Lister() exampledashedv1.TestTypeLister +} + +// TestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type TestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexampledashedv1.TestType] + +// TestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for TestType. +type TestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexampledashedv1.TestType] + +// TestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for TestType. +type TestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexampledashedv1.TestType] + +// TestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for TestType. +type TestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexampledashedv1.TestType] + +// TestTypeIndexers is a specialization of [cache.TypedIndexers] for TestType. +type TestTypeIndexers = cache.TypedIndexers[*apisexampledashedv1.TestType] + +// DeletedTestType is a specialization of [cache.DeletedObject] for TestType. +type DeletedTestType = cache.DeletedObject[*apisexampledashedv1.TestType] + type testTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -50,25 +78,49 @@ type testTypeInformer struct { // NewTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformer]). func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredTestTypeInformer]). func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformerWithOptions]). func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, options) +} + +// NewTypedTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) TestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "example-dashed.some.corp", Version: "v1", Resource: "testtypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexampledashedv1.TestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -101,17 +153,57 @@ func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexampledashedv1.TestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *testTypeInformer) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexampledashedv1.TestType](f.factory.InformerFor(&apisexampledashedv1.TestType{}, f.defaultInformer)) } func (f *testTypeInformer) Lister() exampledashedv1.TestTypeLister { return exampledashedv1.NewTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedTestTypeInformer converts an untyped informer into a TypedTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TypedTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedTestTypeInformer(informer TestTypeInformer) TypedTestTypeInformer { + if informer, ok := informer.(TypedTestTypeInformer); ok { + return informer + } + return &testTypeTypedInformerAdapter{informer} +} + +type testTypeTypedInformerAdapter struct { + TestTypeInformer +} + +func (a *testTypeTypedInformerAdapter) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexampledashedv1.TestType](a.Informer()) +} + +// ToTestTypeIndexInformer converts an untyped informer into a TestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a TestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToTestTypeIndexInformer(informer cache.SharedIndexInformer) TestTypeIndexInformer { + if informer, ok := informer.(TestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexampledashedv1.TestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/clustertesttype.go index c3a9f10cd76..864b2be5fb6 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/clustertesttype.go @@ -35,12 +35,40 @@ import ( ) // ClusterTestTypeInformer provides access to a shared informer and lister for -// ClusterTestTypes. +// ClusterTestTypes. Prefer using the type-safe variant (see [TypedClusterTestTypeInformer]). type ClusterTestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() existinginterfacesv1.ClusterTestTypeLister } +// TypedClusterTestTypeInformer provides access to a shared informer and lister for +// ClusterTestTypes, including the type-safe TypedInformer variant. +// It is a superset of ClusterTestTypeInformer. +type TypedClusterTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterTestTypeIndexInformer + Lister() existinginterfacesv1.ClusterTestTypeLister +} + +// ClusterTestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterTestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexistinginterfacesv1.ClusterTestType] + +// ClusterTestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterTestType. +type ClusterTestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexistinginterfacesv1.ClusterTestType] + +// ClusterTestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterTestType. +type ClusterTestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexistinginterfacesv1.ClusterTestType] + +// ClusterTestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterTestType. +type ClusterTestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexistinginterfacesv1.ClusterTestType] + +// ClusterTestTypeIndexers is a specialization of [cache.TypedIndexers] for ClusterTestType. +type ClusterTestTypeIndexers = cache.TypedIndexers[*apisexistinginterfacesv1.ClusterTestType] + +// DeletedClusterTestType is a specialization of [cache.DeletedObject] for ClusterTestType. +type DeletedClusterTestType = cache.DeletedObject[*apisexistinginterfacesv1.ClusterTestType] + type clusterTestTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type clusterTestTypeInformer struct { // NewClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformer]). func NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterTestTypeInformer]). func NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformerWithOptions]). func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, options) +} + +// NewTypedClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) ClusterTestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "existinginterfaces.acme.corp", Version: "v1", Resource: "clustertesttypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexistinginterfacesv1.ClusterTestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options i Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexistinginterfacesv1.ClusterTestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterTestTypeInformer) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexistinginterfacesv1.ClusterTestType](f.factory.InformerFor(&apisexistinginterfacesv1.ClusterTestType{}, f.defaultInformer)) } func (f *clusterTestTypeInformer) Lister() existinginterfacesv1.ClusterTestTypeLister { return existinginterfacesv1.NewClusterTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedClusterTestTypeInformer converts an untyped informer into a TypedClusterTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// TypedClusterTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterTestTypeInformer(informer ClusterTestTypeInformer) TypedClusterTestTypeInformer { + if informer, ok := informer.(TypedClusterTestTypeInformer); ok { + return informer + } + return &clusterTestTypeTypedInformerAdapter{informer} +} + +type clusterTestTypeTypedInformerAdapter struct { + ClusterTestTypeInformer +} + +func (a *clusterTestTypeTypedInformerAdapter) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexistinginterfacesv1.ClusterTestType](a.Informer()) +} + +// ToClusterTestTypeIndexInformer converts an untyped informer into a ClusterTestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// ClusterTestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterTestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterTestTypeIndexInformer(informer cache.SharedIndexInformer) ClusterTestTypeIndexInformer { + if informer, ok := informer.(ClusterTestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexistinginterfacesv1.ClusterTestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/interface.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/interface.go index 3b27ed16aa8..80a0582af08 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/interface.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ClusterTestTypes returns a ClusterTestTypeInformer. - ClusterTestTypes() ClusterTestTypeInformer + ClusterTestTypes() TypedClusterTestTypeInformer // TestTypes returns a TestTypeInformer. - TestTypes() TestTypeInformer + TestTypes() TypedTestTypeInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ClusterTestTypes returns a ClusterTestTypeInformer. -func (v *version) ClusterTestTypes() ClusterTestTypeInformer { +// ClusterTestTypes returns a TypedClusterTestTypeInformer. +func (v *version) ClusterTestTypes() TypedClusterTestTypeInformer { return &clusterTestTypeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// TestTypes returns a TestTypeInformer. -func (v *version) TestTypes() TestTypeInformer { +// TestTypes returns a TypedTestTypeInformer. +func (v *version) TestTypes() TypedTestTypeInformer { return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/testtype.go index de602f506dd..1752bf13a4f 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/testtype.go @@ -35,12 +35,40 @@ import ( ) // TestTypeInformer provides access to a shared informer and lister for -// TestTypes. +// TestTypes. Prefer using the type-safe variant (see [TypedTestTypeInformer]). type TestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() existinginterfacesv1.TestTypeLister } +// TypedTestTypeInformer provides access to a shared informer and lister for +// TestTypes, including the type-safe TypedInformer variant. +// It is a superset of TestTypeInformer. +type TypedTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() TestTypeIndexInformer + Lister() existinginterfacesv1.TestTypeLister +} + +// TestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type TestTypeIndexInformer cache.TypedSharedIndexInformer[*apisexistinginterfacesv1.TestType] + +// TestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for TestType. +type TestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apisexistinginterfacesv1.TestType] + +// TestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for TestType. +type TestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apisexistinginterfacesv1.TestType] + +// TestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for TestType. +type TestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apisexistinginterfacesv1.TestType] + +// TestTypeIndexers is a specialization of [cache.TypedIndexers] for TestType. +type TestTypeIndexers = cache.TypedIndexers[*apisexistinginterfacesv1.TestType] + +// DeletedTestType is a specialization of [cache.DeletedObject] for TestType. +type DeletedTestType = cache.DeletedObject[*apisexistinginterfacesv1.TestType] + type testTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -50,25 +78,49 @@ type testTypeInformer struct { // NewTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformer]). func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredTestTypeInformer]). func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformerWithOptions]). func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, options) +} + +// NewTypedTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) TestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "existinginterfaces.acme.corp", Version: "v1", Resource: "testtypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apisexistinginterfacesv1.TestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -101,17 +153,57 @@ func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apisexistinginterfacesv1.TestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *testTypeInformer) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexistinginterfacesv1.TestType](f.factory.InformerFor(&apisexistinginterfacesv1.TestType{}, f.defaultInformer)) } func (f *testTypeInformer) Lister() existinginterfacesv1.TestTypeLister { return existinginterfacesv1.NewTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedTestTypeInformer converts an untyped informer into a TypedTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TypedTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedTestTypeInformer(informer TestTypeInformer) TypedTestTypeInformer { + if informer, ok := informer.(TypedTestTypeInformer); ok { + return informer + } + return &testTypeTypedInformerAdapter{informer} +} + +type testTypeTypedInformerAdapter struct { + TestTypeInformer +} + +func (a *testTypeTypedInformerAdapter) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apisexistinginterfacesv1.TestType](a.Informer()) +} + +// ToTestTypeIndexInformer converts an untyped informer into a TestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a TestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToTestTypeIndexInformer(informer cache.SharedIndexInformer) TestTypeIndexInformer { + if informer, ok := informer.(TestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apisexistinginterfacesv1.TestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/factory.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/factory.go index f97c4b642c0..cb9948ef037 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/factory.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/factory.go @@ -258,7 +258,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(...) @@ -316,7 +316,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 diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/secondexample/v1/clustertesttype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/secondexample/v1/clustertesttype.go index 01d1d095496..4f5fe37b1dc 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/secondexample/v1/clustertesttype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/secondexample/v1/clustertesttype.go @@ -35,12 +35,40 @@ import ( ) // ClusterTestTypeInformer provides access to a shared informer and lister for -// ClusterTestTypes. +// ClusterTestTypes. Prefer using the type-safe variant (see [TypedClusterTestTypeInformer]). type ClusterTestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() secondexamplev1.ClusterTestTypeLister } +// TypedClusterTestTypeInformer provides access to a shared informer and lister for +// ClusterTestTypes, including the type-safe TypedInformer variant. +// It is a superset of ClusterTestTypeInformer. +type TypedClusterTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() ClusterTestTypeIndexInformer + Lister() secondexamplev1.ClusterTestTypeLister +} + +// ClusterTestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type ClusterTestTypeIndexInformer cache.TypedSharedIndexInformer[*apissecondexamplev1.ClusterTestType] + +// ClusterTestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for ClusterTestType. +type ClusterTestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apissecondexamplev1.ClusterTestType] + +// ClusterTestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for ClusterTestType. +type ClusterTestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apissecondexamplev1.ClusterTestType] + +// ClusterTestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for ClusterTestType. +type ClusterTestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apissecondexamplev1.ClusterTestType] + +// ClusterTestTypeIndexers is a specialization of [cache.TypedIndexers] for ClusterTestType. +type ClusterTestTypeIndexers = cache.TypedIndexers[*apissecondexamplev1.ClusterTestType] + +// DeletedClusterTestType is a specialization of [cache.DeletedObject] for ClusterTestType. +type DeletedClusterTestType = cache.DeletedObject[*apissecondexamplev1.ClusterTestType] + type clusterTestTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -49,25 +77,49 @@ type clusterTestTypeInformer struct { // NewClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformer]). func NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredClusterTestTypeInformer]). func NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers ClusterTestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) ClusterTestTypeIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedClusterTestTypeInformerWithOptions]). func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedClusterTestTypeInformerWithOptions(client, options) +} + +// NewTypedClusterTestTypeInformerWithOptions constructs a new informer for ClusterTestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedClusterTestTypeInformerWithOptions(client versioned.Interface, options internalinterfaces.InformerOptions) ClusterTestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "secondexample.dev", Version: "v1", Resource: "clustertesttypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apissecondexamplev1.ClusterTestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -100,17 +152,57 @@ func NewClusterTestTypeInformerWithOptions(client versioned.Interface, options i Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedClusterTestTypeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apissecondexamplev1.ClusterTestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *clusterTestTypeInformer) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apissecondexamplev1.ClusterTestType](f.factory.InformerFor(&apissecondexamplev1.ClusterTestType{}, f.defaultInformer)) } func (f *clusterTestTypeInformer) Lister() secondexamplev1.ClusterTestTypeLister { return secondexamplev1.NewClusterTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedClusterTestTypeInformer converts an untyped informer into a TypedClusterTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// TypedClusterTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedClusterTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedClusterTestTypeInformer(informer ClusterTestTypeInformer) TypedClusterTestTypeInformer { + if informer, ok := informer.(TypedClusterTestTypeInformer); ok { + return informer + } + return &clusterTestTypeTypedInformerAdapter{informer} +} + +type clusterTestTypeTypedInformerAdapter struct { + ClusterTestTypeInformer +} + +func (a *clusterTestTypeTypedInformerAdapter) TypedInformer() ClusterTestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apissecondexamplev1.ClusterTestType](a.Informer()) +} + +// ToClusterTestTypeIndexInformer converts an untyped informer into a ClusterTestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *ClusterTestType. If that is not the case, calling type-safe methods of the returned +// ClusterTestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a ClusterTestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToClusterTestTypeIndexInformer(informer cache.SharedIndexInformer) ClusterTestTypeIndexInformer { + if informer, ok := informer.(ClusterTestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apissecondexamplev1.ClusterTestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/secondexample/v1/interface.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/secondexample/v1/interface.go index 3b27ed16aa8..80a0582af08 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/secondexample/v1/interface.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/secondexample/v1/interface.go @@ -25,9 +25,9 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { // ClusterTestTypes returns a ClusterTestTypeInformer. - ClusterTestTypes() ClusterTestTypeInformer + ClusterTestTypes() TypedClusterTestTypeInformer // TestTypes returns a TestTypeInformer. - TestTypes() TestTypeInformer + TestTypes() TypedTestTypeInformer } type version struct { @@ -41,12 +41,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// ClusterTestTypes returns a ClusterTestTypeInformer. -func (v *version) ClusterTestTypes() ClusterTestTypeInformer { +// ClusterTestTypes returns a TypedClusterTestTypeInformer. +func (v *version) ClusterTestTypes() TypedClusterTestTypeInformer { return &clusterTestTypeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } -// TestTypes returns a TestTypeInformer. -func (v *version) TestTypes() TestTypeInformer { +// TestTypes returns a TypedTestTypeInformer. +func (v *version) TestTypes() TypedTestTypeInformer { return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/secondexample/v1/testtype.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/secondexample/v1/testtype.go index 15dc4fb33a8..a2d90409909 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/secondexample/v1/testtype.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/generated/informers/externalversions/secondexample/v1/testtype.go @@ -35,12 +35,40 @@ import ( ) // TestTypeInformer provides access to a shared informer and lister for -// TestTypes. +// TestTypes. Prefer using the type-safe variant (see [TypedTestTypeInformer]). type TestTypeInformer interface { Informer() cache.SharedIndexInformer Lister() secondexamplev1.TestTypeLister } +// TypedTestTypeInformer provides access to a shared informer and lister for +// TestTypes, including the type-safe TypedInformer variant. +// It is a superset of TestTypeInformer. +type TypedTestTypeInformer interface { + Informer() cache.SharedIndexInformer + TypedInformer() TestTypeIndexInformer + Lister() secondexamplev1.TestTypeLister +} + +// TestTypeIndexInformer is a wrapper around the underlying [cache.SharedIndexInformer] +// with type-safe variants of several methods. +type TestTypeIndexInformer cache.TypedSharedIndexInformer[*apissecondexamplev1.TestType] + +// TestTypeHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerFuncs] for TestType. +type TestTypeHandlerFuncs = cache.TypedResourceEventHandlerFuncs[*apissecondexamplev1.TestType] + +// TestTypeDetailedHandlerFuncs is a specialization of [cache.TypedResourceEventHandlerDetailedFuncs] for TestType. +type TestTypeDetailedHandlerFuncs = cache.TypedResourceEventHandlerDetailedFuncs[*apissecondexamplev1.TestType] + +// TestTypeFilteringHandler is a specialization of [cache.TypedFilteringResourceEventHandler] for TestType. +type TestTypeFilteringHandler = cache.TypedFilteringResourceEventHandler[*apissecondexamplev1.TestType] + +// TestTypeIndexers is a specialization of [cache.TypedIndexers] for TestType. +type TestTypeIndexers = cache.TypedIndexers[*apissecondexamplev1.TestType] + +// DeletedTestType is a specialization of [cache.DeletedObject] for TestType. +type DeletedTestType = cache.DeletedObject[*apissecondexamplev1.TestType] + type testTypeInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc @@ -50,25 +78,49 @@ type testTypeInformer struct { // NewTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformer]). func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } +// NewTypedTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers)}) +} + // NewFilteredTestTypeInformer constructs a new informer for TestType type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedFilteredTestTypeInformer]). func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewTypedFilteredTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers TestTypeIndexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) TestTypeIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.TypedIndexersToIndexers(indexers), TweakListOptions: tweakListOptions}) } // NewTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. +// If you really need an independent one, prefer using the type-safe variant (see [NewTypedTestTypeInformerWithOptions]). func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + return NewTypedTestTypeInformerWithOptions(client, namespace, options) +} + +// NewTypedTestTypeInformerWithOptions constructs a new informer for TestType type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTypedTestTypeInformerWithOptions(client versioned.Interface, namespace string, options internalinterfaces.InformerOptions) TestTypeIndexInformer { gvr := schema.GroupVersionResource{Group: "secondexample.dev", Version: "v1", Resource: "testtypes"} identifier := options.InformerName.WithResource(gvr) tweakListOptions := options.TweakListOptions - return cache.NewSharedIndexInformerWithOptions( + return cache.NewTypedSharedIndexInformer[*apissecondexamplev1.TestType](cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { @@ -101,17 +153,57 @@ func NewTestTypeInformerWithOptions(client versioned.Interface, namespace string Indexers: options.Indexers, Identifier: identifier, }, - ) + )) } func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) + return NewTypedTestTypeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *testTypeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apissecondexamplev1.TestType{}, f.defaultInformer) + return f.TypedInformer() +} + +func (f *testTypeInformer) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apissecondexamplev1.TestType](f.factory.InformerFor(&apissecondexamplev1.TestType{}, f.defaultInformer)) } func (f *testTypeInformer) Lister() secondexamplev1.TestTypeLister { return secondexamplev1.NewTestTypeLister(f.Informer().GetIndexer()) } + +// ToTypedTestTypeInformer converts an untyped informer into a TypedTestTypeInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TypedTestTypeInformer leads to runtime panics. A safer alternative is to pass +// around a TypedTestTypeInformer instances that was obtained from a +// SharedInformerFactory. +func ToTypedTestTypeInformer(informer TestTypeInformer) TypedTestTypeInformer { + if informer, ok := informer.(TypedTestTypeInformer); ok { + return informer + } + return &testTypeTypedInformerAdapter{informer} +} + +type testTypeTypedInformerAdapter struct { + TestTypeInformer +} + +func (a *testTypeTypedInformerAdapter) TypedInformer() TestTypeIndexInformer { + return cache.NewTypedSharedIndexInformer[*apissecondexamplev1.TestType](a.Informer()) +} + +// ToTestTypeIndexInformer converts an untyped informer into a TestTypeIndexInformer. +// +// WARNING: this conversion is only safe if the informer handles objects of type +// *TestType. If that is not the case, calling type-safe methods of the returned +// TestTypeIndexInformer leads to runtime panics. A safer alternative is to pass +// around a TestTypeIndexInformer instances that was obtained from a +// SharedInformerFactory. +func ToTestTypeIndexInformer(informer cache.SharedIndexInformer) TestTypeIndexInformer { + if informer, ok := informer.(TestTypeIndexInformer); ok { + return informer + } + return cache.NewTypedSharedIndexInformer[*apissecondexamplev1.TestType](informer) +} diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcp/clients/clientset/versioned/clientset.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcp/clients/clientset/versioned/clientset.go index cd632190092..1faddec05d9 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcp/clients/clientset/versioned/clientset.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcp/clients/clientset/versioned/clientset.go @@ -42,7 +42,7 @@ import ( type ClusterInterface interface { Cluster(logicalcluster.Path) client.Interface - Discovery() discovery.DiscoveryInterface + Discovery() discovery.DiscoveryInterfaces ExampleV1() examplev1.ExampleV1ClusterInterface ExampleV1alpha1() examplev1alpha1.ExampleV1alpha1ClusterInterface ExampleV1beta1() examplev1beta1.ExampleV1beta1ClusterInterface @@ -68,7 +68,7 @@ type ClusterClientset struct { } // Discovery retrieves the DiscoveryClient. -func (c *ClusterClientset) Discovery() discovery.DiscoveryInterface { +func (c *ClusterClientset) Discovery() discovery.DiscoveryInterfaces { if c == nil { return nil } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcp/clients/clientset/versioned/fake/clientset.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcp/clients/clientset/versioned/fake/clientset.go index c1ecd4f2f40..a06411623b5 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcp/clients/clientset/versioned/fake/clientset.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcp/clients/clientset/versioned/fake/clientset.go @@ -86,7 +86,7 @@ type ClusterClientset struct { var _ kcpclientset.ClusterInterface = (*ClusterClientset)(nil) // Discovery retrieves the DiscoveryClient -func (c *ClusterClientset) Discovery() discovery.DiscoveryInterface { +func (c *ClusterClientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } @@ -184,7 +184,7 @@ var ( _ kcptesting.FakeScopedClient = &Clientset{} ) -func (c *Clientset) Discovery() discovery.DiscoveryInterface { +func (c *Clientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcp/clients/informers/externalversions/factory.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcp/clients/informers/externalversions/factory.go index aaf5c336abc..59e4e7d23df 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcp/clients/informers/externalversions/factory.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcp/clients/informers/externalversions/factory.go @@ -232,7 +232,7 @@ type ScopedDynamicSharedInformerFactory interface { // 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() // factory.Start(ctx.Done()) // Start processing these informers. diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcpexisting/clients/clientset/versioned/clientset.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcpexisting/clients/clientset/versioned/clientset.go index ba8558b9b31..c426edb1296 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcpexisting/clients/clientset/versioned/clientset.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcpexisting/clients/clientset/versioned/clientset.go @@ -42,7 +42,7 @@ import ( type ClusterInterface interface { Cluster(logicalcluster.Path) client.Interface - Discovery() discovery.DiscoveryInterface + Discovery() discovery.DiscoveryInterfaces ExampleV1() examplev1.ExampleV1ClusterInterface ExampleV1alpha1() examplev1alpha1.ExampleV1alpha1ClusterInterface ExampleV1beta1() examplev1beta1.ExampleV1beta1ClusterInterface @@ -68,7 +68,7 @@ type ClusterClientset struct { } // Discovery retrieves the DiscoveryClient. -func (c *ClusterClientset) Discovery() discovery.DiscoveryInterface { +func (c *ClusterClientset) Discovery() discovery.DiscoveryInterfaces { if c == nil { return nil } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcpexisting/clients/clientset/versioned/fake/clientset.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcpexisting/clients/clientset/versioned/fake/clientset.go index aae6ee25caa..ffd0cc1f6d6 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcpexisting/clients/clientset/versioned/fake/clientset.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcpexisting/clients/clientset/versioned/fake/clientset.go @@ -86,7 +86,7 @@ type ClusterClientset struct { var _ kcpclientset.ClusterInterface = (*ClusterClientset)(nil) // Discovery retrieves the DiscoveryClient -func (c *ClusterClientset) Discovery() discovery.DiscoveryInterface { +func (c *ClusterClientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } @@ -184,7 +184,7 @@ var ( _ kcptesting.FakeScopedClient = &Clientset{} ) -func (c *Clientset) Discovery() discovery.DiscoveryInterface { +func (c *Clientset) Discovery() discovery.DiscoveryInterfaces { return c.discovery } diff --git a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcpexisting/clients/informers/externalversions/factory.go b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcpexisting/clients/informers/externalversions/factory.go index e185be81b20..367756e282c 100644 --- a/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcpexisting/clients/informers/externalversions/factory.go +++ b/staging/src/github.com/kcp-dev/code-generator/examples/pkg/kcpexisting/clients/informers/externalversions/factory.go @@ -232,7 +232,7 @@ type ScopedDynamicSharedInformerFactory interface { // 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() // factory.Start(ctx.Done()) // Start processing these informers. diff --git a/staging/src/github.com/kcp-dev/code-generator/go.mod b/staging/src/github.com/kcp-dev/code-generator/go.mod index 59cba74d790..bf9c218e444 100644 --- a/staging/src/github.com/kcp-dev/code-generator/go.mod +++ b/staging/src/github.com/kcp-dev/code-generator/go.mod @@ -3,16 +3,17 @@ module github.com/kcp-dev/code-generator/v3 go 1.26.0 require ( - github.com/spf13/pflag v1.0.9 - golang.org/x/text v0.33.0 - k8s.io/code-generator v0.36.0 - k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b + github.com/spf13/pflag v1.0.10 + golang.org/x/text v0.40.0 + k8s.io/code-generator v0.37.0 + k8s.io/gengo/v2 v2.0.0-20260408192533-25e2208e0dc3 k8s.io/klog/v2 v2.140.0 ) require ( github.com/go-logr/logr v1.4.3 // indirect - golang.org/x/mod v0.32.0 // indirect - golang.org/x/sync v0.19.0 // indirect - golang.org/x/tools v0.41.0 // indirect + golang.org/x/mod v0.37.0 // indirect + golang.org/x/sync v0.22.0 // indirect + golang.org/x/tools v0.47.0 // indirect + k8s.io/apimachinery v0.37.0 // indirect ) diff --git a/staging/src/github.com/kcp-dev/code-generator/go.sum b/staging/src/github.com/kcp-dev/code-generator/go.sum index 0798971b652..fb20d41de89 100644 --- a/staging/src/github.com/kcp-dev/code-generator/go.sum +++ b/staging/src/github.com/kcp-dev/code-generator/go.sum @@ -2,19 +2,21 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= -github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= -golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= -golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= -golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= -golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= -golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc= -golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg= -k8s.io/code-generator v0.36.0 h1:XWAkrhnArm0VWMmSFO7kyB+wE2LROwep7hEH0GPGkqA= -k8s.io/code-generator v0.36.0/go.mod h1:Tr2UhfBRdlyRoadfob9aPCmmGe8PUs5XPK9MEJ2nx+w= -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= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ= +golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= +golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= +golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q= +golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA= +k8s.io/apimachinery v0.37.0 h1:Np2AbDtf8x6RDHiD8T9LbKJ9gaegeVNa8yNm5FuGKm0= +k8s.io/apimachinery v0.37.0/go.mod h1:RN3nhprFSCxOi5Selxd7oMTXOe/c+ZbcE7Im+TS2zkE= +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/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=