From 82387790650b5ba3a2bcd49e10522741775b5dc9 Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Tue, 24 Sep 2024 13:13:15 -0700 Subject: [PATCH] Update k8s libraries to v1.31.1 (#6681) - Update K8s libraries to v1.31.1 - Update sigs.k8s.io/controller-runtime to v0.19.0 - Update controller-gen to v0.16.3 - Use ubuntu:24.04 as base image for codegen Some of the key changes that were caused by these updates: - Most functions in `k8s.io/client-go/util/workqueue` have been deprecated and were replaced with typed functions (using Go generics) - The `Version` field no longer exists in the generic apiserver config. It has been replaced with `EffectiveVersion` (this is because kube-apiserver now supports version emulation for more robust K8s version upgrades). `EffectiveVersion` is not required (`Version` used to be optional), and I am not sure whether that was an intentional change. `EffectiveVersion` is used (instead of `Version`) to configure the `/version` route. At the moment we have no intention of supporting version emulation in the Antrea Controller, but we could in the future. As far as I can tell, other changes relating to version emulation support do not affect Antrea. - The arguments to code generators have changed quite a bit. - The code generated for client-go (by `client-gen`) is now more generic (it leverages Go generics), so as a result the generated code is less verbose. - controller-gen now requires uniqueness for controller names (across all controllers in the program), for metrics reporting purposes. Because of this, we had to assign unique names manually to all controllers (and the name validation needs to be explicitly skipped in unit tests). --- build/images/codegen/Dockerfile | 8 +- build/images/codegen/README.md | 3 +- cmd/antrea-agent/agent.go | 2 +- cmd/antrea-agent/options_test.go | 8 +- cmd/antrea-controller/controller.go | 2 + cmd/flow-aggregator/flow-aggregator.go | 8 +- go.mod | 96 +- go.sum | 235 ++- hack/update-codegen-dockerized.sh | 81 +- hack/update-codegen.sh | 2 +- multicluster/Makefile | 2 +- .../antrea-multicluster-leader-global.yml | 174 +- .../yamls/antrea-multicluster-leader.yml | 174 +- .../yamls/antrea-multicluster-member.yml | 8 +- .../clusterset_webhook.go | 2 +- .../gateway_webhook.go | 2 +- .../multicluster-controller/leader_test.go | 23 +- .../multicluster-controller/member_test.go | 21 +- .../memberclusterannounce_webhook.go | 2 +- ...ticluster.crd.antrea.io_clusterclaims.yaml | 2 +- ...ster.crd.antrea.io_clusterinfoimports.yaml | 2 +- ...ulticluster.crd.antrea.io_clustersets.yaml | 2 +- .../multicluster.crd.antrea.io_gateways.yaml | 2 +- ...cluster.crd.antrea.io_labelidentities.yaml | 2 +- ....crd.antrea.io_memberclusterannounces.yaml | 2 +- ...cluster.crd.antrea.io_resourceexports.yaml | 93 +- ...cluster.crd.antrea.io_resourceimports.yaml | 77 +- multicluster/config/rbac/role.yaml | 168 +- .../leader/clusterset_controller.go | 1 + .../leader/labelidentity_export_controller.go | 34 +- .../memberclusterannounce_controller.go | 1 + .../leader/resourceexport_controller.go | 1 + .../multicluster/leader/stale_controller.go | 1 + .../member/clusterset_controller.go | 1 + .../multicluster/member/gateway_controller.go | 1 + .../member/labelidentity_controller.go | 46 +- .../member/labelidentity_import_controller.go | 1 + .../multicluster/member/node_controller.go | 1 + .../member/resourceimport_controller.go | 1 + .../member/resourceimport_controller_test.go | 9 +- .../member/serviceexport_controller.go | 2 + .../hack/update-codegen-dockerized.sh | 21 +- multicluster/hack/update-codegen.sh | 2 +- multicluster/hack/verify-tools.sh | 2 +- .../versioned/fake/clientset_generated.go | 8 +- .../v1alpha1/clusterinfoimport.go | 148 +- .../typed/multicluster/v1alpha1/clusterset.go | 148 +- .../v1alpha1/fake/fake_clusterinfoimport.go | 36 +- .../v1alpha1/fake/fake_clusterset.go | 36 +- .../v1alpha1/fake/fake_gateway.go | 29 +- .../v1alpha1/fake/fake_labelidentity.go | 29 +- .../fake/fake_memberclusterannounce.go | 29 +- .../v1alpha1/fake/fake_resourceexport.go | 36 +- .../v1alpha1/fake/fake_resourceimport.go | 36 +- .../typed/multicluster/v1alpha1/gateway.go | 131 +- .../multicluster/v1alpha1/labelidentity.go | 121 +- .../v1alpha1/memberclusterannounce.go | 131 +- .../multicluster/v1alpha1/resourceexport.go | 148 +- .../multicluster/v1alpha1/resourceimport.go | 148 +- .../multicluster/v1alpha2/clusterclaim.go | 131 +- .../typed/multicluster/v1alpha2/clusterset.go | 148 +- .../v1alpha2/fake/fake_clusterclaim.go | 29 +- .../v1alpha2/fake/fake_clusterset.go | 36 +- .../informers/externalversions/factory.go | 1 + .../v1alpha1/clusterinfoimport.go | 41 +- .../multicluster/v1alpha1/clusterset.go | 41 +- .../listers/multicluster/v1alpha1/gateway.go | 41 +- .../multicluster/v1alpha1/labelidentity.go | 28 +- .../v1alpha1/memberclusterannounce.go | 41 +- .../multicluster/v1alpha1/resourceexport.go | 41 +- .../multicluster/v1alpha1/resourceimport.go | 41 +- .../multicluster/v1alpha2/clusterclaim.go | 41 +- .../multicluster/v1alpha2/clusterset.go | 41 +- .../mocks/mock_controller_runtime_manager.go | 42 +- pkg/agent/apiserver/apiserver.go | 16 +- pkg/agent/apiserver/apiserver_test.go | 7 +- pkg/agent/client/endpoint_resolver.go | 9 +- pkg/agent/controller/bgp/controller.go | 9 +- .../controller/egress/egress_controller.go | 23 +- .../egress/egress_controller_test.go | 14 +- pkg/agent/controller/egress/ip_scheduler.go | 4 +- .../ipsec_certificate_controller.go | 21 +- .../l7_flow_export_controller.go | 22 +- .../l7_flow_export_controller_test.go | 14 +- .../controller/networkpolicy/allocator.go | 34 +- .../networkpolicy/allocator_test.go | 2 +- pkg/agent/controller/networkpolicy/fqdn.go | 21 +- .../controller/networkpolicy/fqdn_test.go | 2 +- .../networkpolicy/networkpolicy_controller.go | 17 +- .../networkpolicy/status_controller.go | 25 +- .../noderoute/node_route_controller.go | 44 +- .../serviceexternalip/controller.go | 23 +- .../serviceexternalip/controller_test.go | 15 +- .../traceflow/traceflow_controller.go | 29 +- .../traceflow/traceflow_controller_test.go | 9 +- .../controller/trafficcontrol/controller.go | 22 +- .../trafficcontrol/controller_test.go | 32 +- .../externalnode/external_node_controller.go | 31 +- .../external_node_controller_test.go | 2 - pkg/agent/memberlist/cluster.go | 25 +- pkg/agent/multicast/mcast_controller.go | 66 +- pkg/agent/multicast/mcast_controller_test.go | 30 +- pkg/agent/multicluster/mc_route_controller.go | 42 +- .../multicluster/mc_route_controller_test.go | 14 +- .../multicluster/pod_route_controller.go | 46 +- .../stretched_networkpolicy_controller.go | 22 +- pkg/agent/nodeportlocal/k8s/npl_controller.go | 19 +- pkg/agent/proxy/proxier_test.go | 2 +- .../secondarynetwork/podwatch/controller.go | 18 +- .../podwatch/controller_test.go | 9 +- pkg/agent/servicecidr/discoverer.go | 9 +- .../support_bundle_controller.go | 27 +- pkg/apis/controlplane/v1beta2/generated.pb.go | 1 + pkg/apis/controlplane/v1beta2/generated.proto | 50 +- pkg/apis/stats/v1alpha1/generated.pb.go | 1 + pkg/apis/stats/v1alpha1/generated.proto | 24 +- pkg/apiserver/apiserver.go | 2 +- .../certificate/cacert_controller.go | 11 +- .../certificate/selfsignedcert_provider.go | 15 +- pkg/apiserver/openapi/zz_generated.openapi.go | 1416 +++++++++++++++-- .../rest_test.go | 8 +- .../antreanetworkpolicystats/rest_test.go | 8 +- .../stats/multicastgroup/rest_test.go | 4 +- .../stats/networkpolicystats/rest_test.go | 4 +- .../versioned/fake/clientset_generated.go | 6 +- .../controlplane/v1beta2/addressgroup.go | 57 +- .../controlplane/v1beta2/appliedtogroup.go | 57 +- .../v1beta2/clustergroupmembers.go | 25 +- .../v1beta2/clustergroupmembers_expansion.go | 2 +- .../typed/controlplane/v1beta2/egressgroup.go | 57 +- .../v1beta2/fake/fake_addressgroup.go | 12 +- .../v1beta2/fake/fake_appliedtogroup.go | 12 +- .../v1beta2/fake/fake_clustergroupmembers.go | 5 +- .../v1beta2/fake/fake_egressgroup.go | 12 +- .../v1beta2/fake/fake_groupassociation.go | 5 +- .../v1beta2/fake/fake_groupmembers.go | 5 +- .../v1beta2/fake/fake_ipgroupassociation.go | 5 +- .../v1beta2/fake/fake_networkpolicy.go | 12 +- .../fake/fake_networkpolicyevaluation.go | 5 +- .../v1beta2/fake/fake_nodestatssummary.go | 5 +- .../fake/fake_supportbundlecollection.go | 12 +- .../controlplane/v1beta2/groupassociation.go | 28 +- .../controlplane/v1beta2/groupmembers.go | 28 +- .../v1beta2/groupmembers_expansion.go | 4 +- .../v1beta2/ipgroupassociation.go | 25 +- .../controlplane/v1beta2/networkpolicy.go | 57 +- .../v1beta2/networkpolicy_expansion.go | 2 +- .../v1beta2/networkpolicyevaluation.go | 23 +- .../controlplane/v1beta2/nodestatssummary.go | 25 +- .../v1beta2/supportbundlecollection.go | 57 +- .../supportbundlecollection_expansion.go | 2 +- .../versioned/typed/crd/v1alpha1/bgppolicy.go | 119 +- .../typed/crd/v1alpha1/externalnode.go | 131 +- .../typed/crd/v1alpha1/fake/fake_bgppolicy.go | 29 +- .../crd/v1alpha1/fake/fake_externalnode.go | 29 +- .../v1alpha1/fake/fake_nodelatencymonitor.go | 29 +- .../fake/fake_supportbundlecollection.go | 36 +- .../typed/crd/v1alpha1/nodelatencymonitor.go | 119 +- .../crd/v1alpha1/supportbundlecollection.go | 137 +- .../typed/crd/v1alpha2/externalentity.go | 131 +- .../crd/v1alpha2/fake/fake_externalentity.go | 29 +- .../typed/crd/v1alpha2/fake/fake_ippool.go | 36 +- .../crd/v1alpha2/fake/fake_trafficcontrol.go | 29 +- .../versioned/typed/crd/v1alpha2/ippool.go | 137 +- .../typed/crd/v1alpha2/trafficcontrol.go | 121 +- .../typed/crd/v1beta1/antreaagentinfo.go | 121 +- .../typed/crd/v1beta1/antreacontrollerinfo.go | 121 +- .../typed/crd/v1beta1/clustergroup.go | 137 +- .../typed/crd/v1beta1/clusternetworkpolicy.go | 137 +- .../versioned/typed/crd/v1beta1/egress.go | 137 +- .../typed/crd/v1beta1/externalippool.go | 137 +- .../crd/v1beta1/fake/fake_antreaagentinfo.go | 29 +- .../v1beta1/fake/fake_antreacontrollerinfo.go | 29 +- .../crd/v1beta1/fake/fake_clustergroup.go | 36 +- .../v1beta1/fake/fake_clusternetworkpolicy.go | 36 +- .../typed/crd/v1beta1/fake/fake_egress.go | 36 +- .../crd/v1beta1/fake/fake_externalippool.go | 36 +- .../typed/crd/v1beta1/fake/fake_group.go | 36 +- .../typed/crd/v1beta1/fake/fake_ippool.go | 36 +- .../crd/v1beta1/fake/fake_networkpolicy.go | 36 +- .../typed/crd/v1beta1/fake/fake_tier.go | 29 +- .../typed/crd/v1beta1/fake/fake_traceflow.go | 36 +- .../versioned/typed/crd/v1beta1/group.go | 148 +- .../versioned/typed/crd/v1beta1/ippool.go | 135 +- .../typed/crd/v1beta1/networkpolicy.go | 148 +- .../versioned/typed/crd/v1beta1/tier.go | 121 +- .../versioned/typed/crd/v1beta1/traceflow.go | 137 +- .../antreaclusternetworkpolicystats.go | 59 +- .../v1alpha1/antreanetworkpolicystats.go | 62 +- .../fake_antreaclusternetworkpolicystats.go | 12 +- .../fake/fake_antreanetworkpolicystats.go | 12 +- .../v1alpha1/fake/fake_multicastgroup.go | 12 +- .../v1alpha1/fake/fake_networkpolicystats.go | 12 +- .../v1alpha1/fake/fake_nodelatencystats.go | 15 +- .../typed/stats/v1alpha1/multicastgroup.go | 57 +- .../stats/v1alpha1/networkpolicystats.go | 62 +- .../typed/stats/v1alpha1/nodelatencystats.go | 63 +- .../system/v1beta1/fake/fake_supportbundle.go | 10 +- .../typed/system/v1beta1/supportbundle.go | 47 +- .../system/v1beta1/supportbundle_expansion.go | 2 +- .../informers/externalversions/factory.go | 1 + pkg/client/listers/crd/v1alpha1/bgppolicy.go | 26 +- .../listers/crd/v1alpha1/externalnode.go | 41 +- .../crd/v1alpha1/nodelatencymonitor.go | 26 +- .../crd/v1alpha1/supportbundlecollection.go | 28 +- .../listers/crd/v1alpha2/externalentity.go | 41 +- pkg/client/listers/crd/v1alpha2/ippool.go | 28 +- .../listers/crd/v1alpha2/trafficcontrol.go | 28 +- .../listers/crd/v1beta1/antreaagentinfo.go | 28 +- .../crd/v1beta1/antreacontrollerinfo.go | 28 +- .../listers/crd/v1beta1/clustergroup.go | 28 +- .../crd/v1beta1/clusternetworkpolicy.go | 28 +- pkg/client/listers/crd/v1beta1/egress.go | 28 +- .../listers/crd/v1beta1/externalippool.go | 28 +- pkg/client/listers/crd/v1beta1/group.go | 41 +- pkg/client/listers/crd/v1beta1/ippool.go | 26 +- .../listers/crd/v1beta1/networkpolicy.go | 41 +- pkg/client/listers/crd/v1beta1/tier.go | 28 +- pkg/client/listers/crd/v1beta1/traceflow.go | 28 +- .../approving_controller.go | 11 +- .../ipsec_csr_signing_controller.go | 21 +- pkg/controller/egress/controller.go | 24 +- pkg/controller/externalippool/controller.go | 16 +- pkg/controller/externalnode/controller.go | 19 +- pkg/controller/grouping/controller_test.go | 2 +- pkg/controller/ipam/antrea_ipam_controller.go | 28 +- .../networkpolicy/adminnetworkpolicy_test.go | 4 +- pkg/controller/networkpolicy/clustergroup.go | 3 +- .../networkpolicy/clustergroup_test.go | 2 +- .../networkpolicy/crd_utils_test.go | 2 +- .../networkpolicy/networkpolicy_controller.go | 64 +- .../networkpolicy_controller_perf_test.go | 15 +- .../networkpolicy_controller_test.go | 40 +- .../networkpolicy/status_controller.go | 11 +- .../networkpolicy/status_controller_test.go | 9 +- pkg/controller/networkpolicy/validate_test.go | 4 +- .../serviceexternalip/controller.go | 21 +- pkg/controller/stats/aggregator_test.go | 4 +- .../supportbundlecollection/controller.go | 21 +- .../controller_test.go | 14 +- pkg/controller/traceflow/controller.go | 30 +- pkg/flowaggregator/apiserver/apiserver.go | 16 +- pkg/monitor/controller.go | 46 +- pkg/monitor/controller_test.go | 8 +- pkg/util/podstore/podstore.go | 15 +- pkg/util/podstore/podstore_test.go | 7 +- 246 files changed, 4032 insertions(+), 6517 deletions(-) diff --git a/build/images/codegen/Dockerfile b/build/images/codegen/Dockerfile index 0d1205ef6fc..ad70a545df8 100644 --- a/build/images/codegen/Dockerfile +++ b/build/images/codegen/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. ARG GO_VERSION -FROM ubuntu:22.04 AS protoc +FROM ubuntu:24.04 AS protoc RUN apt-get update && \ apt-get install -y --no-install-recommends wget ca-certificates unzip @@ -30,13 +30,11 @@ FROM golang:${GO_VERSION} LABEL maintainer="Antrea " LABEL description="A Docker image based on the golang image, which includes codegen tools." -ENV GO111MODULE=on - -ARG K8S_VERSION=1.29.2 +ARG K8S_VERSION=1.31.1 # The k8s.io/kube-openapi repo does not have tag, using a workable commit hash. # We use the version that is referenced in the Kubernetes go.mod (for the # correct K8s version). -ARG KUBEOPENAPI_VERSION=v0.0.0-20231010175941-2dd684a91f00 +ARG KUBEOPENAPI_VERSION=v0.0.0-20240228011516-70dd3763d340 RUN go install k8s.io/code-generator/cmd/client-gen@kubernetes-$K8S_VERSION && \ go install k8s.io/code-generator/cmd/deepcopy-gen@kubernetes-$K8S_VERSION && \ diff --git a/build/images/codegen/README.md b/build/images/codegen/README.md index 58bf1cc973d..d0d67f382d3 100644 --- a/build/images/codegen/README.md +++ b/build/images/codegen/README.md @@ -9,7 +9,7 @@ can run the following: ```bash cd build/images/codegen GO_VERSION=$(head -n 1 ../deps/go-version) -docker build -t antrea/codegen: --build-arg GO_VERSION=$GO_VERSION . +docker build --pull -t antrea/codegen: --build-arg GO_VERSION=$GO_VERSION . docker push antrea/codegen: ``` @@ -22,6 +22,7 @@ Here is the table of codegen images that have been uploaded: | Tag | Change | | :------------------------ | ----------------------------------------------------------------------------- | +| kubernetes-1.31.1 | Upgraded K8s libraries to v1.31.1, controller-gen to v0.16.3, ubuntu to 24.04 | | kubernetes-1.29.2-build.3 | Upgraded Go to v1.23 | | kubernetes-1.29.2-build.2 | Upgraded go.uber.org/mock/mockgen to v0.4.0 | | kubernetes-1.29.2-build.1 | Upgraded controller-gen to v0.14.0 | diff --git a/cmd/antrea-agent/agent.go b/cmd/antrea-agent/agent.go index b497a21bf59..60bd61503aa 100644 --- a/cmd/antrea-agent/agent.go +++ b/cmd/antrea-agent/agent.go @@ -977,7 +977,7 @@ func run(o *Options) error { return fmt.Errorf("error when getting generated cert for agent API server") } - go apiServer.Run(stopCh) + go apiServer.Run(ctx) // The API certificate is passed on directly to the monitor, instead of being provided by // the agentQuerier. This is to avoid a circular dependency between apiServer and diff --git a/cmd/antrea-agent/options_test.go b/cmd/antrea-agent/options_test.go index 919d1af8a7f..35e4481c338 100644 --- a/cmd/antrea-agent/options_test.go +++ b/cmd/antrea-agent/options_test.go @@ -139,7 +139,7 @@ func TestOptionsValidateAntreaProxyConfig(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.LoadBalancerModeDSR, tt.enabledDSR)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.LoadBalancerModeDSR, tt.enabledDSR) o := &Options{config: &agentconfig.AgentConfig{ AntreaProxy: tt.antreaProxyConfig, @@ -199,7 +199,7 @@ func TestOptionsValidateEgressConfig(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.Egress, tt.featureGateValue)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.Egress, tt.featureGateValue) o := &Options{config: &agentconfig.AgentConfig{ Egress: tt.egressConfig, @@ -261,7 +261,7 @@ func TestOptionsValidateMulticastConfig(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.Multicast, true)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.Multicast, true) o := &Options{config: &agentconfig.AgentConfig{ Multicast: agentconfig.MulticastConfig{ Enable: true, @@ -325,7 +325,7 @@ func TestOptionsValidateSecondaryNetworkConfig(t *testing.T) { } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.SecondaryNetwork, tc.featureGateValue)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.SecondaryNetwork, tc.featureGateValue) o := &Options{config: &agentconfig.AgentConfig{}} for _, brName := range tc.ovsBridges { diff --git a/cmd/antrea-controller/controller.go b/cmd/antrea-controller/controller.go index a8381a701f2..e1954fc47f4 100644 --- a/cmd/antrea-controller/controller.go +++ b/cmd/antrea-controller/controller.go @@ -28,6 +28,7 @@ import ( genericopenapi "k8s.io/apiserver/pkg/endpoints/openapi" genericapiserver "k8s.io/apiserver/pkg/server" genericoptions "k8s.io/apiserver/pkg/server/options" + apiserverversion "k8s.io/apiserver/pkg/util/version" "k8s.io/client-go/informers" csrinformers "k8s.io/client-go/informers/certificates/v1" coreinformers "k8s.io/client-go/informers/core/v1" @@ -547,6 +548,7 @@ func createAPIServerConfig(kubeconfig string, openapi.GetOpenAPIDefinitions, genericopenapi.NewDefinitionNamer(apiserver.Scheme)) serverConfig.OpenAPIConfig.Info.Title = "Antrea" + serverConfig.EffectiveVersion = apiserverversion.NewEffectiveVersion(version.GetFullVersion()) serverConfig.EnableMetrics = enableMetrics serverConfig.MinRequestTimeout = int(serverMinWatchTimeout.Seconds()) serverConfig.SecureServing.CipherSuites = cipherSuites diff --git a/cmd/flow-aggregator/flow-aggregator.go b/cmd/flow-aggregator/flow-aggregator.go index 74467aefece..fbf36866dc3 100644 --- a/cmd/flow-aggregator/flow-aggregator.go +++ b/cmd/flow-aggregator/flow-aggregator.go @@ -15,6 +15,7 @@ package main import ( + "context" "fmt" "sync" "time" @@ -41,6 +42,11 @@ func run(configFile string) error { // cause the stopCh channel to be closed; if another signal is received before the program // exits, we will force exit. stopCh := signals.RegisterSignalHandlers() + // Generate a context for functions which require one (instead of stopCh). + // We cancel the context when the function returns, which in the normal case will be when + // stopCh is closed. + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() log.StartLogFileNumberMonitor(stopCh) @@ -81,7 +87,7 @@ func run(configFile string) error { if err != nil { return fmt.Errorf("error when creating flow aggregator API server: %v", err) } - go apiServer.Run(stopCh) + go apiServer.Run(ctx) informerFactory.Start(stopCh) diff --git a/go.mod b/go.mod index 815326e605a..3981a35308a 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/containernetworking/cni v1.2.0 github.com/containernetworking/plugins v1.1.1 github.com/coreos/go-iptables v0.8.0 - github.com/davecgh/go-spew v1.1.1 + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc github.com/fatih/color v1.17.0 github.com/fsnotify/fsnotify v1.7.0 github.com/gammazero/deque v0.1.2 @@ -43,8 +43,8 @@ require ( github.com/onsi/gomega v1.34.1 github.com/osrg/gobgp/v3 v3.29.0 github.com/pkg/sftp v1.13.6 - github.com/prometheus/client_golang v1.18.0 - github.com/prometheus/common v0.47.0 + github.com/prometheus/client_golang v1.19.1 + github.com/prometheus/common v0.55.0 github.com/sirupsen/logrus v1.9.3 github.com/spf13/afero v1.11.0 github.com/spf13/cobra v1.8.1 @@ -67,22 +67,22 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 - k8s.io/api v0.29.2 - k8s.io/apiextensions-apiserver v0.29.2 - k8s.io/apimachinery v0.29.2 - k8s.io/apiserver v0.29.2 - k8s.io/client-go v0.29.2 - k8s.io/component-base v0.29.2 - k8s.io/klog/v2 v2.110.1 - k8s.io/kube-aggregator v0.29.2 - k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 - k8s.io/kubectl v0.29.2 - k8s.io/kubelet v0.29.2 - k8s.io/utils v0.0.0-20230726121419-3b25d923346b - sigs.k8s.io/controller-runtime v0.16.3 + k8s.io/api v0.31.1 + k8s.io/apiextensions-apiserver v0.31.1 + k8s.io/apimachinery v0.31.1 + k8s.io/apiserver v0.31.1 + k8s.io/client-go v0.31.1 + k8s.io/component-base v0.31.1 + k8s.io/klog/v2 v2.130.1 + k8s.io/kube-aggregator v0.31.1 + k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 + k8s.io/kubectl v0.31.1 + k8s.io/kubelet v0.31.1 + k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 + sigs.k8s.io/controller-runtime v0.19.0 sigs.k8s.io/mcs-api v0.1.0 sigs.k8s.io/network-policy-api v0.1.1 - sigs.k8s.io/yaml v1.3.0 + sigs.k8s.io/yaml v1.4.0 ) require ( @@ -94,7 +94,7 @@ require ( github.com/VividCortex/ewma v1.2.0 // indirect github.com/alexflint/go-filemutex v1.2.0 // indirect github.com/andybalholm/brotli v1.0.4 // indirect - github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect + github.com/antlr4-go/antlr/v4 v4.13.0 // indirect github.com/armon/go-metrics v0.4.0 // indirect github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.4 // indirect @@ -114,7 +114,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/cenk/hub v1.0.1 // indirect - github.com/cenkalti/backoff/v4 v4.2.1 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cenkalti/hub v1.0.1 // indirect github.com/cenkalti/rpc2 v0.0.0-20180727162946-9642ea02d0aa // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -129,21 +129,21 @@ require ( github.com/eapache/queue v1.1.0 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect - github.com/evanphx/json-patch/v5 v5.6.0 // indirect + github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/fvbommel/sortorder v1.1.0 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-errors/errors v1.4.2 // indirect github.com/go-faster/city v1.0.1 // indirect github.com/go-faster/errors v0.6.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.3 // indirect + github.com/go-openapi/swag v0.22.4 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/cel-go v0.17.7 // indirect + github.com/google/cel-go v0.20.1 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect @@ -152,7 +152,7 @@ require ( github.com/gorilla/websocket v1.5.0 // indirect github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-msgpack/v2 v2.1.1 // indirect @@ -180,8 +180,8 @@ require ( github.com/mdlayher/socket v0.5.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/moby/spdystream v0.2.0 // indirect - github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect + github.com/moby/spdystream v0.4.0 // indirect + github.com/moby/term v0.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect @@ -196,9 +196,9 @@ require ( github.com/pion/transport/v2 v2.0.0 // indirect github.com/pion/udp v0.1.4 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1 // indirect @@ -212,24 +212,25 @@ require ( github.com/subosito/gotenv v1.4.2 // indirect github.com/ti-mo/netfilter v0.5.2 // indirect github.com/vishvananda/netns v0.0.4 // indirect + github.com/x448/float16 v0.8.4 // indirect github.com/xlab/treeprint v1.2.0 // indirect gitlab.com/golang-commonmark/puny v0.0.0-20191124015043-9f83538fa04f // indirect - go.etcd.io/etcd/api/v3 v3.5.10 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect - go.etcd.io/etcd/client/v3 v3.5.10 // indirect + go.etcd.io/etcd/api/v3 v3.5.14 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.14 // indirect + go.etcd.io/etcd/client/v3 v3.5.14 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 // indirect - go.opentelemetry.io/otel v1.20.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/sdk v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect - go.opentelemetry.io/proto/otlp v1.0.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/sdk v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.25.0 // indirect + go.uber.org/zap v1.26.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/term v0.24.0 // indirect @@ -239,13 +240,14 @@ require ( google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - k8s.io/cli-runtime v0.29.2 // indirect - k8s.io/kms v0.29.2 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 // indirect + k8s.io/cli-runtime v0.31.1 // indirect + k8s.io/kms v0.31.1 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect - sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect + sigs.k8s.io/kustomize/api v0.17.2 // indirect + sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) diff --git a/go.sum b/go.sum index b03ad5c809d..424031fd578 100644 --- a/go.sum +++ b/go.sum @@ -5,10 +5,6 @@ antrea.io/ofnet v0.12.0/go.mod h1:MB3qaInEimj+T8qtpBcIQK+EqeNiY1S/WbUdGk+TzNg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= -cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg= -cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= -cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= @@ -61,8 +57,8 @@ github.com/alexflint/go-filemutex v1.2.0/go.mod h1:mYyQSWvw9Tx2/H2n9qXPb52tTYfE0 github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= -github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18= -github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= +github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= +github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.4.0 h1:yCQqn7dwca4ITXb+CbubHmedzaQYHhNhrEXLYUeEe8Q= github.com/armon/go-metrics v0.4.0/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= @@ -108,8 +104,6 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.16.12 h1:YU9UHPukkCCnETHEExOptF/BxPv github.com/aws/aws-sdk-go-v2/service/sts v1.16.12/go.mod h1:b53qpmhHk7mTL2J/tfG6f38neZiyBQSiNXGCuNKq4+4= github.com/aws/smithy-go v1.12.1 h1:yQRC55aXN/y1W10HgwHle01DRuV9Dpf31iGkotjt3Ag= github.com/aws/smithy-go v1.12.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -122,8 +116,8 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/cenk/hub v1.0.1 h1:RBwXNOF4a8KjD8BJ08XqN8KbrqaGiQLDrgvUGJSHuPA= github.com/cenk/hub v1.0.1/go.mod h1:rJM1LNAW0ppT8FMMuPK6c2NP/R2nH/UthtuRySSaf6Y= -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cenkalti/hub v1.0.1 h1:UMtjc6dHSaOQTO15SVA50MBIR9zQwvsukQupDrkIRtg= github.com/cenkalti/hub v1.0.1/go.mod h1:tcYwtS3a2d9NO/0xDXVJWx3IedurUjYCqFCmpi0lpHs= github.com/cenkalti/rpc2 v0.0.0-20180727162946-9642ea02d0aa h1:t+iWhuJE2aropY4uxKMVbyP+IJ29o422f7YAd73aTjg= @@ -144,8 +138,6 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20 h1:N+3sFI5GUjRKBi+i0TxYVST9h4Ie192jJWpHvthBBgg= -github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= @@ -182,8 +174,9 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 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= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -210,15 +203,13 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= -github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.0.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= -github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= -github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= +github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= +github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d h1:105gxyaGwCFad8crR9dcMQWvV9Hvulu6hwUh4tWPJnM= github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -232,8 +223,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/fvbommel/sortorder v1.1.0 h1:fUmoe+HLsBTctBDoaBwpQo5N+nrCp8g/BjKb/6ZQmYw= -github.com/fvbommel/sortorder v1.1.0/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/gammazero/deque v0.1.2 h1:WvbDJ3YaT4ELf9+Cq9lv4Ef0aPRyZeEpIoVkjOw9kes= github.com/gammazero/deque v0.1.2/go.mod h1:KQw7vFau1hHuM8xmI9RbgKFbAsQFWmBpqQ2KenFLk6M= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -252,14 +243,13 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= -github.com/go-logr/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo= -github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA= +github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= +github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -304,8 +294,9 @@ github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/ github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= @@ -324,8 +315,6 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY= -github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -352,8 +341,8 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/cel-go v0.17.7 h1:6ebJFzu1xO2n7TLtN+UBqShGBhlD85bhvglh5DpcfqQ= -github.com/google/cel-go v0.17.7/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= +github.com/google/cel-go v0.20.1 h1:nDx9r8S3L4pE61eDdt8igGj8rf5kjYR3ILxWIpWNi84= +github.com/google/cel-go v0.20.1/go.mod h1:kWcIzTsPX0zmQ+H3TirHstLLf9ep5QTsZBN9u4dOYLg= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -395,7 +384,6 @@ github.com/googleapis/gnostic v0.3.1/go.mod h1:on+2t9HRStVgn95RSsFWFz+6Q0Snyqv1a github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= @@ -410,8 +398,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -568,10 +556,10 @@ github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTS github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= -github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= -github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= -github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/moby/spdystream v0.4.0 h1:Vy79D6mHeJJjiPdFEL2yku1kl0chZpJfZcPpb16BRl8= +github.com/moby/spdystream v0.4.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= 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= @@ -641,40 +629,41 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/sftp v1.13.6 h1:JFZT4XbOU7l77xGSpOdW+pwIMqP044IyjXX6FGyEKFo= github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 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/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= -github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= +github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpjL1k= -github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= +github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= @@ -686,8 +675,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -768,6 +757,8 @@ github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1Y github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM= github.com/vmware/go-ipfix v0.9.0 h1:4/N5eFliqULEaCUQV0lafOpN/1bItPE9OTAPGhrIXus= github.com/vmware/go-ipfix v0.9.0/go.mod h1:MYEdL6Uel2ufOZyVCKvIAaw9hwnewK8aPr7rnwRbxMY= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ= @@ -780,48 +771,48 @@ gitlab.com/golang-commonmark/puny v0.0.0-20191124015043-9f83538fa04f h1:Wku8eEde gitlab.com/golang-commonmark/puny v0.0.0-20191124015043-9f83538fa04f/go.mod h1:Tiuhl+njh/JIg0uS/sOJVYi0x2HEa5rc1OAaVsb5tAs= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.9 h1:8x7aARPEXiXbHmtUwAIv7eV2fQFHrLLavdiJ3uzJXoI= +go.etcd.io/bbolt v1.3.9/go.mod h1:zaO32+Ti0PK1ivdPtgMESzuzL2VPoIG1PCQNvOdo/dE= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738 h1:VcrIfasaLFkyjk6KNlXQSzO+B0fZcnECiDrKJsfxka0= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.etcd.io/etcd/api/v3 v3.5.10 h1:szRajuUUbLyppkhs9K6BRtjY37l66XQQmw7oZRANE4k= -go.etcd.io/etcd/api/v3 v3.5.10/go.mod h1:TidfmT4Uycad3NM/o25fG3J07odo4GBB9hoxaodFCtI= -go.etcd.io/etcd/client/pkg/v3 v3.5.10 h1:kfYIdQftBnbAq8pUWFXfpuuxFSKzlmM5cSn76JByiT0= -go.etcd.io/etcd/client/pkg/v3 v3.5.10/go.mod h1:DYivfIviIuQ8+/lCq4vcxuseg2P2XbHygkKwFo9fc8U= -go.etcd.io/etcd/client/v2 v2.305.10 h1:MrmRktzv/XF8CvtQt+P6wLUlURaNpSDJHFZhe//2QE4= -go.etcd.io/etcd/client/v2 v2.305.10/go.mod h1:m3CKZi69HzilhVqtPDcjhSGp+kA1OmbNn0qamH80xjA= -go.etcd.io/etcd/client/v3 v3.5.10 h1:W9TXNZ+oB3MCd/8UjxHTWK5J9Nquw9fQBLJd5ne5/Ao= -go.etcd.io/etcd/client/v3 v3.5.10/go.mod h1:RVeBnDz2PUEZqTpgqwAtUd8nAPf5kjyFyND7P1VkOKc= -go.etcd.io/etcd/pkg/v3 v3.5.10 h1:WPR8K0e9kWl1gAhB5A7gEa5ZBTNkT9NdNWrR8Qpo1CM= -go.etcd.io/etcd/pkg/v3 v3.5.10/go.mod h1:TKTuCKKcF1zxmfKWDkfz5qqYaE3JncKKZPFf8c1nFUs= -go.etcd.io/etcd/raft/v3 v3.5.10 h1:cgNAYe7xrsrn/5kXMSaH8kM/Ky8mAdMqGOxyYwpP0LA= -go.etcd.io/etcd/raft/v3 v3.5.10/go.mod h1:odD6kr8XQXTy9oQnyMPBOr0TVe+gT0neQhElQ6jbGRc= -go.etcd.io/etcd/server/v3 v3.5.10 h1:4NOGyOwD5sUZ22PiWYKmfxqoeh72z6EhYjNosKGLmZg= -go.etcd.io/etcd/server/v3 v3.5.10/go.mod h1:gBplPHfs6YI0L+RpGkTQO7buDbHv5HJGG/Bst0/zIPo= +go.etcd.io/etcd/api/v3 v3.5.14 h1:vHObSCxyB9zlF60w7qzAdTcGaglbJOpSj1Xj9+WGxq0= +go.etcd.io/etcd/api/v3 v3.5.14/go.mod h1:BmtWcRlQvwa1h3G2jvKYwIQy4PkHlDej5t7uLMUdJUU= +go.etcd.io/etcd/client/pkg/v3 v3.5.14 h1:SaNH6Y+rVEdxfpA2Jr5wkEvN6Zykme5+YnbCkxvuWxQ= +go.etcd.io/etcd/client/pkg/v3 v3.5.14/go.mod h1:8uMgAokyG1czCtIdsq+AGyYQMvpIKnSvPjFMunkgeZI= +go.etcd.io/etcd/client/v2 v2.305.13 h1:RWfV1SX5jTU0lbCvpVQe3iPQeAHETWdOTb6pxhd77C8= +go.etcd.io/etcd/client/v2 v2.305.13/go.mod h1:iQnL7fepbiomdXMb3om1rHq96htNNGv2sJkEcZGDRRg= +go.etcd.io/etcd/client/v3 v3.5.14 h1:CWfRs4FDaDoSz81giL7zPpZH2Z35tbOrAJkkjMqOupg= +go.etcd.io/etcd/client/v3 v3.5.14/go.mod h1:k3XfdV/VIHy/97rqWjoUzrj9tk7GgJGH9J8L4dNXmAk= +go.etcd.io/etcd/pkg/v3 v3.5.13 h1:st9bDWNsKkBNpP4PR1MvM/9NqUPfvYZx/YXegsYEH8M= +go.etcd.io/etcd/pkg/v3 v3.5.13/go.mod h1:N+4PLrp7agI/Viy+dUYpX7iRtSPvKq+w8Y14d1vX+m0= +go.etcd.io/etcd/raft/v3 v3.5.13 h1:7r/NKAOups1YnKcfro2RvGGo2PTuizF/xh26Z2CTAzA= +go.etcd.io/etcd/raft/v3 v3.5.13/go.mod h1:uUFibGLn2Ksm2URMxN1fICGhk8Wu96EfDQyuLhAcAmw= +go.etcd.io/etcd/server/v3 v3.5.13 h1:V6KG+yMfMSqWt+lGnhFpP5z5dRUj1BDRJ5k1fQ9DFok= +go.etcd.io/etcd/server/v3 v3.5.13/go.mod h1:K/8nbsGupHqmr5MkgaZpLlH1QdX1pcNQLAkODy44XcQ= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 h1:1eHu3/pUSWaOgltNK3WJFaywKsTIr/PwvHyDmi0lQA0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0/go.mod h1:HyABWq60Uy1kjJSa2BVOxUVao8Cdick5AWSKPutqy6U= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 h1:DeFD0VgTZ+Cj6hxravYYZE2W4GlneVH81iAOPjZkzk8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0/go.mod h1:GijYcYmNpX1KazD5JmWGsi4P7dDTTTnfv1UbGn84MnU= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 h1:gvmNvqrPYovvyRmCSygkUDyL8lC5Tl845MLEwqpxhEU= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0/go.mod h1:vNUq47TGFioo+ffTSnKNdob241vePmtNZnAODKapKd0= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/sdk v1.20.0 h1:5Jf6imeFZlZtKv9Qbo6qt2ZkmWtdWx/wzcCbNUlAWGM= -go.opentelemetry.io/otel/sdk v1.20.0/go.mod h1:rmkSx1cZCm/tn16iWDn1GQbLtsW/LvsdEEFzCSRM6V0= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= -go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 h1:qFffATk0X+HD+f1Z8lswGiOQYKHRlzfmdJm0wEaVrFA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0/go.mod h1:MOiCmryaYtc+V0Ei+Tx9o5S1ZjA7kzLucuVuyzBZloQ= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= +go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.starlark.net v0.0.0-20230525235612-a134d8f9ddca h1:VdD38733bfYv5tUZwEIskMM93VanwNIi5bIKnDrJdEY= go.starlark.net v0.0.0-20230525235612-a134d8f9ddca/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -834,8 +825,8 @@ go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= -go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk= +go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1079,6 +1070,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= @@ -1111,70 +1104,70 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78= k8s.io/api v0.18.4/go.mod h1:lOIQAKYgai1+vz9J7YcDZwC26Z0zQewYOGWdyIPUUQ4= -k8s.io/api v0.29.2 h1:hBC7B9+MU+ptchxEqTNW2DkUosJpp1P+Wn6YncZ474A= -k8s.io/api v0.29.2/go.mod h1:sdIaaKuU7P44aoyyLlikSLayT6Vb7bvJNCX105xZXY0= +k8s.io/api v0.31.1 h1:Xe1hX/fPW3PXYYv8BlozYqw63ytA92snr96zMW9gWTU= +k8s.io/api v0.31.1/go.mod h1:sbN1g6eY6XVLeqNsZGLnI5FwVseTrZX7Fv3O26rhAaI= k8s.io/apiextensions-apiserver v0.18.2/go.mod h1:q3faSnRGmYimiocj6cHQ1I3WpLqmDgJFlKL37fC4ZvY= k8s.io/apiextensions-apiserver v0.18.4/go.mod h1:NYeyeYq4SIpFlPxSAB6jHPIdvu3hL0pc36wuRChybio= -k8s.io/apiextensions-apiserver v0.29.2 h1:UK3xB5lOWSnhaCk0RFZ0LUacPZz9RY4wi/yt2Iu+btg= -k8s.io/apiextensions-apiserver v0.29.2/go.mod h1:aLfYjpA5p3OwtqNXQFkhJ56TB+spV8Gc4wfMhUA3/b8= +k8s.io/apiextensions-apiserver v0.31.1 h1:L+hwULvXx+nvTYX/MKM3kKMZyei+UiSXQWciX/N6E40= +k8s.io/apiextensions-apiserver v0.31.1/go.mod h1:tWMPR3sgW+jsl2xm9v7lAyRF1rYEK71i9G5dRtkknoQ= k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= k8s.io/apimachinery v0.18.4/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko= -k8s.io/apimachinery v0.29.2 h1:EWGpfJ856oj11C52NRCHuU7rFDwxev48z+6DSlGNsV8= -k8s.io/apimachinery v0.29.2/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= +k8s.io/apimachinery v0.31.1 h1:mhcUBbj7KUjaVhyXILglcVjuS4nYXiwC+KKFBgIVy7U= +k8s.io/apimachinery v0.31.1/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= k8s.io/apiserver v0.18.2/go.mod h1:Xbh066NqrZO8cbsoenCwyDJ1OSi8Ag8I2lezeHxzwzw= k8s.io/apiserver v0.18.4/go.mod h1:q+zoFct5ABNnYkGIaGQ3bcbUNdmPyOCoEBcg51LChY8= -k8s.io/apiserver v0.29.2 h1:+Z9S0dSNr+CjnVXQePG8TcBWHr3Q7BmAr7NraHvsMiQ= -k8s.io/apiserver v0.29.2/go.mod h1:B0LieKVoyU7ykQvPFm7XSdIHaCHSzCzQWPFa5bqbeMQ= -k8s.io/cli-runtime v0.29.2 h1:smfsOcT4QujeghsNjECKN3lwyX9AwcFU0nvJ7sFN3ro= -k8s.io/cli-runtime v0.29.2/go.mod h1:KLisYYfoqeNfO+MkTWvpqIyb1wpJmmFJhioA0xd4MW8= +k8s.io/apiserver v0.31.1 h1:Sars5ejQDCRBY5f7R3QFHdqN3s61nhkpaX8/k1iEw1c= +k8s.io/apiserver v0.31.1/go.mod h1:lzDhpeToamVZJmmFlaLwdYZwd7zB+WYRYIboqA1kGxM= +k8s.io/cli-runtime v0.31.1 h1:/ZmKhmZ6hNqDM+yf9s3Y4KEYakNXUn5sod2LWGGwCuk= +k8s.io/cli-runtime v0.31.1/go.mod h1:pKv1cDIaq7ehWGuXQ+A//1OIF+7DI+xudXtExMCbe9U= k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU= k8s.io/client-go v0.18.4/go.mod h1:f5sXwL4yAZRkAtzOxRWUhA/N8XzGCb+nPZI8PfobZ9g= -k8s.io/client-go v0.29.2 h1:FEg85el1TeZp+/vYJM7hkDlSTFZ+c5nnK44DJ4FyoRg= -k8s.io/client-go v0.29.2/go.mod h1:knlvFZE58VpqbQpJNbCbctTVXcd35mMyAAwBdpt4jrA= +k8s.io/client-go v0.31.1 h1:f0ugtWSbWpxHR7sjVpQwuvw9a3ZKLXX0u0itkFXufb0= +k8s.io/client-go v0.31.1/go.mod h1:sKI8871MJN2OyeqRlmA4W4KM9KBdBUpDLu/43eGemCg= k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/code-generator v0.18.4/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c= k8s.io/component-base v0.18.2/go.mod h1:kqLlMuhJNHQ9lz8Z7V5bxUUtjFZnrypArGl58gmDfUM= k8s.io/component-base v0.18.4/go.mod h1:7jr/Ef5PGmKwQhyAz/pjByxJbC58mhKAhiaDu0vXfPk= -k8s.io/component-base v0.29.2 h1:lpiLyuvPA9yV1aQwGLENYyK7n/8t6l3nn3zAtFTJYe8= -k8s.io/component-base v0.29.2/go.mod h1:BfB3SLrefbZXiBfbM+2H1dlat21Uewg/5qtKOl8degM= +k8s.io/component-base v0.31.1 h1:UpOepcrX3rQ3ab5NB6g5iP0tvsgJWzxTyAo20sgYSy8= +k8s.io/component-base v0.31.1/go.mod h1:WGeaw7t/kTsqpVTaCoVEtillbqAhF2/JgvO0LDOMa0w= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= -k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= -k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= -k8s.io/kms v0.29.2 h1:MDsbp98gSlEQs7K7dqLKNNTwKFQRYYvO4UOlBOjNy6Y= -k8s.io/kms v0.29.2/go.mod h1:s/9RC4sYRZ/6Tn6yhNjbfJuZdb8LzlXhdlBnKizeFDo= -k8s.io/kube-aggregator v0.29.2 h1:z9qJn5wlGmGaX6EfM7OEhr6fq6SBjDKR6tPRZ/qgxeY= -k8s.io/kube-aggregator v0.29.2/go.mod h1:QEuwzmMJJsg0eg1Gv+u4cWcYeJG2+8vN8/nTXBzopUo= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kms v0.31.1 h1:cGLyV3cIwb0ovpP/jtyIe2mEuQ/MkbhmeBF2IYCA9Io= +k8s.io/kms v0.31.1/go.mod h1:OZKwl1fan3n3N5FFxnW5C4V3ygrah/3YXeJWS3O6+94= +k8s.io/kube-aggregator v0.31.1 h1:vrYBTTs3xMrpiEsmBjsLETZE9uuX67oQ8B3i1BFfMPw= +k8s.io/kube-aggregator v0.31.1/go.mod h1:+aW4NX50uneozN+BtoCxI4g7ND922p8Wy3tWKFDiWVk= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= -k8s.io/kubectl v0.29.2 h1:uaDYaBhumvkwz0S2XHt36fK0v5IdNgL7HyUniwb2IUo= -k8s.io/kubectl v0.29.2/go.mod h1:BhizuYBGcKaHWyq+G7txGw2fXg576QbPrrnQdQDZgqI= -k8s.io/kubelet v0.29.2 h1:bQ2StqkUqPCFNLtGLsb3v3O2LKQHXNMju537zOGboRg= -k8s.io/kubelet v0.29.2/go.mod h1:i5orNPqW/fAMrqptbCXFW/vLBBP12TZZc41IrrvF7SY= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= +k8s.io/kubectl v0.31.1 h1:ih4JQJHxsEggFqDJEHSOdJ69ZxZftgeZvYo7M/cpp24= +k8s.io/kubectl v0.31.1/go.mod h1:aNuQoR43W6MLAtXQ/Bu4GDmoHlbhHKuyD49lmTC8eJM= +k8s.io/kubelet v0.31.1 h1:aAxwVxGzbbMKKk/FnSjvkN52K3LdHhjhzmYcyGBuE0c= +k8s.io/kubelet v0.31.1/go.mod h1:8ZbexYHqUO946gXEfFmnMZiK2UKRGhk7LlGvJ71p2Ig= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.7/go.mod h1:PHgbrJT7lCHcxMU+mDHEm+nx46H4zuuHZkDP6icnhu0= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 h1:TgtAeesdhpm2SGwkQasmbeqDo8th5wOBA5h/AjTKA4I= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0/go.mod h1:VHVDI/KrK4fjnV61bE2g3sA7tiETLn8sooImelsCx3Y= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 h1:2770sDpzrjjsAtVhSeUFseziht227YAWYHLGNM8QPwY= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= sigs.k8s.io/controller-runtime v0.6.1/go.mod h1:XRYBPdbf5XJu9kpS84VJiZ7h/u1hF3gEORz0efEja7A= -sigs.k8s.io/controller-runtime v0.16.3 h1:2TuvuokmfXvDUamSx1SuAOO3eTyye+47mJCigwG62c4= -sigs.k8s.io/controller-runtime v0.16.3/go.mod h1:j7bialYoSn142nv9sCOJmQgDXQXxnroFU4VnX/brVJ0= +sigs.k8s.io/controller-runtime v0.19.0 h1:nWVM7aq+Il2ABxwiCizrVDSlmDcshi9llbaFbC0ji/Q= +sigs.k8s.io/controller-runtime v0.19.0/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= sigs.k8s.io/controller-tools v0.3.0/go.mod h1:enhtKGfxZD1GFEoMgP8Fdbu+uKQ/cq1/WGJhdVChfvI= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/kind v0.8.1/go.mod h1:oNKTxUVPYkV9lWzY6CVMNluVq8cBsyq+UgPJdvA3uu4= -sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 h1:XX3Ajgzov2RKUdc5jW3t5jwY7Bo7dcRm+tFxT+NfgY0= -sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3/go.mod h1:9n16EZKMhXBNSiUC5kSdFQJkdH3zbxS/JoO619G1VAY= -sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 h1:W6cLQc5pnqM7vh3b7HvGNfXrJ/xL6BDMS0v1V/HHg5U= -sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3/go.mod h1:JWP1Fj0VWGHyw3YUPjXSQnRnrwezrZSrApfX5S0nIag= +sigs.k8s.io/kustomize/api v0.17.2 h1:E7/Fjk7V5fboiuijoZHgs4aHuexi5Y2loXlVOAVAG5g= +sigs.k8s.io/kustomize/api v0.17.2/go.mod h1:UWTz9Ct+MvoeQsHcJ5e+vziRRkwimm3HytpZgIYqye0= +sigs.k8s.io/kustomize/kyaml v0.17.1 h1:TnxYQxFXzbmNG6gOINgGWQt09GghzgTP6mIurOgrLCQ= +sigs.k8s.io/kustomize/kyaml v0.17.1/go.mod h1:9V0mCjIEYjlXuCdYsSXvyoy2BTsLESH7TlGV81S282U= sigs.k8s.io/mcs-api v0.1.0 h1:edDbg0oRGfXw8TmZjKYep06LcJLv/qcYLidejnUp0PM= sigs.k8s.io/mcs-api v0.1.0/go.mod h1:gGiAryeFNB4GBsq2LBmVqSgKoobLxt+p7ii/WG5QYYw= sigs.k8s.io/network-policy-api v0.1.1 h1:KDW+AkvCCQI3h8yH8j0hurhvPLNtLeVvmZoqtMaG9ew= @@ -1185,5 +1178,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+s sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/hack/update-codegen-dockerized.sh b/hack/update-codegen-dockerized.sh index 5b9fe4eaf59..b421dc28cdf 100755 --- a/hack/update-codegen-dockerized.sh +++ b/hack/update-codegen-dockerized.sh @@ -129,7 +129,8 @@ function generate_antrea_client_code { --input "crd/v1alpha2" \ --input "crd/v1beta1" \ --input "stats/v1alpha1" \ - --output-package "${ANTREA_PKG}/pkg/client/clientset" \ + --output-dir "pkg/client/clientset" \ + --output-pkg "${ANTREA_PKG}/pkg/client/clientset" \ --plural-exceptions "NetworkPolicyStats:NetworkPolicyStats" \ --plural-exceptions "AntreaNetworkPolicyStats:AntreaNetworkPolicyStats" \ --plural-exceptions "AntreaClusterNetworkPolicyStats:AntreaClusterNetworkPolicyStats" \ @@ -140,50 +141,57 @@ function generate_antrea_client_code { # Generate listers with K8s codegen tools. $GOPATH/bin/lister-gen \ - --input-dirs "${ANTREA_PKG}/pkg/apis/crd/v1alpha1" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/crd/v1alpha2" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/crd/v1beta1" \ - --output-package "${ANTREA_PKG}/pkg/client/listers" \ - --go-header-file hack/boilerplate/license_header.go.txt + --output-dir "pkg/client/listers" \ + --output-pkg "${ANTREA_PKG}/pkg/client/listers" \ + --go-header-file hack/boilerplate/license_header.go.txt \ + "${ANTREA_PKG}/pkg/apis/crd/v1alpha1" \ + "${ANTREA_PKG}/pkg/apis/crd/v1alpha2" \ + "${ANTREA_PKG}/pkg/apis/crd/v1beta1" # Generate informers with K8s codegen tools. $GOPATH/bin/informer-gen \ - --input-dirs "${ANTREA_PKG}/pkg/apis/crd/v1alpha1" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/crd/v1alpha2" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/crd/v1beta1" \ --versioned-clientset-package "${ANTREA_PKG}/pkg/client/clientset/versioned" \ --listers-package "${ANTREA_PKG}/pkg/client/listers" \ - --output-package "${ANTREA_PKG}/pkg/client/informers" \ - --go-header-file hack/boilerplate/license_header.go.txt + --output-dir "pkg/client/informers" \ + --output-pkg "${ANTREA_PKG}/pkg/client/informers" \ + --go-header-file hack/boilerplate/license_header.go.txt \ + "${ANTREA_PKG}/pkg/apis/crd/v1alpha1" \ + "${ANTREA_PKG}/pkg/apis/crd/v1alpha2" \ + "${ANTREA_PKG}/pkg/apis/crd/v1beta1" $GOPATH/bin/deepcopy-gen \ - --input-dirs "${ANTREA_PKG}/pkg/apis/controlplane" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/controlplane/v1beta2" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/system/v1beta1" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/crd/v1alpha1" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/crd/v1alpha2" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/crd/v1beta1" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/stats" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/stats/v1alpha1" \ - -O zz_generated.deepcopy \ - --go-header-file hack/boilerplate/license_header.go.txt + --output-file zz_generated.deepcopy.go \ + --go-header-file hack/boilerplate/license_header.go.txt \ + "${ANTREA_PKG}/pkg/apis/controlplane" \ + "${ANTREA_PKG}/pkg/apis/controlplane/v1beta2" \ + "${ANTREA_PKG}/pkg/apis/system/v1beta1" \ + "${ANTREA_PKG}/pkg/apis/crd/v1alpha1" \ + "${ANTREA_PKG}/pkg/apis/crd/v1alpha2" \ + "${ANTREA_PKG}/pkg/apis/crd/v1beta1" \ + "${ANTREA_PKG}/pkg/apis/stats" \ + "${ANTREA_PKG}/pkg/apis/stats/v1alpha1" $GOPATH/bin/conversion-gen \ - --input-dirs "${ANTREA_PKG}/pkg/apis/controlplane/v1beta2,${ANTREA_PKG}/pkg/apis/controlplane/" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/stats/v1alpha1,${ANTREA_PKG}/pkg/apis/stats/" \ - -O zz_generated.conversion \ - --go-header-file hack/boilerplate/license_header.go.txt + --output-file zz_generated.conversion.go \ + --go-header-file hack/boilerplate/license_header.go.txt \ + "${ANTREA_PKG}/pkg/apis/controlplane/v1beta2" \ + "${ANTREA_PKG}/pkg/apis/controlplane" \ + "${ANTREA_PKG}/pkg/apis/stats/v1alpha1" $GOPATH/bin/openapi-gen \ - --input-dirs "${ANTREA_PKG}/pkg/apis/controlplane/v1beta2" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/system/v1beta1" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/stats/v1alpha1" \ - --input-dirs "${ANTREA_PKG}/pkg/apis/crd/v1beta1" \ - --input-dirs "k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/util/intstr" \ - --input-dirs "k8s.io/api/core/v1" \ - --output-package "${ANTREA_PKG}/pkg/apiserver/openapi" \ - -O zz_generated.openapi \ - --go-header-file hack/boilerplate/license_header.go.txt + --output-dir "pkg/apiserver/openapi" \ + --output-pkg "${ANTREA_PKG}/pkg/apiserver/openapi" \ + --output-file zz_generated.openapi.go \ + --go-header-file hack/boilerplate/license_header.go.txt \ + "${ANTREA_PKG}/pkg/apis/controlplane/v1beta2" \ + "${ANTREA_PKG}/pkg/apis/system/v1beta1" \ + "${ANTREA_PKG}/pkg/apis/stats/v1alpha1" \ + "${ANTREA_PKG}/pkg/apis/crd/v1beta1" \ + "k8s.io/apimachinery/pkg/apis/meta/v1" \ + "k8s.io/apimachinery/pkg/runtime" \ + "k8s.io/apimachinery/pkg/util/intstr" \ + "k8s.io/apimachinery/pkg/version" \ + "k8s.io/api/core/v1" } generate_antrea_client_code @@ -197,9 +205,14 @@ export GOFLAGS="-mod=mod" go mod vendor PACKAGES="${ANTREA_PKG}/pkg/apis/stats/v1alpha1=${ANTREA_PROTO_PKG}.pkg.apis.stats.v1alpha1,\ ${ANTREA_PKG}/pkg/apis/controlplane/v1beta2=${ANTREA_PROTO_PKG}.pkg.apis.controlplane.v1beta2" +# Ask go-to-protobuf not to generate apimachinery types ("-" sign before the +# package name), as we only want to generate our own types. The command fails +# without this, as there is no /go/src/k8s.io folder. $GOPATH/bin/go-to-protobuf \ + --output-dir="/go/src" \ --proto-import vendor \ --packages "${PACKAGES}" \ + --apimachinery-packages "-k8s.io/apimachinery/pkg/util/intstr,-k8s.io/apimachinery/pkg/api/resource,-k8s.io/apimachinery/pkg/runtime/schema,-k8s.io/apimachinery/pkg/runtime,-k8s.io/apimachinery/pkg/apis/meta/v1,-k8s.io/apimachinery/pkg/apis/meta/v1beta1,-k8s.io/apimachinery/pkg/apis/testapigroup/v1" \ --go-header-file hack/boilerplate/license_header.go.txt rm -rf vendor diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 65e15efc21a..75030f517c5 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -22,7 +22,7 @@ function echoerr { } ANTREA_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )" -IMAGE_NAME="antrea/codegen:kubernetes-1.29.2-build.3" +IMAGE_NAME="antrea/codegen:kubernetes-1.31.1" # We will use git clone to make a working copy of the repository into a # temporary directory. This requires that all changes have been committed diff --git a/multicluster/Makefile b/multicluster/Makefile index c799a07aba5..18611e3d77e 100644 --- a/multicluster/Makefile +++ b/multicluster/Makefile @@ -91,7 +91,7 @@ run: manifests generate fmt vet ## Run a controller from your host. CONTROLLER_GEN = $(shell pwd)/bin/controller-gen controller-gen: ## Download controller-gen locally if necessary. - $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0) + $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.3) codegen: ./hack/update-codegen.sh diff --git a/multicluster/build/yamls/antrea-multicluster-leader-global.yml b/multicluster/build/yamls/antrea-multicluster-leader-global.yml index 02877e21947..9fccfbd1d8f 100644 --- a/multicluster/build/yamls/antrea-multicluster-leader-global.yml +++ b/multicluster/build/yamls/antrea-multicluster-leader-global.yml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 labels: app: antrea name: clustersets.multicluster.crd.antrea.io @@ -355,7 +355,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 labels: app: antrea name: memberclusterannounces.multicluster.crd.antrea.io @@ -421,7 +421,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 labels: app: antrea name: resourceexports.multicluster.crd.antrea.io @@ -560,11 +560,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -615,11 +617,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -661,11 +665,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -709,11 +715,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -808,11 +816,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -864,11 +874,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -911,11 +923,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -960,11 +974,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1049,11 +1065,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1128,11 +1146,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1197,11 +1217,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1246,11 +1268,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1355,7 +1379,6 @@ spec: matches all port names and numbers. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -1458,11 +1481,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1537,11 +1562,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1606,11 +1633,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1655,11 +1684,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1774,11 +1805,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1830,11 +1863,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1877,11 +1912,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1926,11 +1963,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2015,11 +2054,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2094,11 +2135,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2163,11 +2206,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2212,11 +2257,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2321,7 +2368,6 @@ spec: matches all port names and numbers. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -2424,11 +2470,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2503,11 +2551,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2572,11 +2622,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2621,11 +2673,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2705,11 +2759,11 @@ spec: items: description: "EndpointSubset is a group of addresses with a common set of ports. The\nexpanded set of endpoints is the - Cartesian product of Addresses x Ports.\nFor example, given:\n\n\n\t{\n\t + Cartesian product of Addresses x Ports.\nFor example, given:\n\n\t{\n\t \ Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}],\n\t \ Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": - \"b\", \"port\": 309}]\n\t}\n\n\nThe resulting set of endpoints - can be viewed as:\n\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 + \"b\", \"port\": 309}]\n\t}\n\nThe resulting set of endpoints + can be viewed as:\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 ],\n\tb: [ 10.10.1.1:309, 10.10.2.2:309 ]" properties: addresses: @@ -2749,7 +2803,6 @@ spec: the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. type: string kind: description: |- @@ -2783,6 +2836,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic notReadyAddresses: description: |- IP addresses which offer the related ports but are not currently marked as ready @@ -2821,7 +2875,6 @@ spec: the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. type: string kind: description: |- @@ -2855,6 +2908,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic ports: description: Port numbers available on the related IP addresses. items: @@ -2868,17 +2922,14 @@ spec: This field follows standard Kubernetes label syntax. Valid values are either: - * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). - * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol. type: string @@ -2894,7 +2945,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The IP protocol for this port. Must be UDP, TCP, or SCTP. @@ -2905,6 +2955,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic type: object type: array type: object @@ -2950,7 +3001,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -3037,7 +3087,6 @@ spec: clients must ensure that clusterIPs[0] and clusterIP have the same value. - This field may hold a maximum of two entries (dual-stack IPs, in either order). These IPs must correspond to the values of the ipFamilies field. Both clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. @@ -3056,6 +3105,7 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic externalName: description: |- externalName is the external reference that discovery mechanisms will @@ -3116,7 +3166,6 @@ spec: NodePort, and LoadBalancer, and does apply to "headless" services. This field will be wiped when updating a Service to type ExternalName. - This field may hold a maximum of two entries (dual-stack families, in either order). These families must correspond to the values of the clusterIPs field, if specified. Both clusterIPs and ipFamilies are @@ -3171,6 +3220,7 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic ports: description: |- The list of ports that are exposed by this service. @@ -3186,17 +3236,14 @@ spec: This field follows standard Kubernetes label syntax. Valid values are either: - * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). - * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol. type: string @@ -3301,6 +3348,16 @@ spec: type: integer type: object type: object + trafficDistribution: + description: |- + TrafficDistribution offers a way to express preferences for how traffic is + distributed to Service endpoints. Implementations can use this field as a + hint, but are not required to guarantee strict adherence. If the field is + not set, the implementation will apply its default routing strategy. If set + to "PreferClose", implementations should prioritize endpoints that are + topologically close (e.g., same zone). + This is an alpha field and requires enabling ServiceTrafficDistribution feature. + type: string type: description: |- type determines how the Service is exposed. Defaults to ClusterIP. Valid @@ -3362,7 +3419,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 labels: app: antrea name: resourceimports.multicluster.crd.antrea.io @@ -3500,11 +3557,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3555,11 +3614,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3601,11 +3662,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3649,11 +3712,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3748,11 +3813,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3804,11 +3871,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3851,11 +3920,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3900,11 +3971,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3989,11 +4062,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4068,11 +4143,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4137,11 +4214,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4186,11 +4265,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4295,7 +4376,6 @@ spec: matches all port names and numbers. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -4398,11 +4478,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4477,11 +4559,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4546,11 +4630,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4595,11 +4681,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4714,11 +4802,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4770,11 +4860,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4817,11 +4909,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4866,11 +4960,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4955,11 +5051,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5034,11 +5132,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5103,11 +5203,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5152,11 +5254,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5261,7 +5365,6 @@ spec: matches all port names and numbers. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -5364,11 +5467,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5443,11 +5548,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5512,11 +5619,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5561,11 +5670,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5645,11 +5756,11 @@ spec: items: description: "EndpointSubset is a group of addresses with a common set of ports. The\nexpanded set of endpoints is the - Cartesian product of Addresses x Ports.\nFor example, given:\n\n\n\t{\n\t + Cartesian product of Addresses x Ports.\nFor example, given:\n\n\t{\n\t \ Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}],\n\t \ Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": - \"b\", \"port\": 309}]\n\t}\n\n\nThe resulting set of endpoints - can be viewed as:\n\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 + \"b\", \"port\": 309}]\n\t}\n\nThe resulting set of endpoints + can be viewed as:\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 ],\n\tb: [ 10.10.1.1:309, 10.10.2.2:309 ]" properties: addresses: @@ -5689,7 +5800,6 @@ spec: the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. type: string kind: description: |- @@ -5723,6 +5833,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic notReadyAddresses: description: |- IP addresses which offer the related ports but are not currently marked as ready @@ -5761,7 +5872,6 @@ spec: the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. type: string kind: description: |- @@ -5795,6 +5905,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic ports: description: Port numbers available on the related IP addresses. items: @@ -5808,17 +5919,14 @@ spec: This field follows standard Kubernetes label syntax. Valid values are either: - * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). - * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol. type: string @@ -5834,7 +5942,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The IP protocol for this port. Must be UDP, TCP, or SCTP. @@ -5845,6 +5952,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic type: object type: array type: object @@ -5890,7 +5998,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -5988,7 +6095,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". Default is TCP. diff --git a/multicluster/build/yamls/antrea-multicluster-leader.yml b/multicluster/build/yamls/antrea-multicluster-leader.yml index 27ad0d5f2a4..8a2318bc51e 100644 --- a/multicluster/build/yamls/antrea-multicluster-leader.yml +++ b/multicluster/build/yamls/antrea-multicluster-leader.yml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 labels: app: antrea name: clustersets.multicluster.crd.antrea.io @@ -355,7 +355,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 labels: app: antrea name: memberclusterannounces.multicluster.crd.antrea.io @@ -421,7 +421,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 labels: app: antrea name: resourceexports.multicluster.crd.antrea.io @@ -560,11 +560,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -615,11 +617,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -661,11 +665,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -709,11 +715,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -808,11 +816,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -864,11 +874,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -911,11 +923,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -960,11 +974,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1049,11 +1065,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1128,11 +1146,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1197,11 +1217,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1246,11 +1268,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1355,7 +1379,6 @@ spec: matches all port names and numbers. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -1458,11 +1481,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1537,11 +1562,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1606,11 +1633,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1655,11 +1684,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1774,11 +1805,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1830,11 +1863,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1877,11 +1912,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1926,11 +1963,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2015,11 +2054,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2094,11 +2135,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2163,11 +2206,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2212,11 +2257,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2321,7 +2368,6 @@ spec: matches all port names and numbers. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -2424,11 +2470,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2503,11 +2551,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2572,11 +2622,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2621,11 +2673,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2705,11 +2759,11 @@ spec: items: description: "EndpointSubset is a group of addresses with a common set of ports. The\nexpanded set of endpoints is the - Cartesian product of Addresses x Ports.\nFor example, given:\n\n\n\t{\n\t + Cartesian product of Addresses x Ports.\nFor example, given:\n\n\t{\n\t \ Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}],\n\t \ Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": - \"b\", \"port\": 309}]\n\t}\n\n\nThe resulting set of endpoints - can be viewed as:\n\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 + \"b\", \"port\": 309}]\n\t}\n\nThe resulting set of endpoints + can be viewed as:\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 ],\n\tb: [ 10.10.1.1:309, 10.10.2.2:309 ]" properties: addresses: @@ -2749,7 +2803,6 @@ spec: the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. type: string kind: description: |- @@ -2783,6 +2836,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic notReadyAddresses: description: |- IP addresses which offer the related ports but are not currently marked as ready @@ -2821,7 +2875,6 @@ spec: the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. type: string kind: description: |- @@ -2855,6 +2908,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic ports: description: Port numbers available on the related IP addresses. items: @@ -2868,17 +2922,14 @@ spec: This field follows standard Kubernetes label syntax. Valid values are either: - * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). - * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol. type: string @@ -2894,7 +2945,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The IP protocol for this port. Must be UDP, TCP, or SCTP. @@ -2905,6 +2955,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic type: object type: array type: object @@ -2950,7 +3001,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -3037,7 +3087,6 @@ spec: clients must ensure that clusterIPs[0] and clusterIP have the same value. - This field may hold a maximum of two entries (dual-stack IPs, in either order). These IPs must correspond to the values of the ipFamilies field. Both clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. @@ -3056,6 +3105,7 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic externalName: description: |- externalName is the external reference that discovery mechanisms will @@ -3116,7 +3166,6 @@ spec: NodePort, and LoadBalancer, and does apply to "headless" services. This field will be wiped when updating a Service to type ExternalName. - This field may hold a maximum of two entries (dual-stack families, in either order). These families must correspond to the values of the clusterIPs field, if specified. Both clusterIPs and ipFamilies are @@ -3171,6 +3220,7 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic ports: description: |- The list of ports that are exposed by this service. @@ -3186,17 +3236,14 @@ spec: This field follows standard Kubernetes label syntax. Valid values are either: - * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). - * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol. type: string @@ -3301,6 +3348,16 @@ spec: type: integer type: object type: object + trafficDistribution: + description: |- + TrafficDistribution offers a way to express preferences for how traffic is + distributed to Service endpoints. Implementations can use this field as a + hint, but are not required to guarantee strict adherence. If the field is + not set, the implementation will apply its default routing strategy. If set + to "PreferClose", implementations should prioritize endpoints that are + topologically close (e.g., same zone). + This is an alpha field and requires enabling ServiceTrafficDistribution feature. + type: string type: description: |- type determines how the Service is exposed. Defaults to ClusterIP. Valid @@ -3362,7 +3419,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 labels: app: antrea name: resourceimports.multicluster.crd.antrea.io @@ -3500,11 +3557,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3555,11 +3614,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3601,11 +3662,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3649,11 +3712,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3748,11 +3813,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3804,11 +3871,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3851,11 +3920,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3900,11 +3971,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -3989,11 +4062,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4068,11 +4143,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4137,11 +4214,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4186,11 +4265,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4295,7 +4376,6 @@ spec: matches all port names and numbers. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -4398,11 +4478,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4477,11 +4559,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4546,11 +4630,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4595,11 +4681,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4714,11 +4802,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4770,11 +4860,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4817,11 +4909,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4866,11 +4960,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -4955,11 +5051,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5034,11 +5132,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5103,11 +5203,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5152,11 +5254,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5261,7 +5365,6 @@ spec: matches all port names and numbers. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -5364,11 +5467,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5443,11 +5548,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5512,11 +5619,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5561,11 +5670,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -5645,11 +5756,11 @@ spec: items: description: "EndpointSubset is a group of addresses with a common set of ports. The\nexpanded set of endpoints is the - Cartesian product of Addresses x Ports.\nFor example, given:\n\n\n\t{\n\t + Cartesian product of Addresses x Ports.\nFor example, given:\n\n\t{\n\t \ Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}],\n\t \ Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": - \"b\", \"port\": 309}]\n\t}\n\n\nThe resulting set of endpoints - can be viewed as:\n\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 + \"b\", \"port\": 309}]\n\t}\n\nThe resulting set of endpoints + can be viewed as:\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 ],\n\tb: [ 10.10.1.1:309, 10.10.2.2:309 ]" properties: addresses: @@ -5689,7 +5800,6 @@ spec: the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. type: string kind: description: |- @@ -5723,6 +5833,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic notReadyAddresses: description: |- IP addresses which offer the related ports but are not currently marked as ready @@ -5761,7 +5872,6 @@ spec: the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. type: string kind: description: |- @@ -5795,6 +5905,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic ports: description: Port numbers available on the related IP addresses. items: @@ -5808,17 +5919,14 @@ spec: This field follows standard Kubernetes label syntax. Valid values are either: - * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). - * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol. type: string @@ -5834,7 +5942,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The IP protocol for this port. Must be UDP, TCP, or SCTP. @@ -5845,6 +5952,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic type: object type: array type: object @@ -5890,7 +5998,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -5988,7 +6095,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". Default is TCP. diff --git a/multicluster/build/yamls/antrea-multicluster-member.yml b/multicluster/build/yamls/antrea-multicluster-member.yml index b9ade771c70..d3b93b0bbec 100644 --- a/multicluster/build/yamls/antrea-multicluster-member.yml +++ b/multicluster/build/yamls/antrea-multicluster-member.yml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 labels: app: antrea name: clusterinfoimports.multicluster.crd.antrea.io @@ -118,7 +118,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 labels: app: antrea name: clustersets.multicluster.crd.antrea.io @@ -471,7 +471,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 labels: app: antrea name: gateways.multicluster.crd.antrea.io @@ -544,7 +544,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 labels: app: antrea name: labelidentities.multicluster.crd.antrea.io diff --git a/multicluster/cmd/multicluster-controller/clusterset_webhook.go b/multicluster/cmd/multicluster-controller/clusterset_webhook.go index 798d70258db..a54df0e735b 100644 --- a/multicluster/cmd/multicluster-controller/clusterset_webhook.go +++ b/multicluster/cmd/multicluster-controller/clusterset_webhook.go @@ -36,7 +36,7 @@ import ( // ClusterSet validator type clusterSetValidator struct { Client client.Client - decoder *admission.Decoder + decoder admission.Decoder namespace string role string } diff --git a/multicluster/cmd/multicluster-controller/gateway_webhook.go b/multicluster/cmd/multicluster-controller/gateway_webhook.go index 2566b583ca5..0e449a59c3e 100644 --- a/multicluster/cmd/multicluster-controller/gateway_webhook.go +++ b/multicluster/cmd/multicluster-controller/gateway_webhook.go @@ -40,7 +40,7 @@ const ( // Gateway validator type gatewayValidator struct { Client client.Client - decoder *admission.Decoder + decoder admission.Decoder namespace string } diff --git a/multicluster/cmd/multicluster-controller/leader_test.go b/multicluster/cmd/multicluster-controller/leader_test.go index bdf73b033dc..911b998bd9c 100644 --- a/multicluster/cmd/multicluster-controller/leader_test.go +++ b/multicluster/cmd/multicluster-controller/leader_test.go @@ -26,6 +26,7 @@ import ( "k8s.io/apimachinery/pkg/api/meta" "k8s.io/client-go/rest" "k8s.io/klog/v2" + "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/cache/informertest" "sigs.k8s.io/controller-runtime/pkg/client/fake" @@ -43,7 +44,12 @@ func initMockManager(mockManager *mocks.MockManager) { mockManager.EXPECT().GetWebhookServer().Return(&webhook.DefaultServer{}).AnyTimes() mockManager.EXPECT().GetClient().Return(fakeClient).AnyTimes() mockManager.EXPECT().GetScheme().Return(common.TestScheme).AnyTimes() - mockManager.EXPECT().GetControllerOptions().Return(config.Controller{}).AnyTimes() + mockManager.EXPECT().GetControllerOptions().Return(config.Controller{ + // Necessary for the tests as the controller-runtime includes a global check for + // controller name uniqueness, and multiple test cases creating the same controllers + // will be run sequentially in the same process by Go. + SkipNameValidation: ptr.To(true), + }).AnyTimes() mockManager.EXPECT().GetCache().Return(&informertest.FakeInformers{}).AnyTimes() mockManager.EXPECT().GetLogger().Return(klog.NewKlogr()).AnyTimes() mockManager.EXPECT().Add(gomock.Any()).Return(nil).AnyTimes() @@ -69,14 +75,15 @@ func TestRunLeader(t *testing.T) { } for _, tc := range testCases { - mockCtrl := gomock.NewController(t) - mockLeaderManager := mocks.NewMockManager(mockCtrl) - initMockManager(mockLeaderManager) - setupManagerAndCertControllerFunc = func(isLeader bool, o *Options) (ctrl.Manager, error) { - return mockLeaderManager, nil - } - ctrl.SetupSignalHandler = mockSetupSignalHandler t.Run(tc.name, func(t *testing.T) { + mockCtrl := gomock.NewController(t) + mockLeaderManager := mocks.NewMockManager(mockCtrl) + initMockManager(mockLeaderManager) + setupManagerAndCertControllerFunc = func(isLeader bool, o *Options) (ctrl.Manager, error) { + return mockLeaderManager, nil + } + ctrl.SetupSignalHandler = mockSetupSignalHandler + err := runLeader(tc.options) assert.NoError(t, err, "got error when running runLeader") }) diff --git a/multicluster/cmd/multicluster-controller/member_test.go b/multicluster/cmd/multicluster-controller/member_test.go index 74c8384f33c..b045fbda61d 100644 --- a/multicluster/cmd/multicluster-controller/member_test.go +++ b/multicluster/cmd/multicluster-controller/member_test.go @@ -86,17 +86,18 @@ func TestRunMember(t *testing.T) { } for _, tc := range testCases { - mockCtrl := gomock.NewController(t) - mockMemberManager := mocks.NewMockManager(mockCtrl) - initMockManager(mockMemberManager) - setupManagerAndCertControllerFunc = func(isLeader bool, o *Options) (ctrl.Manager, error) { - return mockMemberManager, nil - } - member.ServiceCIDRDiscoverFn = func(ctx context.Context, k8sClient client.Client, namespace string) (string, error) { - return "10.101.0.0/16", nil - } - ctrl.SetupSignalHandler = mockSetupSignalHandler t.Run(tc.name, func(t *testing.T) { + mockCtrl := gomock.NewController(t) + mockMemberManager := mocks.NewMockManager(mockCtrl) + initMockManager(mockMemberManager) + setupManagerAndCertControllerFunc = func(isLeader bool, o *Options) (ctrl.Manager, error) { + return mockMemberManager, nil + } + member.ServiceCIDRDiscoverFn = func(ctx context.Context, k8sClient client.Client, namespace string) (string, error) { + return "10.101.0.0/16", nil + } + ctrl.SetupSignalHandler = mockSetupSignalHandler + err := runMember(tc.options) assert.NoError(t, err, "got error when running runMember") }) diff --git a/multicluster/cmd/multicluster-controller/memberclusterannounce_webhook.go b/multicluster/cmd/multicluster-controller/memberclusterannounce_webhook.go index 64ffb18e0ad..0fec4eacef3 100644 --- a/multicluster/cmd/multicluster-controller/memberclusterannounce_webhook.go +++ b/multicluster/cmd/multicluster-controller/memberclusterannounce_webhook.go @@ -37,7 +37,7 @@ import ( type memberClusterAnnounceValidator struct { Client client.Client - decoder *admission.Decoder + decoder admission.Decoder namespace string } diff --git a/multicluster/config/crd/bases/multicluster.crd.antrea.io_clusterclaims.yaml b/multicluster/config/crd/bases/multicluster.crd.antrea.io_clusterclaims.yaml index be8c2a54090..399a4ff3b27 100644 --- a/multicluster/config/crd/bases/multicluster.crd.antrea.io_clusterclaims.yaml +++ b/multicluster/config/crd/bases/multicluster.crd.antrea.io_clusterclaims.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: clusterclaims.multicluster.crd.antrea.io spec: group: multicluster.crd.antrea.io diff --git a/multicluster/config/crd/bases/multicluster.crd.antrea.io_clusterinfoimports.yaml b/multicluster/config/crd/bases/multicluster.crd.antrea.io_clusterinfoimports.yaml index 51e2699ffb2..3eb3237b21a 100644 --- a/multicluster/config/crd/bases/multicluster.crd.antrea.io_clusterinfoimports.yaml +++ b/multicluster/config/crd/bases/multicluster.crd.antrea.io_clusterinfoimports.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: clusterinfoimports.multicluster.crd.antrea.io spec: group: multicluster.crd.antrea.io diff --git a/multicluster/config/crd/bases/multicluster.crd.antrea.io_clustersets.yaml b/multicluster/config/crd/bases/multicluster.crd.antrea.io_clustersets.yaml index 1ad03afa4cf..18cff3d8b90 100644 --- a/multicluster/config/crd/bases/multicluster.crd.antrea.io_clustersets.yaml +++ b/multicluster/config/crd/bases/multicluster.crd.antrea.io_clustersets.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: clustersets.multicluster.crd.antrea.io spec: group: multicluster.crd.antrea.io diff --git a/multicluster/config/crd/bases/multicluster.crd.antrea.io_gateways.yaml b/multicluster/config/crd/bases/multicluster.crd.antrea.io_gateways.yaml index a8fa6869595..127e4b5904e 100644 --- a/multicluster/config/crd/bases/multicluster.crd.antrea.io_gateways.yaml +++ b/multicluster/config/crd/bases/multicluster.crd.antrea.io_gateways.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: gateways.multicluster.crd.antrea.io spec: group: multicluster.crd.antrea.io diff --git a/multicluster/config/crd/bases/multicluster.crd.antrea.io_labelidentities.yaml b/multicluster/config/crd/bases/multicluster.crd.antrea.io_labelidentities.yaml index 2f8479c322f..50bb35da5ad 100644 --- a/multicluster/config/crd/bases/multicluster.crd.antrea.io_labelidentities.yaml +++ b/multicluster/config/crd/bases/multicluster.crd.antrea.io_labelidentities.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: labelidentities.multicluster.crd.antrea.io spec: group: multicluster.crd.antrea.io diff --git a/multicluster/config/crd/bases/multicluster.crd.antrea.io_memberclusterannounces.yaml b/multicluster/config/crd/bases/multicluster.crd.antrea.io_memberclusterannounces.yaml index 78e1393b4ec..df672162487 100644 --- a/multicluster/config/crd/bases/multicluster.crd.antrea.io_memberclusterannounces.yaml +++ b/multicluster/config/crd/bases/multicluster.crd.antrea.io_memberclusterannounces.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: memberclusterannounces.multicluster.crd.antrea.io spec: group: multicluster.crd.antrea.io diff --git a/multicluster/config/crd/bases/multicluster.crd.antrea.io_resourceexports.yaml b/multicluster/config/crd/bases/multicluster.crd.antrea.io_resourceexports.yaml index 75b4b37cbe9..7c99ad0634d 100644 --- a/multicluster/config/crd/bases/multicluster.crd.antrea.io_resourceexports.yaml +++ b/multicluster/config/crd/bases/multicluster.crd.antrea.io_resourceexports.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: resourceexports.multicluster.crd.antrea.io spec: group: multicluster.crd.antrea.io @@ -140,11 +140,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -195,11 +197,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -241,11 +245,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -289,11 +295,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -388,11 +396,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -444,11 +454,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -491,11 +503,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -540,11 +554,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -629,11 +645,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -708,11 +726,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -777,11 +797,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -826,11 +848,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -935,7 +959,6 @@ spec: matches all port names and numbers. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -1038,11 +1061,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1117,11 +1142,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1186,11 +1213,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1235,11 +1264,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1354,11 +1385,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1410,11 +1443,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1457,11 +1492,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1506,11 +1543,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1595,11 +1634,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1674,11 +1715,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1743,11 +1786,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1792,11 +1837,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1901,7 +1948,6 @@ spec: matches all port names and numbers. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -2004,11 +2050,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2083,11 +2131,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2152,11 +2202,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2201,11 +2253,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2285,11 +2339,11 @@ spec: items: description: "EndpointSubset is a group of addresses with a common set of ports. The\nexpanded set of endpoints is the - Cartesian product of Addresses x Ports.\nFor example, given:\n\n\n\t{\n\t + Cartesian product of Addresses x Ports.\nFor example, given:\n\n\t{\n\t \ Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}],\n\t \ Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": - \"b\", \"port\": 309}]\n\t}\n\n\nThe resulting set of endpoints - can be viewed as:\n\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 + \"b\", \"port\": 309}]\n\t}\n\nThe resulting set of endpoints + can be viewed as:\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 ],\n\tb: [ 10.10.1.1:309, 10.10.2.2:309 ]" properties: addresses: @@ -2329,7 +2383,6 @@ spec: the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. type: string kind: description: |- @@ -2363,6 +2416,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic notReadyAddresses: description: |- IP addresses which offer the related ports but are not currently marked as ready @@ -2401,7 +2455,6 @@ spec: the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. type: string kind: description: |- @@ -2435,6 +2488,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic ports: description: Port numbers available on the related IP addresses. items: @@ -2448,17 +2502,14 @@ spec: This field follows standard Kubernetes label syntax. Valid values are either: - * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). - * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol. type: string @@ -2474,7 +2525,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The IP protocol for this port. Must be UDP, TCP, or SCTP. @@ -2485,6 +2535,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic type: object type: array type: object @@ -2530,7 +2581,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -2617,7 +2667,6 @@ spec: clients must ensure that clusterIPs[0] and clusterIP have the same value. - This field may hold a maximum of two entries (dual-stack IPs, in either order). These IPs must correspond to the values of the ipFamilies field. Both clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. @@ -2636,6 +2685,7 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic externalName: description: |- externalName is the external reference that discovery mechanisms will @@ -2696,7 +2746,6 @@ spec: NodePort, and LoadBalancer, and does apply to "headless" services. This field will be wiped when updating a Service to type ExternalName. - This field may hold a maximum of two entries (dual-stack families, in either order). These families must correspond to the values of the clusterIPs field, if specified. Both clusterIPs and ipFamilies are @@ -2751,6 +2800,7 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic ports: description: |- The list of ports that are exposed by this service. @@ -2766,17 +2816,14 @@ spec: This field follows standard Kubernetes label syntax. Valid values are either: - * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). - * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol. type: string @@ -2881,6 +2928,16 @@ spec: type: integer type: object type: object + trafficDistribution: + description: |- + TrafficDistribution offers a way to express preferences for how traffic is + distributed to Service endpoints. Implementations can use this field as a + hint, but are not required to guarantee strict adherence. If the field is + not set, the implementation will apply its default routing strategy. If set + to "PreferClose", implementations should prioritize endpoints that are + topologically close (e.g., same zone). + This is an alpha field and requires enabling ServiceTrafficDistribution feature. + type: string type: description: |- type determines how the Service is exposed. Defaults to ClusterIP. Valid diff --git a/multicluster/config/crd/bases/multicluster.crd.antrea.io_resourceimports.yaml b/multicluster/config/crd/bases/multicluster.crd.antrea.io_resourceimports.yaml index 88433224964..96271cea8a8 100644 --- a/multicluster/config/crd/bases/multicluster.crd.antrea.io_resourceimports.yaml +++ b/multicluster/config/crd/bases/multicluster.crd.antrea.io_resourceimports.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: resourceimports.multicluster.crd.antrea.io spec: group: multicluster.crd.antrea.io @@ -139,11 +139,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -194,11 +196,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -240,11 +244,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -288,11 +294,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -387,11 +395,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -443,11 +453,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -490,11 +502,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -539,11 +553,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -628,11 +644,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -707,11 +725,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -776,11 +796,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -825,11 +847,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -934,7 +958,6 @@ spec: matches all port names and numbers. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -1037,11 +1060,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1116,11 +1141,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1185,11 +1212,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1234,11 +1263,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1353,11 +1384,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1409,11 +1442,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1456,11 +1491,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1505,11 +1542,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1594,11 +1633,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1673,11 +1714,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1742,11 +1785,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1791,11 +1836,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -1900,7 +1947,6 @@ spec: matches all port names and numbers. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -2003,11 +2049,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2082,11 +2130,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2151,11 +2201,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2200,11 +2252,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -2284,11 +2338,11 @@ spec: items: description: "EndpointSubset is a group of addresses with a common set of ports. The\nexpanded set of endpoints is the - Cartesian product of Addresses x Ports.\nFor example, given:\n\n\n\t{\n\t + Cartesian product of Addresses x Ports.\nFor example, given:\n\n\t{\n\t \ Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}],\n\t \ Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": - \"b\", \"port\": 309}]\n\t}\n\n\nThe resulting set of endpoints - can be viewed as:\n\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 + \"b\", \"port\": 309}]\n\t}\n\nThe resulting set of endpoints + can be viewed as:\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 ],\n\tb: [ 10.10.1.1:309, 10.10.2.2:309 ]" properties: addresses: @@ -2328,7 +2382,6 @@ spec: the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. type: string kind: description: |- @@ -2362,6 +2415,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic notReadyAddresses: description: |- IP addresses which offer the related ports but are not currently marked as ready @@ -2400,7 +2454,6 @@ spec: the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. type: string kind: description: |- @@ -2434,6 +2487,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic ports: description: Port numbers available on the related IP addresses. items: @@ -2447,17 +2501,14 @@ spec: This field follows standard Kubernetes label syntax. Valid values are either: - * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). - * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol. type: string @@ -2473,7 +2524,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The IP protocol for this port. Must be UDP, TCP, or SCTP. @@ -2484,6 +2534,7 @@ spec: type: object x-kubernetes-map-type: atomic type: array + x-kubernetes-list-type: atomic type: object type: array type: object @@ -2529,7 +2580,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. @@ -2627,7 +2677,6 @@ spec: format: int32 type: integer protocol: - default: TCP description: |- The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". Default is TCP. diff --git a/multicluster/config/rbac/role.yaml b/multicluster/config/rbac/role.yaml index 77ab509f815..3965bbdb97e 100644 --- a/multicluster/config/rbac/role.yaml +++ b/multicluster/config/rbac/role.yaml @@ -8,6 +8,7 @@ rules: - "" resources: - endpoints + - services verbs: - create - delete @@ -30,18 +31,6 @@ rules: - get - list - watch -- apiGroups: - - "" - resources: - - services - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - apiGroups: - crd.antrea.io resources: @@ -74,135 +63,10 @@ rules: - multicluster.crd.antrea.io resources: - clusterinfoimports - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - multicluster.crd.antrea.io - resources: - - clusterinfoimports/finalizers - verbs: - - update -- apiGroups: - - multicluster.crd.antrea.io - resources: - - clusterinfoimports/status - verbs: - - get - - patch - - update -- apiGroups: - - multicluster.crd.antrea.io - resources: - clustersets - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - multicluster.crd.antrea.io - resources: - - clustersets/finalizers - verbs: - - update -- apiGroups: - - multicluster.crd.antrea.io - resources: - - clustersets/status - verbs: - - get - - patch - - update -- apiGroups: - - multicluster.crd.antrea.io - resources: - gateways - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - multicluster.crd.antrea.io - resources: - - gateways/finalizers - verbs: - - update -- apiGroups: - - multicluster.crd.antrea.io - resources: - - gateways/status - verbs: - - get - - patch - - update -- apiGroups: - - multicluster.crd.antrea.io - resources: - memberclusterannounces - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - multicluster.crd.antrea.io - resources: - - memberclusterannounces/finalizers - verbs: - - update -- apiGroups: - - multicluster.crd.antrea.io - resources: - - memberclusterannounces/status - verbs: - - get - - patch - - update -- apiGroups: - - multicluster.crd.antrea.io - resources: - resourceexports - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - multicluster.crd.antrea.io - resources: - - resourceexports/finalizers - verbs: - - update -- apiGroups: - - multicluster.crd.antrea.io - resources: - - resourceexports/status - verbs: - - get - - patch - - update -- apiGroups: - - multicluster.crd.antrea.io - resources: - resourceimports verbs: - create @@ -215,12 +79,22 @@ rules: - apiGroups: - multicluster.crd.antrea.io resources: + - clusterinfoimports/finalizers + - clustersets/finalizers + - gateways/finalizers + - memberclusterannounces/finalizers + - resourceexports/finalizers - resourceimports/finalizers verbs: - update - apiGroups: - multicluster.crd.antrea.io resources: + - clusterinfoimports/status + - clustersets/status + - gateways/status + - memberclusterannounces/status + - resourceexports/status - resourceimports/status verbs: - get @@ -230,25 +104,6 @@ rules: - multicluster.x-k8s.io resources: - serviceexports - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - multicluster.x-k8s.io - resources: - - serviceexports/status - verbs: - - get - - patch - - update -- apiGroups: - - multicluster.x-k8s.io - resources: - serviceimports verbs: - create @@ -261,6 +116,7 @@ rules: - apiGroups: - multicluster.x-k8s.io resources: + - serviceexports/status - serviceimports/status verbs: - get diff --git a/multicluster/controllers/multicluster/leader/clusterset_controller.go b/multicluster/controllers/multicluster/leader/clusterset_controller.go index faf8186fceb..6f2fce6be89 100644 --- a/multicluster/controllers/multicluster/leader/clusterset_controller.go +++ b/multicluster/controllers/multicluster/leader/clusterset_controller.go @@ -129,6 +129,7 @@ func (r *LeaderClusterSetReconciler) SetupWithManager(mgr ctrl.Manager) error { instance := predicate.GenerationChangedPredicate{} return ctrl.NewControllerManagedBy(mgr). For(&mcv1alpha2.ClusterSet{}). + Named("clusterset"). WithEventFilter(instance). WithOptions(controller.Options{ MaxConcurrentReconciles: 1, diff --git a/multicluster/controllers/multicluster/leader/labelidentity_export_controller.go b/multicluster/controllers/multicluster/leader/labelidentity_export_controller.go index 149eef6121b..b63ac14fe8d 100644 --- a/multicluster/controllers/multicluster/leader/labelidentity_export_controller.go +++ b/multicluster/controllers/multicluster/leader/labelidentity_export_controller.go @@ -50,21 +50,19 @@ const ( // LabelIdentityExportReconciler watches LabelIdentity ResourceExport events in the Common Area, // computes if such an event causes a new LabelIdentity to become present/stale in the entire // ClusterSet, and updates ResourceImports accordingly. -type ( - LabelIdentityExportReconciler struct { - client.Client - Scheme *runtime.Scheme - mutex sync.RWMutex - namespace string - clusterToLabels map[string]sets.Set[string] - labelsToClusters map[string]sets.Set[string] - hashToLabels map[string]string - labelQueue workqueue.RateLimitingInterface - numWorkers int - labelsToID sync.Map - allocator *idAllocator - } -) +type LabelIdentityExportReconciler struct { + client.Client + Scheme *runtime.Scheme + mutex sync.RWMutex + namespace string + clusterToLabels map[string]sets.Set[string] + labelsToClusters map[string]sets.Set[string] + hashToLabels map[string]string + labelQueue workqueue.TypedRateLimitingInterface[string] + numWorkers int + labelsToID sync.Map + allocator *idAllocator +} func NewLabelIdentityExportReconciler( client client.Client, @@ -77,7 +75,7 @@ func NewLabelIdentityExportReconciler( clusterToLabels: map[string]sets.Set[string]{}, labelsToClusters: map[string]sets.Set[string]{}, hashToLabels: map[string]string{}, - labelQueue: workqueue.NewRateLimitingQueue(workqueue.DefaultItemBasedRateLimiter()), + labelQueue: workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedItemBasedRateLimiter[string]()), numWorkers: common.DefaultWorkerCount, labelsToID: sync.Map{}, allocator: newIDAllocator(1, maxIDForAllocation), @@ -120,6 +118,7 @@ func (r *LabelIdentityExportReconciler) SetupWithManager(mgr ctrl.Manager) error instance := predicate.And(generationPredicate, labelIdentityResExportPredicate) return ctrl.NewControllerManagedBy(mgr). For(&mcsv1alpha1.ResourceExport{}). + Named("labelidentity_export"). WithEventFilter(instance). WithOptions(controller.Options{ MaxConcurrentReconciles: common.LabelIdentityWorkerCount, @@ -194,8 +193,7 @@ func (r *LabelIdentityExportReconciler) processLabelForResourceImport() bool { return false } defer r.labelQueue.Done(key) - err := r.syncLabelResourceImport(key.(string)) - if err != nil { + if err := r.syncLabelResourceImport(key); err != nil { // Put the item back on the workqueue to handle any transient errors. r.labelQueue.AddRateLimited(key) klog.ErrorS(err, "Failed to sync ResourceImport for label identity", "label", key) diff --git a/multicluster/controllers/multicluster/leader/memberclusterannounce_controller.go b/multicluster/controllers/multicluster/leader/memberclusterannounce_controller.go index 2a6786da0fd..adc4c8968d2 100644 --- a/multicluster/controllers/multicluster/leader/memberclusterannounce_controller.go +++ b/multicluster/controllers/multicluster/leader/memberclusterannounce_controller.go @@ -118,6 +118,7 @@ func (r *MemberClusterAnnounceReconciler) SetupWithManager(mgr ctrl.Manager) err return ctrl.NewControllerManagedBy(mgr). For(&mcv1alpha1.MemberClusterAnnounce{}). + Named("memberclusterannounce"). Complete(r) } diff --git a/multicluster/controllers/multicluster/leader/resourceexport_controller.go b/multicluster/controllers/multicluster/leader/resourceexport_controller.go index 42ecbee1460..c836f28dc88 100644 --- a/multicluster/controllers/multicluster/leader/resourceexport_controller.go +++ b/multicluster/controllers/multicluster/leader/resourceexport_controller.go @@ -483,6 +483,7 @@ func (r *ResourceExportReconciler) SetupWithManager(mgr ctrl.Manager) error { instance := predicate.And(generationPredicate, labelIdentityResExportPredicate) return ctrl.NewControllerManagedBy(mgr). For(&mcsv1alpha1.ResourceExport{}). + Named("resourceexport"). WithEventFilter(instance). WithOptions(controller.Options{ MaxConcurrentReconciles: common.DefaultWorkerCount, diff --git a/multicluster/controllers/multicluster/leader/stale_controller.go b/multicluster/controllers/multicluster/leader/stale_controller.go index cf4ef7bee3c..a85a882c298 100644 --- a/multicluster/controllers/multicluster/leader/stale_controller.go +++ b/multicluster/controllers/multicluster/leader/stale_controller.go @@ -149,6 +149,7 @@ func (c *StaleResCleanupController) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&mcv1alpha1.MemberClusterAnnounce{}). + Named("memberclusterannounce_stale"). WithOptions(controller.Options{ MaxConcurrentReconciles: 1, }). diff --git a/multicluster/controllers/multicluster/member/clusterset_controller.go b/multicluster/controllers/multicluster/member/clusterset_controller.go index 678bbf26e50..62024a9cb2f 100644 --- a/multicluster/controllers/multicluster/member/clusterset_controller.go +++ b/multicluster/controllers/multicluster/member/clusterset_controller.go @@ -232,6 +232,7 @@ func (r *MemberClusterSetReconciler) SetupWithManager(mgr ctrl.Manager) error { generationPredicate := predicate.GenerationChangedPredicate{} return ctrl.NewControllerManagedBy(mgr). For(&mcv1alpha2.ClusterSet{}). + Named("clusterset"). WithEventFilter(generationPredicate). WithOptions(controller.Options{ MaxConcurrentReconciles: 1, diff --git a/multicluster/controllers/multicluster/member/gateway_controller.go b/multicluster/controllers/multicluster/member/gateway_controller.go index 7c2ed5f5ef7..56085ae081c 100644 --- a/multicluster/controllers/multicluster/member/gateway_controller.go +++ b/multicluster/controllers/multicluster/member/gateway_controller.go @@ -185,6 +185,7 @@ func (r *GatewayReconciler) createResourceExport(ctx context.Context, req ctrl.R func (r *GatewayReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&mcv1alpha1.Gateway{}). + Named("gateway"). Watches(&mcv1alpha2.ClusterSet{}, handler.EnqueueRequestsFromMapFunc(r.clusterSetMapFunc), builder.WithPredicates(statusReadyPredicate)). WithOptions(controller.Options{ diff --git a/multicluster/controllers/multicluster/member/labelidentity_controller.go b/multicluster/controllers/multicluster/member/labelidentity_controller.go index 6d25d4f5c3e..7eb8f219034 100644 --- a/multicluster/controllers/multicluster/member/labelidentity_controller.go +++ b/multicluster/controllers/multicluster/member/labelidentity_controller.go @@ -49,27 +49,25 @@ import ( // LabelIdentityReconciler watches relevant Pod and Namespace events in the member cluster, // computes the label identities added to and deleted from the cluster, and exports them to the // leader cluster for further processing. -type ( - LabelIdentityReconciler struct { - client.Client - Scheme *runtime.Scheme - commonAreaMutex sync.Mutex - commonAreaGetter commonarea.RemoteCommonAreaGetter - remoteCommonArea commonarea.RemoteCommonArea - namespace string - // labelMutex prevents concurrent access to labelToPodsCache and podLabelCache. - // It also prevents concurrent updates to labelExportUpdatesInProgress. - labelMutex sync.RWMutex - // labelToPodsCache stores mapping from label identities to Pods that have this label identity. - labelToPodsCache map[string]sets.Set[string] - // podLabelCache stores mapping from Pods to their label identities. - podLabelCache map[string]string - // labelQueue maintains the normalized labels whose corresponding ResourceExport objects are - // determined to be created/deleted by the reconciler. - labelQueue workqueue.RateLimitingInterface - localClusterID string - } -) +type LabelIdentityReconciler struct { + client.Client + Scheme *runtime.Scheme + commonAreaMutex sync.Mutex + commonAreaGetter commonarea.RemoteCommonAreaGetter + remoteCommonArea commonarea.RemoteCommonArea + namespace string + // labelMutex prevents concurrent access to labelToPodsCache and podLabelCache. + // It also prevents concurrent updates to labelExportUpdatesInProgress. + labelMutex sync.RWMutex + // labelToPodsCache stores mapping from label identities to Pods that have this label identity. + labelToPodsCache map[string]sets.Set[string] + // podLabelCache stores mapping from Pods to their label identities. + podLabelCache map[string]string + // labelQueue maintains the normalized labels whose corresponding ResourceExport objects are + // determined to be created/deleted by the reconciler. + labelQueue workqueue.TypedRateLimitingInterface[string] + localClusterID string +} func NewLabelIdentityReconciler( client client.Client, @@ -83,7 +81,7 @@ func NewLabelIdentityReconciler( commonAreaGetter: commonAreaGetter, labelToPodsCache: map[string]sets.Set[string]{}, podLabelCache: map[string]string{}, - labelQueue: workqueue.NewRateLimitingQueue(workqueue.DefaultItemBasedRateLimiter()), + labelQueue: workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedItemBasedRateLimiter[string]()), } } @@ -134,6 +132,7 @@ func (r *LabelIdentityReconciler) checkRemoteCommonArea() bool { func (r *LabelIdentityReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&v1.Pod{}, builder.WithPredicates(predicate.LabelChangedPredicate{})). + Named("labelidentity"). Watches(&v1.Namespace{}, handler.EnqueueRequestsFromMapFunc(r.namespaceMapFunc), builder.WithPredicates(predicate.LabelChangedPredicate{})). @@ -273,8 +272,7 @@ func (r *LabelIdentityReconciler) processLabelForResourceExport() bool { return false } defer r.labelQueue.Done(key) - err := r.syncLabelResourceExport(key.(string)) - if err != nil { + if err := r.syncLabelResourceExport(key); err != nil { // Put the item back on the workqueue to handle any transient errors. r.labelQueue.AddRateLimited(key) klog.ErrorS(err, "Failed to sync ResourceExport for label identity", "label", key) diff --git a/multicluster/controllers/multicluster/member/labelidentity_import_controller.go b/multicluster/controllers/multicluster/member/labelidentity_import_controller.go index af9d8db32f7..088e3c5db2c 100644 --- a/multicluster/controllers/multicluster/member/labelidentity_import_controller.go +++ b/multicluster/controllers/multicluster/member/labelidentity_import_controller.go @@ -138,6 +138,7 @@ func (r *LabelIdentityResourceImportReconciler) SetupWithManager(mgr ctrl.Manage instance := predicate.And(generationPredicate, labelIdentityResImportPredicate) err := ctrl.NewControllerManagedBy(mgr). For(&multiclusterv1alpha1.ResourceImport{}). + Named("labelidentity_import"). WithEventFilter(instance). WithOptions(controller.Options{ MaxConcurrentReconciles: common.LabelIdentityWorkerCount, diff --git a/multicluster/controllers/multicluster/member/node_controller.go b/multicluster/controllers/multicluster/member/node_controller.go index ec9115737a8..97ed355ee87 100644 --- a/multicluster/controllers/multicluster/member/node_controller.go +++ b/multicluster/controllers/multicluster/member/node_controller.go @@ -372,6 +372,7 @@ func (r *NodeReconciler) SetupWithManager(mgr ctrl.Manager) error { } return ctrl.NewControllerManagedBy(mgr). For(&corev1.Node{}). + Named("node"). Watches(&mcv1alpha2.ClusterSet{}, handler.EnqueueRequestsFromMapFunc(r.clusterSetMapFunc), builder.WithPredicates(statusReadyPredicate)). diff --git a/multicluster/controllers/multicluster/member/resourceimport_controller.go b/multicluster/controllers/multicluster/member/resourceimport_controller.go index c5bfb480408..6402a212b4e 100644 --- a/multicluster/controllers/multicluster/member/resourceimport_controller.go +++ b/multicluster/controllers/multicluster/member/resourceimport_controller.go @@ -389,6 +389,7 @@ func (r *ResourceImportReconciler) SetupWithManager(mgr ctrl.Manager) error { instance := predicate.And(generationPredicate, labelIdentityResImportPredicate) err := ctrl.NewControllerManagedBy(mgr). For(&multiclusterv1alpha1.ResourceImport{}). + Named("resourceimport"). WithEventFilter(instance). WithOptions(controller.Options{ MaxConcurrentReconciles: common.DefaultWorkerCount, diff --git a/multicluster/controllers/multicluster/member/resourceimport_controller_test.go b/multicluster/controllers/multicluster/member/resourceimport_controller_test.go index a8c44798bd3..6b679a3fda2 100644 --- a/multicluster/controllers/multicluster/member/resourceimport_controller_test.go +++ b/multicluster/controllers/multicluster/member/resourceimport_controller_test.go @@ -503,7 +503,7 @@ func TestResourceImportReconciler_handleUpdateEvent(t *testing.T) { type fakeManager struct { remoteClient client.Client reconciler *LabelIdentityResourceImportReconciler - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[*mcv1alpha1.ResourceImport] } func (fm *fakeManager) Run(stopCh <-chan struct{}) { @@ -520,12 +520,11 @@ func (fm *fakeManager) worker() { } func (fm *fakeManager) syncNextItemInQueue() bool { - resImpObj, quit := fm.queue.Get() + resImp, quit := fm.queue.Get() if quit { return false } - defer fm.queue.Done(resImpObj) - resImp := resImpObj.(*mcv1alpha1.ResourceImport) + defer fm.queue.Done(resImp) err := fm.remoteClient.Create(ctx, resImp) if err != nil { fm.queue.AddRateLimited(resImp) @@ -561,7 +560,7 @@ func TestStaleControllerNoRaceWithResourceImportReconciler(t *testing.T) { stopCh := make(chan struct{}) defer close(stopCh) - q := workqueue.NewRateLimitingQueue(workqueue.DefaultItemBasedRateLimiter()) + q := workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedItemBasedRateLimiter[*mcv1alpha1.ResourceImport]()) const numInitialResImp = 50 for i := uint32(1); i <= numInitialResImp; i++ { resImp := &mcv1alpha1.ResourceImport{ diff --git a/multicluster/controllers/multicluster/member/serviceexport_controller.go b/multicluster/controllers/multicluster/member/serviceexport_controller.go index 94c3927b861..55a57c22f30 100644 --- a/multicluster/controllers/multicluster/member/serviceexport_controller.go +++ b/multicluster/controllers/multicluster/member/serviceexport_controller.go @@ -505,6 +505,7 @@ func (r *ServiceExportReconciler) SetupWithManager(mgr ctrl.Manager) error { if r.endpointSliceEnabled { return ctrl.NewControllerManagedBy(mgr). For(&k8smcsv1alpha1.ServiceExport{}, versionChangePredicates). + Named("serviceexport"). Watches(&corev1.Service{}, handler.EnqueueRequestsFromMapFunc(objectMapFunc), versionChangePredicates). Watches(&discovery.EndpointSlice{}, handler.EnqueueRequestsFromMapFunc(endpointSliceMapFunc), versionChangePredicates). Watches(&mcv1alpha2.ClusterSet{}, handler.EnqueueRequestsFromMapFunc(r.clusterSetMapFunc), @@ -516,6 +517,7 @@ func (r *ServiceExportReconciler) SetupWithManager(mgr ctrl.Manager) error { } return ctrl.NewControllerManagedBy(mgr). For(&k8smcsv1alpha1.ServiceExport{}, versionChangePredicates). + Named("serviceexport"). Watches(&corev1.Service{}, handler.EnqueueRequestsFromMapFunc(objectMapFunc), versionChangePredicates). Watches(&corev1.Endpoints{}, handler.EnqueueRequestsFromMapFunc(objectMapFunc), versionChangePredicates). Watches(&mcv1alpha2.ClusterSet{}, handler.EnqueueRequestsFromMapFunc(r.clusterSetMapFunc), diff --git a/multicluster/hack/update-codegen-dockerized.sh b/multicluster/hack/update-codegen-dockerized.sh index a3073a382c8..8e946bbe784 100755 --- a/multicluster/hack/update-codegen-dockerized.sh +++ b/multicluster/hack/update-codegen-dockerized.sh @@ -72,24 +72,27 @@ function generate_multicluster_client_code { --input-base "${ANTREA_PKG}/multicluster/apis" \ --input "multicluster/v1alpha1" \ --input "multicluster/v1alpha2" \ - --output-package "${ANTREA_PKG}/multicluster/pkg/client/clientset" \ + --output-dir "multicluster/pkg/client/clientset" \ + --output-pkg "${ANTREA_PKG}/multicluster/pkg/client/clientset" \ --go-header-file hack/boilerplate/license_header.go.txt # Generate listers with K8s codegen tools. $GOPATH/bin/lister-gen \ - --input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha1" \ - --input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha2" \ - --output-package "${ANTREA_PKG}/multicluster/pkg/client/listers" \ - --go-header-file hack/boilerplate/license_header.go.txt + --output-dir "multicluster/pkg/client/listers" \ + --output-pkg "${ANTREA_PKG}/multicluster/pkg/client/listers" \ + --go-header-file hack/boilerplate/license_header.go.txt \ + "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha1" \ + "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha2" # Generate informers with K8s codegen tools. $GOPATH/bin/informer-gen \ - --input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha1" \ - --input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha2" \ --versioned-clientset-package "${ANTREA_PKG}/multicluster/pkg/client/clientset/versioned" \ --listers-package "${ANTREA_PKG}/multicluster/pkg/client/listers" \ - --output-package "${ANTREA_PKG}/multicluster/pkg/client/informers" \ - --go-header-file hack/boilerplate/license_header.go.txt + --output-dir "multicluster/pkg/client/informers" \ + --output-pkg "${ANTREA_PKG}/multicluster/pkg/client/informers" \ + --go-header-file hack/boilerplate/license_header.go.txt \ + "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha1" \ + "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha2" $GOPATH/bin/controller-gen object:headerFile="hack/boilerplate/license_header.go.txt",year=$(date "+%Y") paths="./multicluster/..." } diff --git a/multicluster/hack/update-codegen.sh b/multicluster/hack/update-codegen.sh index 5d0db866d0e..0c9bd9edf2f 100755 --- a/multicluster/hack/update-codegen.sh +++ b/multicluster/hack/update-codegen.sh @@ -22,7 +22,7 @@ function echoerr { } ANTREA_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )" -IMAGE_NAME="antrea/codegen:kubernetes-1.29.2-build.3" +IMAGE_NAME="antrea/codegen:kubernetes-1.31.1" # We will use git clone to make a working copy of the repository into a # temporary directory. This requires that all changes have been committed diff --git a/multicluster/hack/verify-tools.sh b/multicluster/hack/verify-tools.sh index 239ecba503d..69a2cb53a41 100755 --- a/multicluster/hack/verify-tools.sh +++ b/multicluster/hack/verify-tools.sh @@ -34,7 +34,7 @@ fi if ! which kubectl > /dev/null; then if [[ ${os} == 'darwin' || ${os} == 'linux' ]]; then - curl -LO https://dl.k8s.io/release/v1.29.2/bin/${os}/amd64/kubectl + curl -LO https://dl.k8s.io/release/v1.31.1/bin/${os}/amd64/kubectl chmod +x ./kubectl if [[ "$WORKDIR" != "" ]];then mv kubectl "$WORKDIR" diff --git a/multicluster/pkg/client/clientset/versioned/fake/clientset_generated.go b/multicluster/pkg/client/clientset/versioned/fake/clientset_generated.go index cb345b78f2b..ccc87694707 100644 --- a/multicluster/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/multicluster/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,8 +31,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterinfoimport.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterinfoimport.go index 394d3314c5f..bb444e6be90 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterinfoimport.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterinfoimport.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ClusterInfoImportsGetter has a method to return a ClusterInfoImportInterface. @@ -38,6 +37,7 @@ type ClusterInfoImportsGetter interface { type ClusterInfoImportInterface interface { Create(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.CreateOptions) (*v1alpha1.ClusterInfoImport, error) Update(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.UpdateOptions) (*v1alpha1.ClusterInfoImport, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.UpdateOptions) (*v1alpha1.ClusterInfoImport, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,144 +50,18 @@ type ClusterInfoImportInterface interface { // clusterInfoImports implements ClusterInfoImportInterface type clusterInfoImports struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.ClusterInfoImport, *v1alpha1.ClusterInfoImportList] } // newClusterInfoImports returns a ClusterInfoImports func newClusterInfoImports(c *MulticlusterV1alpha1Client, namespace string) *clusterInfoImports { return &clusterInfoImports{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.ClusterInfoImport, *v1alpha1.ClusterInfoImportList]( + "clusterinfoimports", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.ClusterInfoImport { return &v1alpha1.ClusterInfoImport{} }, + func() *v1alpha1.ClusterInfoImportList { return &v1alpha1.ClusterInfoImportList{} }), } } - -// Get takes name of the clusterInfoImport, and returns the corresponding clusterInfoImport object, and an error if there is any. -func (c *clusterInfoImports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterInfoImport, err error) { - result = &v1alpha1.ClusterInfoImport{} - err = c.client.Get(). - Namespace(c.ns). - Resource("clusterinfoimports"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterInfoImports that match those selectors. -func (c *clusterInfoImports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterInfoImportList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ClusterInfoImportList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("clusterinfoimports"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterInfoImports. -func (c *clusterInfoImports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("clusterinfoimports"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterInfoImport and creates it. Returns the server's representation of the clusterInfoImport, and an error, if there is any. -func (c *clusterInfoImports) Create(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.CreateOptions) (result *v1alpha1.ClusterInfoImport, err error) { - result = &v1alpha1.ClusterInfoImport{} - err = c.client.Post(). - Namespace(c.ns). - Resource("clusterinfoimports"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterInfoImport). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterInfoImport and updates it. Returns the server's representation of the clusterInfoImport, and an error, if there is any. -func (c *clusterInfoImports) Update(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.UpdateOptions) (result *v1alpha1.ClusterInfoImport, err error) { - result = &v1alpha1.ClusterInfoImport{} - err = c.client.Put(). - Namespace(c.ns). - Resource("clusterinfoimports"). - Name(clusterInfoImport.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterInfoImport). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *clusterInfoImports) UpdateStatus(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.UpdateOptions) (result *v1alpha1.ClusterInfoImport, err error) { - result = &v1alpha1.ClusterInfoImport{} - err = c.client.Put(). - Namespace(c.ns). - Resource("clusterinfoimports"). - Name(clusterInfoImport.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterInfoImport). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterInfoImport and deletes it. Returns an error if one occurs. -func (c *clusterInfoImports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("clusterinfoimports"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterInfoImports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("clusterinfoimports"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterInfoImport. -func (c *clusterInfoImports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterInfoImport, err error) { - result = &v1alpha1.ClusterInfoImport{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("clusterinfoimports"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterset.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterset.go index b271b0962e0..dab2c763396 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterset.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/clusterset.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ClusterSetsGetter has a method to return a ClusterSetInterface. @@ -38,6 +37,7 @@ type ClusterSetsGetter interface { type ClusterSetInterface interface { Create(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.CreateOptions) (*v1alpha1.ClusterSet, error) Update(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (*v1alpha1.ClusterSet, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (*v1alpha1.ClusterSet, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,144 +50,18 @@ type ClusterSetInterface interface { // clusterSets implements ClusterSetInterface type clusterSets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.ClusterSet, *v1alpha1.ClusterSetList] } // newClusterSets returns a ClusterSets func newClusterSets(c *MulticlusterV1alpha1Client, namespace string) *clusterSets { return &clusterSets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.ClusterSet, *v1alpha1.ClusterSetList]( + "clustersets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.ClusterSet { return &v1alpha1.ClusterSet{} }, + func() *v1alpha1.ClusterSetList { return &v1alpha1.ClusterSetList{} }), } } - -// Get takes name of the clusterSet, and returns the corresponding clusterSet object, and an error if there is any. -func (c *clusterSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterSet, err error) { - result = &v1alpha1.ClusterSet{} - err = c.client.Get(). - Namespace(c.ns). - Resource("clustersets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterSets that match those selectors. -func (c *clusterSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterSetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ClusterSetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("clustersets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterSets. -func (c *clusterSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("clustersets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterSet and creates it. Returns the server's representation of the clusterSet, and an error, if there is any. -func (c *clusterSets) Create(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.CreateOptions) (result *v1alpha1.ClusterSet, err error) { - result = &v1alpha1.ClusterSet{} - err = c.client.Post(). - Namespace(c.ns). - Resource("clustersets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterSet). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterSet and updates it. Returns the server's representation of the clusterSet, and an error, if there is any. -func (c *clusterSets) Update(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (result *v1alpha1.ClusterSet, err error) { - result = &v1alpha1.ClusterSet{} - err = c.client.Put(). - Namespace(c.ns). - Resource("clustersets"). - Name(clusterSet.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterSet). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *clusterSets) UpdateStatus(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (result *v1alpha1.ClusterSet, err error) { - result = &v1alpha1.ClusterSet{} - err = c.client.Put(). - Namespace(c.ns). - Resource("clustersets"). - Name(clusterSet.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterSet). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterSet and deletes it. Returns an error if one occurs. -func (c *clusterSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("clustersets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("clustersets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterSet. -func (c *clusterSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterSet, err error) { - result = &v1alpha1.ClusterSet{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("clustersets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterinfoimport.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterinfoimport.go index 0be5abde9ef..358a53a29a1 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterinfoimport.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterinfoimport.go @@ -39,22 +39,24 @@ var clusterinfoimportsKind = v1alpha1.SchemeGroupVersion.WithKind("ClusterInfoIm // Get takes name of the clusterInfoImport, and returns the corresponding clusterInfoImport object, and an error if there is any. func (c *FakeClusterInfoImports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterInfoImport, err error) { + emptyResult := &v1alpha1.ClusterInfoImport{} obj, err := c.Fake. - Invokes(testing.NewGetAction(clusterinfoimportsResource, c.ns, name), &v1alpha1.ClusterInfoImport{}) + Invokes(testing.NewGetActionWithOptions(clusterinfoimportsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterInfoImport), err } // List takes label and field selectors, and returns the list of ClusterInfoImports that match those selectors. func (c *FakeClusterInfoImports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterInfoImportList, err error) { + emptyResult := &v1alpha1.ClusterInfoImportList{} obj, err := c.Fake. - Invokes(testing.NewListAction(clusterinfoimportsResource, clusterinfoimportsKind, c.ns, opts), &v1alpha1.ClusterInfoImportList{}) + Invokes(testing.NewListActionWithOptions(clusterinfoimportsResource, clusterinfoimportsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,40 +75,43 @@ func (c *FakeClusterInfoImports) List(ctx context.Context, opts v1.ListOptions) // Watch returns a watch.Interface that watches the requested clusterInfoImports. func (c *FakeClusterInfoImports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(clusterinfoimportsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(clusterinfoimportsResource, c.ns, opts)) } // Create takes the representation of a clusterInfoImport and creates it. Returns the server's representation of the clusterInfoImport, and an error, if there is any. func (c *FakeClusterInfoImports) Create(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.CreateOptions) (result *v1alpha1.ClusterInfoImport, err error) { + emptyResult := &v1alpha1.ClusterInfoImport{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(clusterinfoimportsResource, c.ns, clusterInfoImport), &v1alpha1.ClusterInfoImport{}) + Invokes(testing.NewCreateActionWithOptions(clusterinfoimportsResource, c.ns, clusterInfoImport, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterInfoImport), err } // Update takes the representation of a clusterInfoImport and updates it. Returns the server's representation of the clusterInfoImport, and an error, if there is any. func (c *FakeClusterInfoImports) Update(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.UpdateOptions) (result *v1alpha1.ClusterInfoImport, err error) { + emptyResult := &v1alpha1.ClusterInfoImport{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(clusterinfoimportsResource, c.ns, clusterInfoImport), &v1alpha1.ClusterInfoImport{}) + Invokes(testing.NewUpdateActionWithOptions(clusterinfoimportsResource, c.ns, clusterInfoImport, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterInfoImport), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeClusterInfoImports) UpdateStatus(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.UpdateOptions) (*v1alpha1.ClusterInfoImport, error) { +func (c *FakeClusterInfoImports) UpdateStatus(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.UpdateOptions) (result *v1alpha1.ClusterInfoImport, err error) { + emptyResult := &v1alpha1.ClusterInfoImport{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(clusterinfoimportsResource, "status", c.ns, clusterInfoImport), &v1alpha1.ClusterInfoImport{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(clusterinfoimportsResource, "status", c.ns, clusterInfoImport, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterInfoImport), err } @@ -121,7 +126,7 @@ func (c *FakeClusterInfoImports) Delete(ctx context.Context, name string, opts v // DeleteCollection deletes a collection of objects. func (c *FakeClusterInfoImports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(clusterinfoimportsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(clusterinfoimportsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ClusterInfoImportList{}) return err @@ -129,11 +134,12 @@ func (c *FakeClusterInfoImports) DeleteCollection(ctx context.Context, opts v1.D // Patch applies the patch and returns the patched clusterInfoImport. func (c *FakeClusterInfoImports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterInfoImport, err error) { + emptyResult := &v1alpha1.ClusterInfoImport{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(clusterinfoimportsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ClusterInfoImport{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(clusterinfoimportsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterInfoImport), err } diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterset.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterset.go index d1a57eee98e..b8e624cb4b0 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterset.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_clusterset.go @@ -39,22 +39,24 @@ var clustersetsKind = v1alpha1.SchemeGroupVersion.WithKind("ClusterSet") // Get takes name of the clusterSet, and returns the corresponding clusterSet object, and an error if there is any. func (c *FakeClusterSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterSet, err error) { + emptyResult := &v1alpha1.ClusterSet{} obj, err := c.Fake. - Invokes(testing.NewGetAction(clustersetsResource, c.ns, name), &v1alpha1.ClusterSet{}) + Invokes(testing.NewGetActionWithOptions(clustersetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterSet), err } // List takes label and field selectors, and returns the list of ClusterSets that match those selectors. func (c *FakeClusterSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterSetList, err error) { + emptyResult := &v1alpha1.ClusterSetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(clustersetsResource, clustersetsKind, c.ns, opts), &v1alpha1.ClusterSetList{}) + Invokes(testing.NewListActionWithOptions(clustersetsResource, clustersetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,40 +75,43 @@ func (c *FakeClusterSets) List(ctx context.Context, opts v1.ListOptions) (result // Watch returns a watch.Interface that watches the requested clusterSets. func (c *FakeClusterSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(clustersetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(clustersetsResource, c.ns, opts)) } // Create takes the representation of a clusterSet and creates it. Returns the server's representation of the clusterSet, and an error, if there is any. func (c *FakeClusterSets) Create(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.CreateOptions) (result *v1alpha1.ClusterSet, err error) { + emptyResult := &v1alpha1.ClusterSet{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(clustersetsResource, c.ns, clusterSet), &v1alpha1.ClusterSet{}) + Invokes(testing.NewCreateActionWithOptions(clustersetsResource, c.ns, clusterSet, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterSet), err } // Update takes the representation of a clusterSet and updates it. Returns the server's representation of the clusterSet, and an error, if there is any. func (c *FakeClusterSets) Update(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (result *v1alpha1.ClusterSet, err error) { + emptyResult := &v1alpha1.ClusterSet{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(clustersetsResource, c.ns, clusterSet), &v1alpha1.ClusterSet{}) + Invokes(testing.NewUpdateActionWithOptions(clustersetsResource, c.ns, clusterSet, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterSet), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeClusterSets) UpdateStatus(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (*v1alpha1.ClusterSet, error) { +func (c *FakeClusterSets) UpdateStatus(ctx context.Context, clusterSet *v1alpha1.ClusterSet, opts v1.UpdateOptions) (result *v1alpha1.ClusterSet, err error) { + emptyResult := &v1alpha1.ClusterSet{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(clustersetsResource, "status", c.ns, clusterSet), &v1alpha1.ClusterSet{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(clustersetsResource, "status", c.ns, clusterSet, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterSet), err } @@ -121,7 +126,7 @@ func (c *FakeClusterSets) Delete(ctx context.Context, name string, opts v1.Delet // DeleteCollection deletes a collection of objects. func (c *FakeClusterSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(clustersetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(clustersetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ClusterSetList{}) return err @@ -129,11 +134,12 @@ func (c *FakeClusterSets) DeleteCollection(ctx context.Context, opts v1.DeleteOp // Patch applies the patch and returns the patched clusterSet. func (c *FakeClusterSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterSet, err error) { + emptyResult := &v1alpha1.ClusterSet{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(clustersetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ClusterSet{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(clustersetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterSet), err } diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_gateway.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_gateway.go index d3e26888ad6..169e66e7c39 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_gateway.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_gateway.go @@ -39,22 +39,24 @@ var gatewaysKind = v1alpha1.SchemeGroupVersion.WithKind("Gateway") // Get takes name of the gateway, and returns the corresponding gateway object, and an error if there is any. func (c *FakeGateways) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Gateway, err error) { + emptyResult := &v1alpha1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewGetAction(gatewaysResource, c.ns, name), &v1alpha1.Gateway{}) + Invokes(testing.NewGetActionWithOptions(gatewaysResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Gateway), err } // List takes label and field selectors, and returns the list of Gateways that match those selectors. func (c *FakeGateways) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GatewayList, err error) { + emptyResult := &v1alpha1.GatewayList{} obj, err := c.Fake. - Invokes(testing.NewListAction(gatewaysResource, gatewaysKind, c.ns, opts), &v1alpha1.GatewayList{}) + Invokes(testing.NewListActionWithOptions(gatewaysResource, gatewaysKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,28 +75,30 @@ func (c *FakeGateways) List(ctx context.Context, opts v1.ListOptions) (result *v // Watch returns a watch.Interface that watches the requested gateways. func (c *FakeGateways) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(gatewaysResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(gatewaysResource, c.ns, opts)) } // Create takes the representation of a gateway and creates it. Returns the server's representation of the gateway, and an error, if there is any. func (c *FakeGateways) Create(ctx context.Context, gateway *v1alpha1.Gateway, opts v1.CreateOptions) (result *v1alpha1.Gateway, err error) { + emptyResult := &v1alpha1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(gatewaysResource, c.ns, gateway), &v1alpha1.Gateway{}) + Invokes(testing.NewCreateActionWithOptions(gatewaysResource, c.ns, gateway, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Gateway), err } // Update takes the representation of a gateway and updates it. Returns the server's representation of the gateway, and an error, if there is any. func (c *FakeGateways) Update(ctx context.Context, gateway *v1alpha1.Gateway, opts v1.UpdateOptions) (result *v1alpha1.Gateway, err error) { + emptyResult := &v1alpha1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(gatewaysResource, c.ns, gateway), &v1alpha1.Gateway{}) + Invokes(testing.NewUpdateActionWithOptions(gatewaysResource, c.ns, gateway, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Gateway), err } @@ -109,7 +113,7 @@ func (c *FakeGateways) Delete(ctx context.Context, name string, opts v1.DeleteOp // DeleteCollection deletes a collection of objects. func (c *FakeGateways) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(gatewaysResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(gatewaysResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.GatewayList{}) return err @@ -117,11 +121,12 @@ func (c *FakeGateways) DeleteCollection(ctx context.Context, opts v1.DeleteOptio // Patch applies the patch and returns the patched gateway. func (c *FakeGateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Gateway, err error) { + emptyResult := &v1alpha1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(gatewaysResource, c.ns, name, pt, data, subresources...), &v1alpha1.Gateway{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(gatewaysResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Gateway), err } diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_labelidentity.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_labelidentity.go index 6849c9c60e3..02f096c210e 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_labelidentity.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_labelidentity.go @@ -38,20 +38,22 @@ var labelidentitiesKind = v1alpha1.SchemeGroupVersion.WithKind("LabelIdentity") // Get takes name of the labelIdentity, and returns the corresponding labelIdentity object, and an error if there is any. func (c *FakeLabelIdentities) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.LabelIdentity, err error) { + emptyResult := &v1alpha1.LabelIdentity{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(labelidentitiesResource, name), &v1alpha1.LabelIdentity{}) + Invokes(testing.NewRootGetActionWithOptions(labelidentitiesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LabelIdentity), err } // List takes label and field selectors, and returns the list of LabelIdentities that match those selectors. func (c *FakeLabelIdentities) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.LabelIdentityList, err error) { + emptyResult := &v1alpha1.LabelIdentityList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(labelidentitiesResource, labelidentitiesKind, opts), &v1alpha1.LabelIdentityList{}) + Invokes(testing.NewRootListActionWithOptions(labelidentitiesResource, labelidentitiesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,25 +72,27 @@ func (c *FakeLabelIdentities) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested labelIdentities. func (c *FakeLabelIdentities) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(labelidentitiesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(labelidentitiesResource, opts)) } // Create takes the representation of a labelIdentity and creates it. Returns the server's representation of the labelIdentity, and an error, if there is any. func (c *FakeLabelIdentities) Create(ctx context.Context, labelIdentity *v1alpha1.LabelIdentity, opts v1.CreateOptions) (result *v1alpha1.LabelIdentity, err error) { + emptyResult := &v1alpha1.LabelIdentity{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(labelidentitiesResource, labelIdentity), &v1alpha1.LabelIdentity{}) + Invokes(testing.NewRootCreateActionWithOptions(labelidentitiesResource, labelIdentity, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LabelIdentity), err } // Update takes the representation of a labelIdentity and updates it. Returns the server's representation of the labelIdentity, and an error, if there is any. func (c *FakeLabelIdentities) Update(ctx context.Context, labelIdentity *v1alpha1.LabelIdentity, opts v1.UpdateOptions) (result *v1alpha1.LabelIdentity, err error) { + emptyResult := &v1alpha1.LabelIdentity{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(labelidentitiesResource, labelIdentity), &v1alpha1.LabelIdentity{}) + Invokes(testing.NewRootUpdateActionWithOptions(labelidentitiesResource, labelIdentity, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LabelIdentity), err } @@ -102,7 +106,7 @@ func (c *FakeLabelIdentities) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeLabelIdentities) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(labelidentitiesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(labelidentitiesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.LabelIdentityList{}) return err @@ -110,10 +114,11 @@ func (c *FakeLabelIdentities) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched labelIdentity. func (c *FakeLabelIdentities) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.LabelIdentity, err error) { + emptyResult := &v1alpha1.LabelIdentity{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(labelidentitiesResource, name, pt, data, subresources...), &v1alpha1.LabelIdentity{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(labelidentitiesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LabelIdentity), err } diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_memberclusterannounce.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_memberclusterannounce.go index e63629048cc..e5d05b6e4b9 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_memberclusterannounce.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_memberclusterannounce.go @@ -39,22 +39,24 @@ var memberclusterannouncesKind = v1alpha1.SchemeGroupVersion.WithKind("MemberClu // Get takes name of the memberClusterAnnounce, and returns the corresponding memberClusterAnnounce object, and an error if there is any. func (c *FakeMemberClusterAnnounces) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MemberClusterAnnounce, err error) { + emptyResult := &v1alpha1.MemberClusterAnnounce{} obj, err := c.Fake. - Invokes(testing.NewGetAction(memberclusterannouncesResource, c.ns, name), &v1alpha1.MemberClusterAnnounce{}) + Invokes(testing.NewGetActionWithOptions(memberclusterannouncesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.MemberClusterAnnounce), err } // List takes label and field selectors, and returns the list of MemberClusterAnnounces that match those selectors. func (c *FakeMemberClusterAnnounces) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MemberClusterAnnounceList, err error) { + emptyResult := &v1alpha1.MemberClusterAnnounceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(memberclusterannouncesResource, memberclusterannouncesKind, c.ns, opts), &v1alpha1.MemberClusterAnnounceList{}) + Invokes(testing.NewListActionWithOptions(memberclusterannouncesResource, memberclusterannouncesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,28 +75,30 @@ func (c *FakeMemberClusterAnnounces) List(ctx context.Context, opts v1.ListOptio // Watch returns a watch.Interface that watches the requested memberClusterAnnounces. func (c *FakeMemberClusterAnnounces) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(memberclusterannouncesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(memberclusterannouncesResource, c.ns, opts)) } // Create takes the representation of a memberClusterAnnounce and creates it. Returns the server's representation of the memberClusterAnnounce, and an error, if there is any. func (c *FakeMemberClusterAnnounces) Create(ctx context.Context, memberClusterAnnounce *v1alpha1.MemberClusterAnnounce, opts v1.CreateOptions) (result *v1alpha1.MemberClusterAnnounce, err error) { + emptyResult := &v1alpha1.MemberClusterAnnounce{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(memberclusterannouncesResource, c.ns, memberClusterAnnounce), &v1alpha1.MemberClusterAnnounce{}) + Invokes(testing.NewCreateActionWithOptions(memberclusterannouncesResource, c.ns, memberClusterAnnounce, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.MemberClusterAnnounce), err } // Update takes the representation of a memberClusterAnnounce and updates it. Returns the server's representation of the memberClusterAnnounce, and an error, if there is any. func (c *FakeMemberClusterAnnounces) Update(ctx context.Context, memberClusterAnnounce *v1alpha1.MemberClusterAnnounce, opts v1.UpdateOptions) (result *v1alpha1.MemberClusterAnnounce, err error) { + emptyResult := &v1alpha1.MemberClusterAnnounce{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(memberclusterannouncesResource, c.ns, memberClusterAnnounce), &v1alpha1.MemberClusterAnnounce{}) + Invokes(testing.NewUpdateActionWithOptions(memberclusterannouncesResource, c.ns, memberClusterAnnounce, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.MemberClusterAnnounce), err } @@ -109,7 +113,7 @@ func (c *FakeMemberClusterAnnounces) Delete(ctx context.Context, name string, op // DeleteCollection deletes a collection of objects. func (c *FakeMemberClusterAnnounces) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(memberclusterannouncesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(memberclusterannouncesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.MemberClusterAnnounceList{}) return err @@ -117,11 +121,12 @@ func (c *FakeMemberClusterAnnounces) DeleteCollection(ctx context.Context, opts // Patch applies the patch and returns the patched memberClusterAnnounce. func (c *FakeMemberClusterAnnounces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MemberClusterAnnounce, err error) { + emptyResult := &v1alpha1.MemberClusterAnnounce{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(memberclusterannouncesResource, c.ns, name, pt, data, subresources...), &v1alpha1.MemberClusterAnnounce{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(memberclusterannouncesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.MemberClusterAnnounce), err } diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceexport.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceexport.go index e54aa17f715..f25144cbb9d 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceexport.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceexport.go @@ -39,22 +39,24 @@ var resourceexportsKind = v1alpha1.SchemeGroupVersion.WithKind("ResourceExport") // Get takes name of the resourceExport, and returns the corresponding resourceExport object, and an error if there is any. func (c *FakeResourceExports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceExport, err error) { + emptyResult := &v1alpha1.ResourceExport{} obj, err := c.Fake. - Invokes(testing.NewGetAction(resourceexportsResource, c.ns, name), &v1alpha1.ResourceExport{}) + Invokes(testing.NewGetActionWithOptions(resourceexportsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ResourceExport), err } // List takes label and field selectors, and returns the list of ResourceExports that match those selectors. func (c *FakeResourceExports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceExportList, err error) { + emptyResult := &v1alpha1.ResourceExportList{} obj, err := c.Fake. - Invokes(testing.NewListAction(resourceexportsResource, resourceexportsKind, c.ns, opts), &v1alpha1.ResourceExportList{}) + Invokes(testing.NewListActionWithOptions(resourceexportsResource, resourceexportsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,40 +75,43 @@ func (c *FakeResourceExports) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested resourceExports. func (c *FakeResourceExports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(resourceexportsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(resourceexportsResource, c.ns, opts)) } // Create takes the representation of a resourceExport and creates it. Returns the server's representation of the resourceExport, and an error, if there is any. func (c *FakeResourceExports) Create(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.CreateOptions) (result *v1alpha1.ResourceExport, err error) { + emptyResult := &v1alpha1.ResourceExport{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(resourceexportsResource, c.ns, resourceExport), &v1alpha1.ResourceExport{}) + Invokes(testing.NewCreateActionWithOptions(resourceexportsResource, c.ns, resourceExport, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ResourceExport), err } // Update takes the representation of a resourceExport and updates it. Returns the server's representation of the resourceExport, and an error, if there is any. func (c *FakeResourceExports) Update(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (result *v1alpha1.ResourceExport, err error) { + emptyResult := &v1alpha1.ResourceExport{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(resourceexportsResource, c.ns, resourceExport), &v1alpha1.ResourceExport{}) + Invokes(testing.NewUpdateActionWithOptions(resourceexportsResource, c.ns, resourceExport, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ResourceExport), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeResourceExports) UpdateStatus(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (*v1alpha1.ResourceExport, error) { +func (c *FakeResourceExports) UpdateStatus(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (result *v1alpha1.ResourceExport, err error) { + emptyResult := &v1alpha1.ResourceExport{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(resourceexportsResource, "status", c.ns, resourceExport), &v1alpha1.ResourceExport{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(resourceexportsResource, "status", c.ns, resourceExport, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ResourceExport), err } @@ -121,7 +126,7 @@ func (c *FakeResourceExports) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeResourceExports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(resourceexportsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(resourceexportsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ResourceExportList{}) return err @@ -129,11 +134,12 @@ func (c *FakeResourceExports) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched resourceExport. func (c *FakeResourceExports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceExport, err error) { + emptyResult := &v1alpha1.ResourceExport{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(resourceexportsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ResourceExport{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(resourceexportsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ResourceExport), err } diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceimport.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceimport.go index d60bd0a1c66..a76971b7d36 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceimport.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/fake/fake_resourceimport.go @@ -39,22 +39,24 @@ var resourceimportsKind = v1alpha1.SchemeGroupVersion.WithKind("ResourceImport") // Get takes name of the resourceImport, and returns the corresponding resourceImport object, and an error if there is any. func (c *FakeResourceImports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceImport, err error) { + emptyResult := &v1alpha1.ResourceImport{} obj, err := c.Fake. - Invokes(testing.NewGetAction(resourceimportsResource, c.ns, name), &v1alpha1.ResourceImport{}) + Invokes(testing.NewGetActionWithOptions(resourceimportsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ResourceImport), err } // List takes label and field selectors, and returns the list of ResourceImports that match those selectors. func (c *FakeResourceImports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceImportList, err error) { + emptyResult := &v1alpha1.ResourceImportList{} obj, err := c.Fake. - Invokes(testing.NewListAction(resourceimportsResource, resourceimportsKind, c.ns, opts), &v1alpha1.ResourceImportList{}) + Invokes(testing.NewListActionWithOptions(resourceimportsResource, resourceimportsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,40 +75,43 @@ func (c *FakeResourceImports) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested resourceImports. func (c *FakeResourceImports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(resourceimportsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(resourceimportsResource, c.ns, opts)) } // Create takes the representation of a resourceImport and creates it. Returns the server's representation of the resourceImport, and an error, if there is any. func (c *FakeResourceImports) Create(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.CreateOptions) (result *v1alpha1.ResourceImport, err error) { + emptyResult := &v1alpha1.ResourceImport{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(resourceimportsResource, c.ns, resourceImport), &v1alpha1.ResourceImport{}) + Invokes(testing.NewCreateActionWithOptions(resourceimportsResource, c.ns, resourceImport, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ResourceImport), err } // Update takes the representation of a resourceImport and updates it. Returns the server's representation of the resourceImport, and an error, if there is any. func (c *FakeResourceImports) Update(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (result *v1alpha1.ResourceImport, err error) { + emptyResult := &v1alpha1.ResourceImport{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(resourceimportsResource, c.ns, resourceImport), &v1alpha1.ResourceImport{}) + Invokes(testing.NewUpdateActionWithOptions(resourceimportsResource, c.ns, resourceImport, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ResourceImport), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeResourceImports) UpdateStatus(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (*v1alpha1.ResourceImport, error) { +func (c *FakeResourceImports) UpdateStatus(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (result *v1alpha1.ResourceImport, err error) { + emptyResult := &v1alpha1.ResourceImport{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(resourceimportsResource, "status", c.ns, resourceImport), &v1alpha1.ResourceImport{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(resourceimportsResource, "status", c.ns, resourceImport, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ResourceImport), err } @@ -121,7 +126,7 @@ func (c *FakeResourceImports) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeResourceImports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(resourceimportsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(resourceimportsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ResourceImportList{}) return err @@ -129,11 +134,12 @@ func (c *FakeResourceImports) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched resourceImport. func (c *FakeResourceImports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceImport, err error) { + emptyResult := &v1alpha1.ResourceImport{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(resourceimportsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ResourceImport{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(resourceimportsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ResourceImport), err } diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/gateway.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/gateway.go index a25817fdf39..2f6dfcecfca 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/gateway.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/gateway.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // GatewaysGetter has a method to return a GatewayInterface. @@ -49,128 +48,18 @@ type GatewayInterface interface { // gateways implements GatewayInterface type gateways struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.Gateway, *v1alpha1.GatewayList] } // newGateways returns a Gateways func newGateways(c *MulticlusterV1alpha1Client, namespace string) *gateways { return &gateways{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.Gateway, *v1alpha1.GatewayList]( + "gateways", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Gateway { return &v1alpha1.Gateway{} }, + func() *v1alpha1.GatewayList { return &v1alpha1.GatewayList{} }), } } - -// Get takes name of the gateway, and returns the corresponding gateway object, and an error if there is any. -func (c *gateways) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Gateway, err error) { - result = &v1alpha1.Gateway{} - err = c.client.Get(). - Namespace(c.ns). - Resource("gateways"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Gateways that match those selectors. -func (c *gateways) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GatewayList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.GatewayList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("gateways"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested gateways. -func (c *gateways) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("gateways"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a gateway and creates it. Returns the server's representation of the gateway, and an error, if there is any. -func (c *gateways) Create(ctx context.Context, gateway *v1alpha1.Gateway, opts v1.CreateOptions) (result *v1alpha1.Gateway, err error) { - result = &v1alpha1.Gateway{} - err = c.client.Post(). - Namespace(c.ns). - Resource("gateways"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gateway). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a gateway and updates it. Returns the server's representation of the gateway, and an error, if there is any. -func (c *gateways) Update(ctx context.Context, gateway *v1alpha1.Gateway, opts v1.UpdateOptions) (result *v1alpha1.Gateway, err error) { - result = &v1alpha1.Gateway{} - err = c.client.Put(). - Namespace(c.ns). - Resource("gateways"). - Name(gateway.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gateway). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the gateway and deletes it. Returns an error if one occurs. -func (c *gateways) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("gateways"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *gateways) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("gateways"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched gateway. -func (c *gateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Gateway, err error) { - result = &v1alpha1.Gateway{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("gateways"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/labelidentity.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/labelidentity.go index d20caeece32..882c9b6b3ad 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/labelidentity.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/labelidentity.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // LabelIdentitiesGetter has a method to return a LabelIdentityInterface. @@ -49,118 +48,18 @@ type LabelIdentityInterface interface { // labelIdentities implements LabelIdentityInterface type labelIdentities struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.LabelIdentity, *v1alpha1.LabelIdentityList] } // newLabelIdentities returns a LabelIdentities func newLabelIdentities(c *MulticlusterV1alpha1Client) *labelIdentities { return &labelIdentities{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.LabelIdentity, *v1alpha1.LabelIdentityList]( + "labelidentities", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.LabelIdentity { return &v1alpha1.LabelIdentity{} }, + func() *v1alpha1.LabelIdentityList { return &v1alpha1.LabelIdentityList{} }), } } - -// Get takes name of the labelIdentity, and returns the corresponding labelIdentity object, and an error if there is any. -func (c *labelIdentities) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.LabelIdentity, err error) { - result = &v1alpha1.LabelIdentity{} - err = c.client.Get(). - Resource("labelidentities"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of LabelIdentities that match those selectors. -func (c *labelIdentities) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.LabelIdentityList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.LabelIdentityList{} - err = c.client.Get(). - Resource("labelidentities"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested labelIdentities. -func (c *labelIdentities) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("labelidentities"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a labelIdentity and creates it. Returns the server's representation of the labelIdentity, and an error, if there is any. -func (c *labelIdentities) Create(ctx context.Context, labelIdentity *v1alpha1.LabelIdentity, opts v1.CreateOptions) (result *v1alpha1.LabelIdentity, err error) { - result = &v1alpha1.LabelIdentity{} - err = c.client.Post(). - Resource("labelidentities"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(labelIdentity). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a labelIdentity and updates it. Returns the server's representation of the labelIdentity, and an error, if there is any. -func (c *labelIdentities) Update(ctx context.Context, labelIdentity *v1alpha1.LabelIdentity, opts v1.UpdateOptions) (result *v1alpha1.LabelIdentity, err error) { - result = &v1alpha1.LabelIdentity{} - err = c.client.Put(). - Resource("labelidentities"). - Name(labelIdentity.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(labelIdentity). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the labelIdentity and deletes it. Returns an error if one occurs. -func (c *labelIdentities) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("labelidentities"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *labelIdentities) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("labelidentities"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched labelIdentity. -func (c *labelIdentities) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.LabelIdentity, err error) { - result = &v1alpha1.LabelIdentity{} - err = c.client.Patch(pt). - Resource("labelidentities"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/memberclusterannounce.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/memberclusterannounce.go index c8b18443956..939dddc9202 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/memberclusterannounce.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/memberclusterannounce.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // MemberClusterAnnouncesGetter has a method to return a MemberClusterAnnounceInterface. @@ -49,128 +48,18 @@ type MemberClusterAnnounceInterface interface { // memberClusterAnnounces implements MemberClusterAnnounceInterface type memberClusterAnnounces struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.MemberClusterAnnounce, *v1alpha1.MemberClusterAnnounceList] } // newMemberClusterAnnounces returns a MemberClusterAnnounces func newMemberClusterAnnounces(c *MulticlusterV1alpha1Client, namespace string) *memberClusterAnnounces { return &memberClusterAnnounces{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.MemberClusterAnnounce, *v1alpha1.MemberClusterAnnounceList]( + "memberclusterannounces", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.MemberClusterAnnounce { return &v1alpha1.MemberClusterAnnounce{} }, + func() *v1alpha1.MemberClusterAnnounceList { return &v1alpha1.MemberClusterAnnounceList{} }), } } - -// Get takes name of the memberClusterAnnounce, and returns the corresponding memberClusterAnnounce object, and an error if there is any. -func (c *memberClusterAnnounces) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MemberClusterAnnounce, err error) { - result = &v1alpha1.MemberClusterAnnounce{} - err = c.client.Get(). - Namespace(c.ns). - Resource("memberclusterannounces"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of MemberClusterAnnounces that match those selectors. -func (c *memberClusterAnnounces) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MemberClusterAnnounceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.MemberClusterAnnounceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("memberclusterannounces"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested memberClusterAnnounces. -func (c *memberClusterAnnounces) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("memberclusterannounces"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a memberClusterAnnounce and creates it. Returns the server's representation of the memberClusterAnnounce, and an error, if there is any. -func (c *memberClusterAnnounces) Create(ctx context.Context, memberClusterAnnounce *v1alpha1.MemberClusterAnnounce, opts v1.CreateOptions) (result *v1alpha1.MemberClusterAnnounce, err error) { - result = &v1alpha1.MemberClusterAnnounce{} - err = c.client.Post(). - Namespace(c.ns). - Resource("memberclusterannounces"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(memberClusterAnnounce). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a memberClusterAnnounce and updates it. Returns the server's representation of the memberClusterAnnounce, and an error, if there is any. -func (c *memberClusterAnnounces) Update(ctx context.Context, memberClusterAnnounce *v1alpha1.MemberClusterAnnounce, opts v1.UpdateOptions) (result *v1alpha1.MemberClusterAnnounce, err error) { - result = &v1alpha1.MemberClusterAnnounce{} - err = c.client.Put(). - Namespace(c.ns). - Resource("memberclusterannounces"). - Name(memberClusterAnnounce.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(memberClusterAnnounce). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the memberClusterAnnounce and deletes it. Returns an error if one occurs. -func (c *memberClusterAnnounces) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("memberclusterannounces"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *memberClusterAnnounces) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("memberclusterannounces"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched memberClusterAnnounce. -func (c *memberClusterAnnounces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MemberClusterAnnounce, err error) { - result = &v1alpha1.MemberClusterAnnounce{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("memberclusterannounces"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceexport.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceexport.go index c0c87def4f4..467809edc2a 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceexport.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceexport.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ResourceExportsGetter has a method to return a ResourceExportInterface. @@ -38,6 +37,7 @@ type ResourceExportsGetter interface { type ResourceExportInterface interface { Create(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.CreateOptions) (*v1alpha1.ResourceExport, error) Update(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (*v1alpha1.ResourceExport, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (*v1alpha1.ResourceExport, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,144 +50,18 @@ type ResourceExportInterface interface { // resourceExports implements ResourceExportInterface type resourceExports struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.ResourceExport, *v1alpha1.ResourceExportList] } // newResourceExports returns a ResourceExports func newResourceExports(c *MulticlusterV1alpha1Client, namespace string) *resourceExports { return &resourceExports{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.ResourceExport, *v1alpha1.ResourceExportList]( + "resourceexports", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.ResourceExport { return &v1alpha1.ResourceExport{} }, + func() *v1alpha1.ResourceExportList { return &v1alpha1.ResourceExportList{} }), } } - -// Get takes name of the resourceExport, and returns the corresponding resourceExport object, and an error if there is any. -func (c *resourceExports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceExport, err error) { - result = &v1alpha1.ResourceExport{} - err = c.client.Get(). - Namespace(c.ns). - Resource("resourceexports"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ResourceExports that match those selectors. -func (c *resourceExports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceExportList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ResourceExportList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("resourceexports"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested resourceExports. -func (c *resourceExports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("resourceexports"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a resourceExport and creates it. Returns the server's representation of the resourceExport, and an error, if there is any. -func (c *resourceExports) Create(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.CreateOptions) (result *v1alpha1.ResourceExport, err error) { - result = &v1alpha1.ResourceExport{} - err = c.client.Post(). - Namespace(c.ns). - Resource("resourceexports"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(resourceExport). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a resourceExport and updates it. Returns the server's representation of the resourceExport, and an error, if there is any. -func (c *resourceExports) Update(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (result *v1alpha1.ResourceExport, err error) { - result = &v1alpha1.ResourceExport{} - err = c.client.Put(). - Namespace(c.ns). - Resource("resourceexports"). - Name(resourceExport.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(resourceExport). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *resourceExports) UpdateStatus(ctx context.Context, resourceExport *v1alpha1.ResourceExport, opts v1.UpdateOptions) (result *v1alpha1.ResourceExport, err error) { - result = &v1alpha1.ResourceExport{} - err = c.client.Put(). - Namespace(c.ns). - Resource("resourceexports"). - Name(resourceExport.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(resourceExport). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the resourceExport and deletes it. Returns an error if one occurs. -func (c *resourceExports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("resourceexports"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *resourceExports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("resourceexports"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched resourceExport. -func (c *resourceExports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceExport, err error) { - result = &v1alpha1.ResourceExport{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("resourceexports"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceimport.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceimport.go index 058d49e12b3..b4e3a3e91fd 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceimport.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha1/resourceimport.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ResourceImportsGetter has a method to return a ResourceImportInterface. @@ -38,6 +37,7 @@ type ResourceImportsGetter interface { type ResourceImportInterface interface { Create(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.CreateOptions) (*v1alpha1.ResourceImport, error) Update(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (*v1alpha1.ResourceImport, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (*v1alpha1.ResourceImport, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,144 +50,18 @@ type ResourceImportInterface interface { // resourceImports implements ResourceImportInterface type resourceImports struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.ResourceImport, *v1alpha1.ResourceImportList] } // newResourceImports returns a ResourceImports func newResourceImports(c *MulticlusterV1alpha1Client, namespace string) *resourceImports { return &resourceImports{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.ResourceImport, *v1alpha1.ResourceImportList]( + "resourceimports", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.ResourceImport { return &v1alpha1.ResourceImport{} }, + func() *v1alpha1.ResourceImportList { return &v1alpha1.ResourceImportList{} }), } } - -// Get takes name of the resourceImport, and returns the corresponding resourceImport object, and an error if there is any. -func (c *resourceImports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceImport, err error) { - result = &v1alpha1.ResourceImport{} - err = c.client.Get(). - Namespace(c.ns). - Resource("resourceimports"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ResourceImports that match those selectors. -func (c *resourceImports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceImportList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ResourceImportList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("resourceimports"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested resourceImports. -func (c *resourceImports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("resourceimports"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a resourceImport and creates it. Returns the server's representation of the resourceImport, and an error, if there is any. -func (c *resourceImports) Create(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.CreateOptions) (result *v1alpha1.ResourceImport, err error) { - result = &v1alpha1.ResourceImport{} - err = c.client.Post(). - Namespace(c.ns). - Resource("resourceimports"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(resourceImport). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a resourceImport and updates it. Returns the server's representation of the resourceImport, and an error, if there is any. -func (c *resourceImports) Update(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (result *v1alpha1.ResourceImport, err error) { - result = &v1alpha1.ResourceImport{} - err = c.client.Put(). - Namespace(c.ns). - Resource("resourceimports"). - Name(resourceImport.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(resourceImport). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *resourceImports) UpdateStatus(ctx context.Context, resourceImport *v1alpha1.ResourceImport, opts v1.UpdateOptions) (result *v1alpha1.ResourceImport, err error) { - result = &v1alpha1.ResourceImport{} - err = c.client.Put(). - Namespace(c.ns). - Resource("resourceimports"). - Name(resourceImport.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(resourceImport). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the resourceImport and deletes it. Returns an error if one occurs. -func (c *resourceImports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("resourceimports"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *resourceImports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("resourceimports"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched resourceImport. -func (c *resourceImports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceImport, err error) { - result = &v1alpha1.ResourceImport{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("resourceimports"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/clusterclaim.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/clusterclaim.go index 9aff7f7e840..c1a1b018af7 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/clusterclaim.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/clusterclaim.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha2 import ( "context" - "time" v1alpha2 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha2" scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ClusterClaimsGetter has a method to return a ClusterClaimInterface. @@ -49,128 +48,18 @@ type ClusterClaimInterface interface { // clusterClaims implements ClusterClaimInterface type clusterClaims struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha2.ClusterClaim, *v1alpha2.ClusterClaimList] } // newClusterClaims returns a ClusterClaims func newClusterClaims(c *MulticlusterV1alpha2Client, namespace string) *clusterClaims { return &clusterClaims{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha2.ClusterClaim, *v1alpha2.ClusterClaimList]( + "clusterclaims", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.ClusterClaim { return &v1alpha2.ClusterClaim{} }, + func() *v1alpha2.ClusterClaimList { return &v1alpha2.ClusterClaimList{} }), } } - -// Get takes name of the clusterClaim, and returns the corresponding clusterClaim object, and an error if there is any. -func (c *clusterClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ClusterClaim, err error) { - result = &v1alpha2.ClusterClaim{} - err = c.client.Get(). - Namespace(c.ns). - Resource("clusterclaims"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterClaims that match those selectors. -func (c *clusterClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ClusterClaimList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.ClusterClaimList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("clusterclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterClaims. -func (c *clusterClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("clusterclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterClaim and creates it. Returns the server's representation of the clusterClaim, and an error, if there is any. -func (c *clusterClaims) Create(ctx context.Context, clusterClaim *v1alpha2.ClusterClaim, opts v1.CreateOptions) (result *v1alpha2.ClusterClaim, err error) { - result = &v1alpha2.ClusterClaim{} - err = c.client.Post(). - Namespace(c.ns). - Resource("clusterclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterClaim). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterClaim and updates it. Returns the server's representation of the clusterClaim, and an error, if there is any. -func (c *clusterClaims) Update(ctx context.Context, clusterClaim *v1alpha2.ClusterClaim, opts v1.UpdateOptions) (result *v1alpha2.ClusterClaim, err error) { - result = &v1alpha2.ClusterClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("clusterclaims"). - Name(clusterClaim.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterClaim). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterClaim and deletes it. Returns an error if one occurs. -func (c *clusterClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("clusterclaims"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("clusterclaims"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterClaim. -func (c *clusterClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ClusterClaim, err error) { - result = &v1alpha2.ClusterClaim{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("clusterclaims"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/clusterset.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/clusterset.go index dd768ac69e6..219b5ae1d2e 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/clusterset.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/clusterset.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha2 import ( "context" - "time" v1alpha2 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha2" scheme "antrea.io/antrea/multicluster/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ClusterSetsGetter has a method to return a ClusterSetInterface. @@ -38,6 +37,7 @@ type ClusterSetsGetter interface { type ClusterSetInterface interface { Create(ctx context.Context, clusterSet *v1alpha2.ClusterSet, opts v1.CreateOptions) (*v1alpha2.ClusterSet, error) Update(ctx context.Context, clusterSet *v1alpha2.ClusterSet, opts v1.UpdateOptions) (*v1alpha2.ClusterSet, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterSet *v1alpha2.ClusterSet, opts v1.UpdateOptions) (*v1alpha2.ClusterSet, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,144 +50,18 @@ type ClusterSetInterface interface { // clusterSets implements ClusterSetInterface type clusterSets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha2.ClusterSet, *v1alpha2.ClusterSetList] } // newClusterSets returns a ClusterSets func newClusterSets(c *MulticlusterV1alpha2Client, namespace string) *clusterSets { return &clusterSets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha2.ClusterSet, *v1alpha2.ClusterSetList]( + "clustersets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.ClusterSet { return &v1alpha2.ClusterSet{} }, + func() *v1alpha2.ClusterSetList { return &v1alpha2.ClusterSetList{} }), } } - -// Get takes name of the clusterSet, and returns the corresponding clusterSet object, and an error if there is any. -func (c *clusterSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ClusterSet, err error) { - result = &v1alpha2.ClusterSet{} - err = c.client.Get(). - Namespace(c.ns). - Resource("clustersets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterSets that match those selectors. -func (c *clusterSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ClusterSetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.ClusterSetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("clustersets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterSets. -func (c *clusterSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("clustersets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterSet and creates it. Returns the server's representation of the clusterSet, and an error, if there is any. -func (c *clusterSets) Create(ctx context.Context, clusterSet *v1alpha2.ClusterSet, opts v1.CreateOptions) (result *v1alpha2.ClusterSet, err error) { - result = &v1alpha2.ClusterSet{} - err = c.client.Post(). - Namespace(c.ns). - Resource("clustersets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterSet). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterSet and updates it. Returns the server's representation of the clusterSet, and an error, if there is any. -func (c *clusterSets) Update(ctx context.Context, clusterSet *v1alpha2.ClusterSet, opts v1.UpdateOptions) (result *v1alpha2.ClusterSet, err error) { - result = &v1alpha2.ClusterSet{} - err = c.client.Put(). - Namespace(c.ns). - Resource("clustersets"). - Name(clusterSet.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterSet). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *clusterSets) UpdateStatus(ctx context.Context, clusterSet *v1alpha2.ClusterSet, opts v1.UpdateOptions) (result *v1alpha2.ClusterSet, err error) { - result = &v1alpha2.ClusterSet{} - err = c.client.Put(). - Namespace(c.ns). - Resource("clustersets"). - Name(clusterSet.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterSet). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterSet and deletes it. Returns an error if one occurs. -func (c *clusterSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("clustersets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("clustersets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterSet. -func (c *clusterSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ClusterSet, err error) { - result = &v1alpha2.ClusterSet{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("clustersets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/fake/fake_clusterclaim.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/fake/fake_clusterclaim.go index 8d1a2969c92..2522707388b 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/fake/fake_clusterclaim.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/fake/fake_clusterclaim.go @@ -39,22 +39,24 @@ var clusterclaimsKind = v1alpha2.SchemeGroupVersion.WithKind("ClusterClaim") // Get takes name of the clusterClaim, and returns the corresponding clusterClaim object, and an error if there is any. func (c *FakeClusterClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ClusterClaim, err error) { + emptyResult := &v1alpha2.ClusterClaim{} obj, err := c.Fake. - Invokes(testing.NewGetAction(clusterclaimsResource, c.ns, name), &v1alpha2.ClusterClaim{}) + Invokes(testing.NewGetActionWithOptions(clusterclaimsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterClaim), err } // List takes label and field selectors, and returns the list of ClusterClaims that match those selectors. func (c *FakeClusterClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ClusterClaimList, err error) { + emptyResult := &v1alpha2.ClusterClaimList{} obj, err := c.Fake. - Invokes(testing.NewListAction(clusterclaimsResource, clusterclaimsKind, c.ns, opts), &v1alpha2.ClusterClaimList{}) + Invokes(testing.NewListActionWithOptions(clusterclaimsResource, clusterclaimsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,28 +75,30 @@ func (c *FakeClusterClaims) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested clusterClaims. func (c *FakeClusterClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(clusterclaimsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(clusterclaimsResource, c.ns, opts)) } // Create takes the representation of a clusterClaim and creates it. Returns the server's representation of the clusterClaim, and an error, if there is any. func (c *FakeClusterClaims) Create(ctx context.Context, clusterClaim *v1alpha2.ClusterClaim, opts v1.CreateOptions) (result *v1alpha2.ClusterClaim, err error) { + emptyResult := &v1alpha2.ClusterClaim{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(clusterclaimsResource, c.ns, clusterClaim), &v1alpha2.ClusterClaim{}) + Invokes(testing.NewCreateActionWithOptions(clusterclaimsResource, c.ns, clusterClaim, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterClaim), err } // Update takes the representation of a clusterClaim and updates it. Returns the server's representation of the clusterClaim, and an error, if there is any. func (c *FakeClusterClaims) Update(ctx context.Context, clusterClaim *v1alpha2.ClusterClaim, opts v1.UpdateOptions) (result *v1alpha2.ClusterClaim, err error) { + emptyResult := &v1alpha2.ClusterClaim{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(clusterclaimsResource, c.ns, clusterClaim), &v1alpha2.ClusterClaim{}) + Invokes(testing.NewUpdateActionWithOptions(clusterclaimsResource, c.ns, clusterClaim, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterClaim), err } @@ -109,7 +113,7 @@ func (c *FakeClusterClaims) Delete(ctx context.Context, name string, opts v1.Del // DeleteCollection deletes a collection of objects. func (c *FakeClusterClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(clusterclaimsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(clusterclaimsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.ClusterClaimList{}) return err @@ -117,11 +121,12 @@ func (c *FakeClusterClaims) DeleteCollection(ctx context.Context, opts v1.Delete // Patch applies the patch and returns the patched clusterClaim. func (c *FakeClusterClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ClusterClaim, err error) { + emptyResult := &v1alpha2.ClusterClaim{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(clusterclaimsResource, c.ns, name, pt, data, subresources...), &v1alpha2.ClusterClaim{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(clusterclaimsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterClaim), err } diff --git a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/fake/fake_clusterset.go b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/fake/fake_clusterset.go index 1bd409d02f8..3154ab788bd 100644 --- a/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/fake/fake_clusterset.go +++ b/multicluster/pkg/client/clientset/versioned/typed/multicluster/v1alpha2/fake/fake_clusterset.go @@ -39,22 +39,24 @@ var clustersetsKind = v1alpha2.SchemeGroupVersion.WithKind("ClusterSet") // Get takes name of the clusterSet, and returns the corresponding clusterSet object, and an error if there is any. func (c *FakeClusterSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ClusterSet, err error) { + emptyResult := &v1alpha2.ClusterSet{} obj, err := c.Fake. - Invokes(testing.NewGetAction(clustersetsResource, c.ns, name), &v1alpha2.ClusterSet{}) + Invokes(testing.NewGetActionWithOptions(clustersetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterSet), err } // List takes label and field selectors, and returns the list of ClusterSets that match those selectors. func (c *FakeClusterSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ClusterSetList, err error) { + emptyResult := &v1alpha2.ClusterSetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(clustersetsResource, clustersetsKind, c.ns, opts), &v1alpha2.ClusterSetList{}) + Invokes(testing.NewListActionWithOptions(clustersetsResource, clustersetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,40 +75,43 @@ func (c *FakeClusterSets) List(ctx context.Context, opts v1.ListOptions) (result // Watch returns a watch.Interface that watches the requested clusterSets. func (c *FakeClusterSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(clustersetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(clustersetsResource, c.ns, opts)) } // Create takes the representation of a clusterSet and creates it. Returns the server's representation of the clusterSet, and an error, if there is any. func (c *FakeClusterSets) Create(ctx context.Context, clusterSet *v1alpha2.ClusterSet, opts v1.CreateOptions) (result *v1alpha2.ClusterSet, err error) { + emptyResult := &v1alpha2.ClusterSet{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(clustersetsResource, c.ns, clusterSet), &v1alpha2.ClusterSet{}) + Invokes(testing.NewCreateActionWithOptions(clustersetsResource, c.ns, clusterSet, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterSet), err } // Update takes the representation of a clusterSet and updates it. Returns the server's representation of the clusterSet, and an error, if there is any. func (c *FakeClusterSets) Update(ctx context.Context, clusterSet *v1alpha2.ClusterSet, opts v1.UpdateOptions) (result *v1alpha2.ClusterSet, err error) { + emptyResult := &v1alpha2.ClusterSet{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(clustersetsResource, c.ns, clusterSet), &v1alpha2.ClusterSet{}) + Invokes(testing.NewUpdateActionWithOptions(clustersetsResource, c.ns, clusterSet, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterSet), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeClusterSets) UpdateStatus(ctx context.Context, clusterSet *v1alpha2.ClusterSet, opts v1.UpdateOptions) (*v1alpha2.ClusterSet, error) { +func (c *FakeClusterSets) UpdateStatus(ctx context.Context, clusterSet *v1alpha2.ClusterSet, opts v1.UpdateOptions) (result *v1alpha2.ClusterSet, err error) { + emptyResult := &v1alpha2.ClusterSet{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(clustersetsResource, "status", c.ns, clusterSet), &v1alpha2.ClusterSet{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(clustersetsResource, "status", c.ns, clusterSet, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterSet), err } @@ -121,7 +126,7 @@ func (c *FakeClusterSets) Delete(ctx context.Context, name string, opts v1.Delet // DeleteCollection deletes a collection of objects. func (c *FakeClusterSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(clustersetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(clustersetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.ClusterSetList{}) return err @@ -129,11 +134,12 @@ func (c *FakeClusterSets) DeleteCollection(ctx context.Context, opts v1.DeleteOp // Patch applies the patch and returns the patched clusterSet. func (c *FakeClusterSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ClusterSet, err error) { + emptyResult := &v1alpha2.ClusterSet{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(clustersetsResource, c.ns, name, pt, data, subresources...), &v1alpha2.ClusterSet{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(clustersetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ClusterSet), err } diff --git a/multicluster/pkg/client/informers/externalversions/factory.go b/multicluster/pkg/client/informers/externalversions/factory.go index 5aed620f6de..a4c36d85f3e 100644 --- a/multicluster/pkg/client/informers/externalversions/factory.go +++ b/multicluster/pkg/client/informers/externalversions/factory.go @@ -226,6 +226,7 @@ type SharedInformerFactory interface { // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterinfoimport.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterinfoimport.go index 010acc2b05a..e2d706be90c 100644 --- a/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterinfoimport.go +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterinfoimport.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha1 import ( v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -36,25 +36,17 @@ type ClusterInfoImportLister interface { // clusterInfoImportLister implements the ClusterInfoImportLister interface. type clusterInfoImportLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ClusterInfoImport] } // NewClusterInfoImportLister returns a new ClusterInfoImportLister. func NewClusterInfoImportLister(indexer cache.Indexer) ClusterInfoImportLister { - return &clusterInfoImportLister{indexer: indexer} -} - -// List lists all ClusterInfoImports in the indexer. -func (s *clusterInfoImportLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterInfoImport, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ClusterInfoImport)) - }) - return ret, err + return &clusterInfoImportLister{listers.New[*v1alpha1.ClusterInfoImport](indexer, v1alpha1.Resource("clusterinfoimport"))} } // ClusterInfoImports returns an object that can list and get ClusterInfoImports. func (s *clusterInfoImportLister) ClusterInfoImports(namespace string) ClusterInfoImportNamespaceLister { - return clusterInfoImportNamespaceLister{indexer: s.indexer, namespace: namespace} + return clusterInfoImportNamespaceLister{listers.NewNamespaced[*v1alpha1.ClusterInfoImport](s.ResourceIndexer, namespace)} } // ClusterInfoImportNamespaceLister helps list and get ClusterInfoImports. @@ -72,26 +64,5 @@ type ClusterInfoImportNamespaceLister interface { // clusterInfoImportNamespaceLister implements the ClusterInfoImportNamespaceLister // interface. type clusterInfoImportNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ClusterInfoImports in the indexer for a given namespace. -func (s clusterInfoImportNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterInfoImport, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ClusterInfoImport)) - }) - return ret, err -} - -// Get retrieves the ClusterInfoImport from the indexer for a given namespace and name. -func (s clusterInfoImportNamespaceLister) Get(name string) (*v1alpha1.ClusterInfoImport, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("clusterinfoimport"), name) - } - return obj.(*v1alpha1.ClusterInfoImport), nil + listers.ResourceIndexer[*v1alpha1.ClusterInfoImport] } diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterset.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterset.go index 77c88ce2397..81d0e48f6d8 100644 --- a/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterset.go +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/clusterset.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha1 import ( v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -36,25 +36,17 @@ type ClusterSetLister interface { // clusterSetLister implements the ClusterSetLister interface. type clusterSetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ClusterSet] } // NewClusterSetLister returns a new ClusterSetLister. func NewClusterSetLister(indexer cache.Indexer) ClusterSetLister { - return &clusterSetLister{indexer: indexer} -} - -// List lists all ClusterSets in the indexer. -func (s *clusterSetLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterSet, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ClusterSet)) - }) - return ret, err + return &clusterSetLister{listers.New[*v1alpha1.ClusterSet](indexer, v1alpha1.Resource("clusterset"))} } // ClusterSets returns an object that can list and get ClusterSets. func (s *clusterSetLister) ClusterSets(namespace string) ClusterSetNamespaceLister { - return clusterSetNamespaceLister{indexer: s.indexer, namespace: namespace} + return clusterSetNamespaceLister{listers.NewNamespaced[*v1alpha1.ClusterSet](s.ResourceIndexer, namespace)} } // ClusterSetNamespaceLister helps list and get ClusterSets. @@ -72,26 +64,5 @@ type ClusterSetNamespaceLister interface { // clusterSetNamespaceLister implements the ClusterSetNamespaceLister // interface. type clusterSetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ClusterSets in the indexer for a given namespace. -func (s clusterSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterSet, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ClusterSet)) - }) - return ret, err -} - -// Get retrieves the ClusterSet from the indexer for a given namespace and name. -func (s clusterSetNamespaceLister) Get(name string) (*v1alpha1.ClusterSet, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("clusterset"), name) - } - return obj.(*v1alpha1.ClusterSet), nil + listers.ResourceIndexer[*v1alpha1.ClusterSet] } diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/gateway.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/gateway.go index ef0c272f17a..d1717c16592 100644 --- a/multicluster/pkg/client/listers/multicluster/v1alpha1/gateway.go +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/gateway.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha1 import ( v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -36,25 +36,17 @@ type GatewayLister interface { // gatewayLister implements the GatewayLister interface. type gatewayLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.Gateway] } // NewGatewayLister returns a new GatewayLister. func NewGatewayLister(indexer cache.Indexer) GatewayLister { - return &gatewayLister{indexer: indexer} -} - -// List lists all Gateways in the indexer. -func (s *gatewayLister) List(selector labels.Selector) (ret []*v1alpha1.Gateway, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Gateway)) - }) - return ret, err + return &gatewayLister{listers.New[*v1alpha1.Gateway](indexer, v1alpha1.Resource("gateway"))} } // Gateways returns an object that can list and get Gateways. func (s *gatewayLister) Gateways(namespace string) GatewayNamespaceLister { - return gatewayNamespaceLister{indexer: s.indexer, namespace: namespace} + return gatewayNamespaceLister{listers.NewNamespaced[*v1alpha1.Gateway](s.ResourceIndexer, namespace)} } // GatewayNamespaceLister helps list and get Gateways. @@ -72,26 +64,5 @@ type GatewayNamespaceLister interface { // gatewayNamespaceLister implements the GatewayNamespaceLister // interface. type gatewayNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Gateways in the indexer for a given namespace. -func (s gatewayNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Gateway, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Gateway)) - }) - return ret, err -} - -// Get retrieves the Gateway from the indexer for a given namespace and name. -func (s gatewayNamespaceLister) Get(name string) (*v1alpha1.Gateway, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("gateway"), name) - } - return obj.(*v1alpha1.Gateway), nil + listers.ResourceIndexer[*v1alpha1.Gateway] } diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/labelidentity.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/labelidentity.go index cd465ff6322..e0fcbbd5316 100644 --- a/multicluster/pkg/client/listers/multicluster/v1alpha1/labelidentity.go +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/labelidentity.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha1 import ( v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type LabelIdentityLister interface { // labelIdentityLister implements the LabelIdentityLister interface. type labelIdentityLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.LabelIdentity] } // NewLabelIdentityLister returns a new LabelIdentityLister. func NewLabelIdentityLister(indexer cache.Indexer) LabelIdentityLister { - return &labelIdentityLister{indexer: indexer} -} - -// List lists all LabelIdentities in the indexer. -func (s *labelIdentityLister) List(selector labels.Selector) (ret []*v1alpha1.LabelIdentity, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.LabelIdentity)) - }) - return ret, err -} - -// Get retrieves the LabelIdentity from the index for a given name. -func (s *labelIdentityLister) Get(name string) (*v1alpha1.LabelIdentity, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("labelidentity"), name) - } - return obj.(*v1alpha1.LabelIdentity), nil + return &labelIdentityLister{listers.New[*v1alpha1.LabelIdentity](indexer, v1alpha1.Resource("labelidentity"))} } diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/memberclusterannounce.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/memberclusterannounce.go index d34621a1a0b..7036dedb35d 100644 --- a/multicluster/pkg/client/listers/multicluster/v1alpha1/memberclusterannounce.go +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/memberclusterannounce.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha1 import ( v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -36,25 +36,17 @@ type MemberClusterAnnounceLister interface { // memberClusterAnnounceLister implements the MemberClusterAnnounceLister interface. type memberClusterAnnounceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.MemberClusterAnnounce] } // NewMemberClusterAnnounceLister returns a new MemberClusterAnnounceLister. func NewMemberClusterAnnounceLister(indexer cache.Indexer) MemberClusterAnnounceLister { - return &memberClusterAnnounceLister{indexer: indexer} -} - -// List lists all MemberClusterAnnounces in the indexer. -func (s *memberClusterAnnounceLister) List(selector labels.Selector) (ret []*v1alpha1.MemberClusterAnnounce, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.MemberClusterAnnounce)) - }) - return ret, err + return &memberClusterAnnounceLister{listers.New[*v1alpha1.MemberClusterAnnounce](indexer, v1alpha1.Resource("memberclusterannounce"))} } // MemberClusterAnnounces returns an object that can list and get MemberClusterAnnounces. func (s *memberClusterAnnounceLister) MemberClusterAnnounces(namespace string) MemberClusterAnnounceNamespaceLister { - return memberClusterAnnounceNamespaceLister{indexer: s.indexer, namespace: namespace} + return memberClusterAnnounceNamespaceLister{listers.NewNamespaced[*v1alpha1.MemberClusterAnnounce](s.ResourceIndexer, namespace)} } // MemberClusterAnnounceNamespaceLister helps list and get MemberClusterAnnounces. @@ -72,26 +64,5 @@ type MemberClusterAnnounceNamespaceLister interface { // memberClusterAnnounceNamespaceLister implements the MemberClusterAnnounceNamespaceLister // interface. type memberClusterAnnounceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all MemberClusterAnnounces in the indexer for a given namespace. -func (s memberClusterAnnounceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MemberClusterAnnounce, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.MemberClusterAnnounce)) - }) - return ret, err -} - -// Get retrieves the MemberClusterAnnounce from the indexer for a given namespace and name. -func (s memberClusterAnnounceNamespaceLister) Get(name string) (*v1alpha1.MemberClusterAnnounce, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("memberclusterannounce"), name) - } - return obj.(*v1alpha1.MemberClusterAnnounce), nil + listers.ResourceIndexer[*v1alpha1.MemberClusterAnnounce] } diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceexport.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceexport.go index 10e5a54e529..773ef5d25b7 100644 --- a/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceexport.go +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceexport.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha1 import ( v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -36,25 +36,17 @@ type ResourceExportLister interface { // resourceExportLister implements the ResourceExportLister interface. type resourceExportLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ResourceExport] } // NewResourceExportLister returns a new ResourceExportLister. func NewResourceExportLister(indexer cache.Indexer) ResourceExportLister { - return &resourceExportLister{indexer: indexer} -} - -// List lists all ResourceExports in the indexer. -func (s *resourceExportLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceExport, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ResourceExport)) - }) - return ret, err + return &resourceExportLister{listers.New[*v1alpha1.ResourceExport](indexer, v1alpha1.Resource("resourceexport"))} } // ResourceExports returns an object that can list and get ResourceExports. func (s *resourceExportLister) ResourceExports(namespace string) ResourceExportNamespaceLister { - return resourceExportNamespaceLister{indexer: s.indexer, namespace: namespace} + return resourceExportNamespaceLister{listers.NewNamespaced[*v1alpha1.ResourceExport](s.ResourceIndexer, namespace)} } // ResourceExportNamespaceLister helps list and get ResourceExports. @@ -72,26 +64,5 @@ type ResourceExportNamespaceLister interface { // resourceExportNamespaceLister implements the ResourceExportNamespaceLister // interface. type resourceExportNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ResourceExports in the indexer for a given namespace. -func (s resourceExportNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceExport, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ResourceExport)) - }) - return ret, err -} - -// Get retrieves the ResourceExport from the indexer for a given namespace and name. -func (s resourceExportNamespaceLister) Get(name string) (*v1alpha1.ResourceExport, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("resourceexport"), name) - } - return obj.(*v1alpha1.ResourceExport), nil + listers.ResourceIndexer[*v1alpha1.ResourceExport] } diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceimport.go b/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceimport.go index ae5da8f3abb..3ca2f685832 100644 --- a/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceimport.go +++ b/multicluster/pkg/client/listers/multicluster/v1alpha1/resourceimport.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha1 import ( v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -36,25 +36,17 @@ type ResourceImportLister interface { // resourceImportLister implements the ResourceImportLister interface. type resourceImportLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ResourceImport] } // NewResourceImportLister returns a new ResourceImportLister. func NewResourceImportLister(indexer cache.Indexer) ResourceImportLister { - return &resourceImportLister{indexer: indexer} -} - -// List lists all ResourceImports in the indexer. -func (s *resourceImportLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceImport, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ResourceImport)) - }) - return ret, err + return &resourceImportLister{listers.New[*v1alpha1.ResourceImport](indexer, v1alpha1.Resource("resourceimport"))} } // ResourceImports returns an object that can list and get ResourceImports. func (s *resourceImportLister) ResourceImports(namespace string) ResourceImportNamespaceLister { - return resourceImportNamespaceLister{indexer: s.indexer, namespace: namespace} + return resourceImportNamespaceLister{listers.NewNamespaced[*v1alpha1.ResourceImport](s.ResourceIndexer, namespace)} } // ResourceImportNamespaceLister helps list and get ResourceImports. @@ -72,26 +64,5 @@ type ResourceImportNamespaceLister interface { // resourceImportNamespaceLister implements the ResourceImportNamespaceLister // interface. type resourceImportNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ResourceImports in the indexer for a given namespace. -func (s resourceImportNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceImport, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ResourceImport)) - }) - return ret, err -} - -// Get retrieves the ResourceImport from the indexer for a given namespace and name. -func (s resourceImportNamespaceLister) Get(name string) (*v1alpha1.ResourceImport, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("resourceimport"), name) - } - return obj.(*v1alpha1.ResourceImport), nil + listers.ResourceIndexer[*v1alpha1.ResourceImport] } diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha2/clusterclaim.go b/multicluster/pkg/client/listers/multicluster/v1alpha2/clusterclaim.go index ee75ac1dee9..e3502be5b96 100644 --- a/multicluster/pkg/client/listers/multicluster/v1alpha2/clusterclaim.go +++ b/multicluster/pkg/client/listers/multicluster/v1alpha2/clusterclaim.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha2 import ( v1alpha2 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -36,25 +36,17 @@ type ClusterClaimLister interface { // clusterClaimLister implements the ClusterClaimLister interface. type clusterClaimLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.ClusterClaim] } // NewClusterClaimLister returns a new ClusterClaimLister. func NewClusterClaimLister(indexer cache.Indexer) ClusterClaimLister { - return &clusterClaimLister{indexer: indexer} -} - -// List lists all ClusterClaims in the indexer. -func (s *clusterClaimLister) List(selector labels.Selector) (ret []*v1alpha2.ClusterClaim, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ClusterClaim)) - }) - return ret, err + return &clusterClaimLister{listers.New[*v1alpha2.ClusterClaim](indexer, v1alpha2.Resource("clusterclaim"))} } // ClusterClaims returns an object that can list and get ClusterClaims. func (s *clusterClaimLister) ClusterClaims(namespace string) ClusterClaimNamespaceLister { - return clusterClaimNamespaceLister{indexer: s.indexer, namespace: namespace} + return clusterClaimNamespaceLister{listers.NewNamespaced[*v1alpha2.ClusterClaim](s.ResourceIndexer, namespace)} } // ClusterClaimNamespaceLister helps list and get ClusterClaims. @@ -72,26 +64,5 @@ type ClusterClaimNamespaceLister interface { // clusterClaimNamespaceLister implements the ClusterClaimNamespaceLister // interface. type clusterClaimNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ClusterClaims in the indexer for a given namespace. -func (s clusterClaimNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.ClusterClaim, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ClusterClaim)) - }) - return ret, err -} - -// Get retrieves the ClusterClaim from the indexer for a given namespace and name. -func (s clusterClaimNamespaceLister) Get(name string) (*v1alpha2.ClusterClaim, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("clusterclaim"), name) - } - return obj.(*v1alpha2.ClusterClaim), nil + listers.ResourceIndexer[*v1alpha2.ClusterClaim] } diff --git a/multicluster/pkg/client/listers/multicluster/v1alpha2/clusterset.go b/multicluster/pkg/client/listers/multicluster/v1alpha2/clusterset.go index e5d614f553d..484575eab75 100644 --- a/multicluster/pkg/client/listers/multicluster/v1alpha2/clusterset.go +++ b/multicluster/pkg/client/listers/multicluster/v1alpha2/clusterset.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha2 import ( v1alpha2 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -36,25 +36,17 @@ type ClusterSetLister interface { // clusterSetLister implements the ClusterSetLister interface. type clusterSetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.ClusterSet] } // NewClusterSetLister returns a new ClusterSetLister. func NewClusterSetLister(indexer cache.Indexer) ClusterSetLister { - return &clusterSetLister{indexer: indexer} -} - -// List lists all ClusterSets in the indexer. -func (s *clusterSetLister) List(selector labels.Selector) (ret []*v1alpha2.ClusterSet, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ClusterSet)) - }) - return ret, err + return &clusterSetLister{listers.New[*v1alpha2.ClusterSet](indexer, v1alpha2.Resource("clusterset"))} } // ClusterSets returns an object that can list and get ClusterSets. func (s *clusterSetLister) ClusterSets(namespace string) ClusterSetNamespaceLister { - return clusterSetNamespaceLister{indexer: s.indexer, namespace: namespace} + return clusterSetNamespaceLister{listers.NewNamespaced[*v1alpha2.ClusterSet](s.ResourceIndexer, namespace)} } // ClusterSetNamespaceLister helps list and get ClusterSets. @@ -72,26 +64,5 @@ type ClusterSetNamespaceLister interface { // clusterSetNamespaceLister implements the ClusterSetNamespaceLister // interface. type clusterSetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ClusterSets in the indexer for a given namespace. -func (s clusterSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.ClusterSet, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ClusterSet)) - }) - return ret, err -} - -// Get retrieves the ClusterSet from the indexer for a given namespace and name. -func (s clusterSetNamespaceLister) Get(name string) (*v1alpha2.ClusterSet, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("clusterset"), name) - } - return obj.(*v1alpha2.ClusterSet), nil + listers.ResourceIndexer[*v1alpha2.ClusterSet] } diff --git a/multicluster/test/mocks/mock_controller_runtime_manager.go b/multicluster/test/mocks/mock_controller_runtime_manager.go index b1af80f9eec..c79afa5eb88 100644 --- a/multicluster/test/mocks/mock_controller_runtime_manager.go +++ b/multicluster/test/mocks/mock_controller_runtime_manager.go @@ -1,16 +1,16 @@ -// Copyright 2021 Antrea Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// // Copyright 2024 Antrea Authors +// // +// // Licensed under the Apache License, Version 2.0 (the "License"); +// // you may not use this file except in compliance with the License. +// // You may obtain a copy of the License at +// // +// // http://www.apache.org/licenses/LICENSE-2.0 +// // +// // Unless required by applicable law or agreed to in writing, software +// // distributed under the License is distributed on an "AS IS" BASIS, +// // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// // See the License for the specific language governing permissions and +// // limitations under the License. // // Code generated by MockGen. DO NOT EDIT. @@ -89,6 +89,20 @@ func (mr *MockManagerMockRecorder) AddHealthzCheck(name, check any) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddHealthzCheck", reflect.TypeOf((*MockManager)(nil).AddHealthzCheck), name, check) } +// AddMetricsServerExtraHandler mocks base method. +func (m *MockManager) AddMetricsServerExtraHandler(path string, handler http.Handler) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddMetricsServerExtraHandler", path, handler) + ret0, _ := ret[0].(error) + return ret0 +} + +// AddMetricsServerExtraHandler indicates an expected call of AddMetricsServerExtraHandler. +func (mr *MockManagerMockRecorder) AddMetricsServerExtraHandler(path, handler any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddMetricsServerExtraHandler", reflect.TypeOf((*MockManager)(nil).AddMetricsServerExtraHandler), path, handler) +} + // AddReadyzCheck mocks base method. func (m *MockManager) AddReadyzCheck(name string, check healthz.Checker) error { m.ctrl.T.Helper() @@ -371,4 +385,4 @@ func (m *MockLeaderElectionRunnable) NeedLeaderElection() bool { func (mr *MockLeaderElectionRunnableMockRecorder) NeedLeaderElection() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NeedLeaderElection", reflect.TypeOf((*MockLeaderElectionRunnable)(nil).NeedLeaderElection)) -} \ No newline at end of file +} diff --git a/pkg/agent/apiserver/apiserver.go b/pkg/agent/apiserver/apiserver.go index beaa6dbbd9e..819f5d99daa 100644 --- a/pkg/agent/apiserver/apiserver.go +++ b/pkg/agent/apiserver/apiserver.go @@ -15,6 +15,7 @@ package apiserver import ( + "context" "fmt" "net" "net/http" @@ -25,12 +26,12 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" - k8sversion "k8s.io/apimachinery/pkg/version" genericopenapi "k8s.io/apiserver/pkg/endpoints/openapi" "k8s.io/apiserver/pkg/registry/rest" genericapiserver "k8s.io/apiserver/pkg/server" "k8s.io/apiserver/pkg/server/healthz" genericoptions "k8s.io/apiserver/pkg/server/options" + apiserverversion "k8s.io/apiserver/pkg/util/version" "antrea.io/antrea/pkg/agent/apiserver/handlers/addressgroup" "antrea.io/antrea/pkg/agent/apiserver/handlers/agentinfo" @@ -72,8 +73,8 @@ type agentAPIServer struct { GenericAPIServer *genericapiserver.GenericAPIServer } -func (s *agentAPIServer) Run(stopCh <-chan struct{}) error { - return s.GenericAPIServer.PrepareRun().Run(stopCh) +func (s *agentAPIServer) Run(ctx context.Context) error { + return s.GenericAPIServer.PrepareRun().RunWithContext(ctx) } func (s *agentAPIServer) GetCertData() []byte { @@ -179,14 +180,7 @@ func newConfig(aq agentquerier.AgentQuerier, if err := os.WriteFile(loopbackClientTokenPath, []byte(serverConfig.LoopbackClientConfig.BearerToken), 0600); err != nil { return nil, fmt.Errorf("error when writing loopback access token to file: %v", err) } - v := antreaversion.GetVersion() - serverConfig.Version = &k8sversion.Info{ - Major: fmt.Sprint(v.Major), - Minor: fmt.Sprint(v.Minor), - GitVersion: v.String(), - GitTreeState: antreaversion.GitTreeState, - GitCommit: antreaversion.GetGitSHA(), - } + serverConfig.EffectiveVersion = apiserverversion.NewEffectiveVersion(antreaversion.GetFullVersion()) serverConfig.EnableMetrics = enableMetrics // Add readiness probe to check the status of watchers. watcherCheck := healthz.NamedCheck("watcher", func(_ *http.Request) error { diff --git a/pkg/agent/apiserver/apiserver_test.go b/pkg/agent/apiserver/apiserver_test.go index 03aa0dab1fb..30122a4cca4 100644 --- a/pkg/agent/apiserver/apiserver_test.go +++ b/pkg/agent/apiserver/apiserver_test.go @@ -15,6 +15,7 @@ package apiserver import ( + "context" "net" "net/http" "net/http/httptest" @@ -140,10 +141,10 @@ livez check failed return nil }, ) - stopCh := make(chan struct{}) - defer close(stopCh) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() go func() { - apiserver.Run(stopCh) + apiserver.Run(ctx) }() wg.Wait() diff --git a/pkg/agent/client/endpoint_resolver.go b/pkg/agent/client/endpoint_resolver.go index 9e4eef36fd7..7815d01e899 100644 --- a/pkg/agent/client/endpoint_resolver.go +++ b/pkg/agent/client/endpoint_resolver.go @@ -72,7 +72,7 @@ type EndpointResolver struct { // endpointLister is used to retrieve the Endpoints for the Service during Endpoint selection. endpointsLister corev1listers.EndpointsLister endpointsListerSynced cache.InformerSynced - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] // listeners need to implement the Listerner interface and will get notified when the // current Endpoint URL changes. listeners []Listener @@ -101,7 +101,12 @@ func NewEndpointResolver(kubeClient kubernetes.Interface, namespace, serviceName serviceListerSynced: serviceInformer.Informer().HasSynced, endpointsLister: endpointsInformer.Lister(), endpointsListerSynced: endpointsInformer.Informer().HasSynced, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), controllerName), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: controllerName, + }, + ), } serviceInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{ diff --git a/pkg/agent/controller/bgp/controller.go b/pkg/agent/controller/bgp/controller.go index 941d5a1ba02..8f1e3d4b6d3 100644 --- a/pkg/agent/controller/bgp/controller.go +++ b/pkg/agent/controller/bgp/controller.go @@ -132,7 +132,7 @@ type Controller struct { newBGPServerFn func(globalConfig *bgp.GlobalConfig) bgp.Interface - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] } func NewBGPPolicyController(nodeInformer coreinformers.NodeInformer, @@ -169,7 +169,12 @@ func NewBGPPolicyController(nodeInformer coreinformers.NodeInformer, newBGPServerFn: func(globalConfig *bgp.GlobalConfig) bgp.Interface { return gobgp.NewGoBGPServer(globalConfig) }, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "bgpPolicy"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "bgpPolicy", + }, + ), } c.bgpPolicyInformer.AddEventHandlerWithResyncPeriod( cache.ResourceEventHandlerFuncs{ diff --git a/pkg/agent/controller/egress/egress_controller.go b/pkg/agent/controller/egress/egress_controller.go index 7d50da0bf45..c50345738b4 100644 --- a/pkg/agent/controller/egress/egress_controller.go +++ b/pkg/agent/controller/egress/egress_controller.go @@ -160,7 +160,7 @@ type EgressController struct { egressInformer cache.SharedIndexInformer egressLister crdlisters.EgressLister egressListerSynced cache.InformerSynced - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] externalIPPoolLister crdlisters.ExternalIPPoolLister externalIPPoolListerSynced cache.InformerSynced @@ -242,7 +242,12 @@ func NewEgressController( k8sClient: k8sClient, antreaClientProvider: antreaClientGetter, crdClient: crdClient, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "egressgroup"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "egressgroup", + }, + ), egressInformer: egressInformer.Informer(), egressLister: egressInformer.Lister(), egressListerSynced: egressInformer.Informer().HasSynced, @@ -554,21 +559,13 @@ func (c *EgressController) worker() { } func (c *EgressController) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) + defer c.queue.Done(key) - // We expect strings (Egress name) to come off the workqueue. - if key, ok := obj.(string); !ok { - // As the item in the workqueue is actually invalid, we call Forget here else we'd - // go into a loop of attempting to process a work item that is invalid. - // This should not happen. - c.queue.Forget(obj) - klog.Errorf("Expected string in work queue but got %#v", obj) - return true - } else if err := c.syncEgress(key); err == nil { + if err := c.syncEgress(key); err == nil { // If no error occurs we Forget this item so it does not get queued again until // another change happens. c.queue.Forget(key) diff --git a/pkg/agent/controller/egress/egress_controller_test.go b/pkg/agent/controller/egress/egress_controller_test.go index 24ff0448883..a3d75ffc487 100644 --- a/pkg/agent/controller/egress/egress_controller_test.go +++ b/pkg/agent/controller/egress/egress_controller_test.go @@ -1210,7 +1210,7 @@ func TestPodUpdateShouldSyncEgress(t *testing.T) { require.Equal(t, 1, c.queue.Len()) item, _ := c.queue.Get() require.Equal(t, egress.Name, item) - require.NoError(t, c.syncEgress(item.(string))) + require.NoError(t, c.syncEgress(item)) c.queue.Done(item) c.mockOFClient.EXPECT().InstallPodSNATFlows(uint32(10), net.ParseIP(fakeLocalEgressIP1), uint32(1)) @@ -1227,7 +1227,7 @@ func TestPodUpdateShouldSyncEgress(t *testing.T) { }, time.Second, 10*time.Millisecond) item, _ = c.queue.Get() require.Equal(t, egress.Name, item) - require.NoError(t, c.syncEgress(item.(string))) + require.NoError(t, c.syncEgress(item)) c.queue.Done(item) } @@ -1261,7 +1261,7 @@ func TestExternalIPPoolUpdateShouldSyncEgress(t *testing.T) { for i := 0; i < len(items); i++ { item, _ := c.queue.Get() c.queue.Done(item) - expectedItems.Delete(item.(string)) + expectedItems.Delete(item) } assert.Empty(t, expectedItems) } @@ -1821,16 +1821,16 @@ func TestUpdateServiceCIDRs(t *testing.T) { } } -func checkQueueItemExistence(t *testing.T, queue workqueue.RateLimitingInterface, items ...string) { +func checkQueueItemExistence[T comparable](t *testing.T, queue workqueue.TypedRateLimitingInterface[T], items ...T) { t.Logf("queue len %d", queue.Len()) require.Eventually(t, func() bool { return len(items) == queue.Len() }, time.Second, 10*time.Millisecond, "Didn't find enough items in the queue") - expectedItems := sets.New[string](items...) - actualItems := sets.New[string]() + expectedItems := sets.New[T](items...) + actualItems := sets.New[T]() for i := 0; i < len(expectedItems); i++ { key, _ := queue.Get() - actualItems.Insert(key.(string)) + actualItems.Insert(key) queue.Done(key) } assert.Equal(t, expectedItems, actualItems) diff --git a/pkg/agent/controller/egress/ip_scheduler.go b/pkg/agent/controller/egress/ip_scheduler.go index 2850193faf7..6bbc279b9a4 100644 --- a/pkg/agent/controller/egress/ip_scheduler.go +++ b/pkg/agent/controller/egress/ip_scheduler.go @@ -61,7 +61,7 @@ type egressIPScheduler struct { // queue is used to trigger scheduling. Triggering multiple times before the item is consumed will only cause one // execution of scheduling. - queue workqueue.Interface + queue workqueue.TypedInterface[string] // mutex is used to protect scheduleResults. mutex sync.RWMutex @@ -89,7 +89,7 @@ func NewEgressIPScheduler(cluster memberlist.Interface, egressInformer crdinform scheduledOnce: &atomic.Bool{}, maxEgressIPsPerNode: maxEgressIPsPerNode, nodeToMaxEgressIPs: map[string]int{}, - queue: workqueue.New(), + queue: workqueue.NewTyped[string](), } egressInformer.Informer().AddEventHandlerWithResyncPeriod( cache.ResourceEventHandlerFuncs{ diff --git a/pkg/agent/controller/ipseccertificate/ipsec_certificate_controller.go b/pkg/agent/controller/ipseccertificate/ipsec_certificate_controller.go index 1feeab1a7eb..01f21740d4d 100644 --- a/pkg/agent/controller/ipseccertificate/ipsec_certificate_controller.go +++ b/pkg/agent/controller/ipseccertificate/ipsec_certificate_controller.go @@ -71,7 +71,7 @@ type Controller struct { kubeClient clientset.Interface ovsBridgeClient ovsconfig.OVSBridgeClient nodeName string - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] rotateCertificate func() (*certificateKeyPair, error) certificateKeyPair *certificateKeyPair @@ -110,8 +110,13 @@ func newIPSecCertificateControllerWithCustomClock(kubeClient clientset.Interface kubeClient: kubeClient, ovsBridgeClient: ovsBridgeClient, nodeName: nodeName, - queue: workqueue.NewRateLimitingQueueWithDelayingInterface(workqueue.NewDelayingQueueWithCustomClock(clock, "IPsecCertificateController"), - workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay)), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "IPsecCertificateController", + Clock: clock, + }, + ), clock: clock, caPath: filepath.Join(defaultCertificatesPath, "ca", "ca.crt"), certificateFolderPath: defaultCertificatesPath, @@ -128,16 +133,12 @@ func (c *Controller) worker() { } func (c *Controller) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) - if key, ok := obj.(string); !ok { - c.queue.Forget(obj) - klog.ErrorS(nil, "Unexpected object in work queue", "object", obj) - return true - } else if err := c.syncConfigurations(); err == nil { + defer c.queue.Done(key) + if err := c.syncConfigurations(); err == nil { c.queue.Forget(key) } else { c.queue.AddRateLimited(key) diff --git a/pkg/agent/controller/l7flowexporter/l7_flow_export_controller.go b/pkg/agent/controller/l7flowexporter/l7_flow_export_controller.go index a0c8a016bc8..16f30eb75b4 100644 --- a/pkg/agent/controller/l7flowexporter/l7_flow_export_controller.go +++ b/pkg/agent/controller/l7flowexporter/l7_flow_export_controller.go @@ -69,7 +69,7 @@ type L7FlowExporterController struct { targetPort uint32 - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] } func NewL7FlowExporterController( @@ -89,7 +89,12 @@ func NewL7FlowExporterController( namespaceListerSynced: namespaceInformer.Informer().HasSynced, l7Reconciler: l7Reconciler, podToDirectionMap: make(map[string]v1alpha2.Direction), - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "L7FlowExporterController"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "L7FlowExporterController", + }, + ), } l7c.podInformer.AddEventHandlerWithResyncPeriod( cache.ResourceEventHandlerFuncs{ @@ -134,20 +139,13 @@ func (l7c *L7FlowExporterController) worker() { } func (l7c *L7FlowExporterController) processNextWorkItem() bool { - obj, quit := l7c.queue.Get() + key, quit := l7c.queue.Get() if quit { return false } - defer l7c.queue.Done(obj) + defer l7c.queue.Done(key) - if key, ok := obj.(string); !ok { - // As the item in the work queue is actually invalid, we call Forget here else we'd - // go into a loop of attempting to process a work item that is invalid. - // This should not happen. - l7c.queue.Forget(key) - klog.ErrorS(nil, "Expected string in work queue but got", "key", obj) - return true - } else if err := l7c.syncPod(key); err == nil { + if err := l7c.syncPod(key); err == nil { // If no error occurs we Forget this item, so it does not get queued again until // another change happens. l7c.queue.Forget(key) diff --git a/pkg/agent/controller/l7flowexporter/l7_flow_export_controller_test.go b/pkg/agent/controller/l7flowexporter/l7_flow_export_controller_test.go index 5f400e7b1a2..ef88e7baadd 100644 --- a/pkg/agent/controller/l7flowexporter/l7_flow_export_controller_test.go +++ b/pkg/agent/controller/l7flowexporter/l7_flow_export_controller_test.go @@ -210,7 +210,7 @@ func TestPodAdd(t *testing.T) { waitEvents(t, 1, c) item, _ := c.queue.Get() tt.expectedCalls(c.mockOFClient) - err := c.syncPod(item.(string)) + err := c.syncPod(item) if tt.expectedError != nil { assert.ErrorContains(t, err, tt.expectedError.Error()) } else { @@ -308,7 +308,7 @@ func TestPodUpdate(t *testing.T) { waitEvents(t, 1, c) item, _ := c.queue.Get() - require.NoError(t, c.syncPod(item.(string))) + require.NoError(t, c.syncPod(item)) assert.Equal(t, tt.expectedPodToDirectionMap, c.podToDirectionMap) c.queue.Done(item) }) @@ -367,7 +367,7 @@ func TestPodUpdateRemoveFlows(t *testing.T) { waitEvents(t, 2, c) for i := 0; i < 2; i++ { item, _ := c.queue.Get() - require.NoError(t, c.syncPod(item.(string))) + require.NoError(t, c.syncPod(item)) c.queue.Done(item) } if tt.deletePod { @@ -384,7 +384,7 @@ func TestPodUpdateRemoveFlows(t *testing.T) { waitEvents(t, 1, c) item, _ := c.queue.Get() - require.NoError(t, c.syncPod(item.(string))) + require.NoError(t, c.syncPod(item)) assert.Equal(t, tt.expectedL7PodNNDirAfterFlowRemoved, c.podToDirectionMap) c.queue.Done(item) }) @@ -457,7 +457,7 @@ func TestNamespaceUpdate(t *testing.T) { waitEvents(t, tt.expectedPodsCount, c) for i := 0; i < tt.expectedPodsCount; i++ { item, _ := c.queue.Get() - require.NoError(t, c.syncPod(item.(string))) + require.NoError(t, c.syncPod(item)) c.queue.Done(item) } assert.Equal(t, tt.expectedPodToDirectionMap, c.podToDirectionMap) @@ -518,7 +518,7 @@ func TestNSUpdateRemoveFlows(t *testing.T) { waitEvents(t, 2, c) for i := 0; i < 2; i++ { item, _ := c.queue.Get() - require.NoError(t, c.syncPod(item.(string))) + require.NoError(t, c.syncPod(item)) c.queue.Done(item) } // Update Pods with no annotations @@ -529,7 +529,7 @@ func TestNSUpdateRemoveFlows(t *testing.T) { waitEvents(t, tt.expectedQueueLen, c) for i := 0; i < tt.expectedQueueLen; i++ { item, _ := c.queue.Get() - require.NoError(t, c.syncPod(item.(string))) + require.NoError(t, c.syncPod(item)) c.queue.Done(item) } assert.Equal(t, tt.expectedL7PodNNDirMapAfterFlowRemoved, c.podToDirectionMap) diff --git a/pkg/agent/controller/networkpolicy/allocator.go b/pkg/agent/controller/networkpolicy/allocator.go index 6d48ecd5b1c..1112986e7d4 100644 --- a/pkg/agent/controller/networkpolicy/allocator.go +++ b/pkg/agent/controller/networkpolicy/allocator.go @@ -59,7 +59,7 @@ type idAllocator struct { asyncRuleCache cache.Store // deleteQueue is used to place a rule ID after a given delay for deleting the // the rule in the asyncRuleCache. - deleteQueue workqueue.DelayingInterface + deleteQueue workqueue.TypedDelayingInterface[uint32] // deleteInterval is the delay interval for deleting the rule in the asyncRuleCache. deleteInterval time.Duration } @@ -70,13 +70,16 @@ func asyncRuleCacheKeyFunc(obj interface{}) (string, error) { return strconv.Itoa(int(rule.FlowID)), nil } -// newIDAllocator returns a new *idAllocator. -// It takes a list of allocated IDs, which can be used for the restart case. -func newIDAllocator(asyncRuleDeleteInterval time.Duration, allocatedIDs ...uint32) *idAllocator { +// newIDAllocatorWithClock creates an ID allocator with a custom clock, which is +// useful when writing unit tests. +func newIDAllocatorWithClock(asyncRuleDeleteInterval time.Duration, clock clock.WithTicker, allocatedIDs ...uint32) *idAllocator { allocator := &idAllocator{ availableSet: make(map[uint32]struct{}), asyncRuleCache: cache.NewStore(asyncRuleCacheKeyFunc), - deleteQueue: workqueue.NewNamedDelayingQueue(deleteQueueName), + deleteQueue: workqueue.NewTypedDelayingQueueWithConfig(workqueue.TypedDelayingQueueConfig[uint32]{ + Name: deleteQueueName, + Clock: clock, + }), } // Set the deleteInterval. @@ -104,13 +107,10 @@ func newIDAllocator(asyncRuleDeleteInterval time.Duration, allocatedIDs ...uint3 return allocator } -// newIDAllocatorWithCustomClock creates an ID allocator with a custom clock, -// which is useful when writing robust unit tests. -func newIDAllocatorWithCustomClock(clock clock.WithTicker, asyncRuleDeleteInterval time.Duration, allocatedIDs ...uint32) *idAllocator { - allocator := newIDAllocator(asyncRuleDeleteInterval, allocatedIDs...) - // override regular delaying workqueue with one using a custom clock - allocator.deleteQueue = workqueue.NewDelayingQueueWithCustomClock(clock, deleteQueueName) - return allocator +// newIDAllocator returns a new *idAllocator. +// It takes a list of allocated IDs, which can be used for the restart case. +func newIDAllocator(asyncRuleDeleteInterval time.Duration, allocatedIDs ...uint32) *idAllocator { + return newIDAllocatorWithClock(asyncRuleDeleteInterval, clock.RealClock{}, allocatedIDs...) } // allocateForRule allocates an uint32 ID for a given rule if it's available, otherwise @@ -176,13 +176,13 @@ func (a *idAllocator) processDeleteQueueItem() bool { } defer a.deleteQueue.Done(key) - rule, exists, err := a.getRuleFromAsyncCache(key.(uint32)) + rule, exists, err := a.getRuleFromAsyncCache(key) if !exists { - klog.Warningf("Rule with id %v is not present in the async rule cache", key.(uint32)) + klog.Warningf("Rule with id %v is not present in the async rule cache", key) return true } if err != nil { - klog.Errorf("Unexpected error when trying to get rule with id %d: %v", key.(uint32), err) + klog.Errorf("Unexpected error when trying to get rule with id %d: %v", key, err) return true } if err := a.asyncRuleCache.Delete(rule); err != nil { @@ -190,8 +190,8 @@ func (a *idAllocator) processDeleteQueueItem() bool { return true } - if err := a.release(key.(uint32)); err != nil { - klog.Errorf("Unexpected error when releasing id %d: %v", key.(uint32), err) + if err := a.release(key); err != nil { + klog.Errorf("Unexpected error when releasing id %d: %v", key, err) return true } diff --git a/pkg/agent/controller/networkpolicy/allocator_test.go b/pkg/agent/controller/networkpolicy/allocator_test.go index 7c82e516afa..91aad7d18de 100644 --- a/pkg/agent/controller/networkpolicy/allocator_test.go +++ b/pkg/agent/controller/networkpolicy/allocator_test.go @@ -240,7 +240,7 @@ func TestIdAllocatorWorker(t *testing.T) { fakeClock := newFakeClock(startTime) minAsyncDeleteInterval = testMinAsyncDeleteInterval testAsyncDeleteInterval = tt.testAsyncDeleteInterval - a := newIDAllocatorWithCustomClock(fakeClock, testAsyncDeleteInterval, tt.args...) + a := newIDAllocatorWithClock(testAsyncDeleteInterval, fakeClock, tt.args...) require.NoError(t, a.allocateForRule(tt.rule), "Error allocating ID for rule") stopCh := make(chan struct{}) defer close(stopCh) diff --git a/pkg/agent/controller/networkpolicy/fqdn.go b/pkg/agent/controller/networkpolicy/fqdn.go index b8e28be41c2..1a54290fc83 100644 --- a/pkg/agent/controller/networkpolicy/fqdn.go +++ b/pkg/agent/controller/networkpolicy/fqdn.go @@ -131,7 +131,7 @@ type fqdnController struct { // FQDN names this controller is tracking, with their corresponding dnsMeta. dnsEntryCache map[string]dnsMeta // FQDN names that needs to be re-queried after their respective TTLs. - dnsQueryQueue workqueue.RateLimitingInterface + dnsQueryQueue workqueue.TypedRateLimitingInterface[string] // idAllocator provides interfaces to allocateForRule and release uint32 id. idAllocator *idAllocator @@ -156,11 +156,16 @@ type fqdnController struct { func newFQDNController(client openflow.Client, allocator *idAllocator, dnsServerOverride string, dirtyRuleHandler func(string), v4Enabled, v6Enabled bool, gwPort uint32) (*fqdnController, error) { controller := &fqdnController{ - ofClient: client, - dirtyRuleHandler: dirtyRuleHandler, - ruleSyncTracker: &ruleSyncTracker{updateCh: make(chan ruleRealizationUpdate, 1), ruleToSubscribers: map[string][]*subscriber{}, dirtyRules: sets.New[string]()}, - idAllocator: allocator, - dnsQueryQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "fqdn"), + ofClient: client, + dirtyRuleHandler: dirtyRuleHandler, + ruleSyncTracker: &ruleSyncTracker{updateCh: make(chan ruleRealizationUpdate, 1), ruleToSubscribers: map[string][]*subscriber{}, dirtyRules: sets.New[string]()}, + idAllocator: allocator, + dnsQueryQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "fqdn", + }, + ), dnsEntryCache: map[string]dnsMeta{}, fqdnRuleToSelectedPods: map[string]sets.Set[int32]{}, fqdnToSelectorItem: map[string]sets.Set[fqdnSelectorItem]{}, @@ -637,12 +642,12 @@ func (f *fqdnController) processNextWorkItem() bool { ctx, cancel := context.WithTimeout(context.Background(), dnsRequestTimeout) defer cancel() - err := f.makeDNSRequest(ctx, key.(string)) + err := f.makeDNSRequest(ctx, key) f.handleErr(err, key) return true } -func (f *fqdnController) handleErr(err error, key interface{}) { +func (f *fqdnController) handleErr(err error, key string) { if err == nil { f.dnsQueryQueue.Forget(key) return diff --git a/pkg/agent/controller/networkpolicy/fqdn_test.go b/pkg/agent/controller/networkpolicy/fqdn_test.go index 249f07c6802..46bcffa53b0 100644 --- a/pkg/agent/controller/networkpolicy/fqdn_test.go +++ b/pkg/agent/controller/networkpolicy/fqdn_test.go @@ -188,7 +188,7 @@ func TestAddFQDNRule(t *testing.T) { for f.dnsQueryQueue.Len() > 0 { item, _ := f.dnsQueryQueue.Get() f.dnsQueryQueue.Done(item) - enqueuedFQDNs = append(enqueuedFQDNs, item.(string)) + enqueuedFQDNs = append(enqueuedFQDNs, item) } assert.ElementsMatch(t, tt.enqueuedFQDNs, enqueuedFQDNs) }) diff --git a/pkg/agent/controller/networkpolicy/networkpolicy_controller.go b/pkg/agent/controller/networkpolicy/networkpolicy_controller.go index b95a8e1ec0f..05a5ea315e7 100644 --- a/pkg/agent/controller/networkpolicy/networkpolicy_controller.go +++ b/pkg/agent/controller/networkpolicy/networkpolicy_controller.go @@ -125,7 +125,7 @@ type Controller struct { // after the existing watches expire. antreaClientProvider client.AntreaClientProvider // queue maintains the NetworkPolicy ruleIDs that need to be synced. - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] // ruleCache maintains the desired state of NetworkPolicy rules. ruleCache *ruleCache // podReconciler provides interfaces to reconcile the desired state of @@ -198,8 +198,13 @@ func NewNetworkPolicyController(antreaClientGetter client.AntreaClientProvider, l7Reconciler *l7engine.Reconciler) (*Controller, error) { idAllocator := newIDAllocator(asyncRuleDeleteInterval, dnsInterceptRuleID) c := &Controller{ - antreaClientProvider: antreaClientGetter, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "networkpolicyrule"), + antreaClientProvider: antreaClientGetter, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "networkpolicyrule", + }, + ), ofClient: ofClient, nodeType: nodeType, antreaPolicyEnabled: antreaPolicyEnabled, @@ -721,7 +726,7 @@ func (c *Controller) processNextWorkItem() bool { } defer c.queue.Done(key) - err := c.syncRule(key.(string)) + err := c.syncRule(key) c.handleErr(err, key) return true @@ -734,7 +739,7 @@ func (c *Controller) processAllItemsInQueue() { batchSyncRuleKeys := make([]string, numRules) for i := 0; i < numRules; i++ { ruleKey, _ := c.queue.Get() - batchSyncRuleKeys[i] = ruleKey.(string) + batchSyncRuleKeys[i] = ruleKey // set key to done to prevent missing watched updates between here and fullSync finish. c.queue.Done(ruleKey) } @@ -888,7 +893,7 @@ func (c *Controller) syncRules(keys []string) error { return nil } -func (c *Controller) handleErr(err error, key interface{}) { +func (c *Controller) handleErr(err error, key string) { if err == nil { c.queue.Forget(key) return diff --git a/pkg/agent/controller/networkpolicy/status_controller.go b/pkg/agent/controller/networkpolicy/status_controller.go index 9307048c69b..32bb0dad146 100644 --- a/pkg/agent/controller/networkpolicy/status_controller.go +++ b/pkg/agent/controller/networkpolicy/status_controller.go @@ -61,7 +61,7 @@ type StatusController struct { // realizedRules keeps track of the realized NetworkPolicy rules. realizedRules cache.Indexer // queue maintains the UIDs of the NetworkPolicy that need to be processed. - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[types.UID] } // realizedRule is the struct kept by StatusController for storing a realized rule. @@ -90,7 +90,12 @@ func newStatusController(antreaClientProvider client.AntreaClientProvider, nodeN realizedRules: cache.NewIndexer(realizedRuleKeyFunc, cache.Indexers{ realizedRulePolicyIndex: realizedRulePolicyIndexFunc, }), - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "networkpolicystatus"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[types.UID](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[types.UID]{ + Name: "networkpolicystatus", + }, + ), } } @@ -128,7 +133,7 @@ func (c *StatusController) worker() { } func (c *StatusController) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } @@ -136,17 +141,9 @@ func (c *StatusController) processNextWorkItem() bool { // must remember to call Forget if we do not want this work item being re-queued. For // example, we do not call Forget if a transient error occurs, instead the item is put back // on the workqueue and attempted again after a back-off period. - defer c.queue.Done(obj) - - // We expect NetworkPolicy UID to come off the workqueue. - if key, ok := obj.(types.UID); !ok { - // As the item in the workqueue is actually invalid, we call Forget here else we'd - // go into a loop of attempting to process a work item that is invalid. - // This should not happen: enqueueNode only enqueues UIDs. - c.queue.Forget(obj) - klog.Errorf("Expected UID in work queue but got %#v", obj) - return true - } else if err := c.syncHandler(key); err == nil { + defer c.queue.Done(key) + + if err := c.syncHandler(key); err == nil { // If no error occurs we Forget this item so it does not get queued again until // another change happens. c.queue.Forget(key) diff --git a/pkg/agent/controller/noderoute/node_route_controller.go b/pkg/agent/controller/noderoute/node_route_controller.go index 7541e0198f2..e64aa79ef01 100644 --- a/pkg/agent/controller/noderoute/node_route_controller.go +++ b/pkg/agent/controller/noderoute/node_route_controller.go @@ -73,7 +73,7 @@ type Controller struct { nodeInformer coreinformers.NodeInformer nodeLister corelisters.NodeLister nodeListerSynced cache.InformerSynced - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] // installedNodes records routes and flows installation states of Nodes. // The key is the host name of the Node, the value is the nodeRouteInfo of the Node. // A node will be in the map after its flows and routes are installed successfully. @@ -107,17 +107,22 @@ func NewNodeRouteController( flowRestoreCompleteWait *utilwait.Group, ) *Controller { controller := &Controller{ - ovsBridgeClient: ovsBridgeClient, - ofClient: client, - ovsCtlClient: ovsCtlClient, - routeClient: routeClient, - interfaceStore: interfaceStore, - networkConfig: networkConfig, - nodeConfig: nodeConfig, - nodeInformer: nodeInformer, - nodeLister: nodeInformer.Lister(), - nodeListerSynced: nodeInformer.Informer().HasSynced, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "noderoute"), + ovsBridgeClient: ovsBridgeClient, + ofClient: client, + ovsCtlClient: ovsCtlClient, + routeClient: routeClient, + interfaceStore: interfaceStore, + networkConfig: networkConfig, + nodeConfig: nodeConfig, + nodeInformer: nodeInformer, + nodeLister: nodeInformer.Lister(), + nodeListerSynced: nodeInformer.Informer().HasSynced, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "noderoute", + }, + ), installedNodes: cache.NewIndexer(nodeRouteInfoKeyFunc, cache.Indexers{nodeRouteInfoPodCIDRIndexName: nodeRouteInfoPodCIDRIndexFunc}), wireGuardClient: wireguardClient, ipsecCertificateManager: ipsecCertificateManager, @@ -404,7 +409,7 @@ func (c *Controller) worker() { // function returns false if and only if the work queue was shutdown (no more items will be // processed). func (c *Controller) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } @@ -412,18 +417,7 @@ func (c *Controller) processNextWorkItem() bool { // must remember to call Forget if we do not want this work item being re-queued. For // example, we do not call Forget if a transient error occurs, instead the item is put back // on the workqueue and attempted again after a back-off period. - defer c.queue.Done(obj) - - // We expect strings (Node name) to come off the workqueue. - key, ok := obj.(string) - if !ok { - // As the item in the workqueue is actually invalid, we call Forget here else we'd - // go into a loop of attempting to process a work item that is invalid. - // This should not happen: enqueueNode only enqueues strings. - c.queue.Forget(obj) - klog.Errorf("Expected string in work queue but got %#v", obj) - return true - } + defer c.queue.Done(key) // We call Finished unconditionally even if this only matters for the initial list of // Nodes. There is no harm in calling Finished without a corresponding call to Start. diff --git a/pkg/agent/controller/serviceexternalip/controller.go b/pkg/agent/controller/serviceexternalip/controller.go index 76b7931c15e..e2d2522f2e7 100644 --- a/pkg/agent/controller/serviceexternalip/controller.go +++ b/pkg/agent/controller/serviceexternalip/controller.go @@ -67,7 +67,7 @@ type ServiceExternalIPController struct { endpointsLister corelisters.EndpointsLister endpointsListerSynced cache.InformerSynced - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[apimachinerytypes.NamespacedName] externalIPStates map[apimachinerytypes.NamespacedName]externalIPState externalIPStatesMutex sync.RWMutex @@ -89,9 +89,14 @@ func NewServiceExternalIPController( endpointsInformer coreinformers.EndpointsInformer, ) (*ServiceExternalIPController, error) { c := &ServiceExternalIPController{ - nodeName: nodeName, - cluster: cluster, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "AgentServiceExternalIP"), + nodeName: nodeName, + cluster: cluster, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[apimachinerytypes.NamespacedName](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[apimachinerytypes.NamespacedName]{ + Name: "AgentServiceExternalIP", + }, + ), serviceInformer: serviceInformer.Informer(), serviceLister: serviceInformer.Lister(), serviceListerSynced: serviceInformer.Informer().HasSynced, @@ -253,16 +258,12 @@ func (c *ServiceExternalIPController) worker() { } func (c *ServiceExternalIPController) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) - if key, ok := obj.(apimachinerytypes.NamespacedName); !ok { - c.queue.Forget(obj) - klog.Errorf("Expected NamespacedName in work queue but got %#v", obj) - return true - } else if err := c.syncService(key); err == nil { + defer c.queue.Done(key) + if err := c.syncService(key); err == nil { // If no error occurs we Forget this item so it does not get queued again until // another change happens. c.queue.Forget(key) diff --git a/pkg/agent/controller/serviceexternalip/controller_test.go b/pkg/agent/controller/serviceexternalip/controller_test.go index b43f061f09c..774e36f2622 100644 --- a/pkg/agent/controller/serviceexternalip/controller_test.go +++ b/pkg/agent/controller/serviceexternalip/controller_test.go @@ -134,11 +134,16 @@ func newFakeController(t *testing.T, objs ...runtime.Object) *fakeController { endpointsInformer: endpointInformer.Informer(), endpointsListerSynced: endpointInformer.Informer().HasSynced, endpointsLister: endpointInformer.Lister(), - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "serviceExternalIP"), - externalIPStates: make(map[apimachinerytypes.NamespacedName]externalIPState), - cluster: memberlistCluster, - ipAssigner: mockIPAssigner, - assignedIPs: make(map[string]sets.Set[string]), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[apimachinerytypes.NamespacedName](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[apimachinerytypes.NamespacedName]{ + Name: "ServiceExternalIP", + }, + ), + externalIPStates: make(map[apimachinerytypes.NamespacedName]externalIPState), + cluster: memberlistCluster, + ipAssigner: mockIPAssigner, + assignedIPs: make(map[string]sets.Set[string]), } return &fakeController{ ServiceExternalIPController: eipController, diff --git a/pkg/agent/controller/traceflow/traceflow_controller.go b/pkg/agent/controller/traceflow/traceflow_controller.go index 57fb9dd6978..e18a4e8388b 100644 --- a/pkg/agent/controller/traceflow/traceflow_controller.go +++ b/pkg/agent/controller/traceflow/traceflow_controller.go @@ -101,7 +101,7 @@ type Controller struct { networkConfig *config.NetworkConfig nodeConfig *config.NodeConfig serviceCIDR *net.IPNet // K8s Service ClusterIP CIDR - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] runningTraceflowsMutex sync.RWMutex // runningTraceflows is a map for storing the running Traceflow state // with dataplane tag to be the key. @@ -137,9 +137,14 @@ func NewTraceflowController( networkConfig: networkConfig, nodeConfig: nodeConfig, serviceCIDR: serviceCIDR, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "traceflow"), - runningTraceflows: make(map[int8]*traceflowState), - enableAntreaProxy: enableAntreaProxy, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "traceflow", + }, + ), + runningTraceflows: make(map[int8]*traceflowState), + enableAntreaProxy: enableAntreaProxy, } // Add handlers for Traceflow events. @@ -219,7 +224,7 @@ func (c *Controller) worker() { // until we get notified of a new change. This function returns false if and only if the work queue // was shutdown (no more items will be processed). func (c *Controller) processTraceflowItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } @@ -227,17 +232,9 @@ func (c *Controller) processTraceflowItem() bool { // must remember to call Forget if we do not want this work item being re-queued. For // example, we do not call Forget if a transient error occurs, instead the item is put back // on the workqueue and attempted again after a back-off period. - defer c.queue.Done(obj) - - // We expect strings (Traceflow name) to come off the workqueue. - if key, ok := obj.(string); !ok { - // As the item in the workqueue is actually invalid, we call Forget here else we'd - // go into a loop of attempting to process a work item that is invalid. - // This should not happen: enqueueTraceflow only enqueues strings. - c.queue.Forget(obj) - klog.Errorf("Expected string in work queue but got %#v", obj) - return true - } else if err := c.syncTraceflow(key); err == nil { + defer c.queue.Done(key) + + if err := c.syncTraceflow(key); err == nil { // If no error occurs we Forget this item so it does not get queued again. c.queue.Forget(key) } else { diff --git a/pkg/agent/controller/traceflow/traceflow_controller_test.go b/pkg/agent/controller/traceflow/traceflow_controller_test.go index 2b2040e9f19..5a716248105 100644 --- a/pkg/agent/controller/traceflow/traceflow_controller_test.go +++ b/pkg/agent/controller/traceflow/traceflow_controller_test.go @@ -145,8 +145,13 @@ func newFakeTraceflowController(t *testing.T, initObjects []runtime.Object, netw networkConfig: networkConfig, nodeConfig: nodeConfig, serviceCIDR: serviceCIDRNet, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "traceflow"), - runningTraceflows: make(map[int8]*traceflowState), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "traceflow", + }, + ), + runningTraceflows: make(map[int8]*traceflowState), } return &fakeTraceflowController{ diff --git a/pkg/agent/controller/trafficcontrol/controller.go b/pkg/agent/controller/trafficcontrol/controller.go index 745c173be4e..cf158c8f435 100644 --- a/pkg/agent/controller/trafficcontrol/controller.go +++ b/pkg/agent/controller/trafficcontrol/controller.go @@ -139,7 +139,7 @@ type Controller struct { trafficControlInformer cache.SharedIndexInformer trafficControlLister crdlisters.TrafficControlLister trafficControlListerSynced cache.InformerSynced - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] } func NewTrafficControlController(ofClient openflow.Client, @@ -167,7 +167,12 @@ func NewTrafficControlController(ofClient openflow.Client, podToTCBindings: map[string]*podToTCBinding{}, portToTCBindings: map[string]*portToTCBinding{}, tcStates: map[string]*trafficControlState{}, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "trafficControlGroup"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "trafficControlGroup", + }, + ), } c.trafficControlInformer.AddEventHandlerWithResyncPeriod( cache.ResourceEventHandlerFuncs{ @@ -392,20 +397,13 @@ func (c *Controller) worker() { } func (c *Controller) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) + defer c.queue.Done(key) - if key, ok := obj.(string); !ok { - // As the item in the work queue is actually invalid, we call Forget here else we'd - // go into a loop of attempting to process a work item that is invalid. - // This should not happen. - c.queue.Forget(obj) - klog.Errorf("Expected string in work queue but got %#v", obj) - return true - } else if err := c.syncTrafficControl(key); err == nil { + if err := c.syncTrafficControl(key); err == nil { // If no error occurs we Forget this item, so it does not get queued again until // another change happens. c.queue.Forget(key) diff --git a/pkg/agent/controller/trafficcontrol/controller_test.go b/pkg/agent/controller/trafficcontrol/controller_test.go index 84c77b7ddb6..368c15b12a2 100644 --- a/pkg/agent/controller/trafficcontrol/controller_test.go +++ b/pkg/agent/controller/trafficcontrol/controller_test.go @@ -643,7 +643,7 @@ func TestSharedTargetPort(t *testing.T) { waitEvents(t, 2, c) for i := 0; i < 2; i++ { item, _ := c.queue.Get() - require.NoError(t, c.syncTrafficControl(item.(string))) + require.NoError(t, c.syncTrafficControl(item)) c.queue.Done(item) } @@ -660,7 +660,7 @@ func TestSharedTargetPort(t *testing.T) { waitEvents(t, 1, c) item, _ := c.queue.Get() require.Equal(t, tc1Name, item) - require.NoError(t, c.syncTrafficControl(item.(string))) + require.NoError(t, c.syncTrafficControl(item)) c.queue.Done(item) // Delete TrafficControl tc2. @@ -669,7 +669,7 @@ func TestSharedTargetPort(t *testing.T) { waitEvents(t, 1, c) item, _ = c.queue.Get() require.Equal(t, tc2Name, item) - require.NoError(t, c.syncTrafficControl(item.(string))) + require.NoError(t, c.syncTrafficControl(item)) c.queue.Done(item) } @@ -712,7 +712,7 @@ func TestPodUpdateFromCNIServer(t *testing.T) { waitEvents(t, 1, c) item, _ = c.queue.Get() require.Equal(t, tc1Name, item) - require.NoError(t, c.syncTrafficControl(item.(string))) + require.NoError(t, c.syncTrafficControl(item)) c.queue.Done(item) // After syncing, verify the state of TrafficControl tc1. @@ -732,7 +732,7 @@ func TestPodUpdateFromCNIServer(t *testing.T) { waitEvents(t, 1, c) item, _ = c.queue.Get() require.Equal(t, tc1Name, item) - require.NoError(t, c.syncTrafficControl(item.(string))) + require.NoError(t, c.syncTrafficControl(item)) c.queue.Done(item) // After syncing, verify the state of TrafficControl tc1. @@ -760,7 +760,7 @@ func TestPodLabelsUpdate(t *testing.T) { name string updatedPod *v1.Pod eventsTriggeredByPodLabelsUpdate int - eventsTriggeredByPodLabelsUpdateOrder []interface{} + eventsTriggeredByPodLabelsUpdateOrder []string eventsTriggeredByPodEffectiveTCUpdate int expectedPodBinding *podToTCBinding expectedCalls func(mockOFClient *openflowtest.MockClient) @@ -797,7 +797,7 @@ func TestPodLabelsUpdate(t *testing.T) { name: "Update Pod labels to match TrafficControl tc2 (effective), tc3 (alternative)", updatedPod: newPod("ns1", "pod1", "fakeNode", labels23), eventsTriggeredByPodLabelsUpdate: 2, - eventsTriggeredByPodLabelsUpdateOrder: []interface{}{tc1Name, tc3Name}, + eventsTriggeredByPodLabelsUpdateOrder: []string{tc1Name, tc3Name}, eventsTriggeredByPodEffectiveTCUpdate: 1, expectedPodBinding: &podToTCBinding{effectiveTC: tc2Name, alternativeTCs: sets.New[string](tc3Name)}, expectedCalls: func(mockOFClient *openflowtest.MockClient) { @@ -879,7 +879,7 @@ func TestPodLabelsUpdate(t *testing.T) { // TrafficControl of the Pod), we need to rearrange the order of events. if len(tt.eventsTriggeredByPodLabelsUpdateOrder) != 0 { waitEvents(t, tt.eventsTriggeredByPodLabelsUpdate, c) - var events []interface{} + var events []string for i := 0; i < tt.eventsTriggeredByPodLabelsUpdate; i++ { item, _ := c.queue.Get() events = append(events, item) @@ -895,7 +895,7 @@ func TestPodLabelsUpdate(t *testing.T) { waitEvents(t, tt.eventsTriggeredByPodLabelsUpdate, c) for i := 0; i < tt.eventsTriggeredByPodLabelsUpdate; i++ { item, _ := c.queue.Get() - require.NoError(t, c.syncTrafficControl(item.(string))) + require.NoError(t, c.syncTrafficControl(item)) c.queue.Done(item) } @@ -904,7 +904,7 @@ func TestPodLabelsUpdate(t *testing.T) { waitEvents(t, tt.eventsTriggeredByPodEffectiveTCUpdate, c) for i := 0; i < tt.eventsTriggeredByPodEffectiveTCUpdate; i++ { item, _ := c.queue.Get() - require.NoError(t, c.syncTrafficControl(item.(string))) + require.NoError(t, c.syncTrafficControl(item)) c.queue.Done(item) } } @@ -936,7 +936,7 @@ func TestNamespaceLabelsUpdate(t *testing.T) { name string updatedNS *v1.Namespace eventsTriggeredByNSLabelsUpdate int - eventsTriggeredByNSLabelsUpdateOrder []interface{} + eventsTriggeredByNSLabelsUpdateOrder []string eventsTriggeredByPodEffectiveTCUpdate int expectedPodBinding *podToTCBinding expectedCalls func(mockOFClient *openflowtest.MockClient) @@ -972,7 +972,7 @@ func TestNamespaceLabelsUpdate(t *testing.T) { name: "Update Pod labels to match TrafficControl tc2 (effective), tc3 (alternative)", updatedNS: newNamespace("ns1", labels23), eventsTriggeredByNSLabelsUpdate: 2, - eventsTriggeredByNSLabelsUpdateOrder: []interface{}{tc1Name, tc3Name}, + eventsTriggeredByNSLabelsUpdateOrder: []string{tc1Name, tc3Name}, eventsTriggeredByPodEffectiveTCUpdate: 1, expectedPodBinding: &podToTCBinding{effectiveTC: tc2Name, alternativeTCs: sets.New[string](tc3Name)}, expectedCalls: func(mockOFClient *openflowtest.MockClient) { @@ -1055,7 +1055,7 @@ func TestNamespaceLabelsUpdate(t *testing.T) { // TrafficControl of the Pod in Namespace in ns1), we need to rearrange the order of events. if len(tt.eventsTriggeredByNSLabelsUpdateOrder) != 0 { waitEvents(t, tt.eventsTriggeredByNSLabelsUpdate, c) - var events []interface{} + var events []string for i := 0; i < tt.eventsTriggeredByNSLabelsUpdate; i++ { item, _ := c.queue.Get() events = append(events, item) @@ -1071,7 +1071,7 @@ func TestNamespaceLabelsUpdate(t *testing.T) { waitEvents(t, tt.eventsTriggeredByNSLabelsUpdate, c) for i := 0; i < tt.eventsTriggeredByNSLabelsUpdate; i++ { item, _ := c.queue.Get() - require.NoError(t, c.syncTrafficControl(item.(string))) + require.NoError(t, c.syncTrafficControl(item)) c.queue.Done(item) } @@ -1080,7 +1080,7 @@ func TestNamespaceLabelsUpdate(t *testing.T) { waitEvents(t, tt.eventsTriggeredByPodEffectiveTCUpdate, c) for i := 0; i < tt.eventsTriggeredByPodEffectiveTCUpdate; i++ { item, _ := c.queue.Get() - require.NoError(t, c.syncTrafficControl(item.(string))) + require.NoError(t, c.syncTrafficControl(item)) c.queue.Done(item) } } @@ -1168,7 +1168,7 @@ func TestPodDelete(t *testing.T) { waitEvents(t, 3, c) for i := 0; i < 3; i++ { item, _ := c.queue.Get() - require.NoError(t, c.syncTrafficControl(item.(string))) + require.NoError(t, c.syncTrafficControl(item)) c.queue.Done(item) } diff --git a/pkg/agent/externalnode/external_node_controller.go b/pkg/agent/externalnode/external_node_controller.go index e14c782e7aa..158ff925d47 100644 --- a/pkg/agent/externalnode/external_node_controller.go +++ b/pkg/agent/externalnode/external_node_controller.go @@ -79,7 +79,7 @@ type ExternalNodeController struct { externalNodeInformer cache.SharedIndexInformer externalNodeLister enlister.ExternalNodeLister externalNodeListerSynced cache.InformerSynced - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] ifaceStore interfacestore.InterfaceStore syncedExternalNode *v1alpha1.ExternalNode // externalEntityUpdateNotifier is used for notifying ExternalEntity updates to NetworkPolicyController. @@ -92,13 +92,18 @@ type ExternalNodeController struct { func NewExternalNodeController(ovsBridgeClient ovsconfig.OVSBridgeClient, ofClient openflow.Client, externalNodeInformer cache.SharedIndexInformer, ifaceStore interfacestore.InterfaceStore, externalEntityUpdateNotifier channel.Notifier, externalNodeNamespace string, policyBypassRules []agentConfig.PolicyBypassRule) (*ExternalNodeController, error) { c := &ExternalNodeController{ - ovsBridgeClient: ovsBridgeClient, - ovsctlClient: ovsctl.NewClient(ovsBridgeClient.GetBridgeName()), - ofClient: ofClient, - externalNodeInformer: externalNodeInformer, - externalNodeLister: enlister.NewExternalNodeLister(externalNodeInformer.GetIndexer()), - externalNodeListerSynced: externalNodeInformer.HasSynced, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "externalNode"), + ovsBridgeClient: ovsBridgeClient, + ovsctlClient: ovsctl.NewClient(ovsBridgeClient.GetBridgeName()), + ofClient: ofClient, + externalNodeInformer: externalNodeInformer, + externalNodeLister: enlister.NewExternalNodeLister(externalNodeInformer.GetIndexer()), + externalNodeListerSynced: externalNodeInformer.HasSynced, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "externalNode", + }, + ), ifaceStore: ifaceStore, externalEntityUpdateNotifier: externalEntityUpdateNotifier, policyBypassRules: policyBypassRules, @@ -218,17 +223,13 @@ func (c *ExternalNodeController) worker() { } func (c *ExternalNodeController) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) + defer c.queue.Done(key) - if key, ok := obj.(string); !ok { - c.queue.Forget(obj) - klog.Errorf("Expected string type in work queue but got %#v", obj) - return true - } else if err := c.syncExternalNode(key); err == nil { + if err := c.syncExternalNode(key); err == nil { // If no error occurs, then forget this item so it does not get queued again until // another change happens. c.queue.Forget(key) diff --git a/pkg/agent/externalnode/external_node_controller_test.go b/pkg/agent/externalnode/external_node_controller_test.go index 1bc84db4bc4..fb5bf32c480 100644 --- a/pkg/agent/externalnode/external_node_controller_test.go +++ b/pkg/agent/externalnode/external_node_controller_test.go @@ -28,7 +28,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/tools/cache" - "k8s.io/client-go/util/workqueue" "antrea.io/antrea/pkg/agent/interfacestore" interfacestoretest "antrea.io/antrea/pkg/agent/interfacestore/testing" @@ -419,7 +418,6 @@ func TestEnqueueExternalNodeUpdate(t *testing.T) { }, } { t.Run(tt.name, func(t *testing.T) { - c.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "externalNode") c.enqueueExternalNodeUpdate(tt.oldObj, tt.newObj) if tt.expectEnqueued { assert.Equal(t, 1, c.queue.Len()) diff --git a/pkg/agent/memberlist/cluster.go b/pkg/agent/memberlist/cluster.go index d5e3830774d..3887464884e 100644 --- a/pkg/agent/memberlist/cluster.go +++ b/pkg/agent/memberlist/cluster.go @@ -131,7 +131,7 @@ type Cluster struct { externalIPPoolInformerHasSynced cache.InformerSynced // queue maintains the ExternalIPPool names that need to be synced. - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] } // NewCluster returns a new *Cluster. @@ -157,7 +157,12 @@ func NewCluster( externalIPPoolInformer: externalIPPoolInformer.Informer(), externalIPPoolLister: externalIPPoolInformer.Lister(), externalIPPoolInformerHasSynced: externalIPPoolInformer.Informer().HasSynced, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "externalIPPool"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "externalIPPool", + }, + ), } if ml == nil { @@ -409,21 +414,13 @@ func (c *Cluster) worker() { } func (c *Cluster) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) - - // We expect strings (ExternalIPPool name) to come off the work queue. - if key, ok := obj.(string); !ok { - // As the item in the work queue is actually invalid, we call Forget here else we'd - // go into a loop of attempting to process a work item that is invalid. - // This should not happen. - c.queue.Forget(obj) - klog.Errorf("Expected string in work queue but got %#v", obj) - return true - } else if err := c.syncConsistentHash(key); err == nil { + defer c.queue.Done(key) + + if err := c.syncConsistentHash(key); err == nil { // If no error occurs we Forget this item so it does not get queued again until // another change happens. c.queue.Forget(key) diff --git a/pkg/agent/multicast/mcast_controller.go b/pkg/agent/multicast/mcast_controller.go index cfb9facf490..9d11ae6fe28 100644 --- a/pkg/agent/multicast/mcast_controller.go +++ b/pkg/agent/multicast/mcast_controller.go @@ -238,11 +238,11 @@ type Controller struct { igmpSnooper *IGMPSnooper groupEventCh chan *mcastGroupEvent groupCache cache.Indexer - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] nodeInformer coreinformers.NodeInformer nodeLister corelisters.NodeLister nodeListerSynced cache.InformerSynced - nodeUpdateQueue workqueue.RateLimitingInterface + nodeUpdateQueue workqueue.TypedRateLimitingInterface[string] // installedGroups saves the groups which are configured on OVS. // With encap mode, the entries in installedGroups include all multicast groups identified in the cluster. installedGroups sets.Set[string] @@ -304,15 +304,20 @@ func NewMulticastController(ofClient openflow.Client, groupCache: groupCache, installedGroups: sets.New[string](), installedLocalGroups: sets.New[string](), - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "multicastgroup"), - mRouteClient: multicastRouteClient, - queryInterval: igmpQueryInterval, - mcastGroupTimeout: igmpQueryInterval * 3, - queryGroupId: v4GroupAllocator.Allocate(), - encapEnabled: isEncap, - flexibleIPAMEnabled: enableFlexibleIPAM, - ipv4Enabled: ipv4Enabled, - ipv6Enabled: ipv6Enabled, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "multicastgroup", + }, + ), + mRouteClient: multicastRouteClient, + queryInterval: igmpQueryInterval, + mcastGroupTimeout: igmpQueryInterval * 3, + queryGroupId: v4GroupAllocator.Allocate(), + encapEnabled: isEncap, + flexibleIPAMEnabled: enableFlexibleIPAM, + ipv4Enabled: ipv4Enabled, + ipv6Enabled: ipv6Enabled, } if isEncap { c.nodeGroupID = v4GroupAllocator.Allocate() @@ -320,7 +325,12 @@ func NewMulticastController(ofClient openflow.Client, c.nodeInformer = nodeInformer c.nodeLister = c.nodeInformer.Lister() c.nodeListerSynced = c.nodeInformer.Informer().HasSynced - c.nodeUpdateQueue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "nodeUpdate") + c.nodeUpdateQueue = workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "nodeUpdate", + }, + ) c.nodeInformer.Informer().AddEventHandlerWithResyncPeriod( cache.ResourceEventHandlerFuncs{ AddFunc: func(cur interface{}) { @@ -414,21 +424,13 @@ func (c *Controller) getGroupMemberStatusesByPod(podInterface string) []*GroupMe } func (c *Controller) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) - - // We expect string (multicast group) to come off the workqueue. - if key, ok := obj.(string); !ok { - // As the item in the workqueue is actually invalid, we call Forget here else we'd - // go into a loop of attempting to process a work item that is invalid. - // This should not happen. - c.queue.Forget(obj) - klog.Errorf("Expected string in work queue but got %#v", obj) - return true - } else if err := c.syncGroup(key); err == nil { + defer c.queue.Done(key) + + if err := c.syncGroup(key); err == nil { // If no error occurs we Forget this item so it does not get queued again until // another change happens. c.queue.Forget(key) @@ -841,7 +843,7 @@ func (c *Controller) nodeWorker() { } func (c *Controller) processNextNodeItem() bool { - obj, quit := c.nodeUpdateQueue.Get() + key, quit := c.nodeUpdateQueue.Get() if quit { return false } @@ -849,17 +851,9 @@ func (c *Controller) processNextNodeItem() bool { // must remember to call Forget if we do not want this work item being re-queued. For // example, we do not call Forget if a transient error occurs, instead the item is put back // on the workqueue and attempted again after a back-off period. - defer c.nodeUpdateQueue.Done(obj) - - // We expect strings (Node name) to come off the workqueue. - if key, ok := obj.(string); !ok { - // As the item in the workqueue is actually invalid, we call Forget here else we'd - // go into a loop of attempting to process a work item that is invalid. - // This should not happen: only a constant string enqueues nodeUpdateQueue. - c.nodeUpdateQueue.Forget(obj) - klog.Errorf("Expected string in work queue but got %#v", obj) - return true - } else if err := c.syncNodes(); err == nil { + defer c.nodeUpdateQueue.Done(key) + + if err := c.syncNodes(); err == nil { // If no error occurs we Forget this item so it does not get queued again until // another change happens. c.nodeUpdateQueue.Forget(key) diff --git a/pkg/agent/multicast/mcast_controller_test.go b/pkg/agent/multicast/mcast_controller_test.go index 1a68bfdf7f2..4cbbb477222 100644 --- a/pkg/agent/multicast/mcast_controller_test.go +++ b/pkg/agent/multicast/mcast_controller_test.go @@ -39,7 +39,6 @@ import ( "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/tools/cache" - "k8s.io/client-go/util/workqueue" "antrea.io/antrea/pkg/agent/config" "antrea.io/antrea/pkg/agent/interfacestore" @@ -100,9 +99,7 @@ func TestAddGroupMemberStatus(t *testing.T) { mctrl.addGroupMemberStatus(event) groupCache := mctrl.groupCache compareGroupStatus(t, groupCache, event) - obj, _ := mctrl.queue.Get() - key, ok := obj.(string) - assert.True(t, ok) + key, _ := mctrl.queue.Get() assert.Equal(t, mgroup.String(), key) mockIfaceStore.EXPECT().GetInterfaceByName(if1.InterfaceName).Return(if1, true) mockOFClient.EXPECT().InstallMulticastGroup(gomock.Any(), gomock.Any(), gomock.Any()) @@ -110,7 +107,7 @@ func TestAddGroupMemberStatus(t *testing.T) { mockMulticastSocket.EXPECT().MulticastInterfaceJoinMgroup(mgroup.To4(), nodeIf1IP.To4(), if1.InterfaceName).Times(1) err = mctrl.syncGroup(key) assert.NoError(t, err) - mctrl.queue.Forget(obj) + mctrl.queue.Forget(key) } func TestUpdateGroupMemberStatus(t *testing.T) { @@ -180,10 +177,6 @@ func TestUpdateGroupMemberStatus(t *testing.T) { } func TestCheckNodeUpdate(t *testing.T) { - mockController := newMockMulticastController(t, false, false) - err := mockController.initialize() - require.NoError(t, err) - for _, tc := range []struct { name string oldNode *corev1.Node @@ -244,7 +237,11 @@ func TestCheckNodeUpdate(t *testing.T) { }, } { t.Run(tc.name, func(t *testing.T) { - mockController.nodeUpdateQueue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "nodeUpdate") + // This test assumes encap mode. + mockController := newMockMulticastController(t, true, false) + err := mockController.initialize() + require.NoError(t, err) + mockController.checkNodeUpdate(tc.oldNode, tc.curNode) if tc.nodeUpdated { assert.Equal(t, 1, mockController.nodeUpdateQueue.Len()) @@ -291,9 +288,7 @@ func TestCheckLastMember(t *testing.T) { mctrl.addOrUpdateGroupEvent(ev) } wg.Wait() - obj, _ := mctrl.queue.Get() - key, ok := obj.(string) - assert.True(t, ok) + key, _ := mctrl.queue.Get() assert.Equal(t, status.group.String(), key) err := mctrl.syncGroup(key) assert.NoError(t, err) @@ -304,7 +299,7 @@ func TestCheckLastMember(t *testing.T) { if _, ok, _ := mctrl.groupCache.GetByKey(key); ok { _ = mctrl.groupCache.Delete(status) } - mctrl.queue.Forget(obj) + mctrl.queue.Forget(key) } mockIfaceStore.EXPECT().GetInterfaceByName(if1.InterfaceName).Return(if1, true).Times(1) mockOFClient.EXPECT().InstallMulticastGroup(gomock.Any(), gomock.Any(), gomock.Any()).Times(1) @@ -1171,21 +1166,20 @@ func testRemoteReport(t *testing.T, mockController *Controller, groups []net.IP, processNextItem := func(stopStr string) { for { - obj, quit := mockController.queue.Get() + key, quit := mockController.queue.Get() if quit { return } - key := obj.(string) if key == stopStr { mockController.queue.Forget(key) - mockController.queue.Done(obj) + mockController.queue.Done(key) return } if err := mockController.syncGroup(key); err != nil { t.Errorf("Failed to process %s: %v", key, err) } mockController.queue.Forget(key) - mockController.queue.Done(obj) + mockController.queue.Done(key) } } diff --git a/pkg/agent/multicluster/mc_route_controller.go b/pkg/agent/multicluster/mc_route_controller.go index 78906b78642..cbeb0ef1630 100644 --- a/pkg/agent/multicluster/mc_route_controller.go +++ b/pkg/agent/multicluster/mc_route_controller.go @@ -79,7 +79,7 @@ type MCDefaultRouteController struct { ciImportInformer mcinformersv1alpha1.ClusterInfoImportInformer ciImportLister mclisters.ClusterInfoImportLister ciImportListerSynced cache.InformerSynced - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] // installedCIImports is for saving ClusterInfos which have been processed // in MCDefaultRouteController. Need to use mutex to protect 'installedCIImports' if // we change the number of 'defaultWorkers'. @@ -106,18 +106,23 @@ func NewMCDefaultRouteController( multiclusterConfig agent.MulticlusterConfig, ) *MCDefaultRouteController { controller := &MCDefaultRouteController{ - mcClient: mcClient, - ofClient: client, - routeClient: routeClient, - nodeConfig: nodeConfig, - networkConfig: networkConfig, - gwInformer: gwInformer, - gwLister: gwInformer.Lister(), - gwListerSynced: gwInformer.Informer().HasSynced, - ciImportInformer: ciImportInformer, - ciImportLister: ciImportInformer.Lister(), - ciImportListerSynced: ciImportInformer.Informer().HasSynced, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "gatewayroute"), + mcClient: mcClient, + ofClient: client, + routeClient: routeClient, + nodeConfig: nodeConfig, + networkConfig: networkConfig, + gwInformer: gwInformer, + gwLister: gwInformer.Lister(), + gwListerSynced: gwInformer.Informer().HasSynced, + ciImportInformer: ciImportInformer, + ciImportLister: ciImportInformer.Lister(), + ciImportListerSynced: ciImportInformer.Informer().HasSynced, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "gatewayroute", + }, + ), installedCIImports: make(map[string]*mcv1alpha1.ClusterInfoImport), installedWireGuardPeers: make(map[string]*mcv1alpha1.ClusterInfoImport), namespace: multiclusterConfig.Namespace, @@ -241,18 +246,11 @@ func (c *MCDefaultRouteController) worker() { } func (c *MCDefaultRouteController) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) - - key, ok := obj.(string) - if !ok { - c.queue.Forget(obj) - klog.InfoS("Expected string in work queue but got", "object", obj) - return true - } + defer c.queue.Done(key) syncFn := func() error { if c.wireGuardConfig != nil { diff --git a/pkg/agent/multicluster/mc_route_controller_test.go b/pkg/agent/multicluster/mc_route_controller_test.go index 45ab4692c0b..020862dbaf3 100644 --- a/pkg/agent/multicluster/mc_route_controller_test.go +++ b/pkg/agent/multicluster/mc_route_controller_test.go @@ -547,7 +547,12 @@ func TestEnqueueGateway(t *testing.T) { for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - c.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "gatewayroute") + c.queue = workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "gatewayroute", + }, + ) c.enqueueGateway(tt.obj, tt.isDeleted) assert.Equal(t, tt.expectNum, c.queue.Len()) }) @@ -619,7 +624,12 @@ func TestEnqueueClusterInfoImport(t *testing.T) { for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - c.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "gatewayroute") + c.queue = workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "gatewayroute", + }, + ) c.enqueueClusterInfoImport(tt.obj, tt.isDeleted) assert.Equal(t, tt.expectNum, c.queue.Len()) }) diff --git a/pkg/agent/multicluster/pod_route_controller.go b/pkg/agent/multicluster/pod_route_controller.go index 4dac12d9aa2..b418f93c1a1 100644 --- a/pkg/agent/multicluster/pod_route_controller.go +++ b/pkg/agent/multicluster/pod_route_controller.go @@ -57,8 +57,8 @@ type MCPodRouteController struct { k8sClient kubernetes.Interface ofClient openflow.Client nodeConfig *config.NodeConfig - podQueue workqueue.RateLimitingInterface - gwQueue workqueue.RateLimitingInterface + podQueue workqueue.TypedRateLimitingInterface[string] + gwQueue workqueue.TypedRateLimitingInterface[string] podInformer cache.SharedIndexInformer podLister corelisters.PodLister gwInformer cache.SharedIndexInformer @@ -76,11 +76,21 @@ func NewMCPodRouteController( nodeConfig *config.NodeConfig, ) *MCPodRouteController { controller := &MCPodRouteController{ - k8sClient: k8sClient, - ofClient: client, - nodeConfig: nodeConfig, - podQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "MCPodRouteControllerForPod"), - gwQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "MCPodRouteControllerForGateway"), + k8sClient: k8sClient, + ofClient: client, + nodeConfig: nodeConfig, + podQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "MCPodRouteControllerForPod", + }, + ), + gwQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "MCPodRouteControllerForGateway", + }, + ), gwInformer: gwInformer.Informer(), gwLister: gwInformer.Lister(), podWorkerStopCh: make(chan struct{}), @@ -249,11 +259,7 @@ func (c *MCPodRouteController) processGatewayNextWorkItem() bool { } defer c.gwQueue.Done(key) - if k, ok := key.(string); !ok { - c.gwQueue.Forget(k) - klog.InfoS("Expected string in work queue but got %#v", "object", k) - return true - } else if err := c.syncGateway(); err == nil { + if err := c.syncGateway(); err == nil { c.gwQueue.Forget(key) } else { c.gwQueue.AddRateLimited(key) @@ -324,21 +330,17 @@ func (c *MCPodRouteController) podWorker() { } func (c *MCPodRouteController) processPodNextWorkItem() bool { - obj, quit := c.podQueue.Get() + key, quit := c.podQueue.Get() if quit { return false } - defer c.podQueue.Done(obj) + defer c.podQueue.Done(key) - if k, ok := obj.(string); !ok { - c.podQueue.Forget(obj) - klog.InfoS("Expected string in work queue but got %#v", "object", obj) - return true - } else if err := c.syncPod(k); err == nil { - c.podQueue.Forget(k) + if err := c.syncPod(key); err == nil { + c.podQueue.Forget(key) } else { - c.podQueue.AddRateLimited(k) - klog.ErrorS(err, "Error syncing key, requeuing", "key", k) + c.podQueue.AddRateLimited(key) + klog.ErrorS(err, "Error syncing key, requeuing", "key", key) } return true } diff --git a/pkg/agent/multicluster/stretched_networkpolicy_controller.go b/pkg/agent/multicluster/stretched_networkpolicy_controller.go index 8b455d64389..ea553621cd4 100644 --- a/pkg/agent/multicluster/stretched_networkpolicy_controller.go +++ b/pkg/agent/multicluster/stretched_networkpolicy_controller.go @@ -67,7 +67,7 @@ type StretchedNetworkPolicyController struct { labelIdentityInformer mcinformers.LabelIdentityInformer labelIdentityLister mclisters.LabelIdentityLister LabelIdentityListerSynced cache.InformerSynced - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[types.NamespacedName] lock sync.RWMutex labelToPods map[string]podSet @@ -94,9 +94,14 @@ func NewMCAgentStretchedNetworkPolicyController( labelIdentityInformer: labelIdentityInformer, labelIdentityLister: labelIdentityInformer.Lister(), LabelIdentityListerSynced: labelIdentityInformer.Informer().HasSynced, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultItemBasedRateLimiter(), "stretchedNetworkPolicy"), - labelToPods: map[string]podSet{}, - podToLabel: map[types.NamespacedName]string{}, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.DefaultTypedItemBasedRateLimiter[types.NamespacedName](), + workqueue.TypedRateLimitingQueueConfig[types.NamespacedName]{ + Name: "stretchedNetworkPolicy", + }, + ), + labelToPods: map[string]podSet{}, + podToLabel: map[types.NamespacedName]string{}, } controller.podInformer.AddEventHandlerWithResyncPeriod( @@ -176,16 +181,13 @@ func (s *StretchedNetworkPolicyController) worker() { } func (s *StretchedNetworkPolicyController) processNextWorkItem() bool { - obj, quit := s.queue.Get() + podRef, quit := s.queue.Get() if quit { return false } - defer s.queue.Done(obj) + defer s.queue.Done(podRef) - if podRef, ok := obj.(types.NamespacedName); !ok { - s.queue.Forget(obj) - klog.ErrorS(nil, "Expected type 'NamespacedName' in work queue but got object", "object", obj) - } else if err := s.syncPodClassifierFlow(podRef); err == nil { + if err := s.syncPodClassifierFlow(podRef); err == nil { s.queue.Forget(podRef) } else { // Put the item back on the workqueue to handle any transient errors. diff --git a/pkg/agent/nodeportlocal/k8s/npl_controller.go b/pkg/agent/nodeportlocal/k8s/npl_controller.go index 60d24a64427..72d13f9a82b 100644 --- a/pkg/agent/nodeportlocal/k8s/npl_controller.go +++ b/pkg/agent/nodeportlocal/k8s/npl_controller.go @@ -53,7 +53,7 @@ const ( type NPLController struct { portTable *portcache.PortTable kubeClient clientset.Interface - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] podInformer cache.SharedIndexInformer podLister corelisters.PodLister svcInformer cache.SharedIndexInformer @@ -106,7 +106,12 @@ func NewNPLController(kubeClient clientset.Interface, }, ) - c.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "nodeportlocal") + c.queue = workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "nodeportlocal", + }, + ) return &c } @@ -357,17 +362,13 @@ func (c *NPLController) Worker() { } func (c *NPLController) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) + defer c.queue.Done(key) - if key, ok := obj.(string); !ok { - c.queue.Forget(obj) - klog.Errorf("Expected string in work queue but got %#v", obj) - return true - } else if err := c.syncPod(key); err == nil { + if err := c.syncPod(key); err == nil { klog.V(2).Infof("Successfully processed key: %s, in queue", key) c.queue.Forget(key) } else { diff --git a/pkg/agent/proxy/proxier_test.go b/pkg/agent/proxy/proxier_test.go index 48235254447..53f2e7a85b8 100644 --- a/pkg/agent/proxy/proxier_test.go +++ b/pkg/agent/proxy/proxier_test.go @@ -635,7 +635,7 @@ func testLoadBalancerAdd(t *testing.T, options = append(options, withoutProxyLoadBalancerIPs) } if dsrEnabled { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.LoadBalancerModeDSR, true)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.LoadBalancerModeDSR, true) options = append(options, withDSRMode) } if !endpointSliceEnabled { diff --git a/pkg/agent/secondarynetwork/podwatch/controller.go b/pkg/agent/secondarynetwork/podwatch/controller.go index 43409fb12f8..db9c576e614 100644 --- a/pkg/agent/secondarynetwork/podwatch/controller.go +++ b/pkg/agent/secondarynetwork/podwatch/controller.go @@ -85,7 +85,7 @@ type podCNIInfo struct { type PodController struct { kubeClient clientset.Interface netAttachDefClient netdefclient.K8sCniCncfIoV1Interface - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] podInformer cache.SharedIndexInformer podUpdateSubscriber channel.Subscriber ovsBridgeClient ovsconfig.OVSBridgeClient @@ -112,8 +112,12 @@ func NewPodController( pc := PodController{ kubeClient: kubeClient, netAttachDefClient: netAttachDefClient, - queue: workqueue.NewNamedRateLimitingQueue( - workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "podcontroller"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "podcontroller", + }, + ), podInformer: podInformer, podUpdateSubscriber: podUpdateSubscriber, ovsBridgeClient: ovsBridgeClient, @@ -303,14 +307,12 @@ func (pc *PodController) Worker() { } func (pc *PodController) processNextWorkItem() bool { - obj, quit := pc.queue.Get() + key, quit := pc.queue.Get() if quit { return false } - defer pc.queue.Done(obj) - if key, ok := obj.(string); !ok { - pc.queue.Forget(obj) - } else if err := pc.syncPod(key); err == nil { + defer pc.queue.Done(key) + if err := pc.syncPod(key); err == nil { pc.queue.Forget(key) } else { pc.queue.AddRateLimited(key) diff --git a/pkg/agent/secondarynetwork/podwatch/controller_test.go b/pkg/agent/secondarynetwork/podwatch/controller_test.go index ccce64c4cc7..b65bb02aff0 100644 --- a/pkg/agent/secondarynetwork/podwatch/controller_test.go +++ b/pkg/agent/secondarynetwork/podwatch/controller_test.go @@ -911,9 +911,12 @@ func testPodController(ctrl *gomock.Controller) ( return &PodController{ kubeClient: client, netAttachDefClient: netdefclient, - queue: workqueue.NewNamedRateLimitingQueue( - workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), - "podcontroller"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "podcontroller", + }, + ), podInformer: informerFactory.Core().V1().Pods().Informer(), interfaceConfigurator: interfaceConfigurator, ipamAllocator: mockIPAM, diff --git a/pkg/agent/servicecidr/discoverer.go b/pkg/agent/servicecidr/discoverer.go index 9dbe18afc81..bdc1ebd3942 100644 --- a/pkg/agent/servicecidr/discoverer.go +++ b/pkg/agent/servicecidr/discoverer.go @@ -55,7 +55,7 @@ type Discoverer struct { serviceIPv6CIDR *net.IPNet eventHandlers []EventHandler // queue maintains the Service objects that need to be synced. - queue workqueue.Interface + queue workqueue.TypedInterface[types.NamespacedName] // initialized indicates whether the Discoverer has been initialized. initialized bool } @@ -64,7 +64,7 @@ func NewServiceCIDRDiscoverer(serviceInformer coreinformers.ServiceInformer) *Di d := &Discoverer{ serviceInformer: serviceInformer.Informer(), serviceLister: serviceInformer.Lister(), - queue: workqueue.New(), + queue: workqueue.NewTyped[types.NamespacedName](), } d.serviceInformer.AddEventHandlerWithResyncPeriod( cache.ResourceEventHandlerFuncs{ @@ -89,18 +89,17 @@ func (d *Discoverer) Run(stopCh <-chan struct{}) { go func() { for { - obj, quit := d.queue.Get() + nn, quit := d.queue.Get() if quit { return } - nn := obj.(types.NamespacedName) svc, _ := d.serviceLister.Services(nn.Namespace).Get(nn.Name) // Ignore it if not found. if svc != nil { d.updateServiceCIDR(svc) } - d.queue.Done(obj) + d.queue.Done(nn) } }() <-stopCh diff --git a/pkg/agent/supportbundlecollection/support_bundle_controller.go b/pkg/agent/supportbundlecollection/support_bundle_controller.go index 1202448019e..4d037c820b2 100644 --- a/pkg/agent/supportbundlecollection/support_bundle_controller.go +++ b/pkg/agent/supportbundlecollection/support_bundle_controller.go @@ -70,7 +70,7 @@ type SupportBundleController struct { supportBundleNodeType controlplane.SupportBundleCollectionNodeType namespace string antreaClientGetter client.AntreaClientProvider - queue workqueue.Interface + queue workqueue.TypedInterface[string] supportBundleCollection *cpv1b2.SupportBundleCollection supportBundleCollectionMutex sync.RWMutex ovsCtlClient ovsctl.OVSCtlClient @@ -95,13 +95,15 @@ func NewSupportBundleController(nodeName string, supportBundleNodeType: supportBundleNodeType, namespace: namespace, antreaClientGetter: antreaClientGetter, - queue: workqueue.NewNamed("supportbundle"), - ovsCtlClient: ovsCtlClient, - aq: aq, - npq: npq, - v4Enabled: v4Enabled, - v6Enabled: v6Enabled, - sftpUploader: &sftpUploader{}, + queue: workqueue.NewTypedWithConfig(workqueue.TypedQueueConfig[string]{ + Name: "supportbundle", + }), + ovsCtlClient: ovsCtlClient, + aq: aq, + npq: npq, + v4Enabled: v4Enabled, + v6Enabled: v6Enabled, + sftpUploader: &sftpUploader{}, } return c } @@ -195,16 +197,13 @@ func (c *SupportBundleController) worker() { } func (c *SupportBundleController) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) + defer c.queue.Done(key) - if key, ok := obj.(string); !ok { - klog.Errorf("Expected string in work queue but got %#v", obj) - return true - } else if err := c.syncSupportBundleCollection(key); err == nil { + if err := c.syncSupportBundleCollection(key); err == nil { klog.InfoS("Successfully synced support bundle", "name", key) } else { // Skip retrying as the time may not meet the requirements for SupportBundle. diff --git a/pkg/apis/controlplane/v1beta2/generated.pb.go b/pkg/apis/controlplane/v1beta2/generated.pb.go index 30eacf2c8be..118fbfa3b43 100644 --- a/pkg/apis/controlplane/v1beta2/generated.pb.go +++ b/pkg/apis/controlplane/v1beta2/generated.pb.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: antrea.io/antrea/pkg/apis/controlplane/v1beta2/generated.proto diff --git a/pkg/apis/controlplane/v1beta2/generated.proto b/pkg/apis/controlplane/v1beta2/generated.proto index 8fa6194c1ac..3d72cc7a63d 100644 --- a/pkg/apis/controlplane/v1beta2/generated.proto +++ b/pkg/apis/controlplane/v1beta2/generated.proto @@ -29,21 +29,21 @@ option go_package = "antrea.io/antrea/pkg/apis/controlplane/v1beta2"; // AddressGroup is the message format of antrea/pkg/controller/types.AddressGroup in an API response. message AddressGroup { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; repeated GroupMember groupMembers = 2; } // AddressGroupList is a list of AddressGroup objects. message AddressGroupList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; repeated AddressGroup items = 2; } // AddressGroupPatch describes the incremental update of an AddressGroup. message AddressGroupPatch { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; repeated GroupMember addedGroupMembers = 2; @@ -52,7 +52,7 @@ message AddressGroupPatch { // AppliedToGroup is the message format of antrea/pkg/controller/types.AppliedToGroup in an API response. message AppliedToGroup { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // GroupMembers is list of resources selected by this group. repeated GroupMember groupMembers = 2; @@ -60,14 +60,14 @@ message AppliedToGroup { // AppliedToGroupList is a list of AppliedToGroup objects. message AppliedToGroupList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; repeated AppliedToGroup items = 2; } // AppliedToGroupPatch describes the incremental update of an AppliedToGroup. message AppliedToGroupPatch { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; repeated GroupMember addedGroupMembers = 2; @@ -94,7 +94,7 @@ message BundleServerAuthConfiguration { // ClusterGroupMembers is a list of GroupMember objects or IPBlocks that are currently selected by a ClusterGroup. message ClusterGroupMembers { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; repeated GroupMember effectiveMembers = 2; @@ -108,7 +108,7 @@ message ClusterGroupMembers { } message EgressGroup { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // GroupMembers is list of resources selected by this group. repeated GroupMember groupMembers = 2; @@ -116,14 +116,14 @@ message EgressGroup { // EgressGroupList is a list of EgressGroup objects. message EgressGroupList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; repeated EgressGroup items = 2; } // EgressGroupPatch describes the incremental update of an EgressGroup. message EgressGroupPatch { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta objectMeta = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta objectMeta = 1; repeated GroupMember addedGroupMembers = 2; @@ -146,7 +146,7 @@ message ExternalEntityReference { // GroupAssociation is the message format in an API response for groupassociation queries. message GroupAssociation { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // AssociatedGroups is a list of GroupReferences that is associated with the // Pod/ExternalEntity being queried. @@ -177,7 +177,7 @@ message GroupMember { // GroupMembers is a list of GroupMember objects or IPBlocks that are currently selected by a Group. message GroupMembers { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; repeated GroupMember effectiveMembers = 2; @@ -229,7 +229,7 @@ message IPBlock { } message IPGroupAssociation { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // AssociatedGroups is a list of GroupReferences that is associated with the // IP address being queried. @@ -273,7 +273,7 @@ message NamedPort { // NetworkPolicy is the message format of antrea/pkg/controller/types.NetworkPolicy in an API response. message NetworkPolicy { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Rules is a list of rules to be applied to the selected GroupMembers. repeated NetworkPolicyRule rules = 2; @@ -303,7 +303,7 @@ message NetworkPolicyEvaluation { // do for all other Antrea API types. It should only affect the wire format, and nothing else. // When a new version of this API is introduced in the future (e.g., v1), we can correct // this and assign 1 as the Protobuf field number for the metadata field. - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 3; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 3; optional NetworkPolicyEvaluationRequest request = 1; @@ -330,7 +330,7 @@ message NetworkPolicyEvaluationResponse { // NetworkPolicyList is a list of NetworkPolicy objects. message NetworkPolicyList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; repeated NetworkPolicy items = 2; } @@ -436,15 +436,15 @@ message NetworkPolicyStats { optional NetworkPolicyReference networkPolicy = 1; // The stats of the NetworkPolicy. - optional antrea_io.antrea.pkg.apis.stats.v1alpha1.TrafficStats trafficStats = 2; + optional .antrea_io.antrea.pkg.apis.stats.v1alpha1.TrafficStats trafficStats = 2; // The stats of the NetworkPolicy rules. It's empty for K8s NetworkPolicies as they don't have rule name to identify a rule. - repeated antrea_io.antrea.pkg.apis.stats.v1alpha1.RuleTrafficStats ruleTrafficStats = 3; + repeated .antrea_io.antrea.pkg.apis.stats.v1alpha1.RuleTrafficStats ruleTrafficStats = 3; } // NetworkPolicyStatus is the status of a NetworkPolicy. message NetworkPolicyStatus { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Nodes contains statuses produced on a list of Nodes. repeated NetworkPolicyNodeStatus nodes = 2; @@ -458,7 +458,7 @@ message NodeReference { // NodeStatsSummary contains stats produced on a Node. It's used by the antrea-agents to report stats to the antrea-controller. message NodeStatsSummary { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The TrafficStats of K8s NetworkPolicies collected from the Node. repeated NetworkPolicyStats networkPolicies = 2; @@ -508,7 +508,7 @@ message Service { // Port defines the port name or number on the given protocol. If not specified // and the Protocol is TCP, UDP, or SCTP, this matches all port numbers. // +optional - optional k8s.io.apimachinery.pkg.util.intstr.IntOrString port = 2; + optional .k8s.io.apimachinery.pkg.util.intstr.IntOrString port = 2; // EndPort defines the end of the port range, being the end included within the range. // It can only be specified when a numerical `port` is specified. @@ -547,9 +547,9 @@ message ServiceReference { // SupportBundleCollection is the message format of antrea/pkg/controller/types.SupportBundleCollection in an API response. message SupportBundleCollection { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - optional k8s.io.apimachinery.pkg.apis.meta.v1.Time expiredAt = 2; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time expiredAt = 2; optional string sinceTime = 3; @@ -560,7 +560,7 @@ message SupportBundleCollection { // SupportBundleCollectionList is a list of SupportBundleCollection objects. message SupportBundleCollectionList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; repeated SupportBundleCollection items = 2; } @@ -584,7 +584,7 @@ message SupportBundleCollectionNodeStatus { // SupportBundleCollectionStatus is the status of a SupportBundleCollection. message SupportBundleCollectionStatus { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Nodes contains statuses produced on a list of Nodes. repeated SupportBundleCollectionNodeStatus nodes = 2; diff --git a/pkg/apis/stats/v1alpha1/generated.pb.go b/pkg/apis/stats/v1alpha1/generated.pb.go index 0296fae153e..c6ead39df44 100644 --- a/pkg/apis/stats/v1alpha1/generated.pb.go +++ b/pkg/apis/stats/v1alpha1/generated.pb.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: antrea.io/antrea/pkg/apis/stats/v1alpha1/generated.proto diff --git a/pkg/apis/stats/v1alpha1/generated.proto b/pkg/apis/stats/v1alpha1/generated.proto index 6c6098a8569..0b2ec64db1e 100644 --- a/pkg/apis/stats/v1alpha1/generated.proto +++ b/pkg/apis/stats/v1alpha1/generated.proto @@ -27,7 +27,7 @@ option go_package = "antrea.io/antrea/pkg/apis/stats/v1alpha1"; // AntreaClusterNetworkPolicyStats is the statistics of a Antrea ClusterNetworkPolicy. message AntreaClusterNetworkPolicyStats { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The traffic stats of the Antrea ClusterNetworkPolicy. optional TrafficStats trafficStats = 2; @@ -38,7 +38,7 @@ message AntreaClusterNetworkPolicyStats { // AntreaClusterNetworkPolicyStatsList is a list of AntreaClusterNetworkPolicyStats. message AntreaClusterNetworkPolicyStatsList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // List of AntreaClusterNetworkPolicyStats. repeated AntreaClusterNetworkPolicyStats items = 2; @@ -46,7 +46,7 @@ message AntreaClusterNetworkPolicyStatsList { // AntreaNetworkPolicyStats is the statistics of a Antrea NetworkPolicy. message AntreaNetworkPolicyStats { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The traffic stats of the Antrea NetworkPolicy. optional TrafficStats trafficStats = 2; @@ -57,7 +57,7 @@ message AntreaNetworkPolicyStats { // AntreaNetworkPolicyStatsList is a list of AntreaNetworkPolicyStats. message AntreaNetworkPolicyStatsList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // List of AntreaNetworkPolicyStats. repeated AntreaNetworkPolicyStats items = 2; @@ -65,7 +65,7 @@ message AntreaNetworkPolicyStatsList { // MulticastGroup contains the mapping between multicast group and Pods. message MulticastGroup { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Group is the IP of the multicast group. optional string group = 2; @@ -76,7 +76,7 @@ message MulticastGroup { // MulticastGroupList is a list of MulticastGroup. message MulticastGroupList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // List of MulticastGroup. repeated MulticastGroup items = 2; @@ -84,7 +84,7 @@ message MulticastGroupList { // NetworkPolicyStats is the statistics of a K8s NetworkPolicy. message NetworkPolicyStats { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The traffic stats of the K8s NetworkPolicy. optional TrafficStats trafficStats = 2; @@ -92,7 +92,7 @@ message NetworkPolicyStats { // NetworkPolicyStatsList is a list of NetworkPolicyStats. message NetworkPolicyStatsList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // List of NetworkPolicyStats. repeated NetworkPolicyStats items = 2; @@ -100,7 +100,7 @@ message NetworkPolicyStatsList { // NodeLatencyStats contains all the latency measurements collected by the Agent from a specific Node. message NodeLatencyStats { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The list of PeerNodeLatencyStats. repeated PeerNodeLatencyStats peerNodeLatencyStats = 2; @@ -108,7 +108,7 @@ message NodeLatencyStats { // NodeLatencyStatsList is a list of NodeLatencyStats objects. message NodeLatencyStatsList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // The list of NodeLatencyStats. repeated NodeLatencyStats items = 2; @@ -145,10 +145,10 @@ message TargetIPLatencyStats { optional string targetIP = 1; // The timestamp of the last sent packet. - optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastSendTime = 2; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastSendTime = 2; // The timestamp of the last received packet. - optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastRecvTime = 3; + optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastRecvTime = 3; // The last measured RTT for this target IP, in nanoseconds. optional int64 lastMeasuredRTTNanoseconds = 4; diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index c6a28165c82..85f45fdf41c 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -143,7 +143,7 @@ func (s *APIServer) Run(ctx context.Context) error { } go s.caCertController.Run(ctx, 1) - return s.GenericAPIServer.PrepareRun().Run(ctx.Done()) + return s.GenericAPIServer.PrepareRun().RunWithContext(ctx) } type completedConfig struct { diff --git a/pkg/apiserver/certificate/cacert_controller.go b/pkg/apiserver/certificate/cacert_controller.go index 0e65f20543f..dc16ca004cc 100644 --- a/pkg/apiserver/certificate/cacert_controller.go +++ b/pkg/apiserver/certificate/cacert_controller.go @@ -43,7 +43,7 @@ type CACertController struct { // caContentProvider provides the very latest content of the ca bundle. caContentProvider dynamiccertificates.CAContentProvider // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] client kubernetes.Interface aggregatorClient clientset.Interface @@ -64,8 +64,13 @@ func newCACertController(caContentProvider dynamiccertificates.CAContentProvider caConfig *CAConfig, ) *CACertController { c := &CACertController{ - caContentProvider: caContentProvider, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "CACertController"), + caContentProvider: caContentProvider, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.DefaultTypedControllerRateLimiter[string](), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "CACertController", + }, + ), client: client, aggregatorClient: aggregatorClient, apiExtensionClient: apiExtensionClient, diff --git a/pkg/apiserver/certificate/selfsignedcert_provider.go b/pkg/apiserver/certificate/selfsignedcert_provider.go index 4a42e58a10c..2ec81f13f58 100644 --- a/pkg/apiserver/certificate/selfsignedcert_provider.go +++ b/pkg/apiserver/certificate/selfsignedcert_provider.go @@ -62,7 +62,7 @@ type selfSignedCertProvider struct { listeners []dynamiccertificates.Listener // queue only ever has one item, but it has nice error handling backoff/retry semantics - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] // mutex protects the fields following it. mutex sync.RWMutex @@ -100,10 +100,15 @@ func newSelfSignedCertProvider(client kubernetes.Interface, secureServing *optio secureServing.ServerCert.CertKey.KeyFile = filepath.Join(caConfig.SelfSignedCertDir, caConfig.PairName+".key") provider := &selfSignedCertProvider{ - client: client, - secureServing: secureServing, - caConfig: caConfig, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "selfSignedCertProvider"), + client: client, + secureServing: secureServing, + caConfig: caConfig, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.DefaultTypedControllerRateLimiter[string](), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "selfSignedCertProvider", + }, + ), clock: clockutils.RealClock{}, generateSelfSignedCertKey: certutil.GenerateSelfSignedCertKey, } diff --git a/pkg/apiserver/openapi/zz_generated.openapi.go b/pkg/apiserver/openapi/zz_generated.openapi.go index 0ecf3c1e20c..7f19435bda9 100644 --- a/pkg/apiserver/openapi/zz_generated.openapi.go +++ b/pkg/apiserver/openapi/zz_generated.openapi.go @@ -17,12 +17,11 @@ // Code generated by openapi-gen. DO NOT EDIT. -// This file was autogenerated by openapi-gen. Do not edit it manually! - package openapi import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" intstr "k8s.io/apimachinery/pkg/util/intstr" common "k8s.io/kube-openapi/pkg/common" spec "k8s.io/kube-openapi/pkg/validation/spec" @@ -173,6 +172,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "antrea.io/antrea/pkg/apis/system/v1beta1.SupportBundle": schema_pkg_apis_system_v1beta1_SupportBundle(ref), "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource": schema_k8sio_api_core_v1_AWSElasticBlockStoreVolumeSource(ref), "k8s.io/api/core/v1.Affinity": schema_k8sio_api_core_v1_Affinity(ref), + "k8s.io/api/core/v1.AppArmorProfile": schema_k8sio_api_core_v1_AppArmorProfile(ref), "k8s.io/api/core/v1.AttachedVolume": schema_k8sio_api_core_v1_AttachedVolume(ref), "k8s.io/api/core/v1.AvoidPods": schema_k8sio_api_core_v1_AvoidPods(ref), "k8s.io/api/core/v1.AzureDiskVolumeSource": schema_k8sio_api_core_v1_AzureDiskVolumeSource(ref), @@ -186,7 +186,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/api/core/v1.CephFSVolumeSource": schema_k8sio_api_core_v1_CephFSVolumeSource(ref), "k8s.io/api/core/v1.CinderPersistentVolumeSource": schema_k8sio_api_core_v1_CinderPersistentVolumeSource(ref), "k8s.io/api/core/v1.CinderVolumeSource": schema_k8sio_api_core_v1_CinderVolumeSource(ref), - "k8s.io/api/core/v1.ClaimSource": schema_k8sio_api_core_v1_ClaimSource(ref), "k8s.io/api/core/v1.ClientIPConfig": schema_k8sio_api_core_v1_ClientIPConfig(ref), "k8s.io/api/core/v1.ClusterTrustBundleProjection": schema_k8sio_api_core_v1_ClusterTrustBundleProjection(ref), "k8s.io/api/core/v1.ComponentCondition": schema_k8sio_api_core_v1_ComponentCondition(ref), @@ -208,6 +207,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/api/core/v1.ContainerStateTerminated": schema_k8sio_api_core_v1_ContainerStateTerminated(ref), "k8s.io/api/core/v1.ContainerStateWaiting": schema_k8sio_api_core_v1_ContainerStateWaiting(ref), "k8s.io/api/core/v1.ContainerStatus": schema_k8sio_api_core_v1_ContainerStatus(ref), + "k8s.io/api/core/v1.ContainerUser": schema_k8sio_api_core_v1_ContainerUser(ref), "k8s.io/api/core/v1.DaemonEndpoint": schema_k8sio_api_core_v1_DaemonEndpoint(ref), "k8s.io/api/core/v1.DownwardAPIProjection": schema_k8sio_api_core_v1_DownwardAPIProjection(ref), "k8s.io/api/core/v1.DownwardAPIVolumeFile": schema_k8sio_api_core_v1_DownwardAPIVolumeFile(ref), @@ -245,6 +245,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/api/core/v1.HostPathVolumeSource": schema_k8sio_api_core_v1_HostPathVolumeSource(ref), "k8s.io/api/core/v1.ISCSIPersistentVolumeSource": schema_k8sio_api_core_v1_ISCSIPersistentVolumeSource(ref), "k8s.io/api/core/v1.ISCSIVolumeSource": schema_k8sio_api_core_v1_ISCSIVolumeSource(ref), + "k8s.io/api/core/v1.ImageVolumeSource": schema_k8sio_api_core_v1_ImageVolumeSource(ref), "k8s.io/api/core/v1.KeyToPath": schema_k8sio_api_core_v1_KeyToPath(ref), "k8s.io/api/core/v1.Lifecycle": schema_k8sio_api_core_v1_Lifecycle(ref), "k8s.io/api/core/v1.LifecycleHandler": schema_k8sio_api_core_v1_LifecycleHandler(ref), @@ -252,6 +253,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/api/core/v1.LimitRangeItem": schema_k8sio_api_core_v1_LimitRangeItem(ref), "k8s.io/api/core/v1.LimitRangeList": schema_k8sio_api_core_v1_LimitRangeList(ref), "k8s.io/api/core/v1.LimitRangeSpec": schema_k8sio_api_core_v1_LimitRangeSpec(ref), + "k8s.io/api/core/v1.LinuxContainerUser": schema_k8sio_api_core_v1_LinuxContainerUser(ref), "k8s.io/api/core/v1.List": schema_k8sio_api_core_v1_List(ref), "k8s.io/api/core/v1.LoadBalancerIngress": schema_k8sio_api_core_v1_LoadBalancerIngress(ref), "k8s.io/api/core/v1.LoadBalancerStatus": schema_k8sio_api_core_v1_LoadBalancerStatus(ref), @@ -271,9 +273,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/api/core/v1.NodeConfigSource": schema_k8sio_api_core_v1_NodeConfigSource(ref), "k8s.io/api/core/v1.NodeConfigStatus": schema_k8sio_api_core_v1_NodeConfigStatus(ref), "k8s.io/api/core/v1.NodeDaemonEndpoints": schema_k8sio_api_core_v1_NodeDaemonEndpoints(ref), + "k8s.io/api/core/v1.NodeFeatures": schema_k8sio_api_core_v1_NodeFeatures(ref), "k8s.io/api/core/v1.NodeList": schema_k8sio_api_core_v1_NodeList(ref), "k8s.io/api/core/v1.NodeProxyOptions": schema_k8sio_api_core_v1_NodeProxyOptions(ref), - "k8s.io/api/core/v1.NodeResources": schema_k8sio_api_core_v1_NodeResources(ref), + "k8s.io/api/core/v1.NodeRuntimeHandler": schema_k8sio_api_core_v1_NodeRuntimeHandler(ref), + "k8s.io/api/core/v1.NodeRuntimeHandlerFeatures": schema_k8sio_api_core_v1_NodeRuntimeHandlerFeatures(ref), "k8s.io/api/core/v1.NodeSelector": schema_k8sio_api_core_v1_NodeSelector(ref), "k8s.io/api/core/v1.NodeSelectorRequirement": schema_k8sio_api_core_v1_NodeSelectorRequirement(ref), "k8s.io/api/core/v1.NodeSelectorTerm": schema_k8sio_api_core_v1_NodeSelectorTerm(ref), @@ -340,11 +344,13 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/api/core/v1.ReplicationControllerStatus": schema_k8sio_api_core_v1_ReplicationControllerStatus(ref), "k8s.io/api/core/v1.ResourceClaim": schema_k8sio_api_core_v1_ResourceClaim(ref), "k8s.io/api/core/v1.ResourceFieldSelector": schema_k8sio_api_core_v1_ResourceFieldSelector(ref), + "k8s.io/api/core/v1.ResourceHealth": schema_k8sio_api_core_v1_ResourceHealth(ref), "k8s.io/api/core/v1.ResourceQuota": schema_k8sio_api_core_v1_ResourceQuota(ref), "k8s.io/api/core/v1.ResourceQuotaList": schema_k8sio_api_core_v1_ResourceQuotaList(ref), "k8s.io/api/core/v1.ResourceQuotaSpec": schema_k8sio_api_core_v1_ResourceQuotaSpec(ref), "k8s.io/api/core/v1.ResourceQuotaStatus": schema_k8sio_api_core_v1_ResourceQuotaStatus(ref), "k8s.io/api/core/v1.ResourceRequirements": schema_k8sio_api_core_v1_ResourceRequirements(ref), + "k8s.io/api/core/v1.ResourceStatus": schema_k8sio_api_core_v1_ResourceStatus(ref), "k8s.io/api/core/v1.SELinuxOptions": schema_k8sio_api_core_v1_SELinuxOptions(ref), "k8s.io/api/core/v1.ScaleIOPersistentVolumeSource": schema_k8sio_api_core_v1_ScaleIOPersistentVolumeSource(ref), "k8s.io/api/core/v1.ScaleIOVolumeSource": schema_k8sio_api_core_v1_ScaleIOVolumeSource(ref), @@ -385,6 +391,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/api/core/v1.Volume": schema_k8sio_api_core_v1_Volume(ref), "k8s.io/api/core/v1.VolumeDevice": schema_k8sio_api_core_v1_VolumeDevice(ref), "k8s.io/api/core/v1.VolumeMount": schema_k8sio_api_core_v1_VolumeMount(ref), + "k8s.io/api/core/v1.VolumeMountStatus": schema_k8sio_api_core_v1_VolumeMountStatus(ref), "k8s.io/api/core/v1.VolumeNodeAffinity": schema_k8sio_api_core_v1_VolumeNodeAffinity(ref), "k8s.io/api/core/v1.VolumeProjection": schema_k8sio_api_core_v1_VolumeProjection(ref), "k8s.io/api/core/v1.VolumeResourceRequirements": schema_k8sio_api_core_v1_VolumeResourceRequirements(ref), @@ -402,6 +409,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldSelectorRequirement": schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref), "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref), "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), @@ -444,6 +452,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref), "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), "k8s.io/apimachinery/pkg/util/intstr.IntOrString": schema_apimachinery_pkg_util_intstr_IntOrString(ref), + "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), } } @@ -7082,6 +7091,48 @@ func schema_k8sio_api_core_v1_Affinity(ref common.ReferenceCallback) common.Open } } +func schema_k8sio_api_core_v1_AppArmorProfile(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AppArmorProfile defines a pod or container's AppArmor settings.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type indicates which kind of AppArmor profile will be applied. Valid options are:\n Localhost - a profile pre-loaded on the node.\n RuntimeDefault - the container runtime's default profile.\n Unconfined - no AppArmor enforcement.\n\nPossible enum values:\n - `\"Localhost\"` indicates that a profile pre-loaded on the node should be used.\n - `\"RuntimeDefault\"` indicates that the container runtime's default AppArmor profile should be used.\n - `\"Unconfined\"` indicates that no AppArmor profile should be enforced.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Localhost", "RuntimeDefault", "Unconfined"}, + }, + }, + "localhostProfile": { + SchemaProps: spec.SchemaProps{ + Description: "localhostProfile indicates a profile loaded on the node that should be used. The profile must be preconfigured on the node to work. Must match the loaded name of the profile. Must be set if and only if type is \"Localhost\".", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type"}, + }, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-unions": []interface{}{ + map[string]interface{}{ + "discriminator": "type", + "fields-to-discriminateBy": map[string]interface{}{ + "localhostProfile": "LocalhostProfile", + }, + }, + }, + }, + }, + }, + } +} + func schema_k8sio_api_core_v1_AttachedVolume(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -7120,6 +7171,11 @@ func schema_k8sio_api_core_v1_AvoidPods(ref common.ReferenceCallback) common.Ope Type: []string{"object"}, Properties: map[string]spec.Schema{ "preferAvoidPods": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Bounded-sized list of signatures of pods that should avoid this node, sorted in timestamp order from oldest to newest. Size of the slice is unspecified.", Type: []string{"array"}, @@ -7167,6 +7223,7 @@ func schema_k8sio_api_core_v1_AzureDiskVolumeSource(ref common.ReferenceCallback "cachingMode": { SchemaProps: spec.SchemaProps{ Description: "cachingMode is the Host Caching mode: None, Read Only, Read Write.\n\nPossible enum values:\n - `\"None\"`\n - `\"ReadOnly\"`\n - `\"ReadWrite\"`", + Default: v1.AzureDataDiskCachingReadWrite, Type: []string{"string"}, Format: "", Enum: []interface{}{"None", "ReadOnly", "ReadWrite"}, @@ -7175,6 +7232,7 @@ func schema_k8sio_api_core_v1_AzureDiskVolumeSource(ref common.ReferenceCallback "fsType": { SchemaProps: spec.SchemaProps{ Description: "fsType is Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + Default: "ext4", Type: []string{"string"}, Format: "", }, @@ -7182,6 +7240,7 @@ func schema_k8sio_api_core_v1_AzureDiskVolumeSource(ref common.ReferenceCallback "readOnly": { SchemaProps: spec.SchemaProps{ Description: "readOnly Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + Default: false, Type: []string{"boolean"}, Format: "", }, @@ -7189,6 +7248,7 @@ func schema_k8sio_api_core_v1_AzureDiskVolumeSource(ref common.ReferenceCallback "kind": { SchemaProps: spec.SchemaProps{ Description: "kind expected values are Shared: multiple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared\n\nPossible enum values:\n - `\"Dedicated\"`\n - `\"Managed\"`\n - `\"Shared\"`", + Default: v1.AzureSharedBlobDisk, Type: []string{"string"}, Format: "", Enum: []interface{}{"Dedicated", "Managed", "Shared"}, @@ -7486,6 +7546,11 @@ func schema_k8sio_api_core_v1_Capabilities(ref common.ReferenceCallback) common. Type: []string{"object"}, Properties: map[string]spec.Schema{ "add": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Added capabilities", Type: []string{"array"}, @@ -7501,6 +7566,11 @@ func schema_k8sio_api_core_v1_Capabilities(ref common.ReferenceCallback) common. }, }, "drop": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Removed capabilities", Type: []string{"array"}, @@ -7529,6 +7599,11 @@ func schema_k8sio_api_core_v1_CephFSPersistentVolumeSource(ref common.ReferenceC Type: []string{"object"}, Properties: map[string]spec.Schema{ "monitors": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "monitors is Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it", Type: []string{"array"}, @@ -7594,6 +7669,11 @@ func schema_k8sio_api_core_v1_CephFSVolumeSource(ref common.ReferenceCallback) c Type: []string{"object"}, Properties: map[string]spec.Schema{ "monitors": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "monitors is Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it", Type: []string{"array"}, @@ -7739,33 +7819,6 @@ func schema_k8sio_api_core_v1_CinderVolumeSource(ref common.ReferenceCallback) c } } -func schema_k8sio_api_core_v1_ClaimSource(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ClaimSource describes a reference to a ResourceClaim.\n\nExactly one of these fields should be set. Consumers of this type must treat an empty object as if it has an unknown value.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "resourceClaimName": { - SchemaProps: spec.SchemaProps{ - Description: "ResourceClaimName is the name of a ResourceClaim object in the same namespace as this pod.", - Type: []string{"string"}, - Format: "", - }, - }, - "resourceClaimTemplateName": { - SchemaProps: spec.SchemaProps{ - Description: "ResourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace as this pod.\n\nThe template will be used to create a new ResourceClaim, which will be bound to this pod. When this pod is deleted, the ResourceClaim will also be deleted. The pod name and resource name, along with a generated component, will be used to form a unique name for the ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses.\n\nThis field is immutable and no changes will be made to the corresponding ResourceClaim by the control plane after creating the ResourceClaim.", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - func schema_k8sio_api_core_v1_ClientIPConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -7912,6 +7965,10 @@ func schema_k8sio_api_core_v1_ComponentStatus(ref common.ReferenceCallback) comm "conditions": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "type", "x-kubernetes-patch-strategy": "merge", }, @@ -8071,7 +8128,8 @@ func schema_k8sio_api_core_v1_ConfigMapEnvSource(ref common.ReferenceCallback) c Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Description: "Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Default: "", Type: []string{"string"}, Format: "", }, @@ -8098,7 +8156,8 @@ func schema_k8sio_api_core_v1_ConfigMapKeySelector(ref common.ReferenceCallback) Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Description: "Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Default: "", Type: []string{"string"}, Format: "", }, @@ -8242,12 +8301,18 @@ func schema_k8sio_api_core_v1_ConfigMapProjection(ref common.ReferenceCallback) Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Description: "Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Default: "", Type: []string{"string"}, Format: "", }, }, "items": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "items if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", Type: []string{"array"}, @@ -8285,12 +8350,18 @@ func schema_k8sio_api_core_v1_ConfigMapVolumeSource(ref common.ReferenceCallback Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Description: "Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Default: "", Type: []string{"string"}, Format: "", }, }, "items": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "items if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", Type: []string{"array"}, @@ -8349,6 +8420,11 @@ func schema_k8sio_api_core_v1_Container(ref common.ReferenceCallback) common.Ope }, }, "command": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell", Type: []string{"array"}, @@ -8364,6 +8440,11 @@ func schema_k8sio_api_core_v1_Container(ref common.ReferenceCallback) common.Ope }, }, "args": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Arguments to the entrypoint. The container image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell", Type: []string{"array"}, @@ -8411,6 +8492,11 @@ func schema_k8sio_api_core_v1_Container(ref common.ReferenceCallback) common.Ope }, }, "envFrom": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.", Type: []string{"array"}, @@ -8427,6 +8513,10 @@ func schema_k8sio_api_core_v1_Container(ref common.ReferenceCallback) common.Ope "env": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "name", "x-kubernetes-patch-strategy": "merge", }, @@ -8480,6 +8570,10 @@ func schema_k8sio_api_core_v1_Container(ref common.ReferenceCallback) common.Ope "volumeMounts": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "mountPath", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "mountPath", "x-kubernetes-patch-strategy": "merge", }, @@ -8500,6 +8594,10 @@ func schema_k8sio_api_core_v1_Container(ref common.ReferenceCallback) common.Ope "volumeDevices": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "devicePath", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "devicePath", "x-kubernetes-patch-strategy": "merge", }, @@ -8608,6 +8706,11 @@ func schema_k8sio_api_core_v1_ContainerImage(ref common.ReferenceCallback) commo Type: []string{"object"}, Properties: map[string]spec.Schema{ "names": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Names by which this image is known. e.g. [\"kubernetes.example/hyperkube:v1.0.7\", \"cloud-vendor.registry.example/cloud-vendor/hyperkube:v1.0.7\"]", Type: []string{"array"}, @@ -8957,12 +9060,87 @@ func schema_k8sio_api_core_v1_ContainerStatus(ref common.ReferenceCallback) comm Ref: ref("k8s.io/api/core/v1.ResourceRequirements"), }, }, + "volumeMounts": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "mountPath", + }, + "x-kubernetes-list-type": "map", + "x-kubernetes-patch-merge-key": "mountPath", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Status of volume mounts.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.VolumeMountStatus"), + }, + }, + }, + }, + }, + "user": { + SchemaProps: spec.SchemaProps{ + Description: "User represents user identity information initially attached to the first process of the container", + Ref: ref("k8s.io/api/core/v1.ContainerUser"), + }, + }, + "allocatedResourcesStatus": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "AllocatedResourcesStatus represents the status of various resources allocated for this Pod.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.ResourceStatus"), + }, + }, + }, + }, + }, }, Required: []string{"name", "ready", "restartCount", "image", "imageID"}, }, }, Dependencies: []string{ - "k8s.io/api/core/v1.ContainerState", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + "k8s.io/api/core/v1.ContainerState", "k8s.io/api/core/v1.ContainerUser", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.ResourceStatus", "k8s.io/api/core/v1.VolumeMountStatus", "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + +func schema_k8sio_api_core_v1_ContainerUser(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ContainerUser represents user identity information", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "linux": { + SchemaProps: spec.SchemaProps{ + Description: "Linux holds user identity information initially attached to the first process of the containers in Linux. Note that the actual running identity can be changed if the process has enough privilege to do so.", + Ref: ref("k8s.io/api/core/v1.LinuxContainerUser"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LinuxContainerUser"}, } } @@ -8996,6 +9174,11 @@ func schema_k8sio_api_core_v1_DownwardAPIProjection(ref common.ReferenceCallback Type: []string{"object"}, Properties: map[string]spec.Schema{ "items": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Items is a list of DownwardAPIVolume file", Type: []string{"array"}, @@ -9034,7 +9217,7 @@ func schema_k8sio_api_core_v1_DownwardAPIVolumeFile(ref common.ReferenceCallback }, "fieldRef": { SchemaProps: spec.SchemaProps{ - Description: "Required: Selects a field of the pod: only annotations, labels, name and namespace are supported.", + Description: "Required: Selects a field of the pod: only annotations, labels, name, namespace and uid are supported.", Ref: ref("k8s.io/api/core/v1.ObjectFieldSelector"), }, }, @@ -9068,6 +9251,11 @@ func schema_k8sio_api_core_v1_DownwardAPIVolumeSource(ref common.ReferenceCallba Type: []string{"object"}, Properties: map[string]spec.Schema{ "items": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Items is a list of downward API volume file", Type: []string{"array"}, @@ -9230,6 +9418,11 @@ func schema_k8sio_api_core_v1_EndpointSubset(ref common.ReferenceCallback) commo Type: []string{"object"}, Properties: map[string]spec.Schema{ "addresses": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "IP addresses which offer the related ports that are marked as ready. These endpoints should be considered safe for load balancers and clients to utilize.", Type: []string{"array"}, @@ -9244,6 +9437,11 @@ func schema_k8sio_api_core_v1_EndpointSubset(ref common.ReferenceCallback) commo }, }, "notReadyAddresses": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "IP addresses which offer the related ports but are not currently marked as ready because they have not yet finished starting, have recently failed a readiness check, or have recently failed a liveness check.", Type: []string{"array"}, @@ -9258,6 +9456,11 @@ func schema_k8sio_api_core_v1_EndpointSubset(ref common.ReferenceCallback) commo }, }, "ports": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Port numbers available on the related IP addresses.", Type: []string{"array"}, @@ -9308,6 +9511,11 @@ func schema_k8sio_api_core_v1_Endpoints(ref common.ReferenceCallback) common.Ope }, }, "subsets": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "The set of all endpoints is the union of all subsets. Addresses are placed into subsets according to the IPs they share. A single address with multiple ports, some of which are ready and some of which are not (because they come from different containers) will result in the address being displayed in different subsets for the different ports. No address will appear in both Addresses and NotReadyAddresses in the same subset. Sets of addresses and ports that comprise a service.", Type: []string{"array"}, @@ -9513,6 +9721,11 @@ func schema_k8sio_api_core_v1_EphemeralContainer(ref common.ReferenceCallback) c }, }, "command": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Entrypoint array. Not executed within a shell. The image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell", Type: []string{"array"}, @@ -9528,6 +9741,11 @@ func schema_k8sio_api_core_v1_EphemeralContainer(ref common.ReferenceCallback) c }, }, "args": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Arguments to the entrypoint. The image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell", Type: []string{"array"}, @@ -9575,6 +9793,11 @@ func schema_k8sio_api_core_v1_EphemeralContainer(ref common.ReferenceCallback) c }, }, "envFrom": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.", Type: []string{"array"}, @@ -9591,6 +9814,10 @@ func schema_k8sio_api_core_v1_EphemeralContainer(ref common.ReferenceCallback) c "env": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "name", "x-kubernetes-patch-strategy": "merge", }, @@ -9644,6 +9871,10 @@ func schema_k8sio_api_core_v1_EphemeralContainer(ref common.ReferenceCallback) c "volumeMounts": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "mountPath", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "mountPath", "x-kubernetes-patch-strategy": "merge", }, @@ -9664,6 +9895,10 @@ func schema_k8sio_api_core_v1_EphemeralContainer(ref common.ReferenceCallback) c "volumeDevices": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "devicePath", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "devicePath", "x-kubernetes-patch-strategy": "merge", }, @@ -9794,6 +10029,11 @@ func schema_k8sio_api_core_v1_EphemeralContainerCommon(ref common.ReferenceCallb }, }, "command": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Entrypoint array. Not executed within a shell. The image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell", Type: []string{"array"}, @@ -9809,6 +10049,11 @@ func schema_k8sio_api_core_v1_EphemeralContainerCommon(ref common.ReferenceCallb }, }, "args": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Arguments to the entrypoint. The image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell", Type: []string{"array"}, @@ -9856,6 +10101,11 @@ func schema_k8sio_api_core_v1_EphemeralContainerCommon(ref common.ReferenceCallb }, }, "envFrom": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.", Type: []string{"array"}, @@ -9872,6 +10122,10 @@ func schema_k8sio_api_core_v1_EphemeralContainerCommon(ref common.ReferenceCallb "env": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "name", "x-kubernetes-patch-strategy": "merge", }, @@ -9925,6 +10179,10 @@ func schema_k8sio_api_core_v1_EphemeralContainerCommon(ref common.ReferenceCallb "volumeMounts": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "mountPath", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "mountPath", "x-kubernetes-patch-strategy": "merge", }, @@ -9945,6 +10203,10 @@ func schema_k8sio_api_core_v1_EphemeralContainerCommon(ref common.ReferenceCallb "volumeDevices": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "devicePath", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "devicePath", "x-kubernetes-patch-strategy": "merge", }, @@ -10312,6 +10574,11 @@ func schema_k8sio_api_core_v1_ExecAction(ref common.ReferenceCallback) common.Op Type: []string{"object"}, Properties: map[string]spec.Schema{ "command": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.", Type: []string{"array"}, @@ -10340,6 +10607,11 @@ func schema_k8sio_api_core_v1_FCVolumeSource(ref common.ReferenceCallback) commo Type: []string{"object"}, Properties: map[string]spec.Schema{ "targetWWNs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "targetWWNs is Optional: FC target worldwide names (WWNs)", Type: []string{"array"}, @@ -10376,6 +10648,11 @@ func schema_k8sio_api_core_v1_FCVolumeSource(ref common.ReferenceCallback) commo }, }, "wwids": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "wwids Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.", Type: []string{"array"}, @@ -10768,6 +11045,11 @@ func schema_k8sio_api_core_v1_HTTPGetAction(ref common.ReferenceCallback) common }, }, "httpHeaders": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Custom headers to set in the request. HTTP allows repeated headers.", Type: []string{"array"}, @@ -10830,11 +11112,17 @@ func schema_k8sio_api_core_v1_HostAlias(ref common.ReferenceCallback) common.Ope "ip": { SchemaProps: spec.SchemaProps{ Description: "IP address of the host file entry.", + Default: "", Type: []string{"string"}, Format: "", }, }, "hostnames": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Hostnames for the above IP address.", Type: []string{"array"}, @@ -10850,6 +11138,7 @@ func schema_k8sio_api_core_v1_HostAlias(ref common.ReferenceCallback) common.Ope }, }, }, + Required: []string{"ip"}, }, }, } @@ -10865,11 +11154,13 @@ func schema_k8sio_api_core_v1_HostIP(ref common.ReferenceCallback) common.OpenAP "ip": { SchemaProps: spec.SchemaProps{ Description: "IP is the IP address assigned to the host", + Default: "", Type: []string{"string"}, Format: "", }, }, }, + Required: []string{"ip"}, }, }, } @@ -10939,6 +11230,7 @@ func schema_k8sio_api_core_v1_ISCSIPersistentVolumeSource(ref common.ReferenceCa "iscsiInterface": { SchemaProps: spec.SchemaProps{ Description: "iscsiInterface is the interface Name that uses an iSCSI transport. Defaults to 'default' (tcp).", + Default: "default", Type: []string{"string"}, Format: "", }, @@ -10958,6 +11250,11 @@ func schema_k8sio_api_core_v1_ISCSIPersistentVolumeSource(ref common.ReferenceCa }, }, "portals": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "portals is the iSCSI Target Portal List. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).", Type: []string{"array"}, @@ -11042,6 +11339,7 @@ func schema_k8sio_api_core_v1_ISCSIVolumeSource(ref common.ReferenceCallback) co "iscsiInterface": { SchemaProps: spec.SchemaProps{ Description: "iscsiInterface is the interface Name that uses an iSCSI transport. Defaults to 'default' (tcp).", + Default: "default", Type: []string{"string"}, Format: "", }, @@ -11061,6 +11359,11 @@ func schema_k8sio_api_core_v1_ISCSIVolumeSource(ref common.ReferenceCallback) co }, }, "portals": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).", Type: []string{"array"}, @@ -11111,6 +11414,34 @@ func schema_k8sio_api_core_v1_ISCSIVolumeSource(ref common.ReferenceCallback) co } } +func schema_k8sio_api_core_v1_ImageVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ImageVolumeSource represents a image volume resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "reference": { + SchemaProps: spec.SchemaProps{ + Description: "Required: Image or artifact reference to be used. Behaves in the same way as pod.spec.containers[*].image. Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.", + Type: []string{"string"}, + Format: "", + }, + }, + "pullPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Policy for pulling OCI objects. Possible values are: Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.\n\nPossible enum values:\n - `\"Always\"` means that kubelet always attempts to pull the latest image. Container will fail If the pull fails.\n - `\"IfNotPresent\"` means that kubelet pulls if the image isn't present on disk. Container will fail if the image isn't present and the pull fails.\n - `\"Never\"` means that kubelet never pulls an image, but only uses a local image. Container will fail if the image isn't present", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Always", "IfNotPresent", "Never"}, + }, + }, + }, + }, + }, + } +} + func schema_k8sio_api_core_v1_KeyToPath(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -11410,6 +11741,11 @@ func schema_k8sio_api_core_v1_LimitRangeSpec(ref common.ReferenceCallback) commo Type: []string{"object"}, Properties: map[string]spec.Schema{ "limits": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Limits is the list of LimitRangeItem objects that are enforced.", Type: []string{"array"}, @@ -11432,6 +11768,56 @@ func schema_k8sio_api_core_v1_LimitRangeSpec(ref common.ReferenceCallback) commo } } +func schema_k8sio_api_core_v1_LinuxContainerUser(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LinuxContainerUser represents user identity information in Linux containers", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID is the primary uid initially attached to the first process in the container", + Default: 0, + Type: []string{"integer"}, + Format: "int64", + }, + }, + "gid": { + SchemaProps: spec.SchemaProps{ + Description: "GID is the primary gid initially attached to the first process in the container", + Default: 0, + Type: []string{"integer"}, + Format: "int64", + }, + }, + "supplementalGroups": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "SupplementalGroups are the supplemental groups initially attached to the first process in the container", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: 0, + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + }, + }, + }, + Required: []string{"uid", "gid"}, + }, + }, + } +} + func schema_k8sio_api_core_v1_List(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -11545,6 +11931,11 @@ func schema_k8sio_api_core_v1_LoadBalancerStatus(ref common.ReferenceCallback) c Type: []string{"object"}, Properties: map[string]spec.Schema{ "ingress": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Ingress is a list containing ingress points for the load-balancer. Traffic intended for the service should be sent to these ingress points.", Type: []string{"array"}, @@ -11575,7 +11966,8 @@ func schema_k8sio_api_core_v1_LocalObjectReference(ref common.ReferenceCallback) Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Description: "Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Default: "", Type: []string{"string"}, Format: "", }, @@ -11845,6 +12237,11 @@ func schema_k8sio_api_core_v1_NamespaceSpec(ref common.ReferenceCallback) common Type: []string{"object"}, Properties: map[string]spec.Schema{ "finalizers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Finalizers is an opaque list of values that must be empty to permanently remove object from storage. More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", Type: []string{"array"}, @@ -11883,6 +12280,10 @@ func schema_k8sio_api_core_v1_NamespaceStatus(ref common.ReferenceCallback) comm "conditions": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "type", "x-kubernetes-patch-strategy": "merge", }, @@ -12002,6 +12403,11 @@ func schema_k8sio_api_core_v1_NodeAffinity(ref common.ReferenceCallback) common. }, }, "preferredDuringSchedulingIgnoredDuringExecution": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.", Type: []string{"array"}, @@ -12164,6 +12570,26 @@ func schema_k8sio_api_core_v1_NodeDaemonEndpoints(ref common.ReferenceCallback) } } +func schema_k8sio_api_core_v1_NodeFeatures(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeFeatures describes the set of features implemented by the CRI implementation. The features contained in the NodeFeatures should depend only on the cri implementation independent of runtime handlers.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "supplementalGroupsPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "SupplementalGroupsPolicy is set to true if the runtime supports SupplementalGroupsPolicy and ContainerUser.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_k8sio_api_core_v1_NodeList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -12249,33 +12675,59 @@ func schema_k8sio_api_core_v1_NodeProxyOptions(ref common.ReferenceCallback) com } } -func schema_k8sio_api_core_v1_NodeResources(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_k8sio_api_core_v1_NodeRuntimeHandler(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "NodeResources is an object for conveying resource information about a node. see https://kubernetes.io/docs/concepts/architecture/nodes/#capacity for more details.", + Description: "NodeRuntimeHandler is a set of runtime handler information.", Type: []string{"object"}, Properties: map[string]spec.Schema{ - "Capacity": { + "name": { SchemaProps: spec.SchemaProps{ - Description: "Capacity represents the available resources of a node", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), - }, - }, - }, + Description: "Runtime handler name. Empty for the default runtime handler.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "features": { + SchemaProps: spec.SchemaProps{ + Description: "Supported features.", + Ref: ref("k8s.io/api/core/v1.NodeRuntimeHandlerFeatures"), }, }, }, - Required: []string{"Capacity"}, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + "k8s.io/api/core/v1.NodeRuntimeHandlerFeatures"}, + } +} + +func schema_k8sio_api_core_v1_NodeRuntimeHandlerFeatures(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeRuntimeHandlerFeatures is a set of features implemented by the runtime handler.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "recursiveReadOnlyMounts": { + SchemaProps: spec.SchemaProps{ + Description: "RecursiveReadOnlyMounts is set to true if the runtime handler supports RecursiveReadOnlyMounts.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "userNamespaces": { + SchemaProps: spec.SchemaProps{ + Description: "UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, } } @@ -12287,6 +12739,11 @@ func schema_k8sio_api_core_v1_NodeSelector(ref common.ReferenceCallback) common. Type: []string{"object"}, Properties: map[string]spec.Schema{ "nodeSelectorTerms": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Required. A list of node selector terms. The terms are ORed.", Type: []string{"array"}, @@ -12339,6 +12796,11 @@ func schema_k8sio_api_core_v1_NodeSelectorRequirement(ref common.ReferenceCallba }, }, "values": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.", Type: []string{"array"}, @@ -12368,6 +12830,11 @@ func schema_k8sio_api_core_v1_NodeSelectorTerm(ref common.ReferenceCallback) com Type: []string{"object"}, Properties: map[string]spec.Schema{ "matchExpressions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "A list of node selector requirements by node's labels.", Type: []string{"array"}, @@ -12382,6 +12849,11 @@ func schema_k8sio_api_core_v1_NodeSelectorTerm(ref common.ReferenceCallback) com }, }, "matchFields": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "A list of node selector requirements by node's fields.", Type: []string{"array"}, @@ -12425,6 +12897,7 @@ func schema_k8sio_api_core_v1_NodeSpec(ref common.ReferenceCallback) common.Open "podCIDRs": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-type": "set", "x-kubernetes-patch-strategy": "merge", }, }, @@ -12457,6 +12930,11 @@ func schema_k8sio_api_core_v1_NodeSpec(ref common.ReferenceCallback) common.Open }, }, "taints": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "If specified, the node's taints.", Type: []string{"array"}, @@ -12500,7 +12978,7 @@ func schema_k8sio_api_core_v1_NodeStatus(ref common.ReferenceCallback) common.Op Properties: map[string]spec.Schema{ "capacity": { SchemaProps: spec.SchemaProps{ - Description: "Capacity represents the total resources of a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity", + Description: "Capacity represents the total resources of a node. More info: https://kubernetes.io/docs/reference/node/node-status/#capacity", Type: []string{"object"}, AdditionalProperties: &spec.SchemaOrBool{ Allows: true, @@ -12537,6 +13015,10 @@ func schema_k8sio_api_core_v1_NodeStatus(ref common.ReferenceCallback) common.Op "conditions": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "type", "x-kubernetes-patch-strategy": "merge", }, @@ -12557,6 +13039,10 @@ func schema_k8sio_api_core_v1_NodeStatus(ref common.ReferenceCallback) common.Op "addresses": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "type", "x-kubernetes-patch-strategy": "merge", }, @@ -12589,6 +13075,11 @@ func schema_k8sio_api_core_v1_NodeStatus(ref common.ReferenceCallback) common.Op }, }, "images": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "List of container images on this node", Type: []string{"array"}, @@ -12603,6 +13094,11 @@ func schema_k8sio_api_core_v1_NodeStatus(ref common.ReferenceCallback) common.Op }, }, "volumesInUse": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "List of attachable volumes in use (mounted) by the node.", Type: []string{"array"}, @@ -12618,9 +13114,14 @@ func schema_k8sio_api_core_v1_NodeStatus(ref common.ReferenceCallback) common.Op }, }, "volumesAttached": { - SchemaProps: spec.SchemaProps{ - Description: "List of volumes that are attached to the node.", - Type: []string{"array"}, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of volumes that are attached to the node.", + Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -12637,11 +13138,36 @@ func schema_k8sio_api_core_v1_NodeStatus(ref common.ReferenceCallback) common.Op Ref: ref("k8s.io/api/core/v1.NodeConfigStatus"), }, }, + "runtimeHandlers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "The available runtime handlers.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.NodeRuntimeHandler"), + }, + }, + }, + }, + }, + "features": { + SchemaProps: spec.SchemaProps{ + Description: "Features describes the set of features implemented by the CRI implementation.", + Ref: ref("k8s.io/api/core/v1.NodeFeatures"), + }, + }, }, }, }, Dependencies: []string{ - "k8s.io/api/core/v1.AttachedVolume", "k8s.io/api/core/v1.ContainerImage", "k8s.io/api/core/v1.NodeAddress", "k8s.io/api/core/v1.NodeCondition", "k8s.io/api/core/v1.NodeConfigStatus", "k8s.io/api/core/v1.NodeDaemonEndpoints", "k8s.io/api/core/v1.NodeSystemInfo", "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + "k8s.io/api/core/v1.AttachedVolume", "k8s.io/api/core/v1.ContainerImage", "k8s.io/api/core/v1.NodeAddress", "k8s.io/api/core/v1.NodeCondition", "k8s.io/api/core/v1.NodeConfigStatus", "k8s.io/api/core/v1.NodeDaemonEndpoints", "k8s.io/api/core/v1.NodeFeatures", "k8s.io/api/core/v1.NodeRuntimeHandler", "k8s.io/api/core/v1.NodeSystemInfo", "k8s.io/apimachinery/pkg/api/resource.Quantity"}, } } @@ -12710,7 +13236,7 @@ func schema_k8sio_api_core_v1_NodeSystemInfo(ref common.ReferenceCallback) commo }, "kubeProxyVersion": { SchemaProps: spec.SchemaProps{ - Description: "KubeProxy Version reported by the node.", + Description: "Deprecated: KubeProxy Version reported by the node.", Default: "", Type: []string{"string"}, Format: "", @@ -12975,7 +13501,7 @@ func schema_k8sio_api_core_v1_PersistentVolumeClaimCondition(ref common.Referenc }, "reason": { SchemaProps: spec.SchemaProps{ - Description: "reason is a unique, this should be a short, machine understandable string that gives the reason for condition's last transition. If it reports \"ResizeStarted\" that means the underlying persistent volume is being resized.", + Description: "reason is a unique, this should be a short, machine understandable string that gives the reason for condition's last transition. If it reports \"Resizing\" that means the underlying persistent volume is being resized.", Type: []string{"string"}, Format: "", }, @@ -13055,6 +13581,11 @@ func schema_k8sio_api_core_v1_PersistentVolumeClaimSpec(ref common.ReferenceCall Type: []string{"object"}, Properties: map[string]spec.Schema{ "accessModes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "accessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1", Type: []string{"array"}, @@ -13064,6 +13595,7 @@ func schema_k8sio_api_core_v1_PersistentVolumeClaimSpec(ref common.ReferenceCall Default: "", Type: []string{"string"}, Format: "", + Enum: []interface{}{"ReadOnlyMany", "ReadWriteMany", "ReadWriteOnce", "ReadWriteOncePod"}, }, }, }, @@ -13118,7 +13650,7 @@ func schema_k8sio_api_core_v1_PersistentVolumeClaimSpec(ref common.ReferenceCall }, "volumeAttributesClassName": { SchemaProps: spec.SchemaProps{ - Description: "volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. If specified, the CSI driver will create or update the volume with the attributes defined in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, it can be changed after the claim is created. An empty string value means that no VolumeAttributesClass will be applied to the claim but it's not allowed to reset this field to empty string once it is set. If unspecified and the PersistentVolumeClaim is unbound, the default VolumeAttributesClass will be set by the persistentvolume controller if it exists. If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass (Alpha) Using this field requires the VolumeAttributesClass feature gate to be enabled.", + Description: "volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. If specified, the CSI driver will create or update the volume with the attributes defined in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, it can be changed after the claim is created. An empty string value means that no VolumeAttributesClass will be applied to the claim but it's not allowed to reset this field to empty string once it is set. If unspecified and the PersistentVolumeClaim is unbound, the default VolumeAttributesClass will be set by the persistentvolume controller if it exists. If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ (Beta) Using this field requires the VolumeAttributesClass feature gate to be enabled (off by default).", Type: []string{"string"}, Format: "", }, @@ -13147,6 +13679,11 @@ func schema_k8sio_api_core_v1_PersistentVolumeClaimStatus(ref common.ReferenceCa }, }, "accessModes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "accessModes contains the actual access modes the volume backing the PVC has. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1", Type: []string{"array"}, @@ -13156,6 +13693,7 @@ func schema_k8sio_api_core_v1_PersistentVolumeClaimStatus(ref common.ReferenceCa Default: "", Type: []string{"string"}, Format: "", + Enum: []interface{}{"ReadOnlyMany", "ReadWriteMany", "ReadWriteOnce", "ReadWriteOncePod"}, }, }, }, @@ -13178,12 +13716,16 @@ func schema_k8sio_api_core_v1_PersistentVolumeClaimStatus(ref common.ReferenceCa "conditions": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "type", "x-kubernetes-patch-strategy": "merge", }, }, SchemaProps: spec.SchemaProps{ - Description: "conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'.", + Description: "conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'Resizing'.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -13225,6 +13767,7 @@ func schema_k8sio_api_core_v1_PersistentVolumeClaimStatus(ref common.ReferenceCa Default: "", Type: []string{"string"}, Format: "", + Enum: []interface{}{"ControllerResizeInProgress", "ControllerResizeInfeasible", "NodeResizeInProgress", "NodeResizeInfeasible", "NodeResizePending"}, }, }, }, @@ -13232,14 +13775,14 @@ func schema_k8sio_api_core_v1_PersistentVolumeClaimStatus(ref common.ReferenceCa }, "currentVolumeAttributesClassName": { SchemaProps: spec.SchemaProps{ - Description: "currentVolumeAttributesClassName is the current name of the VolumeAttributesClass the PVC is using. When unset, there is no VolumeAttributeClass applied to this PersistentVolumeClaim This is an alpha field and requires enabling VolumeAttributesClass feature.", + Description: "currentVolumeAttributesClassName is the current name of the VolumeAttributesClass the PVC is using. When unset, there is no VolumeAttributeClass applied to this PersistentVolumeClaim This is a beta field and requires enabling VolumeAttributesClass feature (off by default).", Type: []string{"string"}, Format: "", }, }, "modifyVolumeStatus": { SchemaProps: spec.SchemaProps{ - Description: "ModifyVolumeStatus represents the status object of ControllerModifyVolume operation. When this is unset, there is no ModifyVolume operation being attempted. This is an alpha field and requires enabling VolumeAttributesClass feature.", + Description: "ModifyVolumeStatus represents the status object of ControllerModifyVolume operation. When this is unset, there is no ModifyVolume operation being attempted. This is a beta field and requires enabling VolumeAttributesClass feature (off by default).", Ref: ref("k8s.io/api/core/v1.ModifyVolumeStatus"), }, }, @@ -13662,6 +14205,11 @@ func schema_k8sio_api_core_v1_PersistentVolumeSpec(ref common.ReferenceCallback) }, }, "accessModes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "accessModes contains all ways the volume can be mounted. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes", Type: []string{"array"}, @@ -13671,6 +14219,7 @@ func schema_k8sio_api_core_v1_PersistentVolumeSpec(ref common.ReferenceCallback) Default: "", Type: []string{"string"}, Format: "", + Enum: []interface{}{"ReadOnlyMany", "ReadWriteMany", "ReadWriteOnce", "ReadWriteOncePod"}, }, }, }, @@ -13703,6 +14252,11 @@ func schema_k8sio_api_core_v1_PersistentVolumeSpec(ref common.ReferenceCallback) }, }, "mountOptions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "mountOptions is the list of mount options, e.g. [\"ro\", \"soft\"]. Not validated - mount will simply fail if one is invalid. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options", Type: []string{"array"}, @@ -13733,7 +14287,7 @@ func schema_k8sio_api_core_v1_PersistentVolumeSpec(ref common.ReferenceCallback) }, "volumeAttributesClassName": { SchemaProps: spec.SchemaProps{ - Description: "Name of VolumeAttributesClass to which this persistent volume belongs. Empty value is not allowed. When this field is not set, it indicates that this volume does not belong to any VolumeAttributesClass. This field is mutable and can be changed by the CSI driver after a volume has been updated successfully to a new class. For an unbound PersistentVolume, the volumeAttributesClassName will be matched with unbound PersistentVolumeClaims during the binding process. This is an alpha field and requires enabling VolumeAttributesClass feature.", + Description: "Name of VolumeAttributesClass to which this persistent volume belongs. Empty value is not allowed. When this field is not set, it indicates that this volume does not belong to any VolumeAttributesClass. This field is mutable and can be changed by the CSI driver after a volume has been updated successfully to a new class. For an unbound PersistentVolume, the volumeAttributesClassName will be matched with unbound PersistentVolumeClaims during the binding process. This is a beta field and requires enabling VolumeAttributesClass feature (off by default).", Type: []string{"string"}, Format: "", }, @@ -13777,7 +14331,7 @@ func schema_k8sio_api_core_v1_PersistentVolumeStatus(ref common.ReferenceCallbac }, "lastPhaseTransitionTime": { SchemaProps: spec.SchemaProps{ - Description: "lastPhaseTransitionTime is the time the phase transitioned from one to another and automatically resets to current time everytime a volume phase transitions. This is a beta field and requires the PersistentVolumeLastPhaseTransitionTime feature to be enabled (enabled by default).", + Description: "lastPhaseTransitionTime is the time the phase transitioned from one to another and automatically resets to current time everytime a volume phase transitions.", Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), }, }, @@ -13876,6 +14430,11 @@ func schema_k8sio_api_core_v1_PodAffinity(ref common.ReferenceCallback) common.O Type: []string{"object"}, Properties: map[string]spec.Schema{ "requiredDuringSchedulingIgnoredDuringExecution": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", Type: []string{"array"}, @@ -13890,6 +14449,11 @@ func schema_k8sio_api_core_v1_PodAffinity(ref common.ReferenceCallback) common.O }, }, "preferredDuringSchedulingIgnoredDuringExecution": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", Type: []string{"array"}, @@ -13925,6 +14489,11 @@ func schema_k8sio_api_core_v1_PodAffinityTerm(ref common.ReferenceCallback) comm }, }, "namespaces": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "namespaces specifies a static list of namespace names that the term applies to. The term is applied to the union of the namespaces listed in this field and the ones selected by namespaceSelector. null or empty namespaces list and null namespaceSelector means \"this pod's namespace\".", Type: []string{"array"}, @@ -13960,7 +14529,7 @@ func schema_k8sio_api_core_v1_PodAffinityTerm(ref common.ReferenceCallback) comm }, }, SchemaProps: spec.SchemaProps{ - Description: "MatchLabelKeys is a set of pod label keys to select which pods will be taken into consideration. The keys are used to lookup values from the incoming pod labels, those key-value labels are merged with `LabelSelector` as `key in (value)` to select the group of existing pods which pods will be taken into consideration for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. Also, MatchLabelKeys cannot be set when LabelSelector isn't set. This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.", + Description: "MatchLabelKeys is a set of pod label keys to select which pods will be taken into consideration. The keys are used to lookup values from the incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` to select the group of existing pods which pods will be taken into consideration for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -13980,7 +14549,7 @@ func schema_k8sio_api_core_v1_PodAffinityTerm(ref common.ReferenceCallback) comm }, }, SchemaProps: spec.SchemaProps{ - Description: "MismatchLabelKeys is a set of pod label keys to select which pods will be taken into consideration. The keys are used to lookup values from the incoming pod labels, those key-value labels are merged with `LabelSelector` as `key notin (value)` to select the group of existing pods which pods will be taken into consideration for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both MismatchLabelKeys and LabelSelector. Also, MismatchLabelKeys cannot be set when LabelSelector isn't set. This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.", + Description: "MismatchLabelKeys is a set of pod label keys to select which pods will be taken into consideration. The keys are used to lookup values from the incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` to select the group of existing pods which pods will be taken into consideration for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -14010,6 +14579,11 @@ func schema_k8sio_api_core_v1_PodAntiAffinity(ref common.ReferenceCallback) comm Type: []string{"object"}, Properties: map[string]spec.Schema{ "requiredDuringSchedulingIgnoredDuringExecution": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", Type: []string{"array"}, @@ -14024,6 +14598,11 @@ func schema_k8sio_api_core_v1_PodAntiAffinity(ref common.ReferenceCallback) comm }, }, "preferredDuringSchedulingIgnoredDuringExecution": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", Type: []string{"array"}, @@ -14173,6 +14752,11 @@ func schema_k8sio_api_core_v1_PodDNSConfig(ref common.ReferenceCallback) common. Type: []string{"object"}, Properties: map[string]spec.Schema{ "nameservers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "A list of DNS name server IP addresses. This will be appended to the base nameservers generated from DNSPolicy. Duplicated nameservers will be removed.", Type: []string{"array"}, @@ -14188,6 +14772,11 @@ func schema_k8sio_api_core_v1_PodDNSConfig(ref common.ReferenceCallback) common. }, }, "searches": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "A list of DNS search domains for host-name lookup. This will be appended to the base search paths generated from DNSPolicy. Duplicated search paths will be removed.", Type: []string{"array"}, @@ -14203,6 +14792,11 @@ func schema_k8sio_api_core_v1_PodDNSConfig(ref common.ReferenceCallback) common. }, }, "options": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "A list of DNS resolver options. This will be merged with the base options generated from DNSPolicy. Duplicated entries will be removed. Resolution options given in Options will override those that appear in the base DNSPolicy.", Type: []string{"array"}, @@ -14307,6 +14901,11 @@ func schema_k8sio_api_core_v1_PodExecOptions(ref common.ReferenceCallback) commo }, }, "command": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Command is the remote command to execute. argv array. Not executed within a shell.", Type: []string{"array"}, @@ -14338,11 +14937,13 @@ func schema_k8sio_api_core_v1_PodIP(ref common.ReferenceCallback) common.OpenAPI "ip": { SchemaProps: spec.SchemaProps{ Description: "IP is the IP address assigned to the pod", + Default: "", Type: []string{"string"}, Format: "", }, }, }, + Required: []string{"ip"}, }, }, } @@ -14534,6 +15135,11 @@ func schema_k8sio_api_core_v1_PodPortForwardOptions(ref common.ReferenceCallback }, }, "ports": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "List of ports to forward Required when using WebSockets", Type: []string{"array"}, @@ -14614,7 +15220,7 @@ func schema_k8sio_api_core_v1_PodResourceClaim(ref common.ReferenceCallback) com return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "PodResourceClaim references exactly one ResourceClaim through a ClaimSource. It adds a name to it that uniquely identifies the ResourceClaim inside the Pod. Containers that need access to the ResourceClaim reference it with this name.", + Description: "PodResourceClaim references exactly one ResourceClaim, either directly or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim for the pod.\n\nIt adds a name to it that uniquely identifies the ResourceClaim inside the Pod. Containers that need access to the ResourceClaim reference it with this name.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "name": { @@ -14625,19 +15231,24 @@ func schema_k8sio_api_core_v1_PodResourceClaim(ref common.ReferenceCallback) com Format: "", }, }, - "source": { + "resourceClaimName": { SchemaProps: spec.SchemaProps{ - Description: "Source describes where to find the ResourceClaim.", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/api/core/v1.ClaimSource"), + Description: "ResourceClaimName is the name of a ResourceClaim object in the same namespace as this pod.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceClaimTemplateName": { + SchemaProps: spec.SchemaProps{ + Description: "ResourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace as this pod.\n\nThe template will be used to create a new ResourceClaim, which will be bound to this pod. When this pod is deleted, the ResourceClaim will also be deleted. The pod name and resource name, along with a generated component, will be used to form a unique name for the ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses.\n\nThis field is immutable and no changes will be made to the corresponding ResourceClaim by the control plane after creating the ResourceClaim.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", + Type: []string{"string"}, + Format: "", }, }, }, Required: []string{"name"}, }, }, - Dependencies: []string{ - "k8s.io/api/core/v1.ClaimSource"}, } } @@ -14658,7 +15269,7 @@ func schema_k8sio_api_core_v1_PodResourceClaimStatus(ref common.ReferenceCallbac }, "resourceClaimName": { SchemaProps: spec.SchemaProps{ - Description: "ResourceClaimName is the name of the ResourceClaim that was generated for the Pod in the namespace of the Pod. It this is unset, then generating a ResourceClaim was not necessary. The pod.spec.resourceClaims entry can be ignored in this case.", + Description: "ResourceClaimName is the name of the ResourceClaim that was generated for the Pod in the namespace of the Pod. If this is unset, then generating a ResourceClaim was not necessary. The pod.spec.resourceClaims entry can be ignored in this case.", Type: []string{"string"}, Format: "", }, @@ -14733,8 +15344,13 @@ func schema_k8sio_api_core_v1_PodSecurityContext(ref common.ReferenceCallback) c }, }, "supplementalGroups": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ - Description: "A list of groups applied to the first process run in each container, in addition to the container's primary GID, the fsGroup (if specified), and group memberships defined in the container image for the uid of the container process. If unspecified, no additional groups are added to any container. Note that group memberships defined in the container image for the uid of the container process are still effective, even if they are not included in this list. Note that this field cannot be set when spec.os.name is windows.", + Description: "A list of groups applied to the first process run in each container, in addition to the container's primary GID and fsGroup (if specified). If the SupplementalGroupsPolicy feature is enabled, the supplementalGroupsPolicy field determines whether these are in addition to or instead of any group memberships defined in the container image. If unspecified, no additional groups are added, though group memberships defined in the container image may still be used, depending on the supplementalGroupsPolicy field. Note that this field cannot be set when spec.os.name is windows.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -14747,6 +15363,14 @@ func schema_k8sio_api_core_v1_PodSecurityContext(ref common.ReferenceCallback) c }, }, }, + "supplementalGroupsPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Defines how supplemental groups of the first container processes are calculated. Valid values are \"Merge\" and \"Strict\". If not specified, \"Merge\" is used. (Alpha) Using the field requires the SupplementalGroupsPolicy feature gate to be enabled and the container runtime must implement support for this feature. Note that this field cannot be set when spec.os.name is windows.\n\nPossible enum values:\n - `\"Merge\"` means that the container's provided SupplementalGroups and FsGroup (specified in SecurityContext) will be merged with the primary user's groups as defined in the container image (in /etc/group).\n - `\"Strict\"` means that the container's provided SupplementalGroups and FsGroup (specified in SecurityContext) will be used instead of any groups defined in the container image.", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"Merge", "Strict"}, + }, + }, "fsGroup": { SchemaProps: spec.SchemaProps{ Description: "A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:\n\n1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw----\n\nIf unset, the Kubelet will not modify the ownership and permissions of any volume. Note that this field cannot be set when spec.os.name is windows.", @@ -14755,6 +15379,11 @@ func schema_k8sio_api_core_v1_PodSecurityContext(ref common.ReferenceCallback) c }, }, "sysctls": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported sysctls (by the container runtime) might fail to launch. Note that this field cannot be set when spec.os.name is windows.", Type: []string{"array"}, @@ -14782,11 +15411,17 @@ func schema_k8sio_api_core_v1_PodSecurityContext(ref common.ReferenceCallback) c Ref: ref("k8s.io/api/core/v1.SeccompProfile"), }, }, + "appArmorProfile": { + SchemaProps: spec.SchemaProps{ + Description: "appArmorProfile is the AppArmor options to use by the containers in this pod. Note that this field cannot be set when spec.os.name is windows.", + Ref: ref("k8s.io/api/core/v1.AppArmorProfile"), + }, + }, }, }, }, Dependencies: []string{ - "k8s.io/api/core/v1.SELinuxOptions", "k8s.io/api/core/v1.SeccompProfile", "k8s.io/api/core/v1.Sysctl", "k8s.io/api/core/v1.WindowsSecurityContextOptions"}, + "k8s.io/api/core/v1.AppArmorProfile", "k8s.io/api/core/v1.SELinuxOptions", "k8s.io/api/core/v1.SeccompProfile", "k8s.io/api/core/v1.Sysctl", "k8s.io/api/core/v1.WindowsSecurityContextOptions"}, } } @@ -14821,6 +15456,10 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA "volumes": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "name", "x-kubernetes-patch-strategy": "merge,retainKeys", }, @@ -14841,6 +15480,10 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA "initContainers": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "name", "x-kubernetes-patch-strategy": "merge", }, @@ -14861,6 +15504,10 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA "containers": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "name", "x-kubernetes-patch-strategy": "merge", }, @@ -14881,6 +15528,10 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA "ephemeralContainers": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "name", "x-kubernetes-patch-strategy": "merge", }, @@ -14958,7 +15609,7 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA }, "serviceAccount": { SchemaProps: spec.SchemaProps{ - Description: "DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead.", + Description: "DeprecatedServiceAccount is a deprecated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead.", Type: []string{"string"}, Format: "", }, @@ -14972,7 +15623,7 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA }, "nodeName": { SchemaProps: spec.SchemaProps{ - Description: "NodeName is a request to schedule this pod onto a specific node. If it is non-empty, the scheduler simply schedules this pod onto that node, assuming that it fits resource requirements.", + Description: "NodeName indicates in which node this pod is scheduled. If empty, this pod is a candidate for scheduling by the scheduler defined in schedulerName. Once this field is set, the kubelet for this node becomes responsible for the lifecycle of this pod. This field should not be used to express a desire for the pod to be scheduled on a specific node. https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodename", Type: []string{"string"}, Format: "", }, @@ -15014,6 +15665,10 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA "imagePullSecrets": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "name", "x-kubernetes-patch-strategy": "merge", }, @@ -15059,6 +15714,11 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA }, }, "tolerations": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "If specified, the pod's tolerations.", Type: []string{"array"}, @@ -15075,12 +15735,16 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA "hostAliases": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "ip", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "ip", "x-kubernetes-patch-strategy": "merge", }, }, SchemaProps: spec.SchemaProps{ - Description: "HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. This is only valid for non-hostNetwork pods.", + Description: "HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -15113,6 +15777,11 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA }, }, "readinessGates": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "If specified, all readiness gates will be evaluated for pod readiness. A pod is ready when all its containers are ready AND all conditions specified in the readiness gates have status equal to \"True\" More info: https://git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates", Type: []string{"array"}, @@ -15196,7 +15865,7 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA }, "os": { SchemaProps: spec.SchemaProps{ - Description: "Specifies the OS of the containers in the pod. Some pod and container fields are restricted if this is set.\n\nIf the OS field is set to linux, the following fields must be unset: -securityContext.windowsOptions\n\nIf the OS field is set to windows, following fields must be unset: - spec.hostPID - spec.hostIPC - spec.hostUsers - spec.securityContext.seLinuxOptions - spec.securityContext.seccompProfile - spec.securityContext.fsGroup - spec.securityContext.fsGroupChangePolicy - spec.securityContext.sysctls - spec.shareProcessNamespace - spec.securityContext.runAsUser - spec.securityContext.runAsGroup - spec.securityContext.supplementalGroups - spec.containers[*].securityContext.seLinuxOptions - spec.containers[*].securityContext.seccompProfile - spec.containers[*].securityContext.capabilities - spec.containers[*].securityContext.readOnlyRootFilesystem - spec.containers[*].securityContext.privileged - spec.containers[*].securityContext.allowPrivilegeEscalation - spec.containers[*].securityContext.procMount - spec.containers[*].securityContext.runAsUser - spec.containers[*].securityContext.runAsGroup", + Description: "Specifies the OS of the containers in the pod. Some pod and container fields are restricted if this is set.\n\nIf the OS field is set to linux, the following fields must be unset: -securityContext.windowsOptions\n\nIf the OS field is set to windows, following fields must be unset: - spec.hostPID - spec.hostIPC - spec.hostUsers - spec.securityContext.appArmorProfile - spec.securityContext.seLinuxOptions - spec.securityContext.seccompProfile - spec.securityContext.fsGroup - spec.securityContext.fsGroupChangePolicy - spec.securityContext.sysctls - spec.shareProcessNamespace - spec.securityContext.runAsUser - spec.securityContext.runAsGroup - spec.securityContext.supplementalGroups - spec.securityContext.supplementalGroupsPolicy - spec.containers[*].securityContext.appArmorProfile - spec.containers[*].securityContext.seLinuxOptions - spec.containers[*].securityContext.seccompProfile - spec.containers[*].securityContext.capabilities - spec.containers[*].securityContext.readOnlyRootFilesystem - spec.containers[*].securityContext.privileged - spec.containers[*].securityContext.allowPrivilegeEscalation - spec.containers[*].securityContext.procMount - spec.containers[*].securityContext.runAsUser - spec.containers[*].securityContext.runAsGroup", Ref: ref("k8s.io/api/core/v1.PodOS"), }, }, @@ -15219,7 +15888,7 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA }, }, SchemaProps: spec.SchemaProps{ - Description: "SchedulingGates is an opaque list of values that if specified will block scheduling the pod. If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the scheduler will not attempt to schedule the pod.\n\nSchedulingGates can only be set at pod creation time, and be removed only afterwards.\n\nThis is a beta feature enabled by the PodSchedulingReadiness feature gate.", + Description: "SchedulingGates is an opaque list of values that if specified will block scheduling the pod. If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the scheduler will not attempt to schedule the pod.\n\nSchedulingGates can only be set at pod creation time, and be removed only afterwards.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -15282,6 +15951,10 @@ func schema_k8sio_api_core_v1_PodStatus(ref common.ReferenceCallback) common.Ope "conditions": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "type", "x-kubernetes-patch-strategy": "merge", }, @@ -15358,6 +16031,10 @@ func schema_k8sio_api_core_v1_PodStatus(ref common.ReferenceCallback) common.Ope "podIPs": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "ip", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "ip", "x-kubernetes-patch-strategy": "merge", }, @@ -15382,6 +16059,11 @@ func schema_k8sio_api_core_v1_PodStatus(ref common.ReferenceCallback) common.Ope }, }, "initContainerStatuses": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "The list has one entry per init container in the manifest. The most recent successful init container will have ready = true, the most recently started container will have startTime set. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status", Type: []string{"array"}, @@ -15396,6 +16078,11 @@ func schema_k8sio_api_core_v1_PodStatus(ref common.ReferenceCallback) common.Ope }, }, "containerStatuses": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "The list has one entry per container in the manifest. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status", Type: []string{"array"}, @@ -15418,6 +16105,11 @@ func schema_k8sio_api_core_v1_PodStatus(ref common.ReferenceCallback) common.Ope }, }, "ephemeralContainerStatuses": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Status for any ephemeral containers that have run in this pod.", Type: []string{"array"}, @@ -15911,8 +16603,13 @@ func schema_k8sio_api_core_v1_ProjectedVolumeSource(ref common.ReferenceCallback Type: []string{"object"}, Properties: map[string]spec.Schema{ "sources": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ - Description: "sources is the list of volume projections", + Description: "sources is the list of volume projections. Each entry in this list handles one source.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -16005,6 +16702,11 @@ func schema_k8sio_api_core_v1_RBDPersistentVolumeSource(ref common.ReferenceCall Type: []string{"object"}, Properties: map[string]spec.Schema{ "monitors": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "monitors is a collection of Ceph monitors. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it", Type: []string{"array"}, @@ -16037,6 +16739,7 @@ func schema_k8sio_api_core_v1_RBDPersistentVolumeSource(ref common.ReferenceCall "pool": { SchemaProps: spec.SchemaProps{ Description: "pool is the rados pool name. Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it", + Default: "rbd", Type: []string{"string"}, Format: "", }, @@ -16044,6 +16747,7 @@ func schema_k8sio_api_core_v1_RBDPersistentVolumeSource(ref common.ReferenceCall "user": { SchemaProps: spec.SchemaProps{ Description: "user is the rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it", + Default: "admin", Type: []string{"string"}, Format: "", }, @@ -16051,6 +16755,7 @@ func schema_k8sio_api_core_v1_RBDPersistentVolumeSource(ref common.ReferenceCall "keyring": { SchemaProps: spec.SchemaProps{ Description: "keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it", + Default: "/etc/ceph/keyring", Type: []string{"string"}, Format: "", }, @@ -16085,6 +16790,11 @@ func schema_k8sio_api_core_v1_RBDVolumeSource(ref common.ReferenceCallback) comm Type: []string{"object"}, Properties: map[string]spec.Schema{ "monitors": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "monitors is a collection of Ceph monitors. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it", Type: []string{"array"}, @@ -16117,6 +16827,7 @@ func schema_k8sio_api_core_v1_RBDVolumeSource(ref common.ReferenceCallback) comm "pool": { SchemaProps: spec.SchemaProps{ Description: "pool is the rados pool name. Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it", + Default: "rbd", Type: []string{"string"}, Format: "", }, @@ -16124,6 +16835,7 @@ func schema_k8sio_api_core_v1_RBDVolumeSource(ref common.ReferenceCallback) comm "user": { SchemaProps: spec.SchemaProps{ Description: "user is the rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it", + Default: "admin", Type: []string{"string"}, Format: "", }, @@ -16131,6 +16843,7 @@ func schema_k8sio_api_core_v1_RBDVolumeSource(ref common.ReferenceCallback) comm "keyring": { SchemaProps: spec.SchemaProps{ Description: "keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it", + Default: "/etc/ceph/keyring", Type: []string{"string"}, Format: "", }, @@ -16464,6 +17177,10 @@ func schema_k8sio_api_core_v1_ReplicationControllerStatus(ref common.ReferenceCa "conditions": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "type", "x-kubernetes-patch-strategy": "merge", }, @@ -16505,6 +17222,13 @@ func schema_k8sio_api_core_v1_ResourceClaim(ref common.ReferenceCallback) common Format: "", }, }, + "request": { + SchemaProps: spec.SchemaProps{ + Description: "Request is the name chosen for a request in the referenced claim. If empty, everything from the claim is made available, otherwise only the result of this request.", + Type: []string{"string"}, + Format: "", + }, + }, }, Required: []string{"name"}, }, @@ -16554,6 +17278,35 @@ func schema_k8sio_api_core_v1_ResourceFieldSelector(ref common.ReferenceCallback } } +func schema_k8sio_api_core_v1_ResourceHealth(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceHealth represents the health of a resource. It has the latest device health information. This is a part of KEP https://kep.k8s.io/4680 and historical health changes are planned to be added in future iterations of a KEP.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "resourceID": { + SchemaProps: spec.SchemaProps{ + Description: "ResourceID is the unique identifier of the resource. See the ResourceID type for more information.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "health": { + SchemaProps: spec.SchemaProps{ + Description: "Health of the resource. can be one of:\n - Healthy: operates as normal\n - Unhealthy: reported unhealthy. We consider this a temporary health issue\n since we do not have a mechanism today to distinguish\n temporary and permanent issues.\n - Unknown: The status cannot be determined.\n For example, Device Plugin got unregistered and hasn't been re-registered since.\n\nIn future we may want to introduce the PermanentlyUnhealthy Status.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"resourceID"}, + }, + }, + } +} + func schema_k8sio_api_core_v1_ResourceQuota(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -16677,6 +17430,11 @@ func schema_k8sio_api_core_v1_ResourceQuotaSpec(ref common.ReferenceCallback) co }, }, "scopes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "A collection of filters that must match each object tracked by a quota. If not specified, the quota matches all objects.", Type: []string{"array"}, @@ -16686,6 +17444,7 @@ func schema_k8sio_api_core_v1_ResourceQuotaSpec(ref common.ReferenceCallback) co Default: "", Type: []string{"string"}, Format: "", + Enum: []interface{}{"BestEffort", "CrossNamespacePodAffinity", "NotBestEffort", "NotTerminating", "PriorityClass", "Terminating"}, }, }, }, @@ -16813,28 +17572,73 @@ func schema_k8sio_api_core_v1_ResourceRequirements(ref common.ReferenceCallback) } } -func schema_k8sio_api_core_v1_SELinuxOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_k8sio_api_core_v1_ResourceStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "SELinuxOptions are the labels to be applied to the container", - Type: []string{"object"}, + Type: []string{"object"}, Properties: map[string]spec.Schema{ - "user": { - SchemaProps: spec.SchemaProps{ - Description: "User is a SELinux user label that applies to the container.", - Type: []string{"string"}, - Format: "", - }, - }, - "role": { + "name": { SchemaProps: spec.SchemaProps{ - Description: "Role is a SELinux role label that applies to the container.", + Description: "Name of the resource. Must be unique within the pod and match one of the resources from the pod spec.", + Default: "", Type: []string{"string"}, Format: "", }, }, - "type": { + "resources": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "resourceID", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of unique Resources health. Each element in the list contains an unique resource ID and resource health. At a minimum, ResourceID must uniquely identify the Resource allocated to the Pod on the Node for the lifetime of a Pod. See ResourceID type for it's definition.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.ResourceHealth"), + }, + }, + }, + }, + }, + }, + Required: []string{"name"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ResourceHealth"}, + } +} + +func schema_k8sio_api_core_v1_SELinuxOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SELinuxOptions are the labels to be applied to the container", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "user": { + SchemaProps: spec.SchemaProps{ + Description: "User is a SELinux user label that applies to the container.", + Type: []string{"string"}, + Format: "", + }, + }, + "role": { + SchemaProps: spec.SchemaProps{ + Description: "Role is a SELinux role label that applies to the container.", + Type: []string{"string"}, + Format: "", + }, + }, + "type": { SchemaProps: spec.SchemaProps{ Description: "Type is a SELinux type label that applies to the container.", Type: []string{"string"}, @@ -16907,6 +17711,7 @@ func schema_k8sio_api_core_v1_ScaleIOPersistentVolumeSource(ref common.Reference "storageMode": { SchemaProps: spec.SchemaProps{ Description: "storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned.", + Default: "ThinProvisioned", Type: []string{"string"}, Format: "", }, @@ -16921,6 +17726,7 @@ func schema_k8sio_api_core_v1_ScaleIOPersistentVolumeSource(ref common.Reference "fsType": { SchemaProps: spec.SchemaProps{ Description: "fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Default is \"xfs\"", + Default: "xfs", Type: []string{"string"}, Format: "", }, @@ -16994,6 +17800,7 @@ func schema_k8sio_api_core_v1_ScaleIOVolumeSource(ref common.ReferenceCallback) "storageMode": { SchemaProps: spec.SchemaProps{ Description: "storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned.", + Default: "ThinProvisioned", Type: []string{"string"}, Format: "", }, @@ -17008,6 +17815,7 @@ func schema_k8sio_api_core_v1_ScaleIOVolumeSource(ref common.ReferenceCallback) "fsType": { SchemaProps: spec.SchemaProps{ Description: "fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Default is \"xfs\".", + Default: "xfs", Type: []string{"string"}, Format: "", }, @@ -17036,6 +17844,11 @@ func schema_k8sio_api_core_v1_ScopeSelector(ref common.ReferenceCallback) common Type: []string{"object"}, Properties: map[string]spec.Schema{ "matchExpressions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "A list of scope selector requirements by scope of the resources.", Type: []string{"array"}, @@ -17088,6 +17901,11 @@ func schema_k8sio_api_core_v1_ScopedResourceSelectorRequirement(ref common.Refer }, }, "values": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", Type: []string{"array"}, @@ -17241,7 +18059,8 @@ func schema_k8sio_api_core_v1_SecretEnvSource(ref common.ReferenceCallback) comm Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Description: "Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Default: "", Type: []string{"string"}, Format: "", }, @@ -17268,7 +18087,8 @@ func schema_k8sio_api_core_v1_SecretKeySelector(ref common.ReferenceCallback) co Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Description: "Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Default: "", Type: []string{"string"}, Format: "", }, @@ -17360,12 +18180,18 @@ func schema_k8sio_api_core_v1_SecretProjection(ref common.ReferenceCallback) com Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Description: "Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Default: "", Type: []string{"string"}, Format: "", }, }, "items": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "items if unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", Type: []string{"array"}, @@ -17441,6 +18267,11 @@ func schema_k8sio_api_core_v1_SecretVolumeSource(ref common.ReferenceCallback) c }, }, "items": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "items If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", Type: []string{"array"}, @@ -17545,7 +18376,7 @@ func schema_k8sio_api_core_v1_SecurityContext(ref common.ReferenceCallback) comm }, "procMount": { SchemaProps: spec.SchemaProps{ - Description: "procMount denotes the type of proc mount to use for the containers. The default is DefaultProcMount which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.\n\nPossible enum values:\n - `\"Default\"` uses the container runtime defaults for readonly and masked paths for /proc. Most container runtimes mask certain paths in /proc to avoid accidental security exposure of special devices or information.\n - `\"Unmasked\"` bypasses the default masking behavior of the container runtime and ensures the newly created /proc the container stays in tact with no modifications.", + Description: "procMount denotes the type of proc mount to use for the containers. The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.\n\nPossible enum values:\n - `\"Default\"` uses the container runtime defaults for readonly and masked paths for /proc. Most container runtimes mask certain paths in /proc to avoid accidental security exposure of special devices or information.\n - `\"Unmasked\"` bypasses the default masking behavior of the container runtime and ensures the newly created /proc the container stays in tact with no modifications.", Type: []string{"string"}, Format: "", Enum: []interface{}{"Default", "Unmasked"}, @@ -17557,11 +18388,17 @@ func schema_k8sio_api_core_v1_SecurityContext(ref common.ReferenceCallback) comm Ref: ref("k8s.io/api/core/v1.SeccompProfile"), }, }, + "appArmorProfile": { + SchemaProps: spec.SchemaProps{ + Description: "appArmorProfile is the AppArmor options to use by this container. If set, this profile overrides the pod's appArmorProfile. Note that this field cannot be set when spec.os.name is windows.", + Ref: ref("k8s.io/api/core/v1.AppArmorProfile"), + }, + }, }, }, }, Dependencies: []string{ - "k8s.io/api/core/v1.Capabilities", "k8s.io/api/core/v1.SELinuxOptions", "k8s.io/api/core/v1.SeccompProfile", "k8s.io/api/core/v1.WindowsSecurityContextOptions"}, + "k8s.io/api/core/v1.AppArmorProfile", "k8s.io/api/core/v1.Capabilities", "k8s.io/api/core/v1.SELinuxOptions", "k8s.io/api/core/v1.SeccompProfile", "k8s.io/api/core/v1.WindowsSecurityContextOptions"}, } } @@ -17682,6 +18519,10 @@ func schema_k8sio_api_core_v1_ServiceAccount(ref common.ReferenceCallback) commo "secrets": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "name", "x-kubernetes-patch-strategy": "merge", }, @@ -17700,6 +18541,11 @@ func schema_k8sio_api_core_v1_ServiceAccount(ref common.ReferenceCallback) commo }, }, "imagePullSecrets": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod", Type: []string{"array"}, @@ -18049,6 +18895,11 @@ func schema_k8sio_api_core_v1_ServiceSpec(ref common.ReferenceCallback) common.O }, }, "externalIPs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "externalIPs is a list of IP addresses for which nodes in the cluster will also accept traffic for this service. These IPs are not managed by Kubernetes. The user is responsible for ensuring that traffic arrives at a node with this IP. A common example is external load-balancers that are not part of the Kubernetes system.", Type: []string{"array"}, @@ -18079,6 +18930,11 @@ func schema_k8sio_api_core_v1_ServiceSpec(ref common.ReferenceCallback) common.O }, }, "loadBalancerSourceRanges": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "If specified and supported by the platform, this will restrict traffic through the cloud-provider load-balancer will be restricted to the specified client IPs. This field will be ignored if the cloud-provider does not support the feature.\" More info: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", Type: []string{"array"}, @@ -18102,10 +18958,10 @@ func schema_k8sio_api_core_v1_ServiceSpec(ref common.ReferenceCallback) common.O }, "externalTrafficPolicy": { SchemaProps: spec.SchemaProps{ - Description: "externalTrafficPolicy describes how nodes distribute service traffic they receive on one of the Service's \"externally-facing\" addresses (NodePorts, ExternalIPs, and LoadBalancer IPs). If set to \"Local\", the proxy will configure the service in a way that assumes that external load balancers will take care of balancing the service traffic between nodes, and so each node will deliver traffic only to the node-local endpoints of the service, without masquerading the client source IP. (Traffic mistakenly sent to a node with no endpoints will be dropped.) The default value, \"Cluster\", uses the standard behavior of routing to all endpoints evenly (possibly modified by topology and other features). Note that traffic sent to an External IP or LoadBalancer IP from within the cluster will always get \"Cluster\" semantics, but clients sending to a NodePort from within the cluster may need to take traffic policy into account when picking a node.\n\nPossible enum values:\n - `\"Cluster\"`\n - `\"Cluster\"` routes traffic to all endpoints.\n - `\"Local\"`\n - `\"Local\"` preserves the source IP of the traffic by routing only to endpoints on the same node as the traffic was received on (dropping the traffic if there are no local endpoints).", + Description: "externalTrafficPolicy describes how nodes distribute service traffic they receive on one of the Service's \"externally-facing\" addresses (NodePorts, ExternalIPs, and LoadBalancer IPs). If set to \"Local\", the proxy will configure the service in a way that assumes that external load balancers will take care of balancing the service traffic between nodes, and so each node will deliver traffic only to the node-local endpoints of the service, without masquerading the client source IP. (Traffic mistakenly sent to a node with no endpoints will be dropped.) The default value, \"Cluster\", uses the standard behavior of routing to all endpoints evenly (possibly modified by topology and other features). Note that traffic sent to an External IP or LoadBalancer IP from within the cluster will always get \"Cluster\" semantics, but clients sending to a NodePort from within the cluster may need to take traffic policy into account when picking a node.\n\nPossible enum values:\n - `\"Cluster\"` routes traffic to all endpoints.\n - `\"Local\"` preserves the source IP of the traffic by routing only to endpoints on the same node as the traffic was received on (dropping the traffic if there are no local endpoints).", Type: []string{"string"}, Format: "", - Enum: []interface{}{"Cluster", "Cluster", "Local", "Local"}, + Enum: []interface{}{"Cluster", "Local"}, }, }, "healthCheckNodePort": { @@ -18143,6 +18999,7 @@ func schema_k8sio_api_core_v1_ServiceSpec(ref common.ReferenceCallback) common.O Default: "", Type: []string{"string"}, Format: "", + Enum: []interface{}{"", "IPv4", "IPv6"}, }, }, }, @@ -18178,6 +19035,13 @@ func schema_k8sio_api_core_v1_ServiceSpec(ref common.ReferenceCallback) common.O Enum: []interface{}{"Cluster", "Local"}, }, }, + "trafficDistribution": { + SchemaProps: spec.SchemaProps{ + Description: "TrafficDistribution offers a way to express preferences for how traffic is distributed to Service endpoints. Implementations can use this field as a hint, but are not required to guarantee strict adherence. If the field is not set, the implementation will apply its default routing strategy. If set to \"PreferClose\", implementations should prioritize endpoints that are topologically close (e.g., same zone). This is an alpha field and requires enabling ServiceTrafficDistribution feature.", + Type: []string{"string"}, + Format: "", + }, + }, }, }, }, @@ -18544,6 +19408,11 @@ func schema_k8sio_api_core_v1_TopologySelectorLabelRequirement(ref common.Refere }, }, "values": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "An array of string values. One value must match the label to be selected. Each entry in Values is ORed.", Type: []string{"array"}, @@ -18573,6 +19442,11 @@ func schema_k8sio_api_core_v1_TopologySelectorTerm(ref common.ReferenceCallback) Type: []string{"object"}, Properties: map[string]spec.Schema{ "matchLabelExpressions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "A list of topology selector requirements by labels.", Type: []string{"array"}, @@ -18639,7 +19513,7 @@ func schema_k8sio_api_core_v1_TopologySpreadConstraint(ref common.ReferenceCallb }, "minDomains": { SchemaProps: spec.SchemaProps{ - Description: "MinDomains indicates a minimum number of eligible domains. When the number of eligible domains with matching topology keys is less than minDomains, Pod Topology Spread treats \"global minimum\" as 0, and then the calculation of Skew is performed. And when the number of eligible domains with matching topology keys equals or greater than minDomains, this value has no effect on scheduling. As a result, when the number of eligible domains is less than minDomains, scheduler won't schedule more than maxSkew Pods to those domains. If value is nil, the constraint behaves as if MinDomains is equal to 1. Valid values are integers greater than 0. When value is not nil, WhenUnsatisfiable must be DoNotSchedule.\n\nFor example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same labelSelector spread as 2/2/2: | zone1 | zone2 | zone3 | | P P | P P | P P | The number of domains is less than 5(MinDomains), so \"global minimum\" is treated as 0. In this situation, new pod with the same labelSelector cannot be scheduled, because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, it will violate MaxSkew.\n\nThis is a beta field and requires the MinDomainsInPodTopologySpread feature gate to be enabled (enabled by default).", + Description: "MinDomains indicates a minimum number of eligible domains. When the number of eligible domains with matching topology keys is less than minDomains, Pod Topology Spread treats \"global minimum\" as 0, and then the calculation of Skew is performed. And when the number of eligible domains with matching topology keys equals or greater than minDomains, this value has no effect on scheduling. As a result, when the number of eligible domains is less than minDomains, scheduler won't schedule more than maxSkew Pods to those domains. If value is nil, the constraint behaves as if MinDomains is equal to 1. Valid values are integers greater than 0. When value is not nil, WhenUnsatisfiable must be DoNotSchedule.\n\nFor example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same labelSelector spread as 2/2/2: | zone1 | zone2 | zone3 | | P P | P P | P P | The number of domains is less than 5(MinDomains), so \"global minimum\" is treated as 0. In this situation, new pod with the same labelSelector cannot be scheduled, because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, it will violate MaxSkew.", Type: []string{"integer"}, Format: "int32", }, @@ -18963,12 +19837,18 @@ func schema_k8sio_api_core_v1_Volume(ref common.ReferenceCallback) common.OpenAP Ref: ref("k8s.io/api/core/v1.EphemeralVolumeSource"), }, }, + "image": { + SchemaProps: spec.SchemaProps{ + Description: "image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. The volume is resolved at pod startup depending on which PullPolicy value is provided:\n\n- Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails.\n\nThe volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. The volume will be mounted read-only (ro) and non-executable files (noexec). Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath). The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.", + Ref: ref("k8s.io/api/core/v1.ImageVolumeSource"), + }, + }, }, Required: []string{"name"}, }, }, Dependencies: []string{ - "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/api/core/v1.AzureDiskVolumeSource", "k8s.io/api/core/v1.AzureFileVolumeSource", "k8s.io/api/core/v1.CSIVolumeSource", "k8s.io/api/core/v1.CephFSVolumeSource", "k8s.io/api/core/v1.CinderVolumeSource", "k8s.io/api/core/v1.ConfigMapVolumeSource", "k8s.io/api/core/v1.DownwardAPIVolumeSource", "k8s.io/api/core/v1.EmptyDirVolumeSource", "k8s.io/api/core/v1.EphemeralVolumeSource", "k8s.io/api/core/v1.FCVolumeSource", "k8s.io/api/core/v1.FlexVolumeSource", "k8s.io/api/core/v1.FlockerVolumeSource", "k8s.io/api/core/v1.GCEPersistentDiskVolumeSource", "k8s.io/api/core/v1.GitRepoVolumeSource", "k8s.io/api/core/v1.GlusterfsVolumeSource", "k8s.io/api/core/v1.HostPathVolumeSource", "k8s.io/api/core/v1.ISCSIVolumeSource", "k8s.io/api/core/v1.NFSVolumeSource", "k8s.io/api/core/v1.PersistentVolumeClaimVolumeSource", "k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource", "k8s.io/api/core/v1.PortworxVolumeSource", "k8s.io/api/core/v1.ProjectedVolumeSource", "k8s.io/api/core/v1.QuobyteVolumeSource", "k8s.io/api/core/v1.RBDVolumeSource", "k8s.io/api/core/v1.ScaleIOVolumeSource", "k8s.io/api/core/v1.SecretVolumeSource", "k8s.io/api/core/v1.StorageOSVolumeSource", "k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource"}, + "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/api/core/v1.AzureDiskVolumeSource", "k8s.io/api/core/v1.AzureFileVolumeSource", "k8s.io/api/core/v1.CSIVolumeSource", "k8s.io/api/core/v1.CephFSVolumeSource", "k8s.io/api/core/v1.CinderVolumeSource", "k8s.io/api/core/v1.ConfigMapVolumeSource", "k8s.io/api/core/v1.DownwardAPIVolumeSource", "k8s.io/api/core/v1.EmptyDirVolumeSource", "k8s.io/api/core/v1.EphemeralVolumeSource", "k8s.io/api/core/v1.FCVolumeSource", "k8s.io/api/core/v1.FlexVolumeSource", "k8s.io/api/core/v1.FlockerVolumeSource", "k8s.io/api/core/v1.GCEPersistentDiskVolumeSource", "k8s.io/api/core/v1.GitRepoVolumeSource", "k8s.io/api/core/v1.GlusterfsVolumeSource", "k8s.io/api/core/v1.HostPathVolumeSource", "k8s.io/api/core/v1.ISCSIVolumeSource", "k8s.io/api/core/v1.ImageVolumeSource", "k8s.io/api/core/v1.NFSVolumeSource", "k8s.io/api/core/v1.PersistentVolumeClaimVolumeSource", "k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource", "k8s.io/api/core/v1.PortworxVolumeSource", "k8s.io/api/core/v1.ProjectedVolumeSource", "k8s.io/api/core/v1.QuobyteVolumeSource", "k8s.io/api/core/v1.RBDVolumeSource", "k8s.io/api/core/v1.ScaleIOVolumeSource", "k8s.io/api/core/v1.SecretVolumeSource", "k8s.io/api/core/v1.StorageOSVolumeSource", "k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource"}, } } @@ -19024,6 +19904,13 @@ func schema_k8sio_api_core_v1_VolumeMount(ref common.ReferenceCallback) common.O Format: "", }, }, + "recursiveReadOnly": { + SchemaProps: spec.SchemaProps{ + Description: "RecursiveReadOnly specifies whether read-only mounts should be handled recursively.\n\nIf ReadOnly is false, this field has no meaning and must be unspecified.\n\nIf ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason.\n\nIf this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None).\n\nIf this field is not specified, it is treated as an equivalent of Disabled.", + Type: []string{"string"}, + Format: "", + }, + }, "mountPath": { SchemaProps: spec.SchemaProps{ Description: "Path within the container at which the volume should be mounted. Must not contain ':'.", @@ -19041,7 +19928,7 @@ func schema_k8sio_api_core_v1_VolumeMount(ref common.ReferenceCallback) common.O }, "mountPropagation": { SchemaProps: spec.SchemaProps{ - Description: "mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10.\n\nPossible enum values:\n - `\"Bidirectional\"` means that the volume in a container will receive new mounts from the host or other containers, and its own mounts will be propagated from the container to the host or other containers. Note that this mode is recursively applied to all mounts in the volume (\"rshared\" in Linux terminology).\n - `\"HostToContainer\"` means that the volume in a container will receive new mounts from the host or other containers, but filesystems mounted inside the container won't be propagated to the host or other containers. Note that this mode is recursively applied to all mounts in the volume (\"rslave\" in Linux terminology).\n - `\"None\"` means that the volume in a container will not receive new mounts from the host or other containers, and filesystems mounted inside the container won't be propagated to the host or other containers. Note that this mode corresponds to \"private\" in Linux terminology.", + Description: "mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10. When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified (which defaults to None).\n\nPossible enum values:\n - `\"Bidirectional\"` means that the volume in a container will receive new mounts from the host or other containers, and its own mounts will be propagated from the container to the host or other containers. Note that this mode is recursively applied to all mounts in the volume (\"rshared\" in Linux terminology).\n - `\"HostToContainer\"` means that the volume in a container will receive new mounts from the host or other containers, but filesystems mounted inside the container won't be propagated to the host or other containers. Note that this mode is recursively applied to all mounts in the volume (\"rslave\" in Linux terminology).\n - `\"None\"` means that the volume in a container will not receive new mounts from the host or other containers, and filesystems mounted inside the container won't be propagated to the host or other containers. Note that this mode corresponds to \"private\" in Linux terminology.", Type: []string{"string"}, Format: "", Enum: []interface{}{"Bidirectional", "HostToContainer", "None"}, @@ -19061,6 +19948,50 @@ func schema_k8sio_api_core_v1_VolumeMount(ref common.ReferenceCallback) common.O } } +func schema_k8sio_api_core_v1_VolumeMountStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VolumeMountStatus shows status of volume mounts.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name corresponds to the name of the original VolumeMount.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "mountPath": { + SchemaProps: spec.SchemaProps{ + Description: "MountPath corresponds to the original VolumeMount.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "ReadOnly corresponds to the original VolumeMount.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "recursiveReadOnly": { + SchemaProps: spec.SchemaProps{ + Description: "RecursiveReadOnly must be set to Disabled, Enabled, or unspecified (for non-readonly mounts). An IfPossible value in the original VolumeMount must be translated to Disabled or Enabled, depending on the mount result.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "mountPath"}, + }, + }, + } +} + func schema_k8sio_api_core_v1_VolumeNodeAffinity(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -19086,7 +20017,7 @@ func schema_k8sio_api_core_v1_VolumeProjection(ref common.ReferenceCallback) com return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Projection that may be projected along with other supported volume types", + Description: "Projection that may be projected along with other supported volume types. Exactly one of these fields must be set.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "secret": { @@ -19351,11 +20282,17 @@ func schema_k8sio_api_core_v1_VolumeSource(ref common.ReferenceCallback) common. Ref: ref("k8s.io/api/core/v1.EphemeralVolumeSource"), }, }, + "image": { + SchemaProps: spec.SchemaProps{ + Description: "image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. The volume is resolved at pod startup depending on which PullPolicy value is provided:\n\n- Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails.\n\nThe volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. The volume will be mounted read-only (ro) and non-executable files (noexec). Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath). The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.", + Ref: ref("k8s.io/api/core/v1.ImageVolumeSource"), + }, + }, }, }, }, Dependencies: []string{ - "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/api/core/v1.AzureDiskVolumeSource", "k8s.io/api/core/v1.AzureFileVolumeSource", "k8s.io/api/core/v1.CSIVolumeSource", "k8s.io/api/core/v1.CephFSVolumeSource", "k8s.io/api/core/v1.CinderVolumeSource", "k8s.io/api/core/v1.ConfigMapVolumeSource", "k8s.io/api/core/v1.DownwardAPIVolumeSource", "k8s.io/api/core/v1.EmptyDirVolumeSource", "k8s.io/api/core/v1.EphemeralVolumeSource", "k8s.io/api/core/v1.FCVolumeSource", "k8s.io/api/core/v1.FlexVolumeSource", "k8s.io/api/core/v1.FlockerVolumeSource", "k8s.io/api/core/v1.GCEPersistentDiskVolumeSource", "k8s.io/api/core/v1.GitRepoVolumeSource", "k8s.io/api/core/v1.GlusterfsVolumeSource", "k8s.io/api/core/v1.HostPathVolumeSource", "k8s.io/api/core/v1.ISCSIVolumeSource", "k8s.io/api/core/v1.NFSVolumeSource", "k8s.io/api/core/v1.PersistentVolumeClaimVolumeSource", "k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource", "k8s.io/api/core/v1.PortworxVolumeSource", "k8s.io/api/core/v1.ProjectedVolumeSource", "k8s.io/api/core/v1.QuobyteVolumeSource", "k8s.io/api/core/v1.RBDVolumeSource", "k8s.io/api/core/v1.ScaleIOVolumeSource", "k8s.io/api/core/v1.SecretVolumeSource", "k8s.io/api/core/v1.StorageOSVolumeSource", "k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource"}, + "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/api/core/v1.AzureDiskVolumeSource", "k8s.io/api/core/v1.AzureFileVolumeSource", "k8s.io/api/core/v1.CSIVolumeSource", "k8s.io/api/core/v1.CephFSVolumeSource", "k8s.io/api/core/v1.CinderVolumeSource", "k8s.io/api/core/v1.ConfigMapVolumeSource", "k8s.io/api/core/v1.DownwardAPIVolumeSource", "k8s.io/api/core/v1.EmptyDirVolumeSource", "k8s.io/api/core/v1.EphemeralVolumeSource", "k8s.io/api/core/v1.FCVolumeSource", "k8s.io/api/core/v1.FlexVolumeSource", "k8s.io/api/core/v1.FlockerVolumeSource", "k8s.io/api/core/v1.GCEPersistentDiskVolumeSource", "k8s.io/api/core/v1.GitRepoVolumeSource", "k8s.io/api/core/v1.GlusterfsVolumeSource", "k8s.io/api/core/v1.HostPathVolumeSource", "k8s.io/api/core/v1.ISCSIVolumeSource", "k8s.io/api/core/v1.ImageVolumeSource", "k8s.io/api/core/v1.NFSVolumeSource", "k8s.io/api/core/v1.PersistentVolumeClaimVolumeSource", "k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource", "k8s.io/api/core/v1.PortworxVolumeSource", "k8s.io/api/core/v1.ProjectedVolumeSource", "k8s.io/api/core/v1.QuobyteVolumeSource", "k8s.io/api/core/v1.RBDVolumeSource", "k8s.io/api/core/v1.ScaleIOVolumeSource", "k8s.io/api/core/v1.SecretVolumeSource", "k8s.io/api/core/v1.StorageOSVolumeSource", "k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource"}, } } @@ -19504,6 +20441,11 @@ func schema_pkg_apis_meta_v1_APIGroup(ref common.ReferenceCallback) common.OpenA }, }, "versions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "versions are the versions supported in this group.", Type: []string{"array"}, @@ -19525,6 +20467,11 @@ func schema_pkg_apis_meta_v1_APIGroup(ref common.ReferenceCallback) common.OpenA }, }, "serverAddressByClientCIDRs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", Type: []string{"array"}, @@ -19569,6 +20516,11 @@ func schema_pkg_apis_meta_v1_APIGroupList(ref common.ReferenceCallback) common.O }, }, "groups": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "groups is a list of APIGroup.", Type: []string{"array"}, @@ -19660,6 +20612,11 @@ func schema_pkg_apis_meta_v1_APIResource(ref common.ReferenceCallback) common.Op }, }, "shortNames": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "shortNames is a list of suggested short names of the resource.", Type: []string{"array"}, @@ -19675,6 +20632,11 @@ func schema_pkg_apis_meta_v1_APIResource(ref common.ReferenceCallback) common.Op }, }, "categories": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "categories is a list of the grouped resources this resource belongs to (e.g. 'all')", Type: []string{"array"}, @@ -19733,6 +20695,11 @@ func schema_pkg_apis_meta_v1_APIResourceList(ref common.ReferenceCallback) commo }, }, "resources": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "resources contains the name of the resources and if they are namespaced.", Type: []string{"array"}, @@ -19777,6 +20744,11 @@ func schema_pkg_apis_meta_v1_APIVersions(ref common.ReferenceCallback) common.Op }, }, "versions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "versions are the api versions that are available.", Type: []string{"array"}, @@ -19792,6 +20764,11 @@ func schema_pkg_apis_meta_v1_APIVersions(ref common.ReferenceCallback) common.Op }, }, "serverAddressByClientCIDRs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", Type: []string{"array"}, @@ -19836,6 +20813,11 @@ func schema_pkg_apis_meta_v1_ApplyOptions(ref common.ReferenceCallback) common.O }, }, "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", Type: []string{"array"}, @@ -19956,6 +20938,11 @@ func schema_pkg_apis_meta_v1_CreateOptions(ref common.ReferenceCallback) common. }, }, "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", Type: []string{"array"}, @@ -20039,6 +21026,11 @@ func schema_pkg_apis_meta_v1_DeleteOptions(ref common.ReferenceCallback) common. }, }, "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", Type: []string{"array"}, @@ -20066,8 +21058,58 @@ func schema_pkg_apis_meta_v1_Duration(ref common.ReferenceCallback) common.OpenA Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "Duration is a wrapper around time.Duration which supports correct marshaling to YAML and JSON. In particular, it marshals into strings, which can be used as map keys in json.", - Type: v1.Duration{}.OpenAPISchemaType(), - Format: v1.Duration{}.OpenAPISchemaFormat(), + Type: metav1.Duration{}.OpenAPISchemaType(), + Format: metav1.Duration{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FieldSelectorRequirement is a selector that contains values, a key, and an operator that relates the key and values.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "key is the field selector key that the requirement applies to.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. The list of operators may grow in the future.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"key", "operator"}, }, }, } @@ -20355,6 +21397,11 @@ func schema_pkg_apis_meta_v1_LabelSelector(ref common.ReferenceCallback) common. }, }, "matchExpressions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "matchExpressions is a list of label selector requirements. The requirements are ANDed.", Type: []string{"array"}, @@ -20405,6 +21452,11 @@ func schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref common.ReferenceCallba }, }, "values": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", Type: []string{"array"}, @@ -20681,8 +21733,8 @@ func schema_pkg_apis_meta_v1_MicroTime(ref common.ReferenceCallback) common.Open Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "MicroTime is version of Time with microsecond level precision.", - Type: v1.MicroTime{}.OpenAPISchemaType(), - Format: v1.MicroTime{}.OpenAPISchemaFormat(), + Type: metav1.MicroTime{}.OpenAPISchemaType(), + Format: metav1.MicroTime{}.OpenAPISchemaFormat(), }, }, } @@ -20798,6 +21850,10 @@ func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.Ope "ownerReferences": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "uid", + }, + "x-kubernetes-list-type": "map", "x-kubernetes-patch-merge-key": "uid", "x-kubernetes-patch-strategy": "merge", }, @@ -20818,6 +21874,7 @@ func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.Ope "finalizers": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ + "x-kubernetes-list-type": "set", "x-kubernetes-patch-strategy": "merge", }, }, @@ -20836,6 +21893,11 @@ func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.Ope }, }, "managedFields": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like \"ci-cd\". The set of fields is always in the version that the workflow used when modifying the object.", Type: []string{"array"}, @@ -21042,6 +22104,11 @@ func schema_pkg_apis_meta_v1_PatchOptions(ref common.ReferenceCallback) common.O }, }, "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", Type: []string{"array"}, @@ -21118,6 +22185,11 @@ func schema_pkg_apis_meta_v1_RootPaths(ref common.ReferenceCallback) common.Open Type: []string{"object"}, Properties: map[string]spec.Schema{ "paths": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "paths are the paths available at root.", Type: []string{"array"}, @@ -21219,6 +22291,11 @@ func schema_pkg_apis_meta_v1_Status(ref common.ReferenceCallback) common.OpenAPI }, }, "details": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.", Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"), @@ -21309,6 +22386,11 @@ func schema_pkg_apis_meta_v1_StatusDetails(ref common.ReferenceCallback) common. }, }, "causes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.", Type: []string{"array"}, @@ -21366,6 +22448,11 @@ func schema_pkg_apis_meta_v1_Table(ref common.ReferenceCallback) common.OpenAPID }, }, "columnDefinitions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "columnDefinitions describes each column in the returned items array. The number of cells per row will always match the number of column definitions.", Type: []string{"array"}, @@ -21380,6 +22467,11 @@ func schema_pkg_apis_meta_v1_Table(ref common.ReferenceCallback) common.OpenAPID }, }, "rows": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "rows is the list of items in the table.", Type: []string{"array"}, @@ -21498,6 +22590,11 @@ func schema_pkg_apis_meta_v1_TableRow(ref common.ReferenceCallback) common.OpenA Type: []string{"object"}, Properties: map[string]spec.Schema{ "cells": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "cells will be as wide as the column definitions array and may contain strings, numbers (float64 or int64), booleans, simple maps, lists, or null. See the type field of the column definition for a more detailed description.", Type: []string{"array"}, @@ -21512,6 +22609,11 @@ func schema_pkg_apis_meta_v1_TableRow(ref common.ReferenceCallback) common.OpenA }, }, "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "conditions describe additional status of a row that are relevant for a human user. These conditions apply to the row, not to the object, and will be specific to table output. The only defined condition type is 'Completed', for a row that indicates a resource that has run to completion and can be given less visual priority.", Type: []string{"array"}, @@ -21589,8 +22691,8 @@ func schema_pkg_apis_meta_v1_Time(ref common.ReferenceCallback) common.OpenAPIDe Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.", - Type: v1.Time{}.OpenAPISchemaType(), - Format: v1.Time{}.OpenAPISchemaFormat(), + Type: metav1.Time{}.OpenAPISchemaType(), + Format: metav1.Time{}.OpenAPISchemaFormat(), }, }, } @@ -21675,6 +22777,11 @@ func schema_pkg_apis_meta_v1_UpdateOptions(ref common.ReferenceCallback) common. }, }, "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", Type: []string{"array"}, @@ -21835,3 +22942,80 @@ func schema_apimachinery_pkg_util_intstr_IntOrString(ref common.ReferenceCallbac }, }) } + +func schema_k8sio_apimachinery_pkg_version_Info(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Info contains versioning information. how we'll want to distribute that information.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "major": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "minor": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gitVersion": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gitCommit": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gitTreeState": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "buildDate": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "goVersion": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "compiler": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "platform": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"major", "minor", "gitVersion", "gitCommit", "gitTreeState", "buildDate", "goVersion", "compiler", "platform"}, + }, + }, + } +} diff --git a/pkg/apiserver/registry/stats/antreaclusternetworkpolicystats/rest_test.go b/pkg/apiserver/registry/stats/antreaclusternetworkpolicystats/rest_test.go index 53e491f3565..1a51a5f33a7 100644 --- a/pkg/apiserver/registry/stats/antreaclusternetworkpolicystats/rest_test.go +++ b/pkg/apiserver/registry/stats/antreaclusternetworkpolicystats/rest_test.go @@ -118,8 +118,8 @@ func TestRESTGet(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.NetworkPolicyStats, tt.networkPolicyStatsEnabled)() - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, tt.antreaPolicyEnabled)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.NetworkPolicyStats, tt.networkPolicyStatsEnabled) + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, tt.antreaPolicyEnabled) r := &REST{ statsProvider: &fakeStatsProvider{stats: tt.stats}, @@ -244,8 +244,8 @@ func TestRESTList(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.NetworkPolicyStats, tt.networkPolicyStatsEnabled)() - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, tt.antreaPolicyEnabled)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.NetworkPolicyStats, tt.networkPolicyStatsEnabled) + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, tt.antreaPolicyEnabled) r := &REST{ statsProvider: &fakeStatsProvider{stats: tt.stats}, diff --git a/pkg/apiserver/registry/stats/antreanetworkpolicystats/rest_test.go b/pkg/apiserver/registry/stats/antreanetworkpolicystats/rest_test.go index f2d606ccbe8..fa9318eeca2 100644 --- a/pkg/apiserver/registry/stats/antreanetworkpolicystats/rest_test.go +++ b/pkg/apiserver/registry/stats/antreanetworkpolicystats/rest_test.go @@ -138,8 +138,8 @@ func TestRESTGet(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.NetworkPolicyStats, tt.networkPolicyStatsEnabled)() - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, tt.antreaPolicyEnabled)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.NetworkPolicyStats, tt.networkPolicyStatsEnabled) + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, tt.antreaPolicyEnabled) r := &REST{ statsProvider: &fakeStatsProvider{stats: tt.stats}, @@ -320,8 +320,8 @@ func TestRESTList(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.NetworkPolicyStats, tt.networkPolicyStatsEnabled)() - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, tt.antreaPolicyEnabled)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.NetworkPolicyStats, tt.networkPolicyStatsEnabled) + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, tt.antreaPolicyEnabled) r := &REST{ statsProvider: &fakeStatsProvider{stats: tt.stats}, diff --git a/pkg/apiserver/registry/stats/multicastgroup/rest_test.go b/pkg/apiserver/registry/stats/multicastgroup/rest_test.go index e6775a0d856..23a90a80922 100644 --- a/pkg/apiserver/registry/stats/multicastgroup/rest_test.go +++ b/pkg/apiserver/registry/stats/multicastgroup/rest_test.go @@ -120,7 +120,7 @@ func TestRESTList(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.Multicast, tt.multicastEnabled)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.Multicast, tt.multicastEnabled) r := &REST{ statsProvider: &fakeStatsProvider{groups: tt.stats}, @@ -178,7 +178,7 @@ func TestRESTGet(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.Multicast, tt.multicastEnabled)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.Multicast, tt.multicastEnabled) r := &REST{ statsProvider: &fakeStatsProvider{groups: tt.groups}, diff --git a/pkg/apiserver/registry/stats/networkpolicystats/rest_test.go b/pkg/apiserver/registry/stats/networkpolicystats/rest_test.go index 33e0a1be71a..6d823c949ed 100644 --- a/pkg/apiserver/registry/stats/networkpolicystats/rest_test.go +++ b/pkg/apiserver/registry/stats/networkpolicystats/rest_test.go @@ -126,7 +126,7 @@ func TestRESTGet(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.NetworkPolicyStats, tt.networkPolicyStatsEnabled)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.NetworkPolicyStats, tt.networkPolicyStatsEnabled) r := &REST{ statsProvider: &fakeStatsProvider{stats: tt.stats}, @@ -292,7 +292,7 @@ func TestRESTList(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.NetworkPolicyStats, tt.networkPolicyStatsEnabled)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.NetworkPolicyStats, tt.networkPolicyStatsEnabled) r := &REST{ statsProvider: &fakeStatsProvider{stats: tt.stats}, diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 8a845283643..186c6ff128b 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -39,8 +39,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/addressgroup.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/addressgroup.go index 5005cbdef18..a61e19aa528 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/addressgroup.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/addressgroup.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,13 +18,12 @@ package v1beta2 import ( "context" - "time" v1beta2 "antrea.io/antrea/pkg/apis/controlplane/v1beta2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // AddressGroupsGetter has a method to return a AddressGroupInterface. @@ -43,54 +42,18 @@ type AddressGroupInterface interface { // addressGroups implements AddressGroupInterface type addressGroups struct { - client rest.Interface + *gentype.ClientWithList[*v1beta2.AddressGroup, *v1beta2.AddressGroupList] } // newAddressGroups returns a AddressGroups func newAddressGroups(c *ControlplaneV1beta2Client) *addressGroups { return &addressGroups{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta2.AddressGroup, *v1beta2.AddressGroupList]( + "addressgroups", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta2.AddressGroup { return &v1beta2.AddressGroup{} }, + func() *v1beta2.AddressGroupList { return &v1beta2.AddressGroupList{} }), } } - -// Get takes name of the addressGroup, and returns the corresponding addressGroup object, and an error if there is any. -func (c *addressGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.AddressGroup, err error) { - result = &v1beta2.AddressGroup{} - err = c.client.Get(). - Resource("addressgroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of AddressGroups that match those selectors. -func (c *addressGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.AddressGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta2.AddressGroupList{} - err = c.client.Get(). - Resource("addressgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested addressGroups. -func (c *addressGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("addressgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/appliedtogroup.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/appliedtogroup.go index cdcfe7746d6..95caf9e641e 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/appliedtogroup.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/appliedtogroup.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,13 +18,12 @@ package v1beta2 import ( "context" - "time" v1beta2 "antrea.io/antrea/pkg/apis/controlplane/v1beta2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // AppliedToGroupsGetter has a method to return a AppliedToGroupInterface. @@ -43,54 +42,18 @@ type AppliedToGroupInterface interface { // appliedToGroups implements AppliedToGroupInterface type appliedToGroups struct { - client rest.Interface + *gentype.ClientWithList[*v1beta2.AppliedToGroup, *v1beta2.AppliedToGroupList] } // newAppliedToGroups returns a AppliedToGroups func newAppliedToGroups(c *ControlplaneV1beta2Client) *appliedToGroups { return &appliedToGroups{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta2.AppliedToGroup, *v1beta2.AppliedToGroupList]( + "appliedtogroups", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta2.AppliedToGroup { return &v1beta2.AppliedToGroup{} }, + func() *v1beta2.AppliedToGroupList { return &v1beta2.AppliedToGroupList{} }), } } - -// Get takes name of the appliedToGroup, and returns the corresponding appliedToGroup object, and an error if there is any. -func (c *appliedToGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.AppliedToGroup, err error) { - result = &v1beta2.AppliedToGroup{} - err = c.client.Get(). - Resource("appliedtogroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of AppliedToGroups that match those selectors. -func (c *appliedToGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.AppliedToGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta2.AppliedToGroupList{} - err = c.client.Get(). - Resource("appliedtogroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested appliedToGroups. -func (c *appliedToGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("appliedtogroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/clustergroupmembers.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/clustergroupmembers.go index 331d2968ff6..7abee63597f 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/clustergroupmembers.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/clustergroupmembers.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import ( v1beta2 "antrea.io/antrea/pkg/apis/controlplane/v1beta2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ClusterGroupMembersGetter has a method to return a ClusterGroupMembersInterface. @@ -39,24 +39,17 @@ type ClusterGroupMembersInterface interface { // clusterGroupMembers implements ClusterGroupMembersInterface type clusterGroupMembers struct { - client rest.Interface + *gentype.Client[*v1beta2.ClusterGroupMembers] } // newClusterGroupMembers returns a ClusterGroupMembers func newClusterGroupMembers(c *ControlplaneV1beta2Client) *clusterGroupMembers { return &clusterGroupMembers{ - client: c.RESTClient(), + gentype.NewClient[*v1beta2.ClusterGroupMembers]( + "clustergroupmembers", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta2.ClusterGroupMembers { return &v1beta2.ClusterGroupMembers{} }), } } - -// Get takes name of the clusterGroupMembers, and returns the corresponding clusterGroupMembers object, and an error if there is any. -func (c *clusterGroupMembers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.ClusterGroupMembers, err error) { - result = &v1beta2.ClusterGroupMembers{} - err = c.client.Get(). - Resource("clustergroupmembers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/clustergroupmembers_expansion.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/clustergroupmembers_expansion.go index ec1c5927bb3..d65ac8b9c2d 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/clustergroupmembers_expansion.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/clustergroupmembers_expansion.go @@ -31,7 +31,7 @@ type ClusterGroupMembersExpansion interface { func (c *clusterGroupMembers) PaginatedGet(ctx context.Context, name string, pagination v1beta2.PaginationGetOptions, options v1.GetOptions) (result *v1beta2.ClusterGroupMembers, err error) { result = &v1beta2.ClusterGroupMembers{} - err = c.client.Get(). + err = c.GetClient().Get(). Resource("clustergroupmembers"). Name(name). Param("limit", fmt.Sprint(pagination.Limit)). diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/egressgroup.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/egressgroup.go index 316a8768889..78dfb3270ed 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/egressgroup.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/egressgroup.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,13 +18,12 @@ package v1beta2 import ( "context" - "time" v1beta2 "antrea.io/antrea/pkg/apis/controlplane/v1beta2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // EgressGroupsGetter has a method to return a EgressGroupInterface. @@ -43,54 +42,18 @@ type EgressGroupInterface interface { // egressGroups implements EgressGroupInterface type egressGroups struct { - client rest.Interface + *gentype.ClientWithList[*v1beta2.EgressGroup, *v1beta2.EgressGroupList] } // newEgressGroups returns a EgressGroups func newEgressGroups(c *ControlplaneV1beta2Client) *egressGroups { return &egressGroups{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta2.EgressGroup, *v1beta2.EgressGroupList]( + "egressgroups", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta2.EgressGroup { return &v1beta2.EgressGroup{} }, + func() *v1beta2.EgressGroupList { return &v1beta2.EgressGroupList{} }), } } - -// Get takes name of the egressGroup, and returns the corresponding egressGroup object, and an error if there is any. -func (c *egressGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.EgressGroup, err error) { - result = &v1beta2.EgressGroup{} - err = c.client.Get(). - Resource("egressgroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of EgressGroups that match those selectors. -func (c *egressGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.EgressGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta2.EgressGroupList{} - err = c.client.Get(). - Resource("egressgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested egressGroups. -func (c *egressGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("egressgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_addressgroup.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_addressgroup.go index 9f651e12307..45972739758 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_addressgroup.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_addressgroup.go @@ -37,20 +37,22 @@ var addressgroupsKind = v1beta2.SchemeGroupVersion.WithKind("AddressGroup") // Get takes name of the addressGroup, and returns the corresponding addressGroup object, and an error if there is any. func (c *FakeAddressGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.AddressGroup, err error) { + emptyResult := &v1beta2.AddressGroup{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(addressgroupsResource, name), &v1beta2.AddressGroup{}) + Invokes(testing.NewRootGetActionWithOptions(addressgroupsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.AddressGroup), err } // List takes label and field selectors, and returns the list of AddressGroups that match those selectors. func (c *FakeAddressGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.AddressGroupList, err error) { + emptyResult := &v1beta2.AddressGroupList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(addressgroupsResource, addressgroupsKind, opts), &v1beta2.AddressGroupList{}) + Invokes(testing.NewRootListActionWithOptions(addressgroupsResource, addressgroupsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -69,5 +71,5 @@ func (c *FakeAddressGroups) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested addressGroups. func (c *FakeAddressGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(addressgroupsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(addressgroupsResource, opts)) } diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_appliedtogroup.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_appliedtogroup.go index db6d027ba01..3af56ca9d76 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_appliedtogroup.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_appliedtogroup.go @@ -37,20 +37,22 @@ var appliedtogroupsKind = v1beta2.SchemeGroupVersion.WithKind("AppliedToGroup") // Get takes name of the appliedToGroup, and returns the corresponding appliedToGroup object, and an error if there is any. func (c *FakeAppliedToGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.AppliedToGroup, err error) { + emptyResult := &v1beta2.AppliedToGroup{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(appliedtogroupsResource, name), &v1beta2.AppliedToGroup{}) + Invokes(testing.NewRootGetActionWithOptions(appliedtogroupsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.AppliedToGroup), err } // List takes label and field selectors, and returns the list of AppliedToGroups that match those selectors. func (c *FakeAppliedToGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.AppliedToGroupList, err error) { + emptyResult := &v1beta2.AppliedToGroupList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(appliedtogroupsResource, appliedtogroupsKind, opts), &v1beta2.AppliedToGroupList{}) + Invokes(testing.NewRootListActionWithOptions(appliedtogroupsResource, appliedtogroupsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -69,5 +71,5 @@ func (c *FakeAppliedToGroups) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested appliedToGroups. func (c *FakeAppliedToGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(appliedtogroupsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(appliedtogroupsResource, opts)) } diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_clustergroupmembers.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_clustergroupmembers.go index bc05c15d7d7..10d15ef8a60 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_clustergroupmembers.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_clustergroupmembers.go @@ -35,10 +35,11 @@ var clustergroupmembersKind = v1beta2.SchemeGroupVersion.WithKind("ClusterGroupM // Get takes name of the clusterGroupMembers, and returns the corresponding clusterGroupMembers object, and an error if there is any. func (c *FakeClusterGroupMembers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.ClusterGroupMembers, err error) { + emptyResult := &v1beta2.ClusterGroupMembers{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clustergroupmembersResource, name), &v1beta2.ClusterGroupMembers{}) + Invokes(testing.NewRootGetActionWithOptions(clustergroupmembersResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.ClusterGroupMembers), err } diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_egressgroup.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_egressgroup.go index da62d07f498..28974e57455 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_egressgroup.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_egressgroup.go @@ -37,20 +37,22 @@ var egressgroupsKind = v1beta2.SchemeGroupVersion.WithKind("EgressGroup") // Get takes name of the egressGroup, and returns the corresponding egressGroup object, and an error if there is any. func (c *FakeEgressGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.EgressGroup, err error) { + emptyResult := &v1beta2.EgressGroup{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(egressgroupsResource, name), &v1beta2.EgressGroup{}) + Invokes(testing.NewRootGetActionWithOptions(egressgroupsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.EgressGroup), err } // List takes label and field selectors, and returns the list of EgressGroups that match those selectors. func (c *FakeEgressGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.EgressGroupList, err error) { + emptyResult := &v1beta2.EgressGroupList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(egressgroupsResource, egressgroupsKind, opts), &v1beta2.EgressGroupList{}) + Invokes(testing.NewRootListActionWithOptions(egressgroupsResource, egressgroupsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -69,5 +71,5 @@ func (c *FakeEgressGroups) List(ctx context.Context, opts v1.ListOptions) (resul // Watch returns a watch.Interface that watches the requested egressGroups. func (c *FakeEgressGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(egressgroupsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(egressgroupsResource, opts)) } diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_groupassociation.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_groupassociation.go index bfdd6ba1adb..dade683fa61 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_groupassociation.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_groupassociation.go @@ -36,11 +36,12 @@ var groupassociationsKind = v1beta2.SchemeGroupVersion.WithKind("GroupAssociatio // Get takes name of the groupAssociation, and returns the corresponding groupAssociation object, and an error if there is any. func (c *FakeGroupAssociations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.GroupAssociation, err error) { + emptyResult := &v1beta2.GroupAssociation{} obj, err := c.Fake. - Invokes(testing.NewGetAction(groupassociationsResource, c.ns, name), &v1beta2.GroupAssociation{}) + Invokes(testing.NewGetActionWithOptions(groupassociationsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.GroupAssociation), err } diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_groupmembers.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_groupmembers.go index b3425ff5016..b379499c133 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_groupmembers.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_groupmembers.go @@ -36,11 +36,12 @@ var groupmembersKind = v1beta2.SchemeGroupVersion.WithKind("GroupMembers") // Get takes name of the groupMembers, and returns the corresponding groupMembers object, and an error if there is any. func (c *FakeGroupMembers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.GroupMembers, err error) { + emptyResult := &v1beta2.GroupMembers{} obj, err := c.Fake. - Invokes(testing.NewGetAction(groupmembersResource, c.ns, name), &v1beta2.GroupMembers{}) + Invokes(testing.NewGetActionWithOptions(groupmembersResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.GroupMembers), err } diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_ipgroupassociation.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_ipgroupassociation.go index b693dd78149..49dd5a3630a 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_ipgroupassociation.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_ipgroupassociation.go @@ -35,10 +35,11 @@ var ipgroupassociationsKind = v1beta2.SchemeGroupVersion.WithKind("IPGroupAssoci // Get takes name of the iPGroupAssociation, and returns the corresponding iPGroupAssociation object, and an error if there is any. func (c *FakeIPGroupAssociations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.IPGroupAssociation, err error) { + emptyResult := &v1beta2.IPGroupAssociation{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ipgroupassociationsResource, name), &v1beta2.IPGroupAssociation{}) + Invokes(testing.NewRootGetActionWithOptions(ipgroupassociationsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.IPGroupAssociation), err } diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_networkpolicy.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_networkpolicy.go index 9c4a85a4506..07244b521fc 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_networkpolicy.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_networkpolicy.go @@ -37,20 +37,22 @@ var networkpoliciesKind = v1beta2.SchemeGroupVersion.WithKind("NetworkPolicy") // Get takes name of the networkPolicy, and returns the corresponding networkPolicy object, and an error if there is any. func (c *FakeNetworkPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.NetworkPolicy, err error) { + emptyResult := &v1beta2.NetworkPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(networkpoliciesResource, name), &v1beta2.NetworkPolicy{}) + Invokes(testing.NewRootGetActionWithOptions(networkpoliciesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.NetworkPolicy), err } // List takes label and field selectors, and returns the list of NetworkPolicies that match those selectors. func (c *FakeNetworkPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.NetworkPolicyList, err error) { + emptyResult := &v1beta2.NetworkPolicyList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(networkpoliciesResource, networkpoliciesKind, opts), &v1beta2.NetworkPolicyList{}) + Invokes(testing.NewRootListActionWithOptions(networkpoliciesResource, networkpoliciesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -69,5 +71,5 @@ func (c *FakeNetworkPolicies) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested networkPolicies. func (c *FakeNetworkPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(networkpoliciesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(networkpoliciesResource, opts)) } diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_networkpolicyevaluation.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_networkpolicyevaluation.go index f3f53270b75..7b719f99dcd 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_networkpolicyevaluation.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_networkpolicyevaluation.go @@ -35,10 +35,11 @@ var networkpolicyevaluationsKind = v1beta2.SchemeGroupVersion.WithKind("NetworkP // Create takes the representation of a networkPolicyEvaluation and creates it. Returns the server's representation of the networkPolicyEvaluation, and an error, if there is any. func (c *FakeNetworkPolicyEvaluations) Create(ctx context.Context, networkPolicyEvaluation *v1beta2.NetworkPolicyEvaluation, opts v1.CreateOptions) (result *v1beta2.NetworkPolicyEvaluation, err error) { + emptyResult := &v1beta2.NetworkPolicyEvaluation{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(networkpolicyevaluationsResource, networkPolicyEvaluation), &v1beta2.NetworkPolicyEvaluation{}) + Invokes(testing.NewRootCreateActionWithOptions(networkpolicyevaluationsResource, networkPolicyEvaluation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.NetworkPolicyEvaluation), err } diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_nodestatssummary.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_nodestatssummary.go index 92a41f11cde..e70d0308087 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_nodestatssummary.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_nodestatssummary.go @@ -35,10 +35,11 @@ var nodestatssummariesKind = v1beta2.SchemeGroupVersion.WithKind("NodeStatsSumma // Create takes the representation of a nodeStatsSummary and creates it. Returns the server's representation of the nodeStatsSummary, and an error, if there is any. func (c *FakeNodeStatsSummaries) Create(ctx context.Context, nodeStatsSummary *v1beta2.NodeStatsSummary, opts v1.CreateOptions) (result *v1beta2.NodeStatsSummary, err error) { + emptyResult := &v1beta2.NodeStatsSummary{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(nodestatssummariesResource, nodeStatsSummary), &v1beta2.NodeStatsSummary{}) + Invokes(testing.NewRootCreateActionWithOptions(nodestatssummariesResource, nodeStatsSummary, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.NodeStatsSummary), err } diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_supportbundlecollection.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_supportbundlecollection.go index a62aa85076e..1608d469c04 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_supportbundlecollection.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/fake/fake_supportbundlecollection.go @@ -37,20 +37,22 @@ var supportbundlecollectionsKind = v1beta2.SchemeGroupVersion.WithKind("SupportB // Get takes name of the supportBundleCollection, and returns the corresponding supportBundleCollection object, and an error if there is any. func (c *FakeSupportBundleCollections) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.SupportBundleCollection, err error) { + emptyResult := &v1beta2.SupportBundleCollection{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(supportbundlecollectionsResource, name), &v1beta2.SupportBundleCollection{}) + Invokes(testing.NewRootGetActionWithOptions(supportbundlecollectionsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.SupportBundleCollection), err } // List takes label and field selectors, and returns the list of SupportBundleCollections that match those selectors. func (c *FakeSupportBundleCollections) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.SupportBundleCollectionList, err error) { + emptyResult := &v1beta2.SupportBundleCollectionList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(supportbundlecollectionsResource, supportbundlecollectionsKind, opts), &v1beta2.SupportBundleCollectionList{}) + Invokes(testing.NewRootListActionWithOptions(supportbundlecollectionsResource, supportbundlecollectionsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -69,5 +71,5 @@ func (c *FakeSupportBundleCollections) List(ctx context.Context, opts v1.ListOpt // Watch returns a watch.Interface that watches the requested supportBundleCollections. func (c *FakeSupportBundleCollections) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(supportbundlecollectionsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(supportbundlecollectionsResource, opts)) } diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/groupassociation.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/groupassociation.go index 916c602cfe4..65af7864ad3 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/groupassociation.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/groupassociation.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import ( v1beta2 "antrea.io/antrea/pkg/apis/controlplane/v1beta2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // GroupAssociationsGetter has a method to return a GroupAssociationInterface. @@ -39,27 +39,17 @@ type GroupAssociationInterface interface { // groupAssociations implements GroupAssociationInterface type groupAssociations struct { - client rest.Interface - ns string + *gentype.Client[*v1beta2.GroupAssociation] } // newGroupAssociations returns a GroupAssociations func newGroupAssociations(c *ControlplaneV1beta2Client, namespace string) *groupAssociations { return &groupAssociations{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClient[*v1beta2.GroupAssociation]( + "groupassociations", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta2.GroupAssociation { return &v1beta2.GroupAssociation{} }), } } - -// Get takes name of the groupAssociation, and returns the corresponding groupAssociation object, and an error if there is any. -func (c *groupAssociations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.GroupAssociation, err error) { - result = &v1beta2.GroupAssociation{} - err = c.client.Get(). - Namespace(c.ns). - Resource("groupassociations"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/groupmembers.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/groupmembers.go index a76e57ec033..7acc5830f81 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/groupmembers.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/groupmembers.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import ( v1beta2 "antrea.io/antrea/pkg/apis/controlplane/v1beta2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // GroupMembersGetter has a method to return a GroupMembersInterface. @@ -39,27 +39,17 @@ type GroupMembersInterface interface { // groupMembers implements GroupMembersInterface type groupMembers struct { - client rest.Interface - ns string + *gentype.Client[*v1beta2.GroupMembers] } // newGroupMembers returns a GroupMembers func newGroupMembers(c *ControlplaneV1beta2Client, namespace string) *groupMembers { return &groupMembers{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClient[*v1beta2.GroupMembers]( + "groupmembers", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta2.GroupMembers { return &v1beta2.GroupMembers{} }), } } - -// Get takes name of the groupMembers, and returns the corresponding groupMembers object, and an error if there is any. -func (c *groupMembers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.GroupMembers, err error) { - result = &v1beta2.GroupMembers{} - err = c.client.Get(). - Namespace(c.ns). - Resource("groupmembers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/groupmembers_expansion.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/groupmembers_expansion.go index 9bca82a4e71..3648f83fc63 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/groupmembers_expansion.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/groupmembers_expansion.go @@ -31,8 +31,8 @@ type GroupMembersExpansion interface { func (c *groupMembers) PaginatedGet(ctx context.Context, name string, pagination v1beta2.PaginationGetOptions, options v1.GetOptions) (result *v1beta2.GroupMembers, err error) { result = &v1beta2.GroupMembers{} - err = c.client.Get(). - Namespace(c.ns). + err = c.GetClient().Get(). + Namespace(c.GetNamespace()). Resource("groupmembers"). Name(name). Param("limit", fmt.Sprint(pagination.Limit)). diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/ipgroupassociation.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/ipgroupassociation.go index c34269bd997..f7b0ea84a9e 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/ipgroupassociation.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/ipgroupassociation.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import ( v1beta2 "antrea.io/antrea/pkg/apis/controlplane/v1beta2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // IPGroupAssociationsGetter has a method to return a IPGroupAssociationInterface. @@ -39,24 +39,17 @@ type IPGroupAssociationInterface interface { // iPGroupAssociations implements IPGroupAssociationInterface type iPGroupAssociations struct { - client rest.Interface + *gentype.Client[*v1beta2.IPGroupAssociation] } // newIPGroupAssociations returns a IPGroupAssociations func newIPGroupAssociations(c *ControlplaneV1beta2Client) *iPGroupAssociations { return &iPGroupAssociations{ - client: c.RESTClient(), + gentype.NewClient[*v1beta2.IPGroupAssociation]( + "ipgroupassociations", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta2.IPGroupAssociation { return &v1beta2.IPGroupAssociation{} }), } } - -// Get takes name of the iPGroupAssociation, and returns the corresponding iPGroupAssociation object, and an error if there is any. -func (c *iPGroupAssociations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.IPGroupAssociation, err error) { - result = &v1beta2.IPGroupAssociation{} - err = c.client.Get(). - Resource("ipgroupassociations"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/networkpolicy.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/networkpolicy.go index 043efb8ec85..43491614f31 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/networkpolicy.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/networkpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,13 +18,12 @@ package v1beta2 import ( "context" - "time" v1beta2 "antrea.io/antrea/pkg/apis/controlplane/v1beta2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // NetworkPoliciesGetter has a method to return a NetworkPolicyInterface. @@ -43,54 +42,18 @@ type NetworkPolicyInterface interface { // networkPolicies implements NetworkPolicyInterface type networkPolicies struct { - client rest.Interface + *gentype.ClientWithList[*v1beta2.NetworkPolicy, *v1beta2.NetworkPolicyList] } // newNetworkPolicies returns a NetworkPolicies func newNetworkPolicies(c *ControlplaneV1beta2Client) *networkPolicies { return &networkPolicies{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta2.NetworkPolicy, *v1beta2.NetworkPolicyList]( + "networkpolicies", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta2.NetworkPolicy { return &v1beta2.NetworkPolicy{} }, + func() *v1beta2.NetworkPolicyList { return &v1beta2.NetworkPolicyList{} }), } } - -// Get takes name of the networkPolicy, and returns the corresponding networkPolicy object, and an error if there is any. -func (c *networkPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.NetworkPolicy, err error) { - result = &v1beta2.NetworkPolicy{} - err = c.client.Get(). - Resource("networkpolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NetworkPolicies that match those selectors. -func (c *networkPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.NetworkPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta2.NetworkPolicyList{} - err = c.client.Get(). - Resource("networkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested networkPolicies. -func (c *networkPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("networkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/networkpolicy_expansion.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/networkpolicy_expansion.go index 0cb02b5af53..a75c062f774 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/networkpolicy_expansion.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/networkpolicy_expansion.go @@ -26,5 +26,5 @@ type NetworkPolicyExpansion interface { } func (c *networkPolicies) UpdateStatus(ctx context.Context, name string, status *v1beta2.NetworkPolicyStatus) error { - return c.client.Post().Name(name).Resource("networkpolicies").SubResource("status").Body(status).Do(ctx).Error() + return c.GetClient().Post().Name(name).Resource("networkpolicies").SubResource("status").Body(status).Do(ctx).Error() } diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/networkpolicyevaluation.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/networkpolicyevaluation.go index 241e320c522..6de81f698da 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/networkpolicyevaluation.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/networkpolicyevaluation.go @@ -22,7 +22,7 @@ import ( v1beta2 "antrea.io/antrea/pkg/apis/controlplane/v1beta2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // NetworkPolicyEvaluationsGetter has a method to return a NetworkPolicyEvaluationInterface. @@ -39,24 +39,17 @@ type NetworkPolicyEvaluationInterface interface { // networkPolicyEvaluations implements NetworkPolicyEvaluationInterface type networkPolicyEvaluations struct { - client rest.Interface + *gentype.Client[*v1beta2.NetworkPolicyEvaluation] } // newNetworkPolicyEvaluations returns a NetworkPolicyEvaluations func newNetworkPolicyEvaluations(c *ControlplaneV1beta2Client) *networkPolicyEvaluations { return &networkPolicyEvaluations{ - client: c.RESTClient(), + gentype.NewClient[*v1beta2.NetworkPolicyEvaluation]( + "networkpolicyevaluations", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta2.NetworkPolicyEvaluation { return &v1beta2.NetworkPolicyEvaluation{} }), } } - -// Create takes the representation of a networkPolicyEvaluation and creates it. Returns the server's representation of the networkPolicyEvaluation, and an error, if there is any. -func (c *networkPolicyEvaluations) Create(ctx context.Context, networkPolicyEvaluation *v1beta2.NetworkPolicyEvaluation, opts v1.CreateOptions) (result *v1beta2.NetworkPolicyEvaluation, err error) { - result = &v1beta2.NetworkPolicyEvaluation{} - err = c.client.Post(). - Resource("networkpolicyevaluations"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(networkPolicyEvaluation). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/nodestatssummary.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/nodestatssummary.go index 09e4fab4aab..d1d240bffaf 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/nodestatssummary.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/nodestatssummary.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import ( v1beta2 "antrea.io/antrea/pkg/apis/controlplane/v1beta2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // NodeStatsSummariesGetter has a method to return a NodeStatsSummaryInterface. @@ -39,24 +39,17 @@ type NodeStatsSummaryInterface interface { // nodeStatsSummaries implements NodeStatsSummaryInterface type nodeStatsSummaries struct { - client rest.Interface + *gentype.Client[*v1beta2.NodeStatsSummary] } // newNodeStatsSummaries returns a NodeStatsSummaries func newNodeStatsSummaries(c *ControlplaneV1beta2Client) *nodeStatsSummaries { return &nodeStatsSummaries{ - client: c.RESTClient(), + gentype.NewClient[*v1beta2.NodeStatsSummary]( + "nodestatssummaries", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta2.NodeStatsSummary { return &v1beta2.NodeStatsSummary{} }), } } - -// Create takes the representation of a nodeStatsSummary and creates it. Returns the server's representation of the nodeStatsSummary, and an error, if there is any. -func (c *nodeStatsSummaries) Create(ctx context.Context, nodeStatsSummary *v1beta2.NodeStatsSummary, opts v1.CreateOptions) (result *v1beta2.NodeStatsSummary, err error) { - result = &v1beta2.NodeStatsSummary{} - err = c.client.Post(). - Resource("nodestatssummaries"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeStatsSummary). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/supportbundlecollection.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/supportbundlecollection.go index dce1bb11baa..6eef7d4f700 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/supportbundlecollection.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/supportbundlecollection.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,13 +18,12 @@ package v1beta2 import ( "context" - "time" v1beta2 "antrea.io/antrea/pkg/apis/controlplane/v1beta2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // SupportBundleCollectionsGetter has a method to return a SupportBundleCollectionInterface. @@ -43,54 +42,18 @@ type SupportBundleCollectionInterface interface { // supportBundleCollections implements SupportBundleCollectionInterface type supportBundleCollections struct { - client rest.Interface + *gentype.ClientWithList[*v1beta2.SupportBundleCollection, *v1beta2.SupportBundleCollectionList] } // newSupportBundleCollections returns a SupportBundleCollections func newSupportBundleCollections(c *ControlplaneV1beta2Client) *supportBundleCollections { return &supportBundleCollections{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta2.SupportBundleCollection, *v1beta2.SupportBundleCollectionList]( + "supportbundlecollections", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta2.SupportBundleCollection { return &v1beta2.SupportBundleCollection{} }, + func() *v1beta2.SupportBundleCollectionList { return &v1beta2.SupportBundleCollectionList{} }), } } - -// Get takes name of the supportBundleCollection, and returns the corresponding supportBundleCollection object, and an error if there is any. -func (c *supportBundleCollections) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.SupportBundleCollection, err error) { - result = &v1beta2.SupportBundleCollection{} - err = c.client.Get(). - Resource("supportbundlecollections"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of SupportBundleCollections that match those selectors. -func (c *supportBundleCollections) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.SupportBundleCollectionList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta2.SupportBundleCollectionList{} - err = c.client.Get(). - Resource("supportbundlecollections"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested supportBundleCollections. -func (c *supportBundleCollections) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("supportbundlecollections"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/supportbundlecollection_expansion.go b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/supportbundlecollection_expansion.go index 13b868159f8..67e3b75982e 100644 --- a/pkg/client/clientset/versioned/typed/controlplane/v1beta2/supportbundlecollection_expansion.go +++ b/pkg/client/clientset/versioned/typed/controlplane/v1beta2/supportbundlecollection_expansion.go @@ -25,5 +25,5 @@ type SupportBundleCollectionExpansion interface { } func (c *supportBundleCollections) UpdateStatus(ctx context.Context, name string, status *v1beta2.SupportBundleCollectionStatus) error { - return c.client.Post().Resource("supportbundlecollections").Name(name).SubResource("status").Body(status).Do(ctx).Error() + return c.GetClient().Post().Resource("supportbundlecollections").Name(name).SubResource("status").Body(status).Do(ctx).Error() } diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha1/bgppolicy.go b/pkg/client/clientset/versioned/typed/crd/v1alpha1/bgppolicy.go index 911ec0979c5..a1b691506c7 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha1/bgppolicy.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha1/bgppolicy.go @@ -18,14 +18,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/pkg/apis/crd/v1alpha1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // BGPPoliciesGetter has a method to return a BGPPolicyInterface. @@ -49,118 +48,18 @@ type BGPPolicyInterface interface { // bGPPolicies implements BGPPolicyInterface type bGPPolicies struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.BGPPolicy, *v1alpha1.BGPPolicyList] } // newBGPPolicies returns a BGPPolicies func newBGPPolicies(c *CrdV1alpha1Client) *bGPPolicies { return &bGPPolicies{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.BGPPolicy, *v1alpha1.BGPPolicyList]( + "bgppolicies", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.BGPPolicy { return &v1alpha1.BGPPolicy{} }, + func() *v1alpha1.BGPPolicyList { return &v1alpha1.BGPPolicyList{} }), } } - -// Get takes name of the bGPPolicy, and returns the corresponding bGPPolicy object, and an error if there is any. -func (c *bGPPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BGPPolicy, err error) { - result = &v1alpha1.BGPPolicy{} - err = c.client.Get(). - Resource("bgppolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of BGPPolicies that match those selectors. -func (c *bGPPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BGPPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.BGPPolicyList{} - err = c.client.Get(). - Resource("bgppolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested bGPPolicies. -func (c *bGPPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("bgppolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a bGPPolicy and creates it. Returns the server's representation of the bGPPolicy, and an error, if there is any. -func (c *bGPPolicies) Create(ctx context.Context, bGPPolicy *v1alpha1.BGPPolicy, opts v1.CreateOptions) (result *v1alpha1.BGPPolicy, err error) { - result = &v1alpha1.BGPPolicy{} - err = c.client.Post(). - Resource("bgppolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(bGPPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a bGPPolicy and updates it. Returns the server's representation of the bGPPolicy, and an error, if there is any. -func (c *bGPPolicies) Update(ctx context.Context, bGPPolicy *v1alpha1.BGPPolicy, opts v1.UpdateOptions) (result *v1alpha1.BGPPolicy, err error) { - result = &v1alpha1.BGPPolicy{} - err = c.client.Put(). - Resource("bgppolicies"). - Name(bGPPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(bGPPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the bGPPolicy and deletes it. Returns an error if one occurs. -func (c *bGPPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("bgppolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *bGPPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("bgppolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched bGPPolicy. -func (c *bGPPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BGPPolicy, err error) { - result = &v1alpha1.BGPPolicy{} - err = c.client.Patch(pt). - Resource("bgppolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha1/externalnode.go b/pkg/client/clientset/versioned/typed/crd/v1alpha1/externalnode.go index 06e456dea3f..6c5e70ac19b 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha1/externalnode.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha1/externalnode.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/pkg/apis/crd/v1alpha1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ExternalNodesGetter has a method to return a ExternalNodeInterface. @@ -49,128 +48,18 @@ type ExternalNodeInterface interface { // externalNodes implements ExternalNodeInterface type externalNodes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.ExternalNode, *v1alpha1.ExternalNodeList] } // newExternalNodes returns a ExternalNodes func newExternalNodes(c *CrdV1alpha1Client, namespace string) *externalNodes { return &externalNodes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.ExternalNode, *v1alpha1.ExternalNodeList]( + "externalnodes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.ExternalNode { return &v1alpha1.ExternalNode{} }, + func() *v1alpha1.ExternalNodeList { return &v1alpha1.ExternalNodeList{} }), } } - -// Get takes name of the externalNode, and returns the corresponding externalNode object, and an error if there is any. -func (c *externalNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ExternalNode, err error) { - result = &v1alpha1.ExternalNode{} - err = c.client.Get(). - Namespace(c.ns). - Resource("externalnodes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ExternalNodes that match those selectors. -func (c *externalNodes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ExternalNodeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ExternalNodeList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("externalnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested externalNodes. -func (c *externalNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("externalnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a externalNode and creates it. Returns the server's representation of the externalNode, and an error, if there is any. -func (c *externalNodes) Create(ctx context.Context, externalNode *v1alpha1.ExternalNode, opts v1.CreateOptions) (result *v1alpha1.ExternalNode, err error) { - result = &v1alpha1.ExternalNode{} - err = c.client.Post(). - Namespace(c.ns). - Resource("externalnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(externalNode). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a externalNode and updates it. Returns the server's representation of the externalNode, and an error, if there is any. -func (c *externalNodes) Update(ctx context.Context, externalNode *v1alpha1.ExternalNode, opts v1.UpdateOptions) (result *v1alpha1.ExternalNode, err error) { - result = &v1alpha1.ExternalNode{} - err = c.client.Put(). - Namespace(c.ns). - Resource("externalnodes"). - Name(externalNode.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(externalNode). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the externalNode and deletes it. Returns an error if one occurs. -func (c *externalNodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("externalnodes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *externalNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("externalnodes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched externalNode. -func (c *externalNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ExternalNode, err error) { - result = &v1alpha1.ExternalNode{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("externalnodes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_bgppolicy.go b/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_bgppolicy.go index 784b00a6b1e..5ccb1552af5 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_bgppolicy.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_bgppolicy.go @@ -38,20 +38,22 @@ var bgppoliciesKind = v1alpha1.SchemeGroupVersion.WithKind("BGPPolicy") // Get takes name of the bGPPolicy, and returns the corresponding bGPPolicy object, and an error if there is any. func (c *FakeBGPPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BGPPolicy, err error) { + emptyResult := &v1alpha1.BGPPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(bgppoliciesResource, name), &v1alpha1.BGPPolicy{}) + Invokes(testing.NewRootGetActionWithOptions(bgppoliciesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.BGPPolicy), err } // List takes label and field selectors, and returns the list of BGPPolicies that match those selectors. func (c *FakeBGPPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BGPPolicyList, err error) { + emptyResult := &v1alpha1.BGPPolicyList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(bgppoliciesResource, bgppoliciesKind, opts), &v1alpha1.BGPPolicyList{}) + Invokes(testing.NewRootListActionWithOptions(bgppoliciesResource, bgppoliciesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,25 +72,27 @@ func (c *FakeBGPPolicies) List(ctx context.Context, opts v1.ListOptions) (result // Watch returns a watch.Interface that watches the requested bGPPolicies. func (c *FakeBGPPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(bgppoliciesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(bgppoliciesResource, opts)) } // Create takes the representation of a bGPPolicy and creates it. Returns the server's representation of the bGPPolicy, and an error, if there is any. func (c *FakeBGPPolicies) Create(ctx context.Context, bGPPolicy *v1alpha1.BGPPolicy, opts v1.CreateOptions) (result *v1alpha1.BGPPolicy, err error) { + emptyResult := &v1alpha1.BGPPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(bgppoliciesResource, bGPPolicy), &v1alpha1.BGPPolicy{}) + Invokes(testing.NewRootCreateActionWithOptions(bgppoliciesResource, bGPPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.BGPPolicy), err } // Update takes the representation of a bGPPolicy and updates it. Returns the server's representation of the bGPPolicy, and an error, if there is any. func (c *FakeBGPPolicies) Update(ctx context.Context, bGPPolicy *v1alpha1.BGPPolicy, opts v1.UpdateOptions) (result *v1alpha1.BGPPolicy, err error) { + emptyResult := &v1alpha1.BGPPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(bgppoliciesResource, bGPPolicy), &v1alpha1.BGPPolicy{}) + Invokes(testing.NewRootUpdateActionWithOptions(bgppoliciesResource, bGPPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.BGPPolicy), err } @@ -102,7 +106,7 @@ func (c *FakeBGPPolicies) Delete(ctx context.Context, name string, opts v1.Delet // DeleteCollection deletes a collection of objects. func (c *FakeBGPPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(bgppoliciesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(bgppoliciesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.BGPPolicyList{}) return err @@ -110,10 +114,11 @@ func (c *FakeBGPPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOp // Patch applies the patch and returns the patched bGPPolicy. func (c *FakeBGPPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BGPPolicy, err error) { + emptyResult := &v1alpha1.BGPPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(bgppoliciesResource, name, pt, data, subresources...), &v1alpha1.BGPPolicy{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(bgppoliciesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.BGPPolicy), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_externalnode.go b/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_externalnode.go index 9355950577b..7e1dfeac8d6 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_externalnode.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_externalnode.go @@ -39,22 +39,24 @@ var externalnodesKind = v1alpha1.SchemeGroupVersion.WithKind("ExternalNode") // Get takes name of the externalNode, and returns the corresponding externalNode object, and an error if there is any. func (c *FakeExternalNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ExternalNode, err error) { + emptyResult := &v1alpha1.ExternalNode{} obj, err := c.Fake. - Invokes(testing.NewGetAction(externalnodesResource, c.ns, name), &v1alpha1.ExternalNode{}) + Invokes(testing.NewGetActionWithOptions(externalnodesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ExternalNode), err } // List takes label and field selectors, and returns the list of ExternalNodes that match those selectors. func (c *FakeExternalNodes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ExternalNodeList, err error) { + emptyResult := &v1alpha1.ExternalNodeList{} obj, err := c.Fake. - Invokes(testing.NewListAction(externalnodesResource, externalnodesKind, c.ns, opts), &v1alpha1.ExternalNodeList{}) + Invokes(testing.NewListActionWithOptions(externalnodesResource, externalnodesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,28 +75,30 @@ func (c *FakeExternalNodes) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested externalNodes. func (c *FakeExternalNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(externalnodesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(externalnodesResource, c.ns, opts)) } // Create takes the representation of a externalNode and creates it. Returns the server's representation of the externalNode, and an error, if there is any. func (c *FakeExternalNodes) Create(ctx context.Context, externalNode *v1alpha1.ExternalNode, opts v1.CreateOptions) (result *v1alpha1.ExternalNode, err error) { + emptyResult := &v1alpha1.ExternalNode{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(externalnodesResource, c.ns, externalNode), &v1alpha1.ExternalNode{}) + Invokes(testing.NewCreateActionWithOptions(externalnodesResource, c.ns, externalNode, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ExternalNode), err } // Update takes the representation of a externalNode and updates it. Returns the server's representation of the externalNode, and an error, if there is any. func (c *FakeExternalNodes) Update(ctx context.Context, externalNode *v1alpha1.ExternalNode, opts v1.UpdateOptions) (result *v1alpha1.ExternalNode, err error) { + emptyResult := &v1alpha1.ExternalNode{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(externalnodesResource, c.ns, externalNode), &v1alpha1.ExternalNode{}) + Invokes(testing.NewUpdateActionWithOptions(externalnodesResource, c.ns, externalNode, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ExternalNode), err } @@ -109,7 +113,7 @@ func (c *FakeExternalNodes) Delete(ctx context.Context, name string, opts v1.Del // DeleteCollection deletes a collection of objects. func (c *FakeExternalNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(externalnodesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(externalnodesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ExternalNodeList{}) return err @@ -117,11 +121,12 @@ func (c *FakeExternalNodes) DeleteCollection(ctx context.Context, opts v1.Delete // Patch applies the patch and returns the patched externalNode. func (c *FakeExternalNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ExternalNode, err error) { + emptyResult := &v1alpha1.ExternalNode{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(externalnodesResource, c.ns, name, pt, data, subresources...), &v1alpha1.ExternalNode{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(externalnodesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ExternalNode), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_nodelatencymonitor.go b/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_nodelatencymonitor.go index 76a415f8958..8b3ad569bb6 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_nodelatencymonitor.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_nodelatencymonitor.go @@ -38,20 +38,22 @@ var nodelatencymonitorsKind = v1alpha1.SchemeGroupVersion.WithKind("NodeLatencyM // Get takes name of the nodeLatencyMonitor, and returns the corresponding nodeLatencyMonitor object, and an error if there is any. func (c *FakeNodeLatencyMonitors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeLatencyMonitor, err error) { + emptyResult := &v1alpha1.NodeLatencyMonitor{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(nodelatencymonitorsResource, name), &v1alpha1.NodeLatencyMonitor{}) + Invokes(testing.NewRootGetActionWithOptions(nodelatencymonitorsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeLatencyMonitor), err } // List takes label and field selectors, and returns the list of NodeLatencyMonitors that match those selectors. func (c *FakeNodeLatencyMonitors) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeLatencyMonitorList, err error) { + emptyResult := &v1alpha1.NodeLatencyMonitorList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(nodelatencymonitorsResource, nodelatencymonitorsKind, opts), &v1alpha1.NodeLatencyMonitorList{}) + Invokes(testing.NewRootListActionWithOptions(nodelatencymonitorsResource, nodelatencymonitorsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,25 +72,27 @@ func (c *FakeNodeLatencyMonitors) List(ctx context.Context, opts v1.ListOptions) // Watch returns a watch.Interface that watches the requested nodeLatencyMonitors. func (c *FakeNodeLatencyMonitors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(nodelatencymonitorsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(nodelatencymonitorsResource, opts)) } // Create takes the representation of a nodeLatencyMonitor and creates it. Returns the server's representation of the nodeLatencyMonitor, and an error, if there is any. func (c *FakeNodeLatencyMonitors) Create(ctx context.Context, nodeLatencyMonitor *v1alpha1.NodeLatencyMonitor, opts v1.CreateOptions) (result *v1alpha1.NodeLatencyMonitor, err error) { + emptyResult := &v1alpha1.NodeLatencyMonitor{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(nodelatencymonitorsResource, nodeLatencyMonitor), &v1alpha1.NodeLatencyMonitor{}) + Invokes(testing.NewRootCreateActionWithOptions(nodelatencymonitorsResource, nodeLatencyMonitor, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeLatencyMonitor), err } // Update takes the representation of a nodeLatencyMonitor and updates it. Returns the server's representation of the nodeLatencyMonitor, and an error, if there is any. func (c *FakeNodeLatencyMonitors) Update(ctx context.Context, nodeLatencyMonitor *v1alpha1.NodeLatencyMonitor, opts v1.UpdateOptions) (result *v1alpha1.NodeLatencyMonitor, err error) { + emptyResult := &v1alpha1.NodeLatencyMonitor{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(nodelatencymonitorsResource, nodeLatencyMonitor), &v1alpha1.NodeLatencyMonitor{}) + Invokes(testing.NewRootUpdateActionWithOptions(nodelatencymonitorsResource, nodeLatencyMonitor, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeLatencyMonitor), err } @@ -102,7 +106,7 @@ func (c *FakeNodeLatencyMonitors) Delete(ctx context.Context, name string, opts // DeleteCollection deletes a collection of objects. func (c *FakeNodeLatencyMonitors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(nodelatencymonitorsResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(nodelatencymonitorsResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.NodeLatencyMonitorList{}) return err @@ -110,10 +114,11 @@ func (c *FakeNodeLatencyMonitors) DeleteCollection(ctx context.Context, opts v1. // Patch applies the patch and returns the patched nodeLatencyMonitor. func (c *FakeNodeLatencyMonitors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeLatencyMonitor, err error) { + emptyResult := &v1alpha1.NodeLatencyMonitor{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(nodelatencymonitorsResource, name, pt, data, subresources...), &v1alpha1.NodeLatencyMonitor{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(nodelatencymonitorsResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeLatencyMonitor), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_supportbundlecollection.go b/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_supportbundlecollection.go index 2cb464500b0..548ea1fe97f 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_supportbundlecollection.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_supportbundlecollection.go @@ -38,20 +38,22 @@ var supportbundlecollectionsKind = v1alpha1.SchemeGroupVersion.WithKind("Support // Get takes name of the supportBundleCollection, and returns the corresponding supportBundleCollection object, and an error if there is any. func (c *FakeSupportBundleCollections) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.SupportBundleCollection, err error) { + emptyResult := &v1alpha1.SupportBundleCollection{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(supportbundlecollectionsResource, name), &v1alpha1.SupportBundleCollection{}) + Invokes(testing.NewRootGetActionWithOptions(supportbundlecollectionsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SupportBundleCollection), err } // List takes label and field selectors, and returns the list of SupportBundleCollections that match those selectors. func (c *FakeSupportBundleCollections) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SupportBundleCollectionList, err error) { + emptyResult := &v1alpha1.SupportBundleCollectionList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(supportbundlecollectionsResource, supportbundlecollectionsKind, opts), &v1alpha1.SupportBundleCollectionList{}) + Invokes(testing.NewRootListActionWithOptions(supportbundlecollectionsResource, supportbundlecollectionsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,36 +72,39 @@ func (c *FakeSupportBundleCollections) List(ctx context.Context, opts v1.ListOpt // Watch returns a watch.Interface that watches the requested supportBundleCollections. func (c *FakeSupportBundleCollections) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(supportbundlecollectionsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(supportbundlecollectionsResource, opts)) } // Create takes the representation of a supportBundleCollection and creates it. Returns the server's representation of the supportBundleCollection, and an error, if there is any. func (c *FakeSupportBundleCollections) Create(ctx context.Context, supportBundleCollection *v1alpha1.SupportBundleCollection, opts v1.CreateOptions) (result *v1alpha1.SupportBundleCollection, err error) { + emptyResult := &v1alpha1.SupportBundleCollection{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(supportbundlecollectionsResource, supportBundleCollection), &v1alpha1.SupportBundleCollection{}) + Invokes(testing.NewRootCreateActionWithOptions(supportbundlecollectionsResource, supportBundleCollection, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SupportBundleCollection), err } // Update takes the representation of a supportBundleCollection and updates it. Returns the server's representation of the supportBundleCollection, and an error, if there is any. func (c *FakeSupportBundleCollections) Update(ctx context.Context, supportBundleCollection *v1alpha1.SupportBundleCollection, opts v1.UpdateOptions) (result *v1alpha1.SupportBundleCollection, err error) { + emptyResult := &v1alpha1.SupportBundleCollection{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(supportbundlecollectionsResource, supportBundleCollection), &v1alpha1.SupportBundleCollection{}) + Invokes(testing.NewRootUpdateActionWithOptions(supportbundlecollectionsResource, supportBundleCollection, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SupportBundleCollection), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSupportBundleCollections) UpdateStatus(ctx context.Context, supportBundleCollection *v1alpha1.SupportBundleCollection, opts v1.UpdateOptions) (*v1alpha1.SupportBundleCollection, error) { +func (c *FakeSupportBundleCollections) UpdateStatus(ctx context.Context, supportBundleCollection *v1alpha1.SupportBundleCollection, opts v1.UpdateOptions) (result *v1alpha1.SupportBundleCollection, err error) { + emptyResult := &v1alpha1.SupportBundleCollection{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(supportbundlecollectionsResource, "status", supportBundleCollection), &v1alpha1.SupportBundleCollection{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(supportbundlecollectionsResource, "status", supportBundleCollection, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SupportBundleCollection), err } @@ -113,7 +118,7 @@ func (c *FakeSupportBundleCollections) Delete(ctx context.Context, name string, // DeleteCollection deletes a collection of objects. func (c *FakeSupportBundleCollections) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(supportbundlecollectionsResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(supportbundlecollectionsResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.SupportBundleCollectionList{}) return err @@ -121,10 +126,11 @@ func (c *FakeSupportBundleCollections) DeleteCollection(ctx context.Context, opt // Patch applies the patch and returns the patched supportBundleCollection. func (c *FakeSupportBundleCollections) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.SupportBundleCollection, err error) { + emptyResult := &v1alpha1.SupportBundleCollection{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(supportbundlecollectionsResource, name, pt, data, subresources...), &v1alpha1.SupportBundleCollection{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(supportbundlecollectionsResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SupportBundleCollection), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha1/nodelatencymonitor.go b/pkg/client/clientset/versioned/typed/crd/v1alpha1/nodelatencymonitor.go index cfaef7eebd1..4faa955ab80 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha1/nodelatencymonitor.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha1/nodelatencymonitor.go @@ -18,14 +18,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/pkg/apis/crd/v1alpha1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // NodeLatencyMonitorsGetter has a method to return a NodeLatencyMonitorInterface. @@ -49,118 +48,18 @@ type NodeLatencyMonitorInterface interface { // nodeLatencyMonitors implements NodeLatencyMonitorInterface type nodeLatencyMonitors struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.NodeLatencyMonitor, *v1alpha1.NodeLatencyMonitorList] } // newNodeLatencyMonitors returns a NodeLatencyMonitors func newNodeLatencyMonitors(c *CrdV1alpha1Client) *nodeLatencyMonitors { return &nodeLatencyMonitors{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.NodeLatencyMonitor, *v1alpha1.NodeLatencyMonitorList]( + "nodelatencymonitors", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.NodeLatencyMonitor { return &v1alpha1.NodeLatencyMonitor{} }, + func() *v1alpha1.NodeLatencyMonitorList { return &v1alpha1.NodeLatencyMonitorList{} }), } } - -// Get takes name of the nodeLatencyMonitor, and returns the corresponding nodeLatencyMonitor object, and an error if there is any. -func (c *nodeLatencyMonitors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeLatencyMonitor, err error) { - result = &v1alpha1.NodeLatencyMonitor{} - err = c.client.Get(). - Resource("nodelatencymonitors"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NodeLatencyMonitors that match those selectors. -func (c *nodeLatencyMonitors) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeLatencyMonitorList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.NodeLatencyMonitorList{} - err = c.client.Get(). - Resource("nodelatencymonitors"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested nodeLatencyMonitors. -func (c *nodeLatencyMonitors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("nodelatencymonitors"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a nodeLatencyMonitor and creates it. Returns the server's representation of the nodeLatencyMonitor, and an error, if there is any. -func (c *nodeLatencyMonitors) Create(ctx context.Context, nodeLatencyMonitor *v1alpha1.NodeLatencyMonitor, opts v1.CreateOptions) (result *v1alpha1.NodeLatencyMonitor, err error) { - result = &v1alpha1.NodeLatencyMonitor{} - err = c.client.Post(). - Resource("nodelatencymonitors"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeLatencyMonitor). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a nodeLatencyMonitor and updates it. Returns the server's representation of the nodeLatencyMonitor, and an error, if there is any. -func (c *nodeLatencyMonitors) Update(ctx context.Context, nodeLatencyMonitor *v1alpha1.NodeLatencyMonitor, opts v1.UpdateOptions) (result *v1alpha1.NodeLatencyMonitor, err error) { - result = &v1alpha1.NodeLatencyMonitor{} - err = c.client.Put(). - Resource("nodelatencymonitors"). - Name(nodeLatencyMonitor.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeLatencyMonitor). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the nodeLatencyMonitor and deletes it. Returns an error if one occurs. -func (c *nodeLatencyMonitors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("nodelatencymonitors"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *nodeLatencyMonitors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("nodelatencymonitors"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched nodeLatencyMonitor. -func (c *nodeLatencyMonitors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeLatencyMonitor, err error) { - result = &v1alpha1.NodeLatencyMonitor{} - err = c.client.Patch(pt). - Resource("nodelatencymonitors"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha1/supportbundlecollection.go b/pkg/client/clientset/versioned/typed/crd/v1alpha1/supportbundlecollection.go index b5e36238d9c..b38a112ee92 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha1/supportbundlecollection.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha1/supportbundlecollection.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/pkg/apis/crd/v1alpha1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // SupportBundleCollectionsGetter has a method to return a SupportBundleCollectionInterface. @@ -38,6 +37,7 @@ type SupportBundleCollectionsGetter interface { type SupportBundleCollectionInterface interface { Create(ctx context.Context, supportBundleCollection *v1alpha1.SupportBundleCollection, opts v1.CreateOptions) (*v1alpha1.SupportBundleCollection, error) Update(ctx context.Context, supportBundleCollection *v1alpha1.SupportBundleCollection, opts v1.UpdateOptions) (*v1alpha1.SupportBundleCollection, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, supportBundleCollection *v1alpha1.SupportBundleCollection, opts v1.UpdateOptions) (*v1alpha1.SupportBundleCollection, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,133 +50,18 @@ type SupportBundleCollectionInterface interface { // supportBundleCollections implements SupportBundleCollectionInterface type supportBundleCollections struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.SupportBundleCollection, *v1alpha1.SupportBundleCollectionList] } // newSupportBundleCollections returns a SupportBundleCollections func newSupportBundleCollections(c *CrdV1alpha1Client) *supportBundleCollections { return &supportBundleCollections{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.SupportBundleCollection, *v1alpha1.SupportBundleCollectionList]( + "supportbundlecollections", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.SupportBundleCollection { return &v1alpha1.SupportBundleCollection{} }, + func() *v1alpha1.SupportBundleCollectionList { return &v1alpha1.SupportBundleCollectionList{} }), } } - -// Get takes name of the supportBundleCollection, and returns the corresponding supportBundleCollection object, and an error if there is any. -func (c *supportBundleCollections) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.SupportBundleCollection, err error) { - result = &v1alpha1.SupportBundleCollection{} - err = c.client.Get(). - Resource("supportbundlecollections"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of SupportBundleCollections that match those selectors. -func (c *supportBundleCollections) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SupportBundleCollectionList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.SupportBundleCollectionList{} - err = c.client.Get(). - Resource("supportbundlecollections"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested supportBundleCollections. -func (c *supportBundleCollections) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("supportbundlecollections"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a supportBundleCollection and creates it. Returns the server's representation of the supportBundleCollection, and an error, if there is any. -func (c *supportBundleCollections) Create(ctx context.Context, supportBundleCollection *v1alpha1.SupportBundleCollection, opts v1.CreateOptions) (result *v1alpha1.SupportBundleCollection, err error) { - result = &v1alpha1.SupportBundleCollection{} - err = c.client.Post(). - Resource("supportbundlecollections"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(supportBundleCollection). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a supportBundleCollection and updates it. Returns the server's representation of the supportBundleCollection, and an error, if there is any. -func (c *supportBundleCollections) Update(ctx context.Context, supportBundleCollection *v1alpha1.SupportBundleCollection, opts v1.UpdateOptions) (result *v1alpha1.SupportBundleCollection, err error) { - result = &v1alpha1.SupportBundleCollection{} - err = c.client.Put(). - Resource("supportbundlecollections"). - Name(supportBundleCollection.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(supportBundleCollection). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *supportBundleCollections) UpdateStatus(ctx context.Context, supportBundleCollection *v1alpha1.SupportBundleCollection, opts v1.UpdateOptions) (result *v1alpha1.SupportBundleCollection, err error) { - result = &v1alpha1.SupportBundleCollection{} - err = c.client.Put(). - Resource("supportbundlecollections"). - Name(supportBundleCollection.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(supportBundleCollection). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the supportBundleCollection and deletes it. Returns an error if one occurs. -func (c *supportBundleCollections) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("supportbundlecollections"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *supportBundleCollections) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("supportbundlecollections"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched supportBundleCollection. -func (c *supportBundleCollections) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.SupportBundleCollection, err error) { - result = &v1alpha1.SupportBundleCollection{} - err = c.client.Patch(pt). - Resource("supportbundlecollections"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha2/externalentity.go b/pkg/client/clientset/versioned/typed/crd/v1alpha2/externalentity.go index 22fe5ad9b50..f52e249f0e8 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha2/externalentity.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha2/externalentity.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha2 import ( "context" - "time" v1alpha2 "antrea.io/antrea/pkg/apis/crd/v1alpha2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ExternalEntitiesGetter has a method to return a ExternalEntityInterface. @@ -49,128 +48,18 @@ type ExternalEntityInterface interface { // externalEntities implements ExternalEntityInterface type externalEntities struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha2.ExternalEntity, *v1alpha2.ExternalEntityList] } // newExternalEntities returns a ExternalEntities func newExternalEntities(c *CrdV1alpha2Client, namespace string) *externalEntities { return &externalEntities{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha2.ExternalEntity, *v1alpha2.ExternalEntityList]( + "externalentities", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.ExternalEntity { return &v1alpha2.ExternalEntity{} }, + func() *v1alpha2.ExternalEntityList { return &v1alpha2.ExternalEntityList{} }), } } - -// Get takes name of the externalEntity, and returns the corresponding externalEntity object, and an error if there is any. -func (c *externalEntities) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ExternalEntity, err error) { - result = &v1alpha2.ExternalEntity{} - err = c.client.Get(). - Namespace(c.ns). - Resource("externalentities"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ExternalEntities that match those selectors. -func (c *externalEntities) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ExternalEntityList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.ExternalEntityList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("externalentities"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested externalEntities. -func (c *externalEntities) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("externalentities"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a externalEntity and creates it. Returns the server's representation of the externalEntity, and an error, if there is any. -func (c *externalEntities) Create(ctx context.Context, externalEntity *v1alpha2.ExternalEntity, opts v1.CreateOptions) (result *v1alpha2.ExternalEntity, err error) { - result = &v1alpha2.ExternalEntity{} - err = c.client.Post(). - Namespace(c.ns). - Resource("externalentities"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(externalEntity). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a externalEntity and updates it. Returns the server's representation of the externalEntity, and an error, if there is any. -func (c *externalEntities) Update(ctx context.Context, externalEntity *v1alpha2.ExternalEntity, opts v1.UpdateOptions) (result *v1alpha2.ExternalEntity, err error) { - result = &v1alpha2.ExternalEntity{} - err = c.client.Put(). - Namespace(c.ns). - Resource("externalentities"). - Name(externalEntity.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(externalEntity). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the externalEntity and deletes it. Returns an error if one occurs. -func (c *externalEntities) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("externalentities"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *externalEntities) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("externalentities"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched externalEntity. -func (c *externalEntities) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ExternalEntity, err error) { - result = &v1alpha2.ExternalEntity{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("externalentities"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_externalentity.go b/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_externalentity.go index d8c91d1c01a..bb76624790e 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_externalentity.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_externalentity.go @@ -39,22 +39,24 @@ var externalentitiesKind = v1alpha2.SchemeGroupVersion.WithKind("ExternalEntity" // Get takes name of the externalEntity, and returns the corresponding externalEntity object, and an error if there is any. func (c *FakeExternalEntities) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ExternalEntity, err error) { + emptyResult := &v1alpha2.ExternalEntity{} obj, err := c.Fake. - Invokes(testing.NewGetAction(externalentitiesResource, c.ns, name), &v1alpha2.ExternalEntity{}) + Invokes(testing.NewGetActionWithOptions(externalentitiesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ExternalEntity), err } // List takes label and field selectors, and returns the list of ExternalEntities that match those selectors. func (c *FakeExternalEntities) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ExternalEntityList, err error) { + emptyResult := &v1alpha2.ExternalEntityList{} obj, err := c.Fake. - Invokes(testing.NewListAction(externalentitiesResource, externalentitiesKind, c.ns, opts), &v1alpha2.ExternalEntityList{}) + Invokes(testing.NewListActionWithOptions(externalentitiesResource, externalentitiesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,28 +75,30 @@ func (c *FakeExternalEntities) List(ctx context.Context, opts v1.ListOptions) (r // Watch returns a watch.Interface that watches the requested externalEntities. func (c *FakeExternalEntities) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(externalentitiesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(externalentitiesResource, c.ns, opts)) } // Create takes the representation of a externalEntity and creates it. Returns the server's representation of the externalEntity, and an error, if there is any. func (c *FakeExternalEntities) Create(ctx context.Context, externalEntity *v1alpha2.ExternalEntity, opts v1.CreateOptions) (result *v1alpha2.ExternalEntity, err error) { + emptyResult := &v1alpha2.ExternalEntity{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(externalentitiesResource, c.ns, externalEntity), &v1alpha2.ExternalEntity{}) + Invokes(testing.NewCreateActionWithOptions(externalentitiesResource, c.ns, externalEntity, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ExternalEntity), err } // Update takes the representation of a externalEntity and updates it. Returns the server's representation of the externalEntity, and an error, if there is any. func (c *FakeExternalEntities) Update(ctx context.Context, externalEntity *v1alpha2.ExternalEntity, opts v1.UpdateOptions) (result *v1alpha2.ExternalEntity, err error) { + emptyResult := &v1alpha2.ExternalEntity{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(externalentitiesResource, c.ns, externalEntity), &v1alpha2.ExternalEntity{}) + Invokes(testing.NewUpdateActionWithOptions(externalentitiesResource, c.ns, externalEntity, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ExternalEntity), err } @@ -109,7 +113,7 @@ func (c *FakeExternalEntities) Delete(ctx context.Context, name string, opts v1. // DeleteCollection deletes a collection of objects. func (c *FakeExternalEntities) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(externalentitiesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(externalentitiesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.ExternalEntityList{}) return err @@ -117,11 +121,12 @@ func (c *FakeExternalEntities) DeleteCollection(ctx context.Context, opts v1.Del // Patch applies the patch and returns the patched externalEntity. func (c *FakeExternalEntities) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ExternalEntity, err error) { + emptyResult := &v1alpha2.ExternalEntity{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(externalentitiesResource, c.ns, name, pt, data, subresources...), &v1alpha2.ExternalEntity{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(externalentitiesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ExternalEntity), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_ippool.go b/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_ippool.go index fb98ea8e866..196f750ee05 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_ippool.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_ippool.go @@ -38,20 +38,22 @@ var ippoolsKind = v1alpha2.SchemeGroupVersion.WithKind("IPPool") // Get takes name of the iPPool, and returns the corresponding iPPool object, and an error if there is any. func (c *FakeIPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.IPPool, err error) { + emptyResult := &v1alpha2.IPPool{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ippoolsResource, name), &v1alpha2.IPPool{}) + Invokes(testing.NewRootGetActionWithOptions(ippoolsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.IPPool), err } // List takes label and field selectors, and returns the list of IPPools that match those selectors. func (c *FakeIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.IPPoolList, err error) { + emptyResult := &v1alpha2.IPPoolList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(ippoolsResource, ippoolsKind, opts), &v1alpha2.IPPoolList{}) + Invokes(testing.NewRootListActionWithOptions(ippoolsResource, ippoolsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,36 +72,39 @@ func (c *FakeIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v1 // Watch returns a watch.Interface that watches the requested iPPools. func (c *FakeIPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ippoolsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(ippoolsResource, opts)) } // Create takes the representation of a iPPool and creates it. Returns the server's representation of the iPPool, and an error, if there is any. func (c *FakeIPPools) Create(ctx context.Context, iPPool *v1alpha2.IPPool, opts v1.CreateOptions) (result *v1alpha2.IPPool, err error) { + emptyResult := &v1alpha2.IPPool{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ippoolsResource, iPPool), &v1alpha2.IPPool{}) + Invokes(testing.NewRootCreateActionWithOptions(ippoolsResource, iPPool, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.IPPool), err } // Update takes the representation of a iPPool and updates it. Returns the server's representation of the iPPool, and an error, if there is any. func (c *FakeIPPools) Update(ctx context.Context, iPPool *v1alpha2.IPPool, opts v1.UpdateOptions) (result *v1alpha2.IPPool, err error) { + emptyResult := &v1alpha2.IPPool{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ippoolsResource, iPPool), &v1alpha2.IPPool{}) + Invokes(testing.NewRootUpdateActionWithOptions(ippoolsResource, iPPool, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.IPPool), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeIPPools) UpdateStatus(ctx context.Context, iPPool *v1alpha2.IPPool, opts v1.UpdateOptions) (*v1alpha2.IPPool, error) { +func (c *FakeIPPools) UpdateStatus(ctx context.Context, iPPool *v1alpha2.IPPool, opts v1.UpdateOptions) (result *v1alpha2.IPPool, err error) { + emptyResult := &v1alpha2.IPPool{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(ippoolsResource, "status", iPPool), &v1alpha2.IPPool{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(ippoolsResource, "status", iPPool, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.IPPool), err } @@ -113,7 +118,7 @@ func (c *FakeIPPools) Delete(ctx context.Context, name string, opts v1.DeleteOpt // DeleteCollection deletes a collection of objects. func (c *FakeIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ippoolsResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(ippoolsResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.IPPoolList{}) return err @@ -121,10 +126,11 @@ func (c *FakeIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOption // Patch applies the patch and returns the patched iPPool. func (c *FakeIPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.IPPool, err error) { + emptyResult := &v1alpha2.IPPool{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ippoolsResource, name, pt, data, subresources...), &v1alpha2.IPPool{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(ippoolsResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.IPPool), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_trafficcontrol.go b/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_trafficcontrol.go index d956cef9b43..63ca7ce2d0b 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_trafficcontrol.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_trafficcontrol.go @@ -38,20 +38,22 @@ var trafficcontrolsKind = v1alpha2.SchemeGroupVersion.WithKind("TrafficControl") // Get takes name of the trafficControl, and returns the corresponding trafficControl object, and an error if there is any. func (c *FakeTrafficControls) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.TrafficControl, err error) { + emptyResult := &v1alpha2.TrafficControl{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(trafficcontrolsResource, name), &v1alpha2.TrafficControl{}) + Invokes(testing.NewRootGetActionWithOptions(trafficcontrolsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TrafficControl), err } // List takes label and field selectors, and returns the list of TrafficControls that match those selectors. func (c *FakeTrafficControls) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.TrafficControlList, err error) { + emptyResult := &v1alpha2.TrafficControlList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(trafficcontrolsResource, trafficcontrolsKind, opts), &v1alpha2.TrafficControlList{}) + Invokes(testing.NewRootListActionWithOptions(trafficcontrolsResource, trafficcontrolsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,25 +72,27 @@ func (c *FakeTrafficControls) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested trafficControls. func (c *FakeTrafficControls) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(trafficcontrolsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(trafficcontrolsResource, opts)) } // Create takes the representation of a trafficControl and creates it. Returns the server's representation of the trafficControl, and an error, if there is any. func (c *FakeTrafficControls) Create(ctx context.Context, trafficControl *v1alpha2.TrafficControl, opts v1.CreateOptions) (result *v1alpha2.TrafficControl, err error) { + emptyResult := &v1alpha2.TrafficControl{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(trafficcontrolsResource, trafficControl), &v1alpha2.TrafficControl{}) + Invokes(testing.NewRootCreateActionWithOptions(trafficcontrolsResource, trafficControl, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TrafficControl), err } // Update takes the representation of a trafficControl and updates it. Returns the server's representation of the trafficControl, and an error, if there is any. func (c *FakeTrafficControls) Update(ctx context.Context, trafficControl *v1alpha2.TrafficControl, opts v1.UpdateOptions) (result *v1alpha2.TrafficControl, err error) { + emptyResult := &v1alpha2.TrafficControl{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(trafficcontrolsResource, trafficControl), &v1alpha2.TrafficControl{}) + Invokes(testing.NewRootUpdateActionWithOptions(trafficcontrolsResource, trafficControl, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TrafficControl), err } @@ -102,7 +106,7 @@ func (c *FakeTrafficControls) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeTrafficControls) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(trafficcontrolsResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(trafficcontrolsResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.TrafficControlList{}) return err @@ -110,10 +114,11 @@ func (c *FakeTrafficControls) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched trafficControl. func (c *FakeTrafficControls) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.TrafficControl, err error) { + emptyResult := &v1alpha2.TrafficControl{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(trafficcontrolsResource, name, pt, data, subresources...), &v1alpha2.TrafficControl{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(trafficcontrolsResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TrafficControl), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha2/ippool.go b/pkg/client/clientset/versioned/typed/crd/v1alpha2/ippool.go index a2707764d90..1dcf13b566f 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha2/ippool.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha2/ippool.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha2 import ( "context" - "time" v1alpha2 "antrea.io/antrea/pkg/apis/crd/v1alpha2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // IPPoolsGetter has a method to return a IPPoolInterface. @@ -38,6 +37,7 @@ type IPPoolsGetter interface { type IPPoolInterface interface { Create(ctx context.Context, iPPool *v1alpha2.IPPool, opts v1.CreateOptions) (*v1alpha2.IPPool, error) Update(ctx context.Context, iPPool *v1alpha2.IPPool, opts v1.UpdateOptions) (*v1alpha2.IPPool, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, iPPool *v1alpha2.IPPool, opts v1.UpdateOptions) (*v1alpha2.IPPool, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,133 +50,18 @@ type IPPoolInterface interface { // iPPools implements IPPoolInterface type iPPools struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha2.IPPool, *v1alpha2.IPPoolList] } // newIPPools returns a IPPools func newIPPools(c *CrdV1alpha2Client) *iPPools { return &iPPools{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha2.IPPool, *v1alpha2.IPPoolList]( + "ippools", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha2.IPPool { return &v1alpha2.IPPool{} }, + func() *v1alpha2.IPPoolList { return &v1alpha2.IPPoolList{} }), } } - -// Get takes name of the iPPool, and returns the corresponding iPPool object, and an error if there is any. -func (c *iPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.IPPool, err error) { - result = &v1alpha2.IPPool{} - err = c.client.Get(). - Resource("ippools"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IPPools that match those selectors. -func (c *iPPools) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.IPPoolList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.IPPoolList{} - err = c.client.Get(). - Resource("ippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested iPPools. -func (c *iPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a iPPool and creates it. Returns the server's representation of the iPPool, and an error, if there is any. -func (c *iPPools) Create(ctx context.Context, iPPool *v1alpha2.IPPool, opts v1.CreateOptions) (result *v1alpha2.IPPool, err error) { - result = &v1alpha2.IPPool{} - err = c.client.Post(). - Resource("ippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPPool). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a iPPool and updates it. Returns the server's representation of the iPPool, and an error, if there is any. -func (c *iPPools) Update(ctx context.Context, iPPool *v1alpha2.IPPool, opts v1.UpdateOptions) (result *v1alpha2.IPPool, err error) { - result = &v1alpha2.IPPool{} - err = c.client.Put(). - Resource("ippools"). - Name(iPPool.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPPool). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *iPPools) UpdateStatus(ctx context.Context, iPPool *v1alpha2.IPPool, opts v1.UpdateOptions) (result *v1alpha2.IPPool, err error) { - result = &v1alpha2.IPPool{} - err = c.client.Put(). - Resource("ippools"). - Name(iPPool.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPPool). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the iPPool and deletes it. Returns an error if one occurs. -func (c *iPPools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ippools"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *iPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ippools"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched iPPool. -func (c *iPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.IPPool, err error) { - result = &v1alpha2.IPPool{} - err = c.client.Patch(pt). - Resource("ippools"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha2/trafficcontrol.go b/pkg/client/clientset/versioned/typed/crd/v1alpha2/trafficcontrol.go index 22145d61ce6..fbeea7a2d99 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha2/trafficcontrol.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha2/trafficcontrol.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1alpha2 import ( "context" - "time" v1alpha2 "antrea.io/antrea/pkg/apis/crd/v1alpha2" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // TrafficControlsGetter has a method to return a TrafficControlInterface. @@ -49,118 +48,18 @@ type TrafficControlInterface interface { // trafficControls implements TrafficControlInterface type trafficControls struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha2.TrafficControl, *v1alpha2.TrafficControlList] } // newTrafficControls returns a TrafficControls func newTrafficControls(c *CrdV1alpha2Client) *trafficControls { return &trafficControls{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha2.TrafficControl, *v1alpha2.TrafficControlList]( + "trafficcontrols", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha2.TrafficControl { return &v1alpha2.TrafficControl{} }, + func() *v1alpha2.TrafficControlList { return &v1alpha2.TrafficControlList{} }), } } - -// Get takes name of the trafficControl, and returns the corresponding trafficControl object, and an error if there is any. -func (c *trafficControls) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.TrafficControl, err error) { - result = &v1alpha2.TrafficControl{} - err = c.client.Get(). - Resource("trafficcontrols"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TrafficControls that match those selectors. -func (c *trafficControls) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.TrafficControlList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.TrafficControlList{} - err = c.client.Get(). - Resource("trafficcontrols"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested trafficControls. -func (c *trafficControls) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("trafficcontrols"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a trafficControl and creates it. Returns the server's representation of the trafficControl, and an error, if there is any. -func (c *trafficControls) Create(ctx context.Context, trafficControl *v1alpha2.TrafficControl, opts v1.CreateOptions) (result *v1alpha2.TrafficControl, err error) { - result = &v1alpha2.TrafficControl{} - err = c.client.Post(). - Resource("trafficcontrols"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(trafficControl). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a trafficControl and updates it. Returns the server's representation of the trafficControl, and an error, if there is any. -func (c *trafficControls) Update(ctx context.Context, trafficControl *v1alpha2.TrafficControl, opts v1.UpdateOptions) (result *v1alpha2.TrafficControl, err error) { - result = &v1alpha2.TrafficControl{} - err = c.client.Put(). - Resource("trafficcontrols"). - Name(trafficControl.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(trafficControl). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the trafficControl and deletes it. Returns an error if one occurs. -func (c *trafficControls) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("trafficcontrols"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *trafficControls) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("trafficcontrols"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched trafficControl. -func (c *trafficControls) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.TrafficControl, err error) { - result = &v1alpha2.TrafficControl{} - err = c.client.Patch(pt). - Resource("trafficcontrols"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/antreaagentinfo.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/antreaagentinfo.go index 980358a3939..5628f37cd05 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/antreaagentinfo.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/antreaagentinfo.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // AntreaAgentInfosGetter has a method to return a AntreaAgentInfoInterface. @@ -49,118 +48,18 @@ type AntreaAgentInfoInterface interface { // antreaAgentInfos implements AntreaAgentInfoInterface type antreaAgentInfos struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.AntreaAgentInfo, *v1beta1.AntreaAgentInfoList] } // newAntreaAgentInfos returns a AntreaAgentInfos func newAntreaAgentInfos(c *CrdV1beta1Client) *antreaAgentInfos { return &antreaAgentInfos{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.AntreaAgentInfo, *v1beta1.AntreaAgentInfoList]( + "antreaagentinfos", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.AntreaAgentInfo { return &v1beta1.AntreaAgentInfo{} }, + func() *v1beta1.AntreaAgentInfoList { return &v1beta1.AntreaAgentInfoList{} }), } } - -// Get takes name of the antreaAgentInfo, and returns the corresponding antreaAgentInfo object, and an error if there is any. -func (c *antreaAgentInfos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.AntreaAgentInfo, err error) { - result = &v1beta1.AntreaAgentInfo{} - err = c.client.Get(). - Resource("antreaagentinfos"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of AntreaAgentInfos that match those selectors. -func (c *antreaAgentInfos) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.AntreaAgentInfoList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.AntreaAgentInfoList{} - err = c.client.Get(). - Resource("antreaagentinfos"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested antreaAgentInfos. -func (c *antreaAgentInfos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("antreaagentinfos"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a antreaAgentInfo and creates it. Returns the server's representation of the antreaAgentInfo, and an error, if there is any. -func (c *antreaAgentInfos) Create(ctx context.Context, antreaAgentInfo *v1beta1.AntreaAgentInfo, opts v1.CreateOptions) (result *v1beta1.AntreaAgentInfo, err error) { - result = &v1beta1.AntreaAgentInfo{} - err = c.client.Post(). - Resource("antreaagentinfos"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(antreaAgentInfo). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a antreaAgentInfo and updates it. Returns the server's representation of the antreaAgentInfo, and an error, if there is any. -func (c *antreaAgentInfos) Update(ctx context.Context, antreaAgentInfo *v1beta1.AntreaAgentInfo, opts v1.UpdateOptions) (result *v1beta1.AntreaAgentInfo, err error) { - result = &v1beta1.AntreaAgentInfo{} - err = c.client.Put(). - Resource("antreaagentinfos"). - Name(antreaAgentInfo.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(antreaAgentInfo). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the antreaAgentInfo and deletes it. Returns an error if one occurs. -func (c *antreaAgentInfos) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("antreaagentinfos"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *antreaAgentInfos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("antreaagentinfos"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched antreaAgentInfo. -func (c *antreaAgentInfos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.AntreaAgentInfo, err error) { - result = &v1beta1.AntreaAgentInfo{} - err = c.client.Patch(pt). - Resource("antreaagentinfos"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/antreacontrollerinfo.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/antreacontrollerinfo.go index be4e97f2f93..58d6d8c8d54 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/antreacontrollerinfo.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/antreacontrollerinfo.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // AntreaControllerInfosGetter has a method to return a AntreaControllerInfoInterface. @@ -49,118 +48,18 @@ type AntreaControllerInfoInterface interface { // antreaControllerInfos implements AntreaControllerInfoInterface type antreaControllerInfos struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.AntreaControllerInfo, *v1beta1.AntreaControllerInfoList] } // newAntreaControllerInfos returns a AntreaControllerInfos func newAntreaControllerInfos(c *CrdV1beta1Client) *antreaControllerInfos { return &antreaControllerInfos{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.AntreaControllerInfo, *v1beta1.AntreaControllerInfoList]( + "antreacontrollerinfos", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.AntreaControllerInfo { return &v1beta1.AntreaControllerInfo{} }, + func() *v1beta1.AntreaControllerInfoList { return &v1beta1.AntreaControllerInfoList{} }), } } - -// Get takes name of the antreaControllerInfo, and returns the corresponding antreaControllerInfo object, and an error if there is any. -func (c *antreaControllerInfos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.AntreaControllerInfo, err error) { - result = &v1beta1.AntreaControllerInfo{} - err = c.client.Get(). - Resource("antreacontrollerinfos"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of AntreaControllerInfos that match those selectors. -func (c *antreaControllerInfos) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.AntreaControllerInfoList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.AntreaControllerInfoList{} - err = c.client.Get(). - Resource("antreacontrollerinfos"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested antreaControllerInfos. -func (c *antreaControllerInfos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("antreacontrollerinfos"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a antreaControllerInfo and creates it. Returns the server's representation of the antreaControllerInfo, and an error, if there is any. -func (c *antreaControllerInfos) Create(ctx context.Context, antreaControllerInfo *v1beta1.AntreaControllerInfo, opts v1.CreateOptions) (result *v1beta1.AntreaControllerInfo, err error) { - result = &v1beta1.AntreaControllerInfo{} - err = c.client.Post(). - Resource("antreacontrollerinfos"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(antreaControllerInfo). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a antreaControllerInfo and updates it. Returns the server's representation of the antreaControllerInfo, and an error, if there is any. -func (c *antreaControllerInfos) Update(ctx context.Context, antreaControllerInfo *v1beta1.AntreaControllerInfo, opts v1.UpdateOptions) (result *v1beta1.AntreaControllerInfo, err error) { - result = &v1beta1.AntreaControllerInfo{} - err = c.client.Put(). - Resource("antreacontrollerinfos"). - Name(antreaControllerInfo.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(antreaControllerInfo). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the antreaControllerInfo and deletes it. Returns an error if one occurs. -func (c *antreaControllerInfos) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("antreacontrollerinfos"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *antreaControllerInfos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("antreacontrollerinfos"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched antreaControllerInfo. -func (c *antreaControllerInfos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.AntreaControllerInfo, err error) { - result = &v1beta1.AntreaControllerInfo{} - err = c.client.Patch(pt). - Resource("antreacontrollerinfos"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/clustergroup.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/clustergroup.go index 315471e69fe..1e00195d680 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/clustergroup.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/clustergroup.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ClusterGroupsGetter has a method to return a ClusterGroupInterface. @@ -38,6 +37,7 @@ type ClusterGroupsGetter interface { type ClusterGroupInterface interface { Create(ctx context.Context, clusterGroup *v1beta1.ClusterGroup, opts v1.CreateOptions) (*v1beta1.ClusterGroup, error) Update(ctx context.Context, clusterGroup *v1beta1.ClusterGroup, opts v1.UpdateOptions) (*v1beta1.ClusterGroup, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterGroup *v1beta1.ClusterGroup, opts v1.UpdateOptions) (*v1beta1.ClusterGroup, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,133 +50,18 @@ type ClusterGroupInterface interface { // clusterGroups implements ClusterGroupInterface type clusterGroups struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.ClusterGroup, *v1beta1.ClusterGroupList] } // newClusterGroups returns a ClusterGroups func newClusterGroups(c *CrdV1beta1Client) *clusterGroups { return &clusterGroups{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.ClusterGroup, *v1beta1.ClusterGroupList]( + "clustergroups", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.ClusterGroup { return &v1beta1.ClusterGroup{} }, + func() *v1beta1.ClusterGroupList { return &v1beta1.ClusterGroupList{} }), } } - -// Get takes name of the clusterGroup, and returns the corresponding clusterGroup object, and an error if there is any. -func (c *clusterGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ClusterGroup, err error) { - result = &v1beta1.ClusterGroup{} - err = c.client.Get(). - Resource("clustergroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterGroups that match those selectors. -func (c *clusterGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ClusterGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.ClusterGroupList{} - err = c.client.Get(). - Resource("clustergroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterGroups. -func (c *clusterGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("clustergroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterGroup and creates it. Returns the server's representation of the clusterGroup, and an error, if there is any. -func (c *clusterGroups) Create(ctx context.Context, clusterGroup *v1beta1.ClusterGroup, opts v1.CreateOptions) (result *v1beta1.ClusterGroup, err error) { - result = &v1beta1.ClusterGroup{} - err = c.client.Post(). - Resource("clustergroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterGroup). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterGroup and updates it. Returns the server's representation of the clusterGroup, and an error, if there is any. -func (c *clusterGroups) Update(ctx context.Context, clusterGroup *v1beta1.ClusterGroup, opts v1.UpdateOptions) (result *v1beta1.ClusterGroup, err error) { - result = &v1beta1.ClusterGroup{} - err = c.client.Put(). - Resource("clustergroups"). - Name(clusterGroup.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterGroup). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *clusterGroups) UpdateStatus(ctx context.Context, clusterGroup *v1beta1.ClusterGroup, opts v1.UpdateOptions) (result *v1beta1.ClusterGroup, err error) { - result = &v1beta1.ClusterGroup{} - err = c.client.Put(). - Resource("clustergroups"). - Name(clusterGroup.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterGroup). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterGroup and deletes it. Returns an error if one occurs. -func (c *clusterGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("clustergroups"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("clustergroups"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterGroup. -func (c *clusterGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ClusterGroup, err error) { - result = &v1beta1.ClusterGroup{} - err = c.client.Patch(pt). - Resource("clustergroups"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/clusternetworkpolicy.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/clusternetworkpolicy.go index 95b3d52542f..22659ce65b4 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/clusternetworkpolicy.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/clusternetworkpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ClusterNetworkPoliciesGetter has a method to return a ClusterNetworkPolicyInterface. @@ -38,6 +37,7 @@ type ClusterNetworkPoliciesGetter interface { type ClusterNetworkPolicyInterface interface { Create(ctx context.Context, clusterNetworkPolicy *v1beta1.ClusterNetworkPolicy, opts v1.CreateOptions) (*v1beta1.ClusterNetworkPolicy, error) Update(ctx context.Context, clusterNetworkPolicy *v1beta1.ClusterNetworkPolicy, opts v1.UpdateOptions) (*v1beta1.ClusterNetworkPolicy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterNetworkPolicy *v1beta1.ClusterNetworkPolicy, opts v1.UpdateOptions) (*v1beta1.ClusterNetworkPolicy, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,133 +50,18 @@ type ClusterNetworkPolicyInterface interface { // clusterNetworkPolicies implements ClusterNetworkPolicyInterface type clusterNetworkPolicies struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.ClusterNetworkPolicy, *v1beta1.ClusterNetworkPolicyList] } // newClusterNetworkPolicies returns a ClusterNetworkPolicies func newClusterNetworkPolicies(c *CrdV1beta1Client) *clusterNetworkPolicies { return &clusterNetworkPolicies{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.ClusterNetworkPolicy, *v1beta1.ClusterNetworkPolicyList]( + "clusternetworkpolicies", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.ClusterNetworkPolicy { return &v1beta1.ClusterNetworkPolicy{} }, + func() *v1beta1.ClusterNetworkPolicyList { return &v1beta1.ClusterNetworkPolicyList{} }), } } - -// Get takes name of the clusterNetworkPolicy, and returns the corresponding clusterNetworkPolicy object, and an error if there is any. -func (c *clusterNetworkPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ClusterNetworkPolicy, err error) { - result = &v1beta1.ClusterNetworkPolicy{} - err = c.client.Get(). - Resource("clusternetworkpolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterNetworkPolicies that match those selectors. -func (c *clusterNetworkPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ClusterNetworkPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.ClusterNetworkPolicyList{} - err = c.client.Get(). - Resource("clusternetworkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterNetworkPolicies. -func (c *clusterNetworkPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("clusternetworkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterNetworkPolicy and creates it. Returns the server's representation of the clusterNetworkPolicy, and an error, if there is any. -func (c *clusterNetworkPolicies) Create(ctx context.Context, clusterNetworkPolicy *v1beta1.ClusterNetworkPolicy, opts v1.CreateOptions) (result *v1beta1.ClusterNetworkPolicy, err error) { - result = &v1beta1.ClusterNetworkPolicy{} - err = c.client.Post(). - Resource("clusternetworkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterNetworkPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterNetworkPolicy and updates it. Returns the server's representation of the clusterNetworkPolicy, and an error, if there is any. -func (c *clusterNetworkPolicies) Update(ctx context.Context, clusterNetworkPolicy *v1beta1.ClusterNetworkPolicy, opts v1.UpdateOptions) (result *v1beta1.ClusterNetworkPolicy, err error) { - result = &v1beta1.ClusterNetworkPolicy{} - err = c.client.Put(). - Resource("clusternetworkpolicies"). - Name(clusterNetworkPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterNetworkPolicy). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *clusterNetworkPolicies) UpdateStatus(ctx context.Context, clusterNetworkPolicy *v1beta1.ClusterNetworkPolicy, opts v1.UpdateOptions) (result *v1beta1.ClusterNetworkPolicy, err error) { - result = &v1beta1.ClusterNetworkPolicy{} - err = c.client.Put(). - Resource("clusternetworkpolicies"). - Name(clusterNetworkPolicy.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterNetworkPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterNetworkPolicy and deletes it. Returns an error if one occurs. -func (c *clusterNetworkPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("clusternetworkpolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterNetworkPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("clusternetworkpolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterNetworkPolicy. -func (c *clusterNetworkPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ClusterNetworkPolicy, err error) { - result = &v1beta1.ClusterNetworkPolicy{} - err = c.client.Patch(pt). - Resource("clusternetworkpolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/egress.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/egress.go index 298ca8b6af4..4e8fb2b61ec 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/egress.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/egress.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // EgressesGetter has a method to return a EgressInterface. @@ -38,6 +37,7 @@ type EgressesGetter interface { type EgressInterface interface { Create(ctx context.Context, egress *v1beta1.Egress, opts v1.CreateOptions) (*v1beta1.Egress, error) Update(ctx context.Context, egress *v1beta1.Egress, opts v1.UpdateOptions) (*v1beta1.Egress, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, egress *v1beta1.Egress, opts v1.UpdateOptions) (*v1beta1.Egress, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,133 +50,18 @@ type EgressInterface interface { // egresses implements EgressInterface type egresses struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.Egress, *v1beta1.EgressList] } // newEgresses returns a Egresses func newEgresses(c *CrdV1beta1Client) *egresses { return &egresses{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.Egress, *v1beta1.EgressList]( + "egresses", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.Egress { return &v1beta1.Egress{} }, + func() *v1beta1.EgressList { return &v1beta1.EgressList{} }), } } - -// Get takes name of the egress, and returns the corresponding egress object, and an error if there is any. -func (c *egresses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Egress, err error) { - result = &v1beta1.Egress{} - err = c.client.Get(). - Resource("egresses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Egresses that match those selectors. -func (c *egresses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.EgressList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.EgressList{} - err = c.client.Get(). - Resource("egresses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested egresses. -func (c *egresses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("egresses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a egress and creates it. Returns the server's representation of the egress, and an error, if there is any. -func (c *egresses) Create(ctx context.Context, egress *v1beta1.Egress, opts v1.CreateOptions) (result *v1beta1.Egress, err error) { - result = &v1beta1.Egress{} - err = c.client.Post(). - Resource("egresses"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(egress). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a egress and updates it. Returns the server's representation of the egress, and an error, if there is any. -func (c *egresses) Update(ctx context.Context, egress *v1beta1.Egress, opts v1.UpdateOptions) (result *v1beta1.Egress, err error) { - result = &v1beta1.Egress{} - err = c.client.Put(). - Resource("egresses"). - Name(egress.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(egress). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *egresses) UpdateStatus(ctx context.Context, egress *v1beta1.Egress, opts v1.UpdateOptions) (result *v1beta1.Egress, err error) { - result = &v1beta1.Egress{} - err = c.client.Put(). - Resource("egresses"). - Name(egress.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(egress). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the egress and deletes it. Returns an error if one occurs. -func (c *egresses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("egresses"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *egresses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("egresses"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched egress. -func (c *egresses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Egress, err error) { - result = &v1beta1.Egress{} - err = c.client.Patch(pt). - Resource("egresses"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/externalippool.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/externalippool.go index 95f8950f772..7a38e4a56bd 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/externalippool.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/externalippool.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ExternalIPPoolsGetter has a method to return a ExternalIPPoolInterface. @@ -38,6 +37,7 @@ type ExternalIPPoolsGetter interface { type ExternalIPPoolInterface interface { Create(ctx context.Context, externalIPPool *v1beta1.ExternalIPPool, opts v1.CreateOptions) (*v1beta1.ExternalIPPool, error) Update(ctx context.Context, externalIPPool *v1beta1.ExternalIPPool, opts v1.UpdateOptions) (*v1beta1.ExternalIPPool, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, externalIPPool *v1beta1.ExternalIPPool, opts v1.UpdateOptions) (*v1beta1.ExternalIPPool, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,133 +50,18 @@ type ExternalIPPoolInterface interface { // externalIPPools implements ExternalIPPoolInterface type externalIPPools struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.ExternalIPPool, *v1beta1.ExternalIPPoolList] } // newExternalIPPools returns a ExternalIPPools func newExternalIPPools(c *CrdV1beta1Client) *externalIPPools { return &externalIPPools{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.ExternalIPPool, *v1beta1.ExternalIPPoolList]( + "externalippools", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.ExternalIPPool { return &v1beta1.ExternalIPPool{} }, + func() *v1beta1.ExternalIPPoolList { return &v1beta1.ExternalIPPoolList{} }), } } - -// Get takes name of the externalIPPool, and returns the corresponding externalIPPool object, and an error if there is any. -func (c *externalIPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ExternalIPPool, err error) { - result = &v1beta1.ExternalIPPool{} - err = c.client.Get(). - Resource("externalippools"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ExternalIPPools that match those selectors. -func (c *externalIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ExternalIPPoolList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.ExternalIPPoolList{} - err = c.client.Get(). - Resource("externalippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested externalIPPools. -func (c *externalIPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("externalippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a externalIPPool and creates it. Returns the server's representation of the externalIPPool, and an error, if there is any. -func (c *externalIPPools) Create(ctx context.Context, externalIPPool *v1beta1.ExternalIPPool, opts v1.CreateOptions) (result *v1beta1.ExternalIPPool, err error) { - result = &v1beta1.ExternalIPPool{} - err = c.client.Post(). - Resource("externalippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(externalIPPool). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a externalIPPool and updates it. Returns the server's representation of the externalIPPool, and an error, if there is any. -func (c *externalIPPools) Update(ctx context.Context, externalIPPool *v1beta1.ExternalIPPool, opts v1.UpdateOptions) (result *v1beta1.ExternalIPPool, err error) { - result = &v1beta1.ExternalIPPool{} - err = c.client.Put(). - Resource("externalippools"). - Name(externalIPPool.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(externalIPPool). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *externalIPPools) UpdateStatus(ctx context.Context, externalIPPool *v1beta1.ExternalIPPool, opts v1.UpdateOptions) (result *v1beta1.ExternalIPPool, err error) { - result = &v1beta1.ExternalIPPool{} - err = c.client.Put(). - Resource("externalippools"). - Name(externalIPPool.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(externalIPPool). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the externalIPPool and deletes it. Returns an error if one occurs. -func (c *externalIPPools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("externalippools"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *externalIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("externalippools"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched externalIPPool. -func (c *externalIPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ExternalIPPool, err error) { - result = &v1beta1.ExternalIPPool{} - err = c.client.Patch(pt). - Resource("externalippools"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_antreaagentinfo.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_antreaagentinfo.go index efb9b127c20..83fb5766a86 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_antreaagentinfo.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_antreaagentinfo.go @@ -38,20 +38,22 @@ var antreaagentinfosKind = v1beta1.SchemeGroupVersion.WithKind("AntreaAgentInfo" // Get takes name of the antreaAgentInfo, and returns the corresponding antreaAgentInfo object, and an error if there is any. func (c *FakeAntreaAgentInfos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.AntreaAgentInfo, err error) { + emptyResult := &v1beta1.AntreaAgentInfo{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(antreaagentinfosResource, name), &v1beta1.AntreaAgentInfo{}) + Invokes(testing.NewRootGetActionWithOptions(antreaagentinfosResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AntreaAgentInfo), err } // List takes label and field selectors, and returns the list of AntreaAgentInfos that match those selectors. func (c *FakeAntreaAgentInfos) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.AntreaAgentInfoList, err error) { + emptyResult := &v1beta1.AntreaAgentInfoList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(antreaagentinfosResource, antreaagentinfosKind, opts), &v1beta1.AntreaAgentInfoList{}) + Invokes(testing.NewRootListActionWithOptions(antreaagentinfosResource, antreaagentinfosKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,25 +72,27 @@ func (c *FakeAntreaAgentInfos) List(ctx context.Context, opts v1.ListOptions) (r // Watch returns a watch.Interface that watches the requested antreaAgentInfos. func (c *FakeAntreaAgentInfos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(antreaagentinfosResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(antreaagentinfosResource, opts)) } // Create takes the representation of a antreaAgentInfo and creates it. Returns the server's representation of the antreaAgentInfo, and an error, if there is any. func (c *FakeAntreaAgentInfos) Create(ctx context.Context, antreaAgentInfo *v1beta1.AntreaAgentInfo, opts v1.CreateOptions) (result *v1beta1.AntreaAgentInfo, err error) { + emptyResult := &v1beta1.AntreaAgentInfo{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(antreaagentinfosResource, antreaAgentInfo), &v1beta1.AntreaAgentInfo{}) + Invokes(testing.NewRootCreateActionWithOptions(antreaagentinfosResource, antreaAgentInfo, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AntreaAgentInfo), err } // Update takes the representation of a antreaAgentInfo and updates it. Returns the server's representation of the antreaAgentInfo, and an error, if there is any. func (c *FakeAntreaAgentInfos) Update(ctx context.Context, antreaAgentInfo *v1beta1.AntreaAgentInfo, opts v1.UpdateOptions) (result *v1beta1.AntreaAgentInfo, err error) { + emptyResult := &v1beta1.AntreaAgentInfo{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(antreaagentinfosResource, antreaAgentInfo), &v1beta1.AntreaAgentInfo{}) + Invokes(testing.NewRootUpdateActionWithOptions(antreaagentinfosResource, antreaAgentInfo, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AntreaAgentInfo), err } @@ -102,7 +106,7 @@ func (c *FakeAntreaAgentInfos) Delete(ctx context.Context, name string, opts v1. // DeleteCollection deletes a collection of objects. func (c *FakeAntreaAgentInfos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(antreaagentinfosResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(antreaagentinfosResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.AntreaAgentInfoList{}) return err @@ -110,10 +114,11 @@ func (c *FakeAntreaAgentInfos) DeleteCollection(ctx context.Context, opts v1.Del // Patch applies the patch and returns the patched antreaAgentInfo. func (c *FakeAntreaAgentInfos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.AntreaAgentInfo, err error) { + emptyResult := &v1beta1.AntreaAgentInfo{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(antreaagentinfosResource, name, pt, data, subresources...), &v1beta1.AntreaAgentInfo{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(antreaagentinfosResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AntreaAgentInfo), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_antreacontrollerinfo.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_antreacontrollerinfo.go index 5d7717603dd..9dafff97d83 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_antreacontrollerinfo.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_antreacontrollerinfo.go @@ -38,20 +38,22 @@ var antreacontrollerinfosKind = v1beta1.SchemeGroupVersion.WithKind("AntreaContr // Get takes name of the antreaControllerInfo, and returns the corresponding antreaControllerInfo object, and an error if there is any. func (c *FakeAntreaControllerInfos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.AntreaControllerInfo, err error) { + emptyResult := &v1beta1.AntreaControllerInfo{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(antreacontrollerinfosResource, name), &v1beta1.AntreaControllerInfo{}) + Invokes(testing.NewRootGetActionWithOptions(antreacontrollerinfosResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AntreaControllerInfo), err } // List takes label and field selectors, and returns the list of AntreaControllerInfos that match those selectors. func (c *FakeAntreaControllerInfos) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.AntreaControllerInfoList, err error) { + emptyResult := &v1beta1.AntreaControllerInfoList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(antreacontrollerinfosResource, antreacontrollerinfosKind, opts), &v1beta1.AntreaControllerInfoList{}) + Invokes(testing.NewRootListActionWithOptions(antreacontrollerinfosResource, antreacontrollerinfosKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,25 +72,27 @@ func (c *FakeAntreaControllerInfos) List(ctx context.Context, opts v1.ListOption // Watch returns a watch.Interface that watches the requested antreaControllerInfos. func (c *FakeAntreaControllerInfos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(antreacontrollerinfosResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(antreacontrollerinfosResource, opts)) } // Create takes the representation of a antreaControllerInfo and creates it. Returns the server's representation of the antreaControllerInfo, and an error, if there is any. func (c *FakeAntreaControllerInfos) Create(ctx context.Context, antreaControllerInfo *v1beta1.AntreaControllerInfo, opts v1.CreateOptions) (result *v1beta1.AntreaControllerInfo, err error) { + emptyResult := &v1beta1.AntreaControllerInfo{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(antreacontrollerinfosResource, antreaControllerInfo), &v1beta1.AntreaControllerInfo{}) + Invokes(testing.NewRootCreateActionWithOptions(antreacontrollerinfosResource, antreaControllerInfo, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AntreaControllerInfo), err } // Update takes the representation of a antreaControllerInfo and updates it. Returns the server's representation of the antreaControllerInfo, and an error, if there is any. func (c *FakeAntreaControllerInfos) Update(ctx context.Context, antreaControllerInfo *v1beta1.AntreaControllerInfo, opts v1.UpdateOptions) (result *v1beta1.AntreaControllerInfo, err error) { + emptyResult := &v1beta1.AntreaControllerInfo{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(antreacontrollerinfosResource, antreaControllerInfo), &v1beta1.AntreaControllerInfo{}) + Invokes(testing.NewRootUpdateActionWithOptions(antreacontrollerinfosResource, antreaControllerInfo, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AntreaControllerInfo), err } @@ -102,7 +106,7 @@ func (c *FakeAntreaControllerInfos) Delete(ctx context.Context, name string, opt // DeleteCollection deletes a collection of objects. func (c *FakeAntreaControllerInfos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(antreacontrollerinfosResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(antreacontrollerinfosResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.AntreaControllerInfoList{}) return err @@ -110,10 +114,11 @@ func (c *FakeAntreaControllerInfos) DeleteCollection(ctx context.Context, opts v // Patch applies the patch and returns the patched antreaControllerInfo. func (c *FakeAntreaControllerInfos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.AntreaControllerInfo, err error) { + emptyResult := &v1beta1.AntreaControllerInfo{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(antreacontrollerinfosResource, name, pt, data, subresources...), &v1beta1.AntreaControllerInfo{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(antreacontrollerinfosResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AntreaControllerInfo), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_clustergroup.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_clustergroup.go index 7e588a5a72e..8067bdb693f 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_clustergroup.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_clustergroup.go @@ -38,20 +38,22 @@ var clustergroupsKind = v1beta1.SchemeGroupVersion.WithKind("ClusterGroup") // Get takes name of the clusterGroup, and returns the corresponding clusterGroup object, and an error if there is any. func (c *FakeClusterGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ClusterGroup, err error) { + emptyResult := &v1beta1.ClusterGroup{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clustergroupsResource, name), &v1beta1.ClusterGroup{}) + Invokes(testing.NewRootGetActionWithOptions(clustergroupsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterGroup), err } // List takes label and field selectors, and returns the list of ClusterGroups that match those selectors. func (c *FakeClusterGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ClusterGroupList, err error) { + emptyResult := &v1beta1.ClusterGroupList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(clustergroupsResource, clustergroupsKind, opts), &v1beta1.ClusterGroupList{}) + Invokes(testing.NewRootListActionWithOptions(clustergroupsResource, clustergroupsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,36 +72,39 @@ func (c *FakeClusterGroups) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested clusterGroups. func (c *FakeClusterGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(clustergroupsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(clustergroupsResource, opts)) } // Create takes the representation of a clusterGroup and creates it. Returns the server's representation of the clusterGroup, and an error, if there is any. func (c *FakeClusterGroups) Create(ctx context.Context, clusterGroup *v1beta1.ClusterGroup, opts v1.CreateOptions) (result *v1beta1.ClusterGroup, err error) { + emptyResult := &v1beta1.ClusterGroup{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clustergroupsResource, clusterGroup), &v1beta1.ClusterGroup{}) + Invokes(testing.NewRootCreateActionWithOptions(clustergroupsResource, clusterGroup, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterGroup), err } // Update takes the representation of a clusterGroup and updates it. Returns the server's representation of the clusterGroup, and an error, if there is any. func (c *FakeClusterGroups) Update(ctx context.Context, clusterGroup *v1beta1.ClusterGroup, opts v1.UpdateOptions) (result *v1beta1.ClusterGroup, err error) { + emptyResult := &v1beta1.ClusterGroup{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clustergroupsResource, clusterGroup), &v1beta1.ClusterGroup{}) + Invokes(testing.NewRootUpdateActionWithOptions(clustergroupsResource, clusterGroup, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterGroup), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeClusterGroups) UpdateStatus(ctx context.Context, clusterGroup *v1beta1.ClusterGroup, opts v1.UpdateOptions) (*v1beta1.ClusterGroup, error) { +func (c *FakeClusterGroups) UpdateStatus(ctx context.Context, clusterGroup *v1beta1.ClusterGroup, opts v1.UpdateOptions) (result *v1beta1.ClusterGroup, err error) { + emptyResult := &v1beta1.ClusterGroup{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(clustergroupsResource, "status", clusterGroup), &v1beta1.ClusterGroup{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clustergroupsResource, "status", clusterGroup, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterGroup), err } @@ -113,7 +118,7 @@ func (c *FakeClusterGroups) Delete(ctx context.Context, name string, opts v1.Del // DeleteCollection deletes a collection of objects. func (c *FakeClusterGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(clustergroupsResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(clustergroupsResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.ClusterGroupList{}) return err @@ -121,10 +126,11 @@ func (c *FakeClusterGroups) DeleteCollection(ctx context.Context, opts v1.Delete // Patch applies the patch and returns the patched clusterGroup. func (c *FakeClusterGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ClusterGroup, err error) { + emptyResult := &v1beta1.ClusterGroup{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clustergroupsResource, name, pt, data, subresources...), &v1beta1.ClusterGroup{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustergroupsResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterGroup), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_clusternetworkpolicy.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_clusternetworkpolicy.go index 6d535fa435b..41445485400 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_clusternetworkpolicy.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_clusternetworkpolicy.go @@ -38,20 +38,22 @@ var clusternetworkpoliciesKind = v1beta1.SchemeGroupVersion.WithKind("ClusterNet // Get takes name of the clusterNetworkPolicy, and returns the corresponding clusterNetworkPolicy object, and an error if there is any. func (c *FakeClusterNetworkPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ClusterNetworkPolicy, err error) { + emptyResult := &v1beta1.ClusterNetworkPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clusternetworkpoliciesResource, name), &v1beta1.ClusterNetworkPolicy{}) + Invokes(testing.NewRootGetActionWithOptions(clusternetworkpoliciesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterNetworkPolicy), err } // List takes label and field selectors, and returns the list of ClusterNetworkPolicies that match those selectors. func (c *FakeClusterNetworkPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ClusterNetworkPolicyList, err error) { + emptyResult := &v1beta1.ClusterNetworkPolicyList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(clusternetworkpoliciesResource, clusternetworkpoliciesKind, opts), &v1beta1.ClusterNetworkPolicyList{}) + Invokes(testing.NewRootListActionWithOptions(clusternetworkpoliciesResource, clusternetworkpoliciesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,36 +72,39 @@ func (c *FakeClusterNetworkPolicies) List(ctx context.Context, opts v1.ListOptio // Watch returns a watch.Interface that watches the requested clusterNetworkPolicies. func (c *FakeClusterNetworkPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(clusternetworkpoliciesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(clusternetworkpoliciesResource, opts)) } // Create takes the representation of a clusterNetworkPolicy and creates it. Returns the server's representation of the clusterNetworkPolicy, and an error, if there is any. func (c *FakeClusterNetworkPolicies) Create(ctx context.Context, clusterNetworkPolicy *v1beta1.ClusterNetworkPolicy, opts v1.CreateOptions) (result *v1beta1.ClusterNetworkPolicy, err error) { + emptyResult := &v1beta1.ClusterNetworkPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clusternetworkpoliciesResource, clusterNetworkPolicy), &v1beta1.ClusterNetworkPolicy{}) + Invokes(testing.NewRootCreateActionWithOptions(clusternetworkpoliciesResource, clusterNetworkPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterNetworkPolicy), err } // Update takes the representation of a clusterNetworkPolicy and updates it. Returns the server's representation of the clusterNetworkPolicy, and an error, if there is any. func (c *FakeClusterNetworkPolicies) Update(ctx context.Context, clusterNetworkPolicy *v1beta1.ClusterNetworkPolicy, opts v1.UpdateOptions) (result *v1beta1.ClusterNetworkPolicy, err error) { + emptyResult := &v1beta1.ClusterNetworkPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clusternetworkpoliciesResource, clusterNetworkPolicy), &v1beta1.ClusterNetworkPolicy{}) + Invokes(testing.NewRootUpdateActionWithOptions(clusternetworkpoliciesResource, clusterNetworkPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterNetworkPolicy), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeClusterNetworkPolicies) UpdateStatus(ctx context.Context, clusterNetworkPolicy *v1beta1.ClusterNetworkPolicy, opts v1.UpdateOptions) (*v1beta1.ClusterNetworkPolicy, error) { +func (c *FakeClusterNetworkPolicies) UpdateStatus(ctx context.Context, clusterNetworkPolicy *v1beta1.ClusterNetworkPolicy, opts v1.UpdateOptions) (result *v1beta1.ClusterNetworkPolicy, err error) { + emptyResult := &v1beta1.ClusterNetworkPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(clusternetworkpoliciesResource, "status", clusterNetworkPolicy), &v1beta1.ClusterNetworkPolicy{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clusternetworkpoliciesResource, "status", clusterNetworkPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterNetworkPolicy), err } @@ -113,7 +118,7 @@ func (c *FakeClusterNetworkPolicies) Delete(ctx context.Context, name string, op // DeleteCollection deletes a collection of objects. func (c *FakeClusterNetworkPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(clusternetworkpoliciesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(clusternetworkpoliciesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.ClusterNetworkPolicyList{}) return err @@ -121,10 +126,11 @@ func (c *FakeClusterNetworkPolicies) DeleteCollection(ctx context.Context, opts // Patch applies the patch and returns the patched clusterNetworkPolicy. func (c *FakeClusterNetworkPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ClusterNetworkPolicy, err error) { + emptyResult := &v1beta1.ClusterNetworkPolicy{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clusternetworkpoliciesResource, name, pt, data, subresources...), &v1beta1.ClusterNetworkPolicy{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clusternetworkpoliciesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterNetworkPolicy), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_egress.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_egress.go index 22c8cb47e87..a9186eba315 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_egress.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_egress.go @@ -38,20 +38,22 @@ var egressesKind = v1beta1.SchemeGroupVersion.WithKind("Egress") // Get takes name of the egress, and returns the corresponding egress object, and an error if there is any. func (c *FakeEgresses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Egress, err error) { + emptyResult := &v1beta1.Egress{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(egressesResource, name), &v1beta1.Egress{}) + Invokes(testing.NewRootGetActionWithOptions(egressesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Egress), err } // List takes label and field selectors, and returns the list of Egresses that match those selectors. func (c *FakeEgresses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.EgressList, err error) { + emptyResult := &v1beta1.EgressList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(egressesResource, egressesKind, opts), &v1beta1.EgressList{}) + Invokes(testing.NewRootListActionWithOptions(egressesResource, egressesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,36 +72,39 @@ func (c *FakeEgresses) List(ctx context.Context, opts v1.ListOptions) (result *v // Watch returns a watch.Interface that watches the requested egresses. func (c *FakeEgresses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(egressesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(egressesResource, opts)) } // Create takes the representation of a egress and creates it. Returns the server's representation of the egress, and an error, if there is any. func (c *FakeEgresses) Create(ctx context.Context, egress *v1beta1.Egress, opts v1.CreateOptions) (result *v1beta1.Egress, err error) { + emptyResult := &v1beta1.Egress{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(egressesResource, egress), &v1beta1.Egress{}) + Invokes(testing.NewRootCreateActionWithOptions(egressesResource, egress, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Egress), err } // Update takes the representation of a egress and updates it. Returns the server's representation of the egress, and an error, if there is any. func (c *FakeEgresses) Update(ctx context.Context, egress *v1beta1.Egress, opts v1.UpdateOptions) (result *v1beta1.Egress, err error) { + emptyResult := &v1beta1.Egress{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(egressesResource, egress), &v1beta1.Egress{}) + Invokes(testing.NewRootUpdateActionWithOptions(egressesResource, egress, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Egress), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeEgresses) UpdateStatus(ctx context.Context, egress *v1beta1.Egress, opts v1.UpdateOptions) (*v1beta1.Egress, error) { +func (c *FakeEgresses) UpdateStatus(ctx context.Context, egress *v1beta1.Egress, opts v1.UpdateOptions) (result *v1beta1.Egress, err error) { + emptyResult := &v1beta1.Egress{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(egressesResource, "status", egress), &v1beta1.Egress{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(egressesResource, "status", egress, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Egress), err } @@ -113,7 +118,7 @@ func (c *FakeEgresses) Delete(ctx context.Context, name string, opts v1.DeleteOp // DeleteCollection deletes a collection of objects. func (c *FakeEgresses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(egressesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(egressesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.EgressList{}) return err @@ -121,10 +126,11 @@ func (c *FakeEgresses) DeleteCollection(ctx context.Context, opts v1.DeleteOptio // Patch applies the patch and returns the patched egress. func (c *FakeEgresses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Egress, err error) { + emptyResult := &v1beta1.Egress{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(egressesResource, name, pt, data, subresources...), &v1beta1.Egress{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(egressesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Egress), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_externalippool.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_externalippool.go index 7380012b33c..de3a23101a3 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_externalippool.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_externalippool.go @@ -38,20 +38,22 @@ var externalippoolsKind = v1beta1.SchemeGroupVersion.WithKind("ExternalIPPool") // Get takes name of the externalIPPool, and returns the corresponding externalIPPool object, and an error if there is any. func (c *FakeExternalIPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ExternalIPPool, err error) { + emptyResult := &v1beta1.ExternalIPPool{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(externalippoolsResource, name), &v1beta1.ExternalIPPool{}) + Invokes(testing.NewRootGetActionWithOptions(externalippoolsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ExternalIPPool), err } // List takes label and field selectors, and returns the list of ExternalIPPools that match those selectors. func (c *FakeExternalIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ExternalIPPoolList, err error) { + emptyResult := &v1beta1.ExternalIPPoolList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(externalippoolsResource, externalippoolsKind, opts), &v1beta1.ExternalIPPoolList{}) + Invokes(testing.NewRootListActionWithOptions(externalippoolsResource, externalippoolsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,36 +72,39 @@ func (c *FakeExternalIPPools) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested externalIPPools. func (c *FakeExternalIPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(externalippoolsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(externalippoolsResource, opts)) } // Create takes the representation of a externalIPPool and creates it. Returns the server's representation of the externalIPPool, and an error, if there is any. func (c *FakeExternalIPPools) Create(ctx context.Context, externalIPPool *v1beta1.ExternalIPPool, opts v1.CreateOptions) (result *v1beta1.ExternalIPPool, err error) { + emptyResult := &v1beta1.ExternalIPPool{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(externalippoolsResource, externalIPPool), &v1beta1.ExternalIPPool{}) + Invokes(testing.NewRootCreateActionWithOptions(externalippoolsResource, externalIPPool, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ExternalIPPool), err } // Update takes the representation of a externalIPPool and updates it. Returns the server's representation of the externalIPPool, and an error, if there is any. func (c *FakeExternalIPPools) Update(ctx context.Context, externalIPPool *v1beta1.ExternalIPPool, opts v1.UpdateOptions) (result *v1beta1.ExternalIPPool, err error) { + emptyResult := &v1beta1.ExternalIPPool{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(externalippoolsResource, externalIPPool), &v1beta1.ExternalIPPool{}) + Invokes(testing.NewRootUpdateActionWithOptions(externalippoolsResource, externalIPPool, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ExternalIPPool), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeExternalIPPools) UpdateStatus(ctx context.Context, externalIPPool *v1beta1.ExternalIPPool, opts v1.UpdateOptions) (*v1beta1.ExternalIPPool, error) { +func (c *FakeExternalIPPools) UpdateStatus(ctx context.Context, externalIPPool *v1beta1.ExternalIPPool, opts v1.UpdateOptions) (result *v1beta1.ExternalIPPool, err error) { + emptyResult := &v1beta1.ExternalIPPool{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(externalippoolsResource, "status", externalIPPool), &v1beta1.ExternalIPPool{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(externalippoolsResource, "status", externalIPPool, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ExternalIPPool), err } @@ -113,7 +118,7 @@ func (c *FakeExternalIPPools) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeExternalIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(externalippoolsResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(externalippoolsResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.ExternalIPPoolList{}) return err @@ -121,10 +126,11 @@ func (c *FakeExternalIPPools) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched externalIPPool. func (c *FakeExternalIPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ExternalIPPool, err error) { + emptyResult := &v1beta1.ExternalIPPool{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(externalippoolsResource, name, pt, data, subresources...), &v1beta1.ExternalIPPool{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(externalippoolsResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ExternalIPPool), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_group.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_group.go index 2a4842270a7..8ed7394c663 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_group.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_group.go @@ -39,22 +39,24 @@ var groupsKind = v1beta1.SchemeGroupVersion.WithKind("Group") // Get takes name of the group, and returns the corresponding group object, and an error if there is any. func (c *FakeGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Group, err error) { + emptyResult := &v1beta1.Group{} obj, err := c.Fake. - Invokes(testing.NewGetAction(groupsResource, c.ns, name), &v1beta1.Group{}) + Invokes(testing.NewGetActionWithOptions(groupsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Group), err } // List takes label and field selectors, and returns the list of Groups that match those selectors. func (c *FakeGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.GroupList, err error) { + emptyResult := &v1beta1.GroupList{} obj, err := c.Fake. - Invokes(testing.NewListAction(groupsResource, groupsKind, c.ns, opts), &v1beta1.GroupList{}) + Invokes(testing.NewListActionWithOptions(groupsResource, groupsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,40 +75,43 @@ func (c *FakeGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1b // Watch returns a watch.Interface that watches the requested groups. func (c *FakeGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(groupsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(groupsResource, c.ns, opts)) } // Create takes the representation of a group and creates it. Returns the server's representation of the group, and an error, if there is any. func (c *FakeGroups) Create(ctx context.Context, group *v1beta1.Group, opts v1.CreateOptions) (result *v1beta1.Group, err error) { + emptyResult := &v1beta1.Group{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(groupsResource, c.ns, group), &v1beta1.Group{}) + Invokes(testing.NewCreateActionWithOptions(groupsResource, c.ns, group, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Group), err } // Update takes the representation of a group and updates it. Returns the server's representation of the group, and an error, if there is any. func (c *FakeGroups) Update(ctx context.Context, group *v1beta1.Group, opts v1.UpdateOptions) (result *v1beta1.Group, err error) { + emptyResult := &v1beta1.Group{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(groupsResource, c.ns, group), &v1beta1.Group{}) + Invokes(testing.NewUpdateActionWithOptions(groupsResource, c.ns, group, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Group), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeGroups) UpdateStatus(ctx context.Context, group *v1beta1.Group, opts v1.UpdateOptions) (*v1beta1.Group, error) { +func (c *FakeGroups) UpdateStatus(ctx context.Context, group *v1beta1.Group, opts v1.UpdateOptions) (result *v1beta1.Group, err error) { + emptyResult := &v1beta1.Group{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(groupsResource, "status", c.ns, group), &v1beta1.Group{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(groupsResource, "status", c.ns, group, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Group), err } @@ -121,7 +126,7 @@ func (c *FakeGroups) Delete(ctx context.Context, name string, opts v1.DeleteOpti // DeleteCollection deletes a collection of objects. func (c *FakeGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(groupsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(groupsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.GroupList{}) return err @@ -129,11 +134,12 @@ func (c *FakeGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions // Patch applies the patch and returns the patched group. func (c *FakeGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Group, err error) { + emptyResult := &v1beta1.Group{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(groupsResource, c.ns, name, pt, data, subresources...), &v1beta1.Group{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(groupsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Group), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_ippool.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_ippool.go index 9e23c4ebd9f..348092e9bff 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_ippool.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_ippool.go @@ -38,20 +38,22 @@ var ippoolsKind = v1beta1.SchemeGroupVersion.WithKind("IPPool") // Get takes name of the iPPool, and returns the corresponding iPPool object, and an error if there is any. func (c *FakeIPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.IPPool, err error) { + emptyResult := &v1beta1.IPPool{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ippoolsResource, name), &v1beta1.IPPool{}) + Invokes(testing.NewRootGetActionWithOptions(ippoolsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.IPPool), err } // List takes label and field selectors, and returns the list of IPPools that match those selectors. func (c *FakeIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.IPPoolList, err error) { + emptyResult := &v1beta1.IPPoolList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(ippoolsResource, ippoolsKind, opts), &v1beta1.IPPoolList{}) + Invokes(testing.NewRootListActionWithOptions(ippoolsResource, ippoolsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,36 +72,39 @@ func (c *FakeIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v1 // Watch returns a watch.Interface that watches the requested iPPools. func (c *FakeIPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ippoolsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(ippoolsResource, opts)) } // Create takes the representation of a iPPool and creates it. Returns the server's representation of the iPPool, and an error, if there is any. func (c *FakeIPPools) Create(ctx context.Context, iPPool *v1beta1.IPPool, opts v1.CreateOptions) (result *v1beta1.IPPool, err error) { + emptyResult := &v1beta1.IPPool{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ippoolsResource, iPPool), &v1beta1.IPPool{}) + Invokes(testing.NewRootCreateActionWithOptions(ippoolsResource, iPPool, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.IPPool), err } // Update takes the representation of a iPPool and updates it. Returns the server's representation of the iPPool, and an error, if there is any. func (c *FakeIPPools) Update(ctx context.Context, iPPool *v1beta1.IPPool, opts v1.UpdateOptions) (result *v1beta1.IPPool, err error) { + emptyResult := &v1beta1.IPPool{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ippoolsResource, iPPool), &v1beta1.IPPool{}) + Invokes(testing.NewRootUpdateActionWithOptions(ippoolsResource, iPPool, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.IPPool), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeIPPools) UpdateStatus(ctx context.Context, iPPool *v1beta1.IPPool, opts v1.UpdateOptions) (*v1beta1.IPPool, error) { +func (c *FakeIPPools) UpdateStatus(ctx context.Context, iPPool *v1beta1.IPPool, opts v1.UpdateOptions) (result *v1beta1.IPPool, err error) { + emptyResult := &v1beta1.IPPool{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(ippoolsResource, "status", iPPool), &v1beta1.IPPool{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(ippoolsResource, "status", iPPool, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.IPPool), err } @@ -113,7 +118,7 @@ func (c *FakeIPPools) Delete(ctx context.Context, name string, opts v1.DeleteOpt // DeleteCollection deletes a collection of objects. func (c *FakeIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ippoolsResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(ippoolsResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.IPPoolList{}) return err @@ -121,10 +126,11 @@ func (c *FakeIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOption // Patch applies the patch and returns the patched iPPool. func (c *FakeIPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.IPPool, err error) { + emptyResult := &v1beta1.IPPool{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ippoolsResource, name, pt, data, subresources...), &v1beta1.IPPool{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(ippoolsResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.IPPool), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_networkpolicy.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_networkpolicy.go index 91204112417..5c6897a7695 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_networkpolicy.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_networkpolicy.go @@ -39,22 +39,24 @@ var networkpoliciesKind = v1beta1.SchemeGroupVersion.WithKind("NetworkPolicy") // Get takes name of the networkPolicy, and returns the corresponding networkPolicy object, and an error if there is any. func (c *FakeNetworkPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.NetworkPolicy, err error) { + emptyResult := &v1beta1.NetworkPolicy{} obj, err := c.Fake. - Invokes(testing.NewGetAction(networkpoliciesResource, c.ns, name), &v1beta1.NetworkPolicy{}) + Invokes(testing.NewGetActionWithOptions(networkpoliciesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.NetworkPolicy), err } // List takes label and field selectors, and returns the list of NetworkPolicies that match those selectors. func (c *FakeNetworkPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.NetworkPolicyList, err error) { + emptyResult := &v1beta1.NetworkPolicyList{} obj, err := c.Fake. - Invokes(testing.NewListAction(networkpoliciesResource, networkpoliciesKind, c.ns, opts), &v1beta1.NetworkPolicyList{}) + Invokes(testing.NewListActionWithOptions(networkpoliciesResource, networkpoliciesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,40 +75,43 @@ func (c *FakeNetworkPolicies) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested networkPolicies. func (c *FakeNetworkPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(networkpoliciesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(networkpoliciesResource, c.ns, opts)) } // Create takes the representation of a networkPolicy and creates it. Returns the server's representation of the networkPolicy, and an error, if there is any. func (c *FakeNetworkPolicies) Create(ctx context.Context, networkPolicy *v1beta1.NetworkPolicy, opts v1.CreateOptions) (result *v1beta1.NetworkPolicy, err error) { + emptyResult := &v1beta1.NetworkPolicy{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(networkpoliciesResource, c.ns, networkPolicy), &v1beta1.NetworkPolicy{}) + Invokes(testing.NewCreateActionWithOptions(networkpoliciesResource, c.ns, networkPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.NetworkPolicy), err } // Update takes the representation of a networkPolicy and updates it. Returns the server's representation of the networkPolicy, and an error, if there is any. func (c *FakeNetworkPolicies) Update(ctx context.Context, networkPolicy *v1beta1.NetworkPolicy, opts v1.UpdateOptions) (result *v1beta1.NetworkPolicy, err error) { + emptyResult := &v1beta1.NetworkPolicy{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(networkpoliciesResource, c.ns, networkPolicy), &v1beta1.NetworkPolicy{}) + Invokes(testing.NewUpdateActionWithOptions(networkpoliciesResource, c.ns, networkPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.NetworkPolicy), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeNetworkPolicies) UpdateStatus(ctx context.Context, networkPolicy *v1beta1.NetworkPolicy, opts v1.UpdateOptions) (*v1beta1.NetworkPolicy, error) { +func (c *FakeNetworkPolicies) UpdateStatus(ctx context.Context, networkPolicy *v1beta1.NetworkPolicy, opts v1.UpdateOptions) (result *v1beta1.NetworkPolicy, err error) { + emptyResult := &v1beta1.NetworkPolicy{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(networkpoliciesResource, "status", c.ns, networkPolicy), &v1beta1.NetworkPolicy{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(networkpoliciesResource, "status", c.ns, networkPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.NetworkPolicy), err } @@ -121,7 +126,7 @@ func (c *FakeNetworkPolicies) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeNetworkPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(networkpoliciesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(networkpoliciesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.NetworkPolicyList{}) return err @@ -129,11 +134,12 @@ func (c *FakeNetworkPolicies) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched networkPolicy. func (c *FakeNetworkPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.NetworkPolicy, err error) { + emptyResult := &v1beta1.NetworkPolicy{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(networkpoliciesResource, c.ns, name, pt, data, subresources...), &v1beta1.NetworkPolicy{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(networkpoliciesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.NetworkPolicy), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_tier.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_tier.go index 5b88ff4f367..e032d9567c4 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_tier.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_tier.go @@ -38,20 +38,22 @@ var tiersKind = v1beta1.SchemeGroupVersion.WithKind("Tier") // Get takes name of the tier, and returns the corresponding tier object, and an error if there is any. func (c *FakeTiers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Tier, err error) { + emptyResult := &v1beta1.Tier{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(tiersResource, name), &v1beta1.Tier{}) + Invokes(testing.NewRootGetActionWithOptions(tiersResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Tier), err } // List takes label and field selectors, and returns the list of Tiers that match those selectors. func (c *FakeTiers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.TierList, err error) { + emptyResult := &v1beta1.TierList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(tiersResource, tiersKind, opts), &v1beta1.TierList{}) + Invokes(testing.NewRootListActionWithOptions(tiersResource, tiersKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,25 +72,27 @@ func (c *FakeTiers) List(ctx context.Context, opts v1.ListOptions) (result *v1be // Watch returns a watch.Interface that watches the requested tiers. func (c *FakeTiers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(tiersResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(tiersResource, opts)) } // Create takes the representation of a tier and creates it. Returns the server's representation of the tier, and an error, if there is any. func (c *FakeTiers) Create(ctx context.Context, tier *v1beta1.Tier, opts v1.CreateOptions) (result *v1beta1.Tier, err error) { + emptyResult := &v1beta1.Tier{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(tiersResource, tier), &v1beta1.Tier{}) + Invokes(testing.NewRootCreateActionWithOptions(tiersResource, tier, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Tier), err } // Update takes the representation of a tier and updates it. Returns the server's representation of the tier, and an error, if there is any. func (c *FakeTiers) Update(ctx context.Context, tier *v1beta1.Tier, opts v1.UpdateOptions) (result *v1beta1.Tier, err error) { + emptyResult := &v1beta1.Tier{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(tiersResource, tier), &v1beta1.Tier{}) + Invokes(testing.NewRootUpdateActionWithOptions(tiersResource, tier, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Tier), err } @@ -102,7 +106,7 @@ func (c *FakeTiers) Delete(ctx context.Context, name string, opts v1.DeleteOptio // DeleteCollection deletes a collection of objects. func (c *FakeTiers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(tiersResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(tiersResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.TierList{}) return err @@ -110,10 +114,11 @@ func (c *FakeTiers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, // Patch applies the patch and returns the patched tier. func (c *FakeTiers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Tier, err error) { + emptyResult := &v1beta1.Tier{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(tiersResource, name, pt, data, subresources...), &v1beta1.Tier{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(tiersResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Tier), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_traceflow.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_traceflow.go index 065830f9a19..44fc32399a7 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_traceflow.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/fake/fake_traceflow.go @@ -38,20 +38,22 @@ var traceflowsKind = v1beta1.SchemeGroupVersion.WithKind("Traceflow") // Get takes name of the traceflow, and returns the corresponding traceflow object, and an error if there is any. func (c *FakeTraceflows) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Traceflow, err error) { + emptyResult := &v1beta1.Traceflow{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(traceflowsResource, name), &v1beta1.Traceflow{}) + Invokes(testing.NewRootGetActionWithOptions(traceflowsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Traceflow), err } // List takes label and field selectors, and returns the list of Traceflows that match those selectors. func (c *FakeTraceflows) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.TraceflowList, err error) { + emptyResult := &v1beta1.TraceflowList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(traceflowsResource, traceflowsKind, opts), &v1beta1.TraceflowList{}) + Invokes(testing.NewRootListActionWithOptions(traceflowsResource, traceflowsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -70,36 +72,39 @@ func (c *FakeTraceflows) List(ctx context.Context, opts v1.ListOptions) (result // Watch returns a watch.Interface that watches the requested traceflows. func (c *FakeTraceflows) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(traceflowsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(traceflowsResource, opts)) } // Create takes the representation of a traceflow and creates it. Returns the server's representation of the traceflow, and an error, if there is any. func (c *FakeTraceflows) Create(ctx context.Context, traceflow *v1beta1.Traceflow, opts v1.CreateOptions) (result *v1beta1.Traceflow, err error) { + emptyResult := &v1beta1.Traceflow{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(traceflowsResource, traceflow), &v1beta1.Traceflow{}) + Invokes(testing.NewRootCreateActionWithOptions(traceflowsResource, traceflow, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Traceflow), err } // Update takes the representation of a traceflow and updates it. Returns the server's representation of the traceflow, and an error, if there is any. func (c *FakeTraceflows) Update(ctx context.Context, traceflow *v1beta1.Traceflow, opts v1.UpdateOptions) (result *v1beta1.Traceflow, err error) { + emptyResult := &v1beta1.Traceflow{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(traceflowsResource, traceflow), &v1beta1.Traceflow{}) + Invokes(testing.NewRootUpdateActionWithOptions(traceflowsResource, traceflow, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Traceflow), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeTraceflows) UpdateStatus(ctx context.Context, traceflow *v1beta1.Traceflow, opts v1.UpdateOptions) (*v1beta1.Traceflow, error) { +func (c *FakeTraceflows) UpdateStatus(ctx context.Context, traceflow *v1beta1.Traceflow, opts v1.UpdateOptions) (result *v1beta1.Traceflow, err error) { + emptyResult := &v1beta1.Traceflow{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(traceflowsResource, "status", traceflow), &v1beta1.Traceflow{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(traceflowsResource, "status", traceflow, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Traceflow), err } @@ -113,7 +118,7 @@ func (c *FakeTraceflows) Delete(ctx context.Context, name string, opts v1.Delete // DeleteCollection deletes a collection of objects. func (c *FakeTraceflows) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(traceflowsResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(traceflowsResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.TraceflowList{}) return err @@ -121,10 +126,11 @@ func (c *FakeTraceflows) DeleteCollection(ctx context.Context, opts v1.DeleteOpt // Patch applies the patch and returns the patched traceflow. func (c *FakeTraceflows) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Traceflow, err error) { + emptyResult := &v1beta1.Traceflow{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(traceflowsResource, name, pt, data, subresources...), &v1beta1.Traceflow{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(traceflowsResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Traceflow), err } diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/group.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/group.go index 6a3cc8a2975..c7d59dad57d 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/group.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/group.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // GroupsGetter has a method to return a GroupInterface. @@ -38,6 +37,7 @@ type GroupsGetter interface { type GroupInterface interface { Create(ctx context.Context, group *v1beta1.Group, opts v1.CreateOptions) (*v1beta1.Group, error) Update(ctx context.Context, group *v1beta1.Group, opts v1.UpdateOptions) (*v1beta1.Group, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, group *v1beta1.Group, opts v1.UpdateOptions) (*v1beta1.Group, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,144 +50,18 @@ type GroupInterface interface { // groups implements GroupInterface type groups struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta1.Group, *v1beta1.GroupList] } // newGroups returns a Groups func newGroups(c *CrdV1beta1Client, namespace string) *groups { return &groups{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta1.Group, *v1beta1.GroupList]( + "groups", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.Group { return &v1beta1.Group{} }, + func() *v1beta1.GroupList { return &v1beta1.GroupList{} }), } } - -// Get takes name of the group, and returns the corresponding group object, and an error if there is any. -func (c *groups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Group, err error) { - result = &v1beta1.Group{} - err = c.client.Get(). - Namespace(c.ns). - Resource("groups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Groups that match those selectors. -func (c *groups) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.GroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.GroupList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("groups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested groups. -func (c *groups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("groups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a group and creates it. Returns the server's representation of the group, and an error, if there is any. -func (c *groups) Create(ctx context.Context, group *v1beta1.Group, opts v1.CreateOptions) (result *v1beta1.Group, err error) { - result = &v1beta1.Group{} - err = c.client.Post(). - Namespace(c.ns). - Resource("groups"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(group). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a group and updates it. Returns the server's representation of the group, and an error, if there is any. -func (c *groups) Update(ctx context.Context, group *v1beta1.Group, opts v1.UpdateOptions) (result *v1beta1.Group, err error) { - result = &v1beta1.Group{} - err = c.client.Put(). - Namespace(c.ns). - Resource("groups"). - Name(group.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(group). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *groups) UpdateStatus(ctx context.Context, group *v1beta1.Group, opts v1.UpdateOptions) (result *v1beta1.Group, err error) { - result = &v1beta1.Group{} - err = c.client.Put(). - Namespace(c.ns). - Resource("groups"). - Name(group.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(group). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the group and deletes it. Returns an error if one occurs. -func (c *groups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("groups"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *groups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("groups"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched group. -func (c *groups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Group, err error) { - result = &v1beta1.Group{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("groups"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/ippool.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/ippool.go index d1e241ec286..bdd71d3d846 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/ippool.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/ippool.go @@ -18,14 +18,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // IPPoolsGetter has a method to return a IPPoolInterface. @@ -38,6 +37,7 @@ type IPPoolsGetter interface { type IPPoolInterface interface { Create(ctx context.Context, iPPool *v1beta1.IPPool, opts v1.CreateOptions) (*v1beta1.IPPool, error) Update(ctx context.Context, iPPool *v1beta1.IPPool, opts v1.UpdateOptions) (*v1beta1.IPPool, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, iPPool *v1beta1.IPPool, opts v1.UpdateOptions) (*v1beta1.IPPool, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,133 +50,18 @@ type IPPoolInterface interface { // iPPools implements IPPoolInterface type iPPools struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.IPPool, *v1beta1.IPPoolList] } // newIPPools returns a IPPools func newIPPools(c *CrdV1beta1Client) *iPPools { return &iPPools{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.IPPool, *v1beta1.IPPoolList]( + "ippools", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.IPPool { return &v1beta1.IPPool{} }, + func() *v1beta1.IPPoolList { return &v1beta1.IPPoolList{} }), } } - -// Get takes name of the iPPool, and returns the corresponding iPPool object, and an error if there is any. -func (c *iPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.IPPool, err error) { - result = &v1beta1.IPPool{} - err = c.client.Get(). - Resource("ippools"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IPPools that match those selectors. -func (c *iPPools) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.IPPoolList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.IPPoolList{} - err = c.client.Get(). - Resource("ippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested iPPools. -func (c *iPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a iPPool and creates it. Returns the server's representation of the iPPool, and an error, if there is any. -func (c *iPPools) Create(ctx context.Context, iPPool *v1beta1.IPPool, opts v1.CreateOptions) (result *v1beta1.IPPool, err error) { - result = &v1beta1.IPPool{} - err = c.client.Post(). - Resource("ippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPPool). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a iPPool and updates it. Returns the server's representation of the iPPool, and an error, if there is any. -func (c *iPPools) Update(ctx context.Context, iPPool *v1beta1.IPPool, opts v1.UpdateOptions) (result *v1beta1.IPPool, err error) { - result = &v1beta1.IPPool{} - err = c.client.Put(). - Resource("ippools"). - Name(iPPool.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPPool). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *iPPools) UpdateStatus(ctx context.Context, iPPool *v1beta1.IPPool, opts v1.UpdateOptions) (result *v1beta1.IPPool, err error) { - result = &v1beta1.IPPool{} - err = c.client.Put(). - Resource("ippools"). - Name(iPPool.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPPool). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the iPPool and deletes it. Returns an error if one occurs. -func (c *iPPools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ippools"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *iPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ippools"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched iPPool. -func (c *iPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.IPPool, err error) { - result = &v1beta1.IPPool{} - err = c.client.Patch(pt). - Resource("ippools"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/networkpolicy.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/networkpolicy.go index 4d3f322831e..92406dd99d2 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/networkpolicy.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/networkpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // NetworkPoliciesGetter has a method to return a NetworkPolicyInterface. @@ -38,6 +37,7 @@ type NetworkPoliciesGetter interface { type NetworkPolicyInterface interface { Create(ctx context.Context, networkPolicy *v1beta1.NetworkPolicy, opts v1.CreateOptions) (*v1beta1.NetworkPolicy, error) Update(ctx context.Context, networkPolicy *v1beta1.NetworkPolicy, opts v1.UpdateOptions) (*v1beta1.NetworkPolicy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, networkPolicy *v1beta1.NetworkPolicy, opts v1.UpdateOptions) (*v1beta1.NetworkPolicy, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,144 +50,18 @@ type NetworkPolicyInterface interface { // networkPolicies implements NetworkPolicyInterface type networkPolicies struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta1.NetworkPolicy, *v1beta1.NetworkPolicyList] } // newNetworkPolicies returns a NetworkPolicies func newNetworkPolicies(c *CrdV1beta1Client, namespace string) *networkPolicies { return &networkPolicies{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta1.NetworkPolicy, *v1beta1.NetworkPolicyList]( + "networkpolicies", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.NetworkPolicy { return &v1beta1.NetworkPolicy{} }, + func() *v1beta1.NetworkPolicyList { return &v1beta1.NetworkPolicyList{} }), } } - -// Get takes name of the networkPolicy, and returns the corresponding networkPolicy object, and an error if there is any. -func (c *networkPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.NetworkPolicy, err error) { - result = &v1beta1.NetworkPolicy{} - err = c.client.Get(). - Namespace(c.ns). - Resource("networkpolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NetworkPolicies that match those selectors. -func (c *networkPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.NetworkPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.NetworkPolicyList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("networkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested networkPolicies. -func (c *networkPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("networkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a networkPolicy and creates it. Returns the server's representation of the networkPolicy, and an error, if there is any. -func (c *networkPolicies) Create(ctx context.Context, networkPolicy *v1beta1.NetworkPolicy, opts v1.CreateOptions) (result *v1beta1.NetworkPolicy, err error) { - result = &v1beta1.NetworkPolicy{} - err = c.client.Post(). - Namespace(c.ns). - Resource("networkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(networkPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a networkPolicy and updates it. Returns the server's representation of the networkPolicy, and an error, if there is any. -func (c *networkPolicies) Update(ctx context.Context, networkPolicy *v1beta1.NetworkPolicy, opts v1.UpdateOptions) (result *v1beta1.NetworkPolicy, err error) { - result = &v1beta1.NetworkPolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("networkpolicies"). - Name(networkPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(networkPolicy). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *networkPolicies) UpdateStatus(ctx context.Context, networkPolicy *v1beta1.NetworkPolicy, opts v1.UpdateOptions) (result *v1beta1.NetworkPolicy, err error) { - result = &v1beta1.NetworkPolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("networkpolicies"). - Name(networkPolicy.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(networkPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the networkPolicy and deletes it. Returns an error if one occurs. -func (c *networkPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("networkpolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *networkPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("networkpolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched networkPolicy. -func (c *networkPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.NetworkPolicy, err error) { - result = &v1beta1.NetworkPolicy{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("networkpolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/tier.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/tier.go index 7ff6c292b5e..b04646622d1 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/tier.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/tier.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // TiersGetter has a method to return a TierInterface. @@ -49,118 +48,18 @@ type TierInterface interface { // tiers implements TierInterface type tiers struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.Tier, *v1beta1.TierList] } // newTiers returns a Tiers func newTiers(c *CrdV1beta1Client) *tiers { return &tiers{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.Tier, *v1beta1.TierList]( + "tiers", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.Tier { return &v1beta1.Tier{} }, + func() *v1beta1.TierList { return &v1beta1.TierList{} }), } } - -// Get takes name of the tier, and returns the corresponding tier object, and an error if there is any. -func (c *tiers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Tier, err error) { - result = &v1beta1.Tier{} - err = c.client.Get(). - Resource("tiers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Tiers that match those selectors. -func (c *tiers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.TierList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.TierList{} - err = c.client.Get(). - Resource("tiers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested tiers. -func (c *tiers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("tiers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a tier and creates it. Returns the server's representation of the tier, and an error, if there is any. -func (c *tiers) Create(ctx context.Context, tier *v1beta1.Tier, opts v1.CreateOptions) (result *v1beta1.Tier, err error) { - result = &v1beta1.Tier{} - err = c.client.Post(). - Resource("tiers"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(tier). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a tier and updates it. Returns the server's representation of the tier, and an error, if there is any. -func (c *tiers) Update(ctx context.Context, tier *v1beta1.Tier, opts v1.UpdateOptions) (result *v1beta1.Tier, err error) { - result = &v1beta1.Tier{} - err = c.client.Put(). - Resource("tiers"). - Name(tier.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(tier). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the tier and deletes it. Returns an error if one occurs. -func (c *tiers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("tiers"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *tiers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("tiers"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched tier. -func (c *tiers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Tier, err error) { - result = &v1beta1.Tier{} - err = c.client.Patch(pt). - Resource("tiers"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1beta1/traceflow.go b/pkg/client/clientset/versioned/typed/crd/v1beta1/traceflow.go index 7145d5411e1..605f15492f3 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1beta1/traceflow.go +++ b/pkg/client/clientset/versioned/typed/crd/v1beta1/traceflow.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // TraceflowsGetter has a method to return a TraceflowInterface. @@ -38,6 +37,7 @@ type TraceflowsGetter interface { type TraceflowInterface interface { Create(ctx context.Context, traceflow *v1beta1.Traceflow, opts v1.CreateOptions) (*v1beta1.Traceflow, error) Update(ctx context.Context, traceflow *v1beta1.Traceflow, opts v1.UpdateOptions) (*v1beta1.Traceflow, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, traceflow *v1beta1.Traceflow, opts v1.UpdateOptions) (*v1beta1.Traceflow, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -50,133 +50,18 @@ type TraceflowInterface interface { // traceflows implements TraceflowInterface type traceflows struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.Traceflow, *v1beta1.TraceflowList] } // newTraceflows returns a Traceflows func newTraceflows(c *CrdV1beta1Client) *traceflows { return &traceflows{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.Traceflow, *v1beta1.TraceflowList]( + "traceflows", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.Traceflow { return &v1beta1.Traceflow{} }, + func() *v1beta1.TraceflowList { return &v1beta1.TraceflowList{} }), } } - -// Get takes name of the traceflow, and returns the corresponding traceflow object, and an error if there is any. -func (c *traceflows) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Traceflow, err error) { - result = &v1beta1.Traceflow{} - err = c.client.Get(). - Resource("traceflows"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Traceflows that match those selectors. -func (c *traceflows) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.TraceflowList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.TraceflowList{} - err = c.client.Get(). - Resource("traceflows"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested traceflows. -func (c *traceflows) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("traceflows"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a traceflow and creates it. Returns the server's representation of the traceflow, and an error, if there is any. -func (c *traceflows) Create(ctx context.Context, traceflow *v1beta1.Traceflow, opts v1.CreateOptions) (result *v1beta1.Traceflow, err error) { - result = &v1beta1.Traceflow{} - err = c.client.Post(). - Resource("traceflows"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(traceflow). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a traceflow and updates it. Returns the server's representation of the traceflow, and an error, if there is any. -func (c *traceflows) Update(ctx context.Context, traceflow *v1beta1.Traceflow, opts v1.UpdateOptions) (result *v1beta1.Traceflow, err error) { - result = &v1beta1.Traceflow{} - err = c.client.Put(). - Resource("traceflows"). - Name(traceflow.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(traceflow). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *traceflows) UpdateStatus(ctx context.Context, traceflow *v1beta1.Traceflow, opts v1.UpdateOptions) (result *v1beta1.Traceflow, err error) { - result = &v1beta1.Traceflow{} - err = c.client.Put(). - Resource("traceflows"). - Name(traceflow.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(traceflow). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the traceflow and deletes it. Returns an error if one occurs. -func (c *traceflows) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("traceflows"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *traceflows) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("traceflows"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched traceflow. -func (c *traceflows) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Traceflow, err error) { - result = &v1beta1.Traceflow{} - err = c.client.Patch(pt). - Resource("traceflows"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/antreaclusternetworkpolicystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/antreaclusternetworkpolicystats.go index 9920405606e..768870d315c 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/antreaclusternetworkpolicystats.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/antreaclusternetworkpolicystats.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,13 +18,12 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // AntreaClusterNetworkPolicyStatsGetter has a method to return a AntreaClusterNetworkPolicyStatsInterface. @@ -43,54 +42,20 @@ type AntreaClusterNetworkPolicyStatsInterface interface { // antreaClusterNetworkPolicyStats implements AntreaClusterNetworkPolicyStatsInterface type antreaClusterNetworkPolicyStats struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.AntreaClusterNetworkPolicyStats, *v1alpha1.AntreaClusterNetworkPolicyStatsList] } // newAntreaClusterNetworkPolicyStats returns a AntreaClusterNetworkPolicyStats func newAntreaClusterNetworkPolicyStats(c *StatsV1alpha1Client) *antreaClusterNetworkPolicyStats { return &antreaClusterNetworkPolicyStats{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.AntreaClusterNetworkPolicyStats, *v1alpha1.AntreaClusterNetworkPolicyStatsList]( + "antreaclusternetworkpolicystats", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.AntreaClusterNetworkPolicyStats { return &v1alpha1.AntreaClusterNetworkPolicyStats{} }, + func() *v1alpha1.AntreaClusterNetworkPolicyStatsList { + return &v1alpha1.AntreaClusterNetworkPolicyStatsList{} + }), } } - -// Get takes name of the antreaClusterNetworkPolicyStats, and returns the corresponding antreaClusterNetworkPolicyStats object, and an error if there is any. -func (c *antreaClusterNetworkPolicyStats) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AntreaClusterNetworkPolicyStats, err error) { - result = &v1alpha1.AntreaClusterNetworkPolicyStats{} - err = c.client.Get(). - Resource("antreaclusternetworkpolicystats"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of AntreaClusterNetworkPolicyStats that match those selectors. -func (c *antreaClusterNetworkPolicyStats) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AntreaClusterNetworkPolicyStatsList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.AntreaClusterNetworkPolicyStatsList{} - err = c.client.Get(). - Resource("antreaclusternetworkpolicystats"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested antreaClusterNetworkPolicyStats. -func (c *antreaClusterNetworkPolicyStats) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("antreaclusternetworkpolicystats"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/antreanetworkpolicystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/antreanetworkpolicystats.go index a03950ecbf2..4466a198d2e 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/antreanetworkpolicystats.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/antreanetworkpolicystats.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,13 +18,12 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // AntreaNetworkPolicyStatsGetter has a method to return a AntreaNetworkPolicyStatsInterface. @@ -43,59 +42,18 @@ type AntreaNetworkPolicyStatsInterface interface { // antreaNetworkPolicyStats implements AntreaNetworkPolicyStatsInterface type antreaNetworkPolicyStats struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.AntreaNetworkPolicyStats, *v1alpha1.AntreaNetworkPolicyStatsList] } // newAntreaNetworkPolicyStats returns a AntreaNetworkPolicyStats func newAntreaNetworkPolicyStats(c *StatsV1alpha1Client, namespace string) *antreaNetworkPolicyStats { return &antreaNetworkPolicyStats{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.AntreaNetworkPolicyStats, *v1alpha1.AntreaNetworkPolicyStatsList]( + "antreanetworkpolicystats", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.AntreaNetworkPolicyStats { return &v1alpha1.AntreaNetworkPolicyStats{} }, + func() *v1alpha1.AntreaNetworkPolicyStatsList { return &v1alpha1.AntreaNetworkPolicyStatsList{} }), } } - -// Get takes name of the antreaNetworkPolicyStats, and returns the corresponding antreaNetworkPolicyStats object, and an error if there is any. -func (c *antreaNetworkPolicyStats) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AntreaNetworkPolicyStats, err error) { - result = &v1alpha1.AntreaNetworkPolicyStats{} - err = c.client.Get(). - Namespace(c.ns). - Resource("antreanetworkpolicystats"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of AntreaNetworkPolicyStats that match those selectors. -func (c *antreaNetworkPolicyStats) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AntreaNetworkPolicyStatsList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.AntreaNetworkPolicyStatsList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("antreanetworkpolicystats"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested antreaNetworkPolicyStats. -func (c *antreaNetworkPolicyStats) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("antreanetworkpolicystats"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_antreaclusternetworkpolicystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_antreaclusternetworkpolicystats.go index 9a7c63f5acd..0294df55a40 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_antreaclusternetworkpolicystats.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_antreaclusternetworkpolicystats.go @@ -37,20 +37,22 @@ var antreaclusternetworkpolicystatsKind = v1alpha1.SchemeGroupVersion.WithKind(" // Get takes name of the antreaClusterNetworkPolicyStats, and returns the corresponding antreaClusterNetworkPolicyStats object, and an error if there is any. func (c *FakeAntreaClusterNetworkPolicyStats) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AntreaClusterNetworkPolicyStats, err error) { + emptyResult := &v1alpha1.AntreaClusterNetworkPolicyStats{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(antreaclusternetworkpolicystatsResource, name), &v1alpha1.AntreaClusterNetworkPolicyStats{}) + Invokes(testing.NewRootGetActionWithOptions(antreaclusternetworkpolicystatsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AntreaClusterNetworkPolicyStats), err } // List takes label and field selectors, and returns the list of AntreaClusterNetworkPolicyStats that match those selectors. func (c *FakeAntreaClusterNetworkPolicyStats) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AntreaClusterNetworkPolicyStatsList, err error) { + emptyResult := &v1alpha1.AntreaClusterNetworkPolicyStatsList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(antreaclusternetworkpolicystatsResource, antreaclusternetworkpolicystatsKind, opts), &v1alpha1.AntreaClusterNetworkPolicyStatsList{}) + Invokes(testing.NewRootListActionWithOptions(antreaclusternetworkpolicystatsResource, antreaclusternetworkpolicystatsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -69,5 +71,5 @@ func (c *FakeAntreaClusterNetworkPolicyStats) List(ctx context.Context, opts v1. // Watch returns a watch.Interface that watches the requested antreaClusterNetworkPolicyStats. func (c *FakeAntreaClusterNetworkPolicyStats) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(antreaclusternetworkpolicystatsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(antreaclusternetworkpolicystatsResource, opts)) } diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_antreanetworkpolicystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_antreanetworkpolicystats.go index dbd931186a4..f01b9c373ec 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_antreanetworkpolicystats.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_antreanetworkpolicystats.go @@ -38,22 +38,24 @@ var antreanetworkpolicystatsKind = v1alpha1.SchemeGroupVersion.WithKind("AntreaN // Get takes name of the antreaNetworkPolicyStats, and returns the corresponding antreaNetworkPolicyStats object, and an error if there is any. func (c *FakeAntreaNetworkPolicyStats) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AntreaNetworkPolicyStats, err error) { + emptyResult := &v1alpha1.AntreaNetworkPolicyStats{} obj, err := c.Fake. - Invokes(testing.NewGetAction(antreanetworkpolicystatsResource, c.ns, name), &v1alpha1.AntreaNetworkPolicyStats{}) + Invokes(testing.NewGetActionWithOptions(antreanetworkpolicystatsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AntreaNetworkPolicyStats), err } // List takes label and field selectors, and returns the list of AntreaNetworkPolicyStats that match those selectors. func (c *FakeAntreaNetworkPolicyStats) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AntreaNetworkPolicyStatsList, err error) { + emptyResult := &v1alpha1.AntreaNetworkPolicyStatsList{} obj, err := c.Fake. - Invokes(testing.NewListAction(antreanetworkpolicystatsResource, antreanetworkpolicystatsKind, c.ns, opts), &v1alpha1.AntreaNetworkPolicyStatsList{}) + Invokes(testing.NewListActionWithOptions(antreanetworkpolicystatsResource, antreanetworkpolicystatsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -72,6 +74,6 @@ func (c *FakeAntreaNetworkPolicyStats) List(ctx context.Context, opts v1.ListOpt // Watch returns a watch.Interface that watches the requested antreaNetworkPolicyStats. func (c *FakeAntreaNetworkPolicyStats) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(antreanetworkpolicystatsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(antreanetworkpolicystatsResource, c.ns, opts)) } diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_multicastgroup.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_multicastgroup.go index 1c7d87bdfa9..46fae97815e 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_multicastgroup.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_multicastgroup.go @@ -37,20 +37,22 @@ var multicastgroupsKind = v1alpha1.SchemeGroupVersion.WithKind("MulticastGroup") // Get takes name of the multicastGroup, and returns the corresponding multicastGroup object, and an error if there is any. func (c *FakeMulticastGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MulticastGroup, err error) { + emptyResult := &v1alpha1.MulticastGroup{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(multicastgroupsResource, name), &v1alpha1.MulticastGroup{}) + Invokes(testing.NewRootGetActionWithOptions(multicastgroupsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.MulticastGroup), err } // List takes label and field selectors, and returns the list of MulticastGroups that match those selectors. func (c *FakeMulticastGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MulticastGroupList, err error) { + emptyResult := &v1alpha1.MulticastGroupList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(multicastgroupsResource, multicastgroupsKind, opts), &v1alpha1.MulticastGroupList{}) + Invokes(testing.NewRootListActionWithOptions(multicastgroupsResource, multicastgroupsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -69,5 +71,5 @@ func (c *FakeMulticastGroups) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested multicastGroups. func (c *FakeMulticastGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(multicastgroupsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(multicastgroupsResource, opts)) } diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_networkpolicystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_networkpolicystats.go index 532b794518a..e3aaba19591 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_networkpolicystats.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_networkpolicystats.go @@ -38,22 +38,24 @@ var networkpolicystatsKind = v1alpha1.SchemeGroupVersion.WithKind("NetworkPolicy // Get takes name of the networkPolicyStats, and returns the corresponding networkPolicyStats object, and an error if there is any. func (c *FakeNetworkPolicyStats) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NetworkPolicyStats, err error) { + emptyResult := &v1alpha1.NetworkPolicyStats{} obj, err := c.Fake. - Invokes(testing.NewGetAction(networkpolicystatsResource, c.ns, name), &v1alpha1.NetworkPolicyStats{}) + Invokes(testing.NewGetActionWithOptions(networkpolicystatsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NetworkPolicyStats), err } // List takes label and field selectors, and returns the list of NetworkPolicyStats that match those selectors. func (c *FakeNetworkPolicyStats) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NetworkPolicyStatsList, err error) { + emptyResult := &v1alpha1.NetworkPolicyStatsList{} obj, err := c.Fake. - Invokes(testing.NewListAction(networkpolicystatsResource, networkpolicystatsKind, c.ns, opts), &v1alpha1.NetworkPolicyStatsList{}) + Invokes(testing.NewListActionWithOptions(networkpolicystatsResource, networkpolicystatsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -72,6 +74,6 @@ func (c *FakeNetworkPolicyStats) List(ctx context.Context, opts v1.ListOptions) // Watch returns a watch.Interface that watches the requested networkPolicyStats. func (c *FakeNetworkPolicyStats) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(networkpolicystatsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(networkpolicystatsResource, c.ns, opts)) } diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go index 2759511f411..071e12bb538 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go @@ -36,20 +36,22 @@ var nodelatencystatsKind = v1alpha1.SchemeGroupVersion.WithKind("NodeLatencyStat // Get takes name of the nodeLatencyStats, and returns the corresponding nodeLatencyStats object, and an error if there is any. func (c *FakeNodeLatencyStats) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeLatencyStats, err error) { + emptyResult := &v1alpha1.NodeLatencyStats{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(nodelatencystatsResource, name), &v1alpha1.NodeLatencyStats{}) + Invokes(testing.NewRootGetActionWithOptions(nodelatencystatsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeLatencyStats), err } // List takes label and field selectors, and returns the list of NodeLatencyStats that match those selectors. func (c *FakeNodeLatencyStats) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeLatencyStatsList, err error) { + emptyResult := &v1alpha1.NodeLatencyStatsList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(nodelatencystatsResource, nodelatencystatsKind, opts), &v1alpha1.NodeLatencyStatsList{}) + Invokes(testing.NewRootListActionWithOptions(nodelatencystatsResource, nodelatencystatsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -67,10 +69,11 @@ func (c *FakeNodeLatencyStats) List(ctx context.Context, opts v1.ListOptions) (r // Create takes the representation of a nodeLatencyStats and creates it. Returns the server's representation of the nodeLatencyStats, and an error, if there is any. func (c *FakeNodeLatencyStats) Create(ctx context.Context, nodeLatencyStats *v1alpha1.NodeLatencyStats, opts v1.CreateOptions) (result *v1alpha1.NodeLatencyStats, err error) { + emptyResult := &v1alpha1.NodeLatencyStats{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(nodelatencystatsResource, nodeLatencyStats), &v1alpha1.NodeLatencyStats{}) + Invokes(testing.NewRootCreateActionWithOptions(nodelatencystatsResource, nodeLatencyStats, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeLatencyStats), err } diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/multicastgroup.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/multicastgroup.go index ee3b92db191..cf07f505a22 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/multicastgroup.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/multicastgroup.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,13 +18,12 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // MulticastGroupsGetter has a method to return a MulticastGroupInterface. @@ -43,54 +42,18 @@ type MulticastGroupInterface interface { // multicastGroups implements MulticastGroupInterface type multicastGroups struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.MulticastGroup, *v1alpha1.MulticastGroupList] } // newMulticastGroups returns a MulticastGroups func newMulticastGroups(c *StatsV1alpha1Client) *multicastGroups { return &multicastGroups{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.MulticastGroup, *v1alpha1.MulticastGroupList]( + "multicastgroups", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.MulticastGroup { return &v1alpha1.MulticastGroup{} }, + func() *v1alpha1.MulticastGroupList { return &v1alpha1.MulticastGroupList{} }), } } - -// Get takes name of the multicastGroup, and returns the corresponding multicastGroup object, and an error if there is any. -func (c *multicastGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MulticastGroup, err error) { - result = &v1alpha1.MulticastGroup{} - err = c.client.Get(). - Resource("multicastgroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of MulticastGroups that match those selectors. -func (c *multicastGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MulticastGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.MulticastGroupList{} - err = c.client.Get(). - Resource("multicastgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested multicastGroups. -func (c *multicastGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("multicastgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/networkpolicystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/networkpolicystats.go index 1e90dbe0432..2491fce1409 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/networkpolicystats.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/networkpolicystats.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,13 +18,12 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // NetworkPolicyStatsGetter has a method to return a NetworkPolicyStatsInterface. @@ -43,59 +42,18 @@ type NetworkPolicyStatsInterface interface { // networkPolicyStats implements NetworkPolicyStatsInterface type networkPolicyStats struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.NetworkPolicyStats, *v1alpha1.NetworkPolicyStatsList] } // newNetworkPolicyStats returns a NetworkPolicyStats func newNetworkPolicyStats(c *StatsV1alpha1Client, namespace string) *networkPolicyStats { return &networkPolicyStats{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.NetworkPolicyStats, *v1alpha1.NetworkPolicyStatsList]( + "networkpolicystats", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.NetworkPolicyStats { return &v1alpha1.NetworkPolicyStats{} }, + func() *v1alpha1.NetworkPolicyStatsList { return &v1alpha1.NetworkPolicyStatsList{} }), } } - -// Get takes name of the networkPolicyStats, and returns the corresponding networkPolicyStats object, and an error if there is any. -func (c *networkPolicyStats) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NetworkPolicyStats, err error) { - result = &v1alpha1.NetworkPolicyStats{} - err = c.client.Get(). - Namespace(c.ns). - Resource("networkpolicystats"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NetworkPolicyStats that match those selectors. -func (c *networkPolicyStats) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NetworkPolicyStatsList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.NetworkPolicyStatsList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("networkpolicystats"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested networkPolicyStats. -func (c *networkPolicyStats) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("networkpolicystats"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go index f4593b86653..fa0424404f2 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go @@ -18,12 +18,11 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // NodeLatencyStatsGetter has a method to return a NodeLatencyStatsInterface. @@ -43,62 +42,18 @@ type NodeLatencyStatsInterface interface { // nodeLatencyStats implements NodeLatencyStatsInterface type nodeLatencyStats struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.NodeLatencyStats, *v1alpha1.NodeLatencyStatsList] } // newNodeLatencyStats returns a NodeLatencyStats func newNodeLatencyStats(c *StatsV1alpha1Client) *nodeLatencyStats { return &nodeLatencyStats{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.NodeLatencyStats, *v1alpha1.NodeLatencyStatsList]( + "nodelatencystats", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.NodeLatencyStats { return &v1alpha1.NodeLatencyStats{} }, + func() *v1alpha1.NodeLatencyStatsList { return &v1alpha1.NodeLatencyStatsList{} }), } } - -// Get takes name of the nodeLatencyStats, and returns the corresponding nodeLatencyStats object, and an error if there is any. -func (c *nodeLatencyStats) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeLatencyStats, err error) { - result = &v1alpha1.NodeLatencyStats{} - err = c.client.Get(). - Resource("nodelatencystats"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NodeLatencyStats that match those selectors. -func (c *nodeLatencyStats) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeLatencyStatsList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.NodeLatencyStatsList{} - err = c.client.Get(). - Resource("nodelatencystats"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Create takes the representation of a nodeLatencyStats and creates it. Returns the server's representation of the nodeLatencyStats, and an error, if there is any. -func (c *nodeLatencyStats) Create(ctx context.Context, nodeLatencyStats *v1alpha1.NodeLatencyStats, opts v1.CreateOptions) (result *v1alpha1.NodeLatencyStats, err error) { - result = &v1alpha1.NodeLatencyStats{} - err = c.client.Post(). - Resource("nodelatencystats"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeLatencyStats). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the nodeLatencyStats and deletes it. Returns an error if one occurs. -func (c *nodeLatencyStats) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("nodelatencystats"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} diff --git a/pkg/client/clientset/versioned/typed/system/v1beta1/fake/fake_supportbundle.go b/pkg/client/clientset/versioned/typed/system/v1beta1/fake/fake_supportbundle.go index bea73e9a3c2..5445b30dcef 100644 --- a/pkg/client/clientset/versioned/typed/system/v1beta1/fake/fake_supportbundle.go +++ b/pkg/client/clientset/versioned/typed/system/v1beta1/fake/fake_supportbundle.go @@ -35,20 +35,22 @@ var supportbundlesKind = v1beta1.SchemeGroupVersion.WithKind("SupportBundle") // Get takes name of the supportBundle, and returns the corresponding supportBundle object, and an error if there is any. func (c *FakeSupportBundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.SupportBundle, err error) { + emptyResult := &v1beta1.SupportBundle{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(supportbundlesResource, name), &v1beta1.SupportBundle{}) + Invokes(testing.NewRootGetActionWithOptions(supportbundlesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.SupportBundle), err } // Create takes the representation of a supportBundle and creates it. Returns the server's representation of the supportBundle, and an error, if there is any. func (c *FakeSupportBundles) Create(ctx context.Context, supportBundle *v1beta1.SupportBundle, opts v1.CreateOptions) (result *v1beta1.SupportBundle, err error) { + emptyResult := &v1beta1.SupportBundle{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(supportbundlesResource, supportBundle), &v1beta1.SupportBundle{}) + Invokes(testing.NewRootCreateActionWithOptions(supportbundlesResource, supportBundle, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.SupportBundle), err } diff --git a/pkg/client/clientset/versioned/typed/system/v1beta1/supportbundle.go b/pkg/client/clientset/versioned/typed/system/v1beta1/supportbundle.go index 30743a46fa3..333505b12ee 100644 --- a/pkg/client/clientset/versioned/typed/system/v1beta1/supportbundle.go +++ b/pkg/client/clientset/versioned/typed/system/v1beta1/supportbundle.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import ( v1beta1 "antrea.io/antrea/pkg/apis/system/v1beta1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // SupportBundlesGetter has a method to return a SupportBundleInterface. @@ -41,46 +41,17 @@ type SupportBundleInterface interface { // supportBundles implements SupportBundleInterface type supportBundles struct { - client rest.Interface + *gentype.Client[*v1beta1.SupportBundle] } // newSupportBundles returns a SupportBundles func newSupportBundles(c *SystemV1beta1Client) *supportBundles { return &supportBundles{ - client: c.RESTClient(), + gentype.NewClient[*v1beta1.SupportBundle]( + "supportbundles", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.SupportBundle { return &v1beta1.SupportBundle{} }), } } - -// Get takes name of the supportBundle, and returns the corresponding supportBundle object, and an error if there is any. -func (c *supportBundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.SupportBundle, err error) { - result = &v1beta1.SupportBundle{} - err = c.client.Get(). - Resource("supportbundles"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// Create takes the representation of a supportBundle and creates it. Returns the server's representation of the supportBundle, and an error, if there is any. -func (c *supportBundles) Create(ctx context.Context, supportBundle *v1beta1.SupportBundle, opts v1.CreateOptions) (result *v1beta1.SupportBundle, err error) { - result = &v1beta1.SupportBundle{} - err = c.client.Post(). - Resource("supportbundles"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(supportBundle). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the supportBundle and deletes it. Returns an error if one occurs. -func (c *supportBundles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("supportbundles"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} diff --git a/pkg/client/clientset/versioned/typed/system/v1beta1/supportbundle_expansion.go b/pkg/client/clientset/versioned/typed/system/v1beta1/supportbundle_expansion.go index 257a1ba0fad..31520d33fe8 100644 --- a/pkg/client/clientset/versioned/typed/system/v1beta1/supportbundle_expansion.go +++ b/pkg/client/clientset/versioned/typed/system/v1beta1/supportbundle_expansion.go @@ -24,7 +24,7 @@ type SupportBundleExpansion interface { } func (c *supportBundles) Download(ctx context.Context, name string) (io.ReadCloser, error) { - return c.client.Get(). + return c.GetClient().Get(). Resource("supportbundles"). Name(name). SubResource("download"). diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index 09f1a888bb6..4f91bcb24ad 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -226,6 +226,7 @@ type SharedInformerFactory interface { // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new diff --git a/pkg/client/listers/crd/v1alpha1/bgppolicy.go b/pkg/client/listers/crd/v1alpha1/bgppolicy.go index 8ffe2d1f115..33079ed6fe5 100644 --- a/pkg/client/listers/crd/v1alpha1/bgppolicy.go +++ b/pkg/client/listers/crd/v1alpha1/bgppolicy.go @@ -18,8 +18,8 @@ package v1alpha1 import ( v1alpha1 "antrea.io/antrea/pkg/apis/crd/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type BGPPolicyLister interface { // bGPPolicyLister implements the BGPPolicyLister interface. type bGPPolicyLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.BGPPolicy] } // NewBGPPolicyLister returns a new BGPPolicyLister. func NewBGPPolicyLister(indexer cache.Indexer) BGPPolicyLister { - return &bGPPolicyLister{indexer: indexer} -} - -// List lists all BGPPolicies in the indexer. -func (s *bGPPolicyLister) List(selector labels.Selector) (ret []*v1alpha1.BGPPolicy, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.BGPPolicy)) - }) - return ret, err -} - -// Get retrieves the BGPPolicy from the index for a given name. -func (s *bGPPolicyLister) Get(name string) (*v1alpha1.BGPPolicy, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("bgppolicy"), name) - } - return obj.(*v1alpha1.BGPPolicy), nil + return &bGPPolicyLister{listers.New[*v1alpha1.BGPPolicy](indexer, v1alpha1.Resource("bgppolicy"))} } diff --git a/pkg/client/listers/crd/v1alpha1/externalnode.go b/pkg/client/listers/crd/v1alpha1/externalnode.go index b1062dcd25c..18c9b44cea4 100644 --- a/pkg/client/listers/crd/v1alpha1/externalnode.go +++ b/pkg/client/listers/crd/v1alpha1/externalnode.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha1 import ( v1alpha1 "antrea.io/antrea/pkg/apis/crd/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -36,25 +36,17 @@ type ExternalNodeLister interface { // externalNodeLister implements the ExternalNodeLister interface. type externalNodeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ExternalNode] } // NewExternalNodeLister returns a new ExternalNodeLister. func NewExternalNodeLister(indexer cache.Indexer) ExternalNodeLister { - return &externalNodeLister{indexer: indexer} -} - -// List lists all ExternalNodes in the indexer. -func (s *externalNodeLister) List(selector labels.Selector) (ret []*v1alpha1.ExternalNode, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ExternalNode)) - }) - return ret, err + return &externalNodeLister{listers.New[*v1alpha1.ExternalNode](indexer, v1alpha1.Resource("externalnode"))} } // ExternalNodes returns an object that can list and get ExternalNodes. func (s *externalNodeLister) ExternalNodes(namespace string) ExternalNodeNamespaceLister { - return externalNodeNamespaceLister{indexer: s.indexer, namespace: namespace} + return externalNodeNamespaceLister{listers.NewNamespaced[*v1alpha1.ExternalNode](s.ResourceIndexer, namespace)} } // ExternalNodeNamespaceLister helps list and get ExternalNodes. @@ -72,26 +64,5 @@ type ExternalNodeNamespaceLister interface { // externalNodeNamespaceLister implements the ExternalNodeNamespaceLister // interface. type externalNodeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ExternalNodes in the indexer for a given namespace. -func (s externalNodeNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ExternalNode, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ExternalNode)) - }) - return ret, err -} - -// Get retrieves the ExternalNode from the indexer for a given namespace and name. -func (s externalNodeNamespaceLister) Get(name string) (*v1alpha1.ExternalNode, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("externalnode"), name) - } - return obj.(*v1alpha1.ExternalNode), nil + listers.ResourceIndexer[*v1alpha1.ExternalNode] } diff --git a/pkg/client/listers/crd/v1alpha1/nodelatencymonitor.go b/pkg/client/listers/crd/v1alpha1/nodelatencymonitor.go index 214da973843..a412a6d1828 100644 --- a/pkg/client/listers/crd/v1alpha1/nodelatencymonitor.go +++ b/pkg/client/listers/crd/v1alpha1/nodelatencymonitor.go @@ -18,8 +18,8 @@ package v1alpha1 import ( v1alpha1 "antrea.io/antrea/pkg/apis/crd/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type NodeLatencyMonitorLister interface { // nodeLatencyMonitorLister implements the NodeLatencyMonitorLister interface. type nodeLatencyMonitorLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.NodeLatencyMonitor] } // NewNodeLatencyMonitorLister returns a new NodeLatencyMonitorLister. func NewNodeLatencyMonitorLister(indexer cache.Indexer) NodeLatencyMonitorLister { - return &nodeLatencyMonitorLister{indexer: indexer} -} - -// List lists all NodeLatencyMonitors in the indexer. -func (s *nodeLatencyMonitorLister) List(selector labels.Selector) (ret []*v1alpha1.NodeLatencyMonitor, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NodeLatencyMonitor)) - }) - return ret, err -} - -// Get retrieves the NodeLatencyMonitor from the index for a given name. -func (s *nodeLatencyMonitorLister) Get(name string) (*v1alpha1.NodeLatencyMonitor, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("nodelatencymonitor"), name) - } - return obj.(*v1alpha1.NodeLatencyMonitor), nil + return &nodeLatencyMonitorLister{listers.New[*v1alpha1.NodeLatencyMonitor](indexer, v1alpha1.Resource("nodelatencymonitor"))} } diff --git a/pkg/client/listers/crd/v1alpha1/supportbundlecollection.go b/pkg/client/listers/crd/v1alpha1/supportbundlecollection.go index 75d59adc5d4..cf6ac3f5391 100644 --- a/pkg/client/listers/crd/v1alpha1/supportbundlecollection.go +++ b/pkg/client/listers/crd/v1alpha1/supportbundlecollection.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha1 import ( v1alpha1 "antrea.io/antrea/pkg/apis/crd/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type SupportBundleCollectionLister interface { // supportBundleCollectionLister implements the SupportBundleCollectionLister interface. type supportBundleCollectionLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.SupportBundleCollection] } // NewSupportBundleCollectionLister returns a new SupportBundleCollectionLister. func NewSupportBundleCollectionLister(indexer cache.Indexer) SupportBundleCollectionLister { - return &supportBundleCollectionLister{indexer: indexer} -} - -// List lists all SupportBundleCollections in the indexer. -func (s *supportBundleCollectionLister) List(selector labels.Selector) (ret []*v1alpha1.SupportBundleCollection, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.SupportBundleCollection)) - }) - return ret, err -} - -// Get retrieves the SupportBundleCollection from the index for a given name. -func (s *supportBundleCollectionLister) Get(name string) (*v1alpha1.SupportBundleCollection, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("supportbundlecollection"), name) - } - return obj.(*v1alpha1.SupportBundleCollection), nil + return &supportBundleCollectionLister{listers.New[*v1alpha1.SupportBundleCollection](indexer, v1alpha1.Resource("supportbundlecollection"))} } diff --git a/pkg/client/listers/crd/v1alpha2/externalentity.go b/pkg/client/listers/crd/v1alpha2/externalentity.go index 0569434160d..325b2c7bf1a 100644 --- a/pkg/client/listers/crd/v1alpha2/externalentity.go +++ b/pkg/client/listers/crd/v1alpha2/externalentity.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha2 import ( v1alpha2 "antrea.io/antrea/pkg/apis/crd/v1alpha2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -36,25 +36,17 @@ type ExternalEntityLister interface { // externalEntityLister implements the ExternalEntityLister interface. type externalEntityLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.ExternalEntity] } // NewExternalEntityLister returns a new ExternalEntityLister. func NewExternalEntityLister(indexer cache.Indexer) ExternalEntityLister { - return &externalEntityLister{indexer: indexer} -} - -// List lists all ExternalEntities in the indexer. -func (s *externalEntityLister) List(selector labels.Selector) (ret []*v1alpha2.ExternalEntity, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ExternalEntity)) - }) - return ret, err + return &externalEntityLister{listers.New[*v1alpha2.ExternalEntity](indexer, v1alpha2.Resource("externalentity"))} } // ExternalEntities returns an object that can list and get ExternalEntities. func (s *externalEntityLister) ExternalEntities(namespace string) ExternalEntityNamespaceLister { - return externalEntityNamespaceLister{indexer: s.indexer, namespace: namespace} + return externalEntityNamespaceLister{listers.NewNamespaced[*v1alpha2.ExternalEntity](s.ResourceIndexer, namespace)} } // ExternalEntityNamespaceLister helps list and get ExternalEntities. @@ -72,26 +64,5 @@ type ExternalEntityNamespaceLister interface { // externalEntityNamespaceLister implements the ExternalEntityNamespaceLister // interface. type externalEntityNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ExternalEntities in the indexer for a given namespace. -func (s externalEntityNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.ExternalEntity, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ExternalEntity)) - }) - return ret, err -} - -// Get retrieves the ExternalEntity from the indexer for a given namespace and name. -func (s externalEntityNamespaceLister) Get(name string) (*v1alpha2.ExternalEntity, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("externalentity"), name) - } - return obj.(*v1alpha2.ExternalEntity), nil + listers.ResourceIndexer[*v1alpha2.ExternalEntity] } diff --git a/pkg/client/listers/crd/v1alpha2/ippool.go b/pkg/client/listers/crd/v1alpha2/ippool.go index f8c8bb36eed..d6314b32033 100644 --- a/pkg/client/listers/crd/v1alpha2/ippool.go +++ b/pkg/client/listers/crd/v1alpha2/ippool.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha2 import ( v1alpha2 "antrea.io/antrea/pkg/apis/crd/v1alpha2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type IPPoolLister interface { // iPPoolLister implements the IPPoolLister interface. type iPPoolLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.IPPool] } // NewIPPoolLister returns a new IPPoolLister. func NewIPPoolLister(indexer cache.Indexer) IPPoolLister { - return &iPPoolLister{indexer: indexer} -} - -// List lists all IPPools in the indexer. -func (s *iPPoolLister) List(selector labels.Selector) (ret []*v1alpha2.IPPool, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.IPPool)) - }) - return ret, err -} - -// Get retrieves the IPPool from the index for a given name. -func (s *iPPoolLister) Get(name string) (*v1alpha2.IPPool, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("ippool"), name) - } - return obj.(*v1alpha2.IPPool), nil + return &iPPoolLister{listers.New[*v1alpha2.IPPool](indexer, v1alpha2.Resource("ippool"))} } diff --git a/pkg/client/listers/crd/v1alpha2/trafficcontrol.go b/pkg/client/listers/crd/v1alpha2/trafficcontrol.go index c8d15b0757a..794032aadd9 100644 --- a/pkg/client/listers/crd/v1alpha2/trafficcontrol.go +++ b/pkg/client/listers/crd/v1alpha2/trafficcontrol.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1alpha2 import ( v1alpha2 "antrea.io/antrea/pkg/apis/crd/v1alpha2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type TrafficControlLister interface { // trafficControlLister implements the TrafficControlLister interface. type trafficControlLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.TrafficControl] } // NewTrafficControlLister returns a new TrafficControlLister. func NewTrafficControlLister(indexer cache.Indexer) TrafficControlLister { - return &trafficControlLister{indexer: indexer} -} - -// List lists all TrafficControls in the indexer. -func (s *trafficControlLister) List(selector labels.Selector) (ret []*v1alpha2.TrafficControl, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.TrafficControl)) - }) - return ret, err -} - -// Get retrieves the TrafficControl from the index for a given name. -func (s *trafficControlLister) Get(name string) (*v1alpha2.TrafficControl, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("trafficcontrol"), name) - } - return obj.(*v1alpha2.TrafficControl), nil + return &trafficControlLister{listers.New[*v1alpha2.TrafficControl](indexer, v1alpha2.Resource("trafficcontrol"))} } diff --git a/pkg/client/listers/crd/v1beta1/antreaagentinfo.go b/pkg/client/listers/crd/v1beta1/antreaagentinfo.go index 3c9dcd3d6b3..0e38fabb4a2 100644 --- a/pkg/client/listers/crd/v1beta1/antreaagentinfo.go +++ b/pkg/client/listers/crd/v1beta1/antreaagentinfo.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1beta1 import ( v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type AntreaAgentInfoLister interface { // antreaAgentInfoLister implements the AntreaAgentInfoLister interface. type antreaAgentInfoLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.AntreaAgentInfo] } // NewAntreaAgentInfoLister returns a new AntreaAgentInfoLister. func NewAntreaAgentInfoLister(indexer cache.Indexer) AntreaAgentInfoLister { - return &antreaAgentInfoLister{indexer: indexer} -} - -// List lists all AntreaAgentInfos in the indexer. -func (s *antreaAgentInfoLister) List(selector labels.Selector) (ret []*v1beta1.AntreaAgentInfo, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.AntreaAgentInfo)) - }) - return ret, err -} - -// Get retrieves the AntreaAgentInfo from the index for a given name. -func (s *antreaAgentInfoLister) Get(name string) (*v1beta1.AntreaAgentInfo, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("antreaagentinfo"), name) - } - return obj.(*v1beta1.AntreaAgentInfo), nil + return &antreaAgentInfoLister{listers.New[*v1beta1.AntreaAgentInfo](indexer, v1beta1.Resource("antreaagentinfo"))} } diff --git a/pkg/client/listers/crd/v1beta1/antreacontrollerinfo.go b/pkg/client/listers/crd/v1beta1/antreacontrollerinfo.go index 62e71df534c..d11804c4292 100644 --- a/pkg/client/listers/crd/v1beta1/antreacontrollerinfo.go +++ b/pkg/client/listers/crd/v1beta1/antreacontrollerinfo.go @@ -1,4 +1,4 @@ -// Copyright 2021 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1beta1 import ( v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type AntreaControllerInfoLister interface { // antreaControllerInfoLister implements the AntreaControllerInfoLister interface. type antreaControllerInfoLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.AntreaControllerInfo] } // NewAntreaControllerInfoLister returns a new AntreaControllerInfoLister. func NewAntreaControllerInfoLister(indexer cache.Indexer) AntreaControllerInfoLister { - return &antreaControllerInfoLister{indexer: indexer} -} - -// List lists all AntreaControllerInfos in the indexer. -func (s *antreaControllerInfoLister) List(selector labels.Selector) (ret []*v1beta1.AntreaControllerInfo, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.AntreaControllerInfo)) - }) - return ret, err -} - -// Get retrieves the AntreaControllerInfo from the index for a given name. -func (s *antreaControllerInfoLister) Get(name string) (*v1beta1.AntreaControllerInfo, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("antreacontrollerinfo"), name) - } - return obj.(*v1beta1.AntreaControllerInfo), nil + return &antreaControllerInfoLister{listers.New[*v1beta1.AntreaControllerInfo](indexer, v1beta1.Resource("antreacontrollerinfo"))} } diff --git a/pkg/client/listers/crd/v1beta1/clustergroup.go b/pkg/client/listers/crd/v1beta1/clustergroup.go index f3df1f83983..7320f5f4dab 100644 --- a/pkg/client/listers/crd/v1beta1/clustergroup.go +++ b/pkg/client/listers/crd/v1beta1/clustergroup.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1beta1 import ( v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type ClusterGroupLister interface { // clusterGroupLister implements the ClusterGroupLister interface. type clusterGroupLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.ClusterGroup] } // NewClusterGroupLister returns a new ClusterGroupLister. func NewClusterGroupLister(indexer cache.Indexer) ClusterGroupLister { - return &clusterGroupLister{indexer: indexer} -} - -// List lists all ClusterGroups in the indexer. -func (s *clusterGroupLister) List(selector labels.Selector) (ret []*v1beta1.ClusterGroup, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.ClusterGroup)) - }) - return ret, err -} - -// Get retrieves the ClusterGroup from the index for a given name. -func (s *clusterGroupLister) Get(name string) (*v1beta1.ClusterGroup, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("clustergroup"), name) - } - return obj.(*v1beta1.ClusterGroup), nil + return &clusterGroupLister{listers.New[*v1beta1.ClusterGroup](indexer, v1beta1.Resource("clustergroup"))} } diff --git a/pkg/client/listers/crd/v1beta1/clusternetworkpolicy.go b/pkg/client/listers/crd/v1beta1/clusternetworkpolicy.go index 5b27c325ec8..8a3563f1faf 100644 --- a/pkg/client/listers/crd/v1beta1/clusternetworkpolicy.go +++ b/pkg/client/listers/crd/v1beta1/clusternetworkpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1beta1 import ( v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type ClusterNetworkPolicyLister interface { // clusterNetworkPolicyLister implements the ClusterNetworkPolicyLister interface. type clusterNetworkPolicyLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.ClusterNetworkPolicy] } // NewClusterNetworkPolicyLister returns a new ClusterNetworkPolicyLister. func NewClusterNetworkPolicyLister(indexer cache.Indexer) ClusterNetworkPolicyLister { - return &clusterNetworkPolicyLister{indexer: indexer} -} - -// List lists all ClusterNetworkPolicies in the indexer. -func (s *clusterNetworkPolicyLister) List(selector labels.Selector) (ret []*v1beta1.ClusterNetworkPolicy, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.ClusterNetworkPolicy)) - }) - return ret, err -} - -// Get retrieves the ClusterNetworkPolicy from the index for a given name. -func (s *clusterNetworkPolicyLister) Get(name string) (*v1beta1.ClusterNetworkPolicy, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("clusternetworkpolicy"), name) - } - return obj.(*v1beta1.ClusterNetworkPolicy), nil + return &clusterNetworkPolicyLister{listers.New[*v1beta1.ClusterNetworkPolicy](indexer, v1beta1.Resource("clusternetworkpolicy"))} } diff --git a/pkg/client/listers/crd/v1beta1/egress.go b/pkg/client/listers/crd/v1beta1/egress.go index 47111652351..3f70939d0fb 100644 --- a/pkg/client/listers/crd/v1beta1/egress.go +++ b/pkg/client/listers/crd/v1beta1/egress.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1beta1 import ( v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type EgressLister interface { // egressLister implements the EgressLister interface. type egressLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.Egress] } // NewEgressLister returns a new EgressLister. func NewEgressLister(indexer cache.Indexer) EgressLister { - return &egressLister{indexer: indexer} -} - -// List lists all Egresses in the indexer. -func (s *egressLister) List(selector labels.Selector) (ret []*v1beta1.Egress, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Egress)) - }) - return ret, err -} - -// Get retrieves the Egress from the index for a given name. -func (s *egressLister) Get(name string) (*v1beta1.Egress, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("egress"), name) - } - return obj.(*v1beta1.Egress), nil + return &egressLister{listers.New[*v1beta1.Egress](indexer, v1beta1.Resource("egress"))} } diff --git a/pkg/client/listers/crd/v1beta1/externalippool.go b/pkg/client/listers/crd/v1beta1/externalippool.go index ae43d75391d..0f8b810980e 100644 --- a/pkg/client/listers/crd/v1beta1/externalippool.go +++ b/pkg/client/listers/crd/v1beta1/externalippool.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1beta1 import ( v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type ExternalIPPoolLister interface { // externalIPPoolLister implements the ExternalIPPoolLister interface. type externalIPPoolLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.ExternalIPPool] } // NewExternalIPPoolLister returns a new ExternalIPPoolLister. func NewExternalIPPoolLister(indexer cache.Indexer) ExternalIPPoolLister { - return &externalIPPoolLister{indexer: indexer} -} - -// List lists all ExternalIPPools in the indexer. -func (s *externalIPPoolLister) List(selector labels.Selector) (ret []*v1beta1.ExternalIPPool, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.ExternalIPPool)) - }) - return ret, err -} - -// Get retrieves the ExternalIPPool from the index for a given name. -func (s *externalIPPoolLister) Get(name string) (*v1beta1.ExternalIPPool, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("externalippool"), name) - } - return obj.(*v1beta1.ExternalIPPool), nil + return &externalIPPoolLister{listers.New[*v1beta1.ExternalIPPool](indexer, v1beta1.Resource("externalippool"))} } diff --git a/pkg/client/listers/crd/v1beta1/group.go b/pkg/client/listers/crd/v1beta1/group.go index 56c3d95e716..d5ab0f710f6 100644 --- a/pkg/client/listers/crd/v1beta1/group.go +++ b/pkg/client/listers/crd/v1beta1/group.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1beta1 import ( v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -36,25 +36,17 @@ type GroupLister interface { // groupLister implements the GroupLister interface. type groupLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.Group] } // NewGroupLister returns a new GroupLister. func NewGroupLister(indexer cache.Indexer) GroupLister { - return &groupLister{indexer: indexer} -} - -// List lists all Groups in the indexer. -func (s *groupLister) List(selector labels.Selector) (ret []*v1beta1.Group, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Group)) - }) - return ret, err + return &groupLister{listers.New[*v1beta1.Group](indexer, v1beta1.Resource("group"))} } // Groups returns an object that can list and get Groups. func (s *groupLister) Groups(namespace string) GroupNamespaceLister { - return groupNamespaceLister{indexer: s.indexer, namespace: namespace} + return groupNamespaceLister{listers.NewNamespaced[*v1beta1.Group](s.ResourceIndexer, namespace)} } // GroupNamespaceLister helps list and get Groups. @@ -72,26 +64,5 @@ type GroupNamespaceLister interface { // groupNamespaceLister implements the GroupNamespaceLister // interface. type groupNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Groups in the indexer for a given namespace. -func (s groupNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Group, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Group)) - }) - return ret, err -} - -// Get retrieves the Group from the indexer for a given namespace and name. -func (s groupNamespaceLister) Get(name string) (*v1beta1.Group, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("group"), name) - } - return obj.(*v1beta1.Group), nil + listers.ResourceIndexer[*v1beta1.Group] } diff --git a/pkg/client/listers/crd/v1beta1/ippool.go b/pkg/client/listers/crd/v1beta1/ippool.go index e060d0634ef..a2bf3053a99 100644 --- a/pkg/client/listers/crd/v1beta1/ippool.go +++ b/pkg/client/listers/crd/v1beta1/ippool.go @@ -18,8 +18,8 @@ package v1beta1 import ( v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type IPPoolLister interface { // iPPoolLister implements the IPPoolLister interface. type iPPoolLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.IPPool] } // NewIPPoolLister returns a new IPPoolLister. func NewIPPoolLister(indexer cache.Indexer) IPPoolLister { - return &iPPoolLister{indexer: indexer} -} - -// List lists all IPPools in the indexer. -func (s *iPPoolLister) List(selector labels.Selector) (ret []*v1beta1.IPPool, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.IPPool)) - }) - return ret, err -} - -// Get retrieves the IPPool from the index for a given name. -func (s *iPPoolLister) Get(name string) (*v1beta1.IPPool, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("ippool"), name) - } - return obj.(*v1beta1.IPPool), nil + return &iPPoolLister{listers.New[*v1beta1.IPPool](indexer, v1beta1.Resource("ippool"))} } diff --git a/pkg/client/listers/crd/v1beta1/networkpolicy.go b/pkg/client/listers/crd/v1beta1/networkpolicy.go index 9131f6fcdf2..f300ef0992e 100644 --- a/pkg/client/listers/crd/v1beta1/networkpolicy.go +++ b/pkg/client/listers/crd/v1beta1/networkpolicy.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1beta1 import ( v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -36,25 +36,17 @@ type NetworkPolicyLister interface { // networkPolicyLister implements the NetworkPolicyLister interface. type networkPolicyLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.NetworkPolicy] } // NewNetworkPolicyLister returns a new NetworkPolicyLister. func NewNetworkPolicyLister(indexer cache.Indexer) NetworkPolicyLister { - return &networkPolicyLister{indexer: indexer} -} - -// List lists all NetworkPolicies in the indexer. -func (s *networkPolicyLister) List(selector labels.Selector) (ret []*v1beta1.NetworkPolicy, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.NetworkPolicy)) - }) - return ret, err + return &networkPolicyLister{listers.New[*v1beta1.NetworkPolicy](indexer, v1beta1.Resource("networkpolicy"))} } // NetworkPolicies returns an object that can list and get NetworkPolicies. func (s *networkPolicyLister) NetworkPolicies(namespace string) NetworkPolicyNamespaceLister { - return networkPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} + return networkPolicyNamespaceLister{listers.NewNamespaced[*v1beta1.NetworkPolicy](s.ResourceIndexer, namespace)} } // NetworkPolicyNamespaceLister helps list and get NetworkPolicies. @@ -72,26 +64,5 @@ type NetworkPolicyNamespaceLister interface { // networkPolicyNamespaceLister implements the NetworkPolicyNamespaceLister // interface. type networkPolicyNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all NetworkPolicies in the indexer for a given namespace. -func (s networkPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.NetworkPolicy, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.NetworkPolicy)) - }) - return ret, err -} - -// Get retrieves the NetworkPolicy from the indexer for a given namespace and name. -func (s networkPolicyNamespaceLister) Get(name string) (*v1beta1.NetworkPolicy, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("networkpolicy"), name) - } - return obj.(*v1beta1.NetworkPolicy), nil + listers.ResourceIndexer[*v1beta1.NetworkPolicy] } diff --git a/pkg/client/listers/crd/v1beta1/tier.go b/pkg/client/listers/crd/v1beta1/tier.go index 6bfa4c7f897..7f4cbbac84c 100644 --- a/pkg/client/listers/crd/v1beta1/tier.go +++ b/pkg/client/listers/crd/v1beta1/tier.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1beta1 import ( v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type TierLister interface { // tierLister implements the TierLister interface. type tierLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.Tier] } // NewTierLister returns a new TierLister. func NewTierLister(indexer cache.Indexer) TierLister { - return &tierLister{indexer: indexer} -} - -// List lists all Tiers in the indexer. -func (s *tierLister) List(selector labels.Selector) (ret []*v1beta1.Tier, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Tier)) - }) - return ret, err -} - -// Get retrieves the Tier from the index for a given name. -func (s *tierLister) Get(name string) (*v1beta1.Tier, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("tier"), name) - } - return obj.(*v1beta1.Tier), nil + return &tierLister{listers.New[*v1beta1.Tier](indexer, v1beta1.Resource("tier"))} } diff --git a/pkg/client/listers/crd/v1beta1/traceflow.go b/pkg/client/listers/crd/v1beta1/traceflow.go index df1fc9a671f..1cd980c9513 100644 --- a/pkg/client/listers/crd/v1beta1/traceflow.go +++ b/pkg/client/listers/crd/v1beta1/traceflow.go @@ -1,4 +1,4 @@ -// Copyright 2023 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package v1beta1 import ( v1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,30 +37,10 @@ type TraceflowLister interface { // traceflowLister implements the TraceflowLister interface. type traceflowLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.Traceflow] } // NewTraceflowLister returns a new TraceflowLister. func NewTraceflowLister(indexer cache.Indexer) TraceflowLister { - return &traceflowLister{indexer: indexer} -} - -// List lists all Traceflows in the indexer. -func (s *traceflowLister) List(selector labels.Selector) (ret []*v1beta1.Traceflow, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Traceflow)) - }) - return ret, err -} - -// Get retrieves the Traceflow from the index for a given name. -func (s *traceflowLister) Get(name string) (*v1beta1.Traceflow, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("traceflow"), name) - } - return obj.(*v1beta1.Traceflow), nil + return &traceflowLister{listers.New[*v1beta1.Traceflow](indexer, v1beta1.Resource("traceflow"))} } diff --git a/pkg/controller/certificatesigningrequest/approving_controller.go b/pkg/controller/certificatesigningrequest/approving_controller.go index 4a328df29a9..de571a24dc2 100644 --- a/pkg/controller/certificatesigningrequest/approving_controller.go +++ b/pkg/controller/certificatesigningrequest/approving_controller.go @@ -47,7 +47,7 @@ type CSRApprovingController struct { csrInformer cache.SharedIndexInformer csrLister csrlisters.CertificateSigningRequestLister csrListerSynced cache.InformerSynced - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] approvers []approver } @@ -58,7 +58,12 @@ func NewCSRApprovingController(client clientset.Interface, csrInformer cache.Sha csrInformer: csrInformer, csrLister: csrLister, csrListerSynced: csrInformer.HasSynced, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "certificateSigningRequest"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "certificateSigningRequest", + }, + ), approvers: []approver{ newIPsecCSRApprover(client), }, @@ -156,7 +161,7 @@ func (c *CSRApprovingController) processNextWorkItem() bool { return false } defer c.queue.Done(key) - err := c.syncCSR(key.(string)) + err := c.syncCSR(key) if err != nil { c.queue.AddRateLimited(key) klog.ErrorS(err, "Failed to sync CertificateSigningRequest", "CertificateSigningRequest", key) diff --git a/pkg/controller/certificatesigningrequest/ipsec_csr_signing_controller.go b/pkg/controller/certificatesigningrequest/ipsec_csr_signing_controller.go index 2f2e847d74c..d116d791ade 100644 --- a/pkg/controller/certificatesigningrequest/ipsec_csr_signing_controller.go +++ b/pkg/controller/certificatesigningrequest/ipsec_csr_signing_controller.go @@ -75,8 +75,8 @@ type IPsecCSRSigningController struct { // saved CertificateAuthority certificateAuthority atomic.Value - queue workqueue.RateLimitingInterface - fixturesQueue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] + fixturesQueue workqueue.TypedRateLimitingInterface[string] } // certificateAuthority implements a certificate authority and used by the signing controller. @@ -126,8 +126,18 @@ func NewIPsecCSRSigningController(client clientset.Interface, csrInformer cache. configMapLister: configMapLister, configMapListerSynced: caConfigMapInformer.HasSynced, selfSignedCA: selfSignedCA, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "certificateSigningRequest"), - fixturesQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "certificateSigningRequest"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "certificateSigningRequest", + }, + ), + fixturesQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "certificateSigningRequestFixtures", + }, + ), } csrInformer.AddEventHandlerWithResyncPeriod( @@ -422,8 +432,7 @@ func (c *IPsecCSRSigningController) processNextWorkItem() bool { return false } defer c.queue.Done(key) - err := c.syncCSR(key.(string)) - if err != nil { + if err := c.syncCSR(key); err != nil { c.queue.AddRateLimited(key) klog.ErrorS(err, "Failed to sync CertificateSigningRequest", "CertificateSigningRequest", key) return true diff --git a/pkg/controller/egress/controller.go b/pkg/controller/egress/controller.go index efc08c1e462..a6e6d814890 100644 --- a/pkg/controller/egress/controller.go +++ b/pkg/controller/egress/controller.go @@ -87,7 +87,7 @@ type EgressController struct { // egressGroupStore is the storage where the EgressGroups are stored. egressGroupStore storage.Interface // queue maintains the EgressGroup objects that need to be synced. - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] // groupingInterface knows Pods that a given group selects. groupingInterface grouping.Interface // Added as a member to the struct to allow injection for testing. @@ -101,13 +101,18 @@ func NewEgressController(crdClient clientset.Interface, externalIPAllocator externalippool.ExternalIPAllocator, egressGroupStore storage.Interface) *EgressController { c := &EgressController{ - crdClient: crdClient, - egressInformer: egressInformer, - egressLister: egressInformer.Lister(), - egressListerSynced: egressInformer.Informer().HasSynced, - egressIndexer: egressInformer.Informer().GetIndexer(), - egressGroupStore: egressGroupStore, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "egress"), + crdClient: crdClient, + egressInformer: egressInformer, + egressLister: egressInformer.Lister(), + egressListerSynced: egressInformer.Informer().HasSynced, + egressIndexer: egressInformer.Informer().GetIndexer(), + egressGroupStore: egressGroupStore, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "egress", + }, + ), groupingInterface: groupingInterface, groupingInterfaceSynced: groupingInterface.HasSynced, ipAllocationMap: map[string]*ipAllocation{}, @@ -203,8 +208,7 @@ func (c *EgressController) processNextEgressGroupWorkItem() bool { } defer c.queue.Done(key) - err := c.syncEgress(key.(string)) - if err != nil { + if err := c.syncEgress(key); err != nil { // Put the item back on the workqueue to handle any transient errors. c.queue.AddRateLimited(key) klog.ErrorS(err, "Failed to sync EgressGroup", "key", key) diff --git a/pkg/controller/externalippool/controller.go b/pkg/controller/externalippool/controller.go index ae54ce5b46a..2964fd53c23 100644 --- a/pkg/controller/externalippool/controller.go +++ b/pkg/controller/externalippool/controller.go @@ -114,7 +114,7 @@ type ExternalIPPoolController struct { handlersWaitGroup sync.WaitGroup // queue maintains the ExternalIPPool objects that need to be synced. - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] } // NewExternalIPPoolController returns a new *ExternalIPPoolController. @@ -123,9 +123,14 @@ func NewExternalIPPoolController(crdClient clientset.Interface, externalIPPoolIn crdClient: crdClient, externalIPPoolLister: externalIPPoolInformer.Lister(), externalIPPoolListerSynced: externalIPPoolInformer.Informer().HasSynced, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "externalIPPool"), - ipAllocatorInitialized: &atomic.Value{}, - ipAllocatorMap: make(map[string]ipallocator.MultiIPAllocator), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "externalIPPool", + }, + ), + ipAllocatorInitialized: &atomic.Value{}, + ipAllocatorMap: make(map[string]ipallocator.MultiIPAllocator), } externalIPPoolInformer.Informer().AddEventHandlerWithResyncPeriod( cache.ResourceEventHandlerFuncs{ @@ -369,8 +374,7 @@ func (c *ExternalIPPoolController) processNextWorkItem() bool { } defer c.queue.Done(key) - err := c.updateExternalIPPoolStatus(key.(string)) - if err != nil { + if err := c.updateExternalIPPoolStatus(key); err != nil { // Put the item back in the workqueue to handle any transient errors. c.queue.AddRateLimited(key) klog.ErrorS(err, "Failed to sync ExternalIPPool status", "ExternalIPPool", key) diff --git a/pkg/controller/externalnode/controller.go b/pkg/controller/externalnode/controller.go index d1c7f277875..6f683f4a2c2 100644 --- a/pkg/controller/externalnode/controller.go +++ b/pkg/controller/externalnode/controller.go @@ -70,7 +70,7 @@ type ExternalNodeController struct { syncedExternalNode cache.Store // queue maintains the ExternalNode objects that need to be synced. - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] } func NewExternalNodeController(crdClient clientset.Interface, externalNodeInformer externalnodeinformers.ExternalNodeInformer, @@ -87,7 +87,12 @@ func NewExternalNodeController(crdClient clientset.Interface, externalNodeInform externalEntityListerSynced: externalEntityInformer.Informer().HasSynced, syncedExternalNode: cache.NewStore(keyFunc), - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "externalnode"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "externalNode", + }, + ), } c.externalNodeInformer.Informer().AddEventHandlerWithResyncPeriod( cache.ResourceEventHandlerFuncs{ @@ -185,17 +190,13 @@ func (c *ExternalNodeController) worker() { } func (c *ExternalNodeController) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) + defer c.queue.Done(key) - if key, ok := obj.(string); !ok { - c.queue.Forget(obj) - klog.Errorf("Expected string in ExternalNode work queue but got %#v", obj) - return true - } else if err := c.syncExternalNode(key); err == nil { + if err := c.syncExternalNode(key); err == nil { // If no error occurs we Forget this item so it does not get queued again until // another change happens. c.queue.Forget(key) diff --git a/pkg/controller/grouping/controller_test.go b/pkg/controller/grouping/controller_test.go index 97d1c425e78..ac9517f8c35 100644 --- a/pkg/controller/grouping/controller_test.go +++ b/pkg/controller/grouping/controller_test.go @@ -68,7 +68,7 @@ func TestGroupEntityControllerRun(t *testing.T) { eventChanSize = originalEventChanSize }() - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, tt.antreaPolicyEnabled)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, tt.antreaPolicyEnabled) var objs []runtime.Object for _, pod := range tt.initialPods { objs = append(objs, pod) diff --git a/pkg/controller/ipam/antrea_ipam_controller.go b/pkg/controller/ipam/antrea_ipam_controller.go index d6b84ac4395..b1d5c5f788a 100644 --- a/pkg/controller/ipam/antrea_ipam_controller.go +++ b/pkg/controller/ipam/antrea_ipam_controller.go @@ -68,7 +68,7 @@ type AntreaIPAMController struct { crdClient versioned.Interface // Pool cleanup events triggered by StatefulSet add/delete - statefulSetQueue workqueue.RateLimitingInterface + statefulSetQueue workqueue.TypedRateLimitingInterface[string] // follow changes for Namespace objects namespaceLister corelisters.NamespaceLister @@ -88,7 +88,7 @@ type AntreaIPAMController struct { ipPoolListerSynced cache.InformerSynced // statusQueue maintains the IPPool objects that need to be synced. - statusQueue workqueue.RateLimitingInterface + statusQueue workqueue.TypedRateLimitingInterface[string] } func statefulSetIndexFunc(obj interface{}) ([]string, error) { @@ -114,8 +114,13 @@ func NewAntreaIPAMController(crdClient versioned.Interface, ipPoolInformer.Informer().AddIndexers(cache.Indexers{statefulSetIndex: statefulSetIndexFunc}) c := &AntreaIPAMController{ - crdClient: crdClient, - statefulSetQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "statefulSetPreallocationAndCleanup"), + crdClient: crdClient, + statefulSetQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "statefulSetPreallocationAndCleanup", + }, + ), namespaceLister: namespaceInformer.Lister(), namespaceListerSynced: namespaceInformer.Informer().HasSynced, statefulSetInformer: statefulSetInformer, @@ -125,7 +130,12 @@ func NewAntreaIPAMController(crdClient versioned.Interface, ipPoolInformer: ipPoolInformer, ipPoolLister: ipPoolInformer.Lister(), ipPoolListerSynced: ipPoolInformer.Informer().HasSynced, - statusQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "IPPoolStatus"), + statusQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "IPPoolStatus", + }, + ), } // Add handlers for Stateful Set events. @@ -353,14 +363,13 @@ func (c *AntreaIPAMController) processNextStatefulSetWorkItem() bool { defer c.statefulSetQueue.Done(key) - namespacedName := key.(string) - namespace, name := k8s.SplitNamespacedName(namespacedName) + namespace, name := k8s.SplitNamespacedName(key) ss, err := c.statefulSetInformer.Lister().StatefulSets(namespace).Get(name) if err != nil { if errors.IsNotFound(err) { // StatefulSet no longer present - clean up reserved pool IPs - err = c.cleanIPPoolForStatefulSet(namespacedName) + err = c.cleanIPPoolForStatefulSet(key) if err != nil { // Put the item back on the workqueue to handle any transient errors. c.statefulSetQueue.AddRateLimited(key) @@ -445,8 +454,7 @@ func (c *AntreaIPAMController) processNextWorkItem() bool { } defer c.statusQueue.Done(key) - err := c.updateIPPoolCounters(key.(string)) - if err != nil { + if err := c.updateIPPoolCounters(key); err != nil { // Put the item back in the workqueue to handle any transient errors. c.statusQueue.AddRateLimited(key) klog.ErrorS(err, "Failed to sync IPPool status", "IPPool", key) diff --git a/pkg/controller/networkpolicy/adminnetworkpolicy_test.go b/pkg/controller/networkpolicy/adminnetworkpolicy_test.go index c7dea83f135..f7d1fb9394f 100644 --- a/pkg/controller/networkpolicy/adminnetworkpolicy_test.go +++ b/pkg/controller/networkpolicy/adminnetworkpolicy_test.go @@ -413,7 +413,7 @@ func TestProcessAdminNetworkPolicy(t *testing.T) { expectedAddressGroups: 0, }, } - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AdminNetworkPolicy, true) + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AdminNetworkPolicy, true) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { _, c := newController(nil, nil) @@ -709,7 +709,7 @@ func TestProcessBaselineAdminNetworkPolicy(t *testing.T) { expectedAddressGroups: 1, }, } - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AdminNetworkPolicy, true) + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AdminNetworkPolicy, true) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { _, c := newController(nil, nil) diff --git a/pkg/controller/networkpolicy/clustergroup.go b/pkg/controller/networkpolicy/clustergroup.go index 6e99618f973..821a3448d35 100644 --- a/pkg/controller/networkpolicy/clustergroup.go +++ b/pkg/controller/networkpolicy/clustergroup.go @@ -187,8 +187,7 @@ func (c *NetworkPolicyController) processNextInternalGroupWorkItem() bool { } defer c.internalGroupQueue.Done(key) - err := c.syncInternalGroup(key.(string)) - if err != nil { + if err := c.syncInternalGroup(key); err != nil { // Put the item back in the workqueue to handle any transient errors. c.internalGroupQueue.AddRateLimited(key) klog.Errorf("Failed to sync internal Group %s: %v", key, err) diff --git a/pkg/controller/networkpolicy/clustergroup_test.go b/pkg/controller/networkpolicy/clustergroup_test.go index 4378a73fa95..f8daadb127c 100644 --- a/pkg/controller/networkpolicy/clustergroup_test.go +++ b/pkg/controller/networkpolicy/clustergroup_test.go @@ -1018,7 +1018,7 @@ func TestSyncInternalGroup(t *testing.T) { actualKeys := make([]controlplane.NetworkPolicyReference, 0, 2) for i := 0; i < 2; i++ { key, _ := npc.internalNetworkPolicyQueue.Get() - actualKeys = append(actualKeys, key.(controlplane.NetworkPolicyReference)) + actualKeys = append(actualKeys, key) npc.internalNetworkPolicyQueue.Done(key) } assert.ElementsMatch(t, expectedKeys, actualKeys) diff --git a/pkg/controller/networkpolicy/crd_utils_test.go b/pkg/controller/networkpolicy/crd_utils_test.go index 40963a94596..0c3eb5c5d37 100644 --- a/pkg/controller/networkpolicy/crd_utils_test.go +++ b/pkg/controller/networkpolicy/crd_utils_test.go @@ -476,7 +476,7 @@ func TestToAntreaPeerForCRD(t *testing.T) { npc.addClusterGroup(&cgA) npc.cgStore.Add(&cgA) if tt.clusterSetScope { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.Multicluster, true)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.Multicluster, true) labelIdentityA := "ns:kubernetes.io/metadata.name=testing,purpose=test&pod:foo1=bar1" labelIdentityB := "ns:kubernetes.io/metadata.name=testing,purpose=test&pod:foo2=bar2" npc.labelIdentityInterface.AddLabelIdentity(labelIdentityA, 1) diff --git a/pkg/controller/networkpolicy/networkpolicy_controller.go b/pkg/controller/networkpolicy/networkpolicy_controller.go index a38503ed88f..840539167c2 100644 --- a/pkg/controller/networkpolicy/networkpolicy_controller.go +++ b/pkg/controller/networkpolicy/networkpolicy_controller.go @@ -235,16 +235,16 @@ type NetworkPolicyController struct { // appliedToGroupQueue maintains the networkpolicy.AppliedToGroup objects that // need to be synced. - appliedToGroupQueue workqueue.RateLimitingInterface + appliedToGroupQueue workqueue.TypedRateLimitingInterface[string] // addressGroupQueue maintains the networkpolicy.AddressGroup objects that // need to be synced. - addressGroupQueue workqueue.RateLimitingInterface + addressGroupQueue workqueue.TypedRateLimitingInterface[string] // internalNetworkPolicyQueue maintains the networkpolicy.NetworkPolicy objects that // need to be synced. - internalNetworkPolicyQueue workqueue.RateLimitingInterface + internalNetworkPolicyQueue workqueue.TypedRateLimitingInterface[controlplane.NetworkPolicyReference] // internalGroupQueue maintains the networkpolicy.Group objects that needs to be // synced. - internalGroupQueue workqueue.RateLimitingInterface + internalGroupQueue workqueue.TypedRateLimitingInterface[string] // internalNetworkPolicyMutex prevents concurrent processing of internal networkpolicies who refer // to the same addressgroups/appliedtogroups. @@ -435,15 +435,35 @@ func NewNetworkPolicyController(kubeClient clientset.Interface, appliedToGroupStore: appliedToGroupStore, internalNetworkPolicyStore: internalNetworkPolicyStore, internalGroupStore: internalGroupStore, - appliedToGroupQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "appliedToGroup"), - addressGroupQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "addressGroup"), - internalNetworkPolicyQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "internalNetworkPolicy"), - internalGroupQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "internalGroup"), - groupingInterface: groupingInterface, - groupingInterfaceSynced: groupingInterface.HasSynced, - labelIdentityInterface: labelIdentityInterface, - stretchNPEnabled: stretchedNPEnabled, - appliedToGroupNotifier: newNotifier(), + appliedToGroupQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "appliedToGroup", + }, + ), + addressGroupQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "addressGroup", + }, + ), + internalNetworkPolicyQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[controlplane.NetworkPolicyReference](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[controlplane.NetworkPolicyReference]{ + Name: "internalNetworkPolicy", + }, + ), + internalGroupQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "internalGroup", + }, + ), + groupingInterface: groupingInterface, + groupingInterfaceSynced: groupingInterface.HasSynced, + labelIdentityInterface: labelIdentityInterface, + stretchNPEnabled: stretchedNPEnabled, + appliedToGroupNotifier: newNotifier(), } n.groupingInterface.AddEventHandler(appliedToGroupType, n.enqueueAppliedToGroup) n.groupingInterface.AddEventHandler(addressGroupType, n.enqueueAddressGroup) @@ -996,7 +1016,7 @@ func (n *NetworkPolicyController) internalNetworkPolicyWorker() { // be processed). func (n *NetworkPolicyController) processNextInternalNetworkPolicyWorkItem() bool { defer n.heartbeat("processNextInternalNetworkPolicyWorkItem") - key, quit := n.internalNetworkPolicyQueue.Get() + networkPolicyRef, quit := n.internalNetworkPolicyQueue.Get() if quit { return false } @@ -1004,19 +1024,17 @@ func (n *NetworkPolicyController) processNextInternalNetworkPolicyWorkItem() boo // must remember to call Forget if we do not want this work item being re-queued. For // example, we do not call Forget if a transient error occurs, instead the item is put back // on the workqueue and attempted again after a back-off period. - defer n.internalNetworkPolicyQueue.Done(key) + defer n.internalNetworkPolicyQueue.Done(networkPolicyRef) - networkPolicyRef := key.(controlplane.NetworkPolicyReference) - err := n.syncInternalNetworkPolicy(&networkPolicyRef) - if err != nil { + if err := n.syncInternalNetworkPolicy(&networkPolicyRef); err != nil { // Put the item back on the workqueue to handle any transient errors. - n.internalNetworkPolicyQueue.AddRateLimited(key) - klog.Errorf("Failed to sync internal NetworkPolicy %s: %v", key, err) + n.internalNetworkPolicyQueue.AddRateLimited(networkPolicyRef) + klog.Errorf("Failed to sync internal NetworkPolicy %s: %v", networkPolicyRef, err) return true } // If no error occurs we Forget this item so it does not get queued again until // another change happens. - n.internalNetworkPolicyQueue.Forget(key) + n.internalNetworkPolicyQueue.Forget(networkPolicyRef) return true } @@ -1035,7 +1053,7 @@ func (n *NetworkPolicyController) processNextAddressGroupWorkItem() bool { } defer n.addressGroupQueue.Done(key) - err := n.syncAddressGroup(key.(string)) + err := n.syncAddressGroup(key) if err != nil { // Put the item back on the workqueue to handle any transient errors. n.addressGroupQueue.AddRateLimited(key) @@ -1063,7 +1081,7 @@ func (n *NetworkPolicyController) processNextAppliedToGroupWorkItem() bool { } defer n.appliedToGroupQueue.Done(key) - err := n.syncAppliedToGroup(key.(string)) + err := n.syncAppliedToGroup(key) if err != nil { // Put the item back on the workqueue to handle any transient errors. n.appliedToGroupQueue.AddRateLimited(key) diff --git a/pkg/controller/networkpolicy/networkpolicy_controller_perf_test.go b/pkg/controller/networkpolicy/networkpolicy_controller_perf_test.go index fcc091a6e52..3f308b6cb6f 100644 --- a/pkg/controller/networkpolicy/networkpolicy_controller_perf_test.go +++ b/pkg/controller/networkpolicy/networkpolicy_controller_perf_test.go @@ -38,7 +38,6 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/klog/v2" - "antrea.io/antrea/pkg/apis/controlplane" "antrea.io/antrea/pkg/apis/crd/v1alpha2" "antrea.io/antrea/pkg/apis/crd/v1beta1" ) @@ -547,20 +546,19 @@ func BenchmarkSyncAddressGroup(b *testing.B) { for c.appliedToGroupQueue.Len() > 0 { key, _ := c.appliedToGroupQueue.Get() - c.syncAppliedToGroup(key.(string)) + c.syncAppliedToGroup(key) c.appliedToGroupQueue.Done(key) } for c.internalNetworkPolicyQueue.Len() > 0 { key, _ := c.internalNetworkPolicyQueue.Get() - networkPolicyRef := key.(controlplane.NetworkPolicyReference) - c.syncInternalNetworkPolicy(&networkPolicyRef) + c.syncInternalNetworkPolicy(&key) c.internalNetworkPolicyQueue.Done(key) } key, _ := c.addressGroupQueue.Get() b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { - c.syncAddressGroup(key.(string)) + c.syncAddressGroup(key) } } @@ -658,18 +656,17 @@ func benchmarkInit(b *testing.B, namespaces []*corev1.Namespace, networkPolicies } for c.appliedToGroupQueue.Len() > 0 { key, _ := c.appliedToGroupQueue.Get() - c.syncAppliedToGroup(key.(string)) + c.syncAppliedToGroup(key) c.appliedToGroupQueue.Done(key) } for c.internalNetworkPolicyQueue.Len() > 0 { key, _ := c.internalNetworkPolicyQueue.Get() - networkPolicyRef := key.(controlplane.NetworkPolicyReference) - c.syncInternalNetworkPolicy(&networkPolicyRef) + c.syncInternalNetworkPolicy(&key) c.internalNetworkPolicyQueue.Done(key) } for c.addressGroupQueue.Len() > 0 { key, _ := c.addressGroupQueue.Get() - c.syncAddressGroup(key.(string)) + c.syncAddressGroup(key) c.addressGroupQueue.Done(key) } // We stop the time for deferred functions, even if they should diff --git a/pkg/controller/networkpolicy/networkpolicy_controller_test.go b/pkg/controller/networkpolicy/networkpolicy_controller_test.go index 580fb0c85e7..3fe5dd05efd 100644 --- a/pkg/controller/networkpolicy/networkpolicy_controller_test.go +++ b/pkg/controller/networkpolicy/networkpolicy_controller_test.go @@ -229,12 +229,32 @@ func newControllerWithoutEventHandler(k8sObjects, crdObjects []runtime.Object) ( appliedToGroupStore: appliedToGroupStore, internalNetworkPolicyStore: internalNetworkPolicyStore, internalGroupStore: internalGroupStore, - appliedToGroupQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "appliedToGroup"), - addressGroupQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "addressGroup"), - internalNetworkPolicyQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "internalNetworkPolicy"), - internalGroupQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "internalGroup"), - groupingInterface: groupEntityIndex, - appliedToGroupNotifier: newNotifier(), + appliedToGroupQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "appliedToGroup", + }, + ), + addressGroupQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "addressGroup", + }, + ), + internalNetworkPolicyQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[controlplane.NetworkPolicyReference](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[controlplane.NetworkPolicyReference]{ + Name: "internalNetworkPolicy", + }, + ), + internalGroupQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "internalGroup", + }, + ), + groupingInterface: groupEntityIndex, + appliedToGroupNotifier: newNotifier(), } npController.tierInformer.Informer().AddIndexers(tierIndexers) npController.acnpInformer.Informer().AddIndexers(acnpIndexers) @@ -4108,13 +4128,13 @@ func TestClusterNetworkPolicyWithClusterGroup(t *testing.T) { checkResources(expectedPolicy, expectedAppliedToGroup, expectedAddressGroup) } -func checkQueueItemExistence(t *testing.T, queue workqueue.RateLimitingInterface, items ...string) { +func checkQueueItemExistence[T comparable](t *testing.T, queue workqueue.TypedRateLimitingInterface[T], items ...T) { require.Equal(t, len(items), queue.Len()) - expectedItems := sets.New[string](items...) - actualItems := sets.New[string]() + expectedItems := sets.New[T](items...) + actualItems := sets.New[T]() for i := 0; i < len(expectedItems); i++ { key, _ := queue.Get() - actualItems.Insert(key.(string)) + actualItems.Insert(key) queue.Done(key) } assert.Equal(t, expectedItems, actualItems) diff --git a/pkg/controller/networkpolicy/status_controller.go b/pkg/controller/networkpolicy/status_controller.go index 406e9c42e8c..a9b71cac69a 100644 --- a/pkg/controller/networkpolicy/status_controller.go +++ b/pkg/controller/networkpolicy/status_controller.go @@ -60,7 +60,7 @@ type StatusController struct { npControlInterface networkPolicyControlInterface // queue maintains the keys of the NetworkPolicy objects that need to be synced. - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] // internalNetworkPolicyStore is the storage where the populated internal Network Policy are stored. internalNetworkPolicyStore storage.Interface @@ -84,7 +84,12 @@ func NewStatusController(antreaClient antreaclientset.Interface, internalNetwork annpLister: annpInformer.Lister(), acnpLister: acnpInformer.Lister(), }, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "networkpolicy"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "networkpolicy", + }, + ), internalNetworkPolicyStore: internalNetworkPolicyStore, statuses: map[string]map[string]*controlplane.NetworkPolicyNodeStatus{}, acnpListerSynced: acnpInformer.Informer().HasSynced, @@ -244,7 +249,7 @@ func (c *StatusController) processNextWorkItem() bool { } defer c.queue.Done(key) - err := c.syncHandler(key.(string)) + err := c.syncHandler(key) if err == nil { c.queue.Forget(key) return true diff --git a/pkg/controller/networkpolicy/status_controller_test.go b/pkg/controller/networkpolicy/status_controller_test.go index 00513ceb9b2..53cca74ad6e 100644 --- a/pkg/controller/networkpolicy/status_controller_test.go +++ b/pkg/controller/networkpolicy/status_controller_test.go @@ -78,8 +78,13 @@ func newTestStatusController(initialObjects ...runtime.Object) (*StatusControlle acnpInformer := antreaInformerFactory.Crd().V1beta1().ClusterNetworkPolicies() annpInformer := antreaInformerFactory.Crd().V1beta1().NetworkPolicies() statusController := &StatusController{ - npControlInterface: networkPolicyControl, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "networkpolicy"), + npControlInterface: networkPolicyControl, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "networkpolicy", + }, + ), internalNetworkPolicyStore: networkPolicyStore, statuses: map[string]map[string]*controlplane.NetworkPolicyNodeStatus{}, acnpListerSynced: acnpInformer.Informer().HasSynced, diff --git a/pkg/controller/networkpolicy/validate_test.go b/pkg/controller/networkpolicy/validate_test.go index 94d8bbe8cc3..43bf8cb59f4 100644 --- a/pkg/controller/networkpolicy/validate_test.go +++ b/pkg/controller/networkpolicy/validate_test.go @@ -1832,7 +1832,7 @@ func TestValidateAntreaClusterNetworkPolicy(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { for feature, value := range tt.featureGates { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, feature, value)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, feature, value) } _, controller := newController(nil, nil) validator := NewNetworkPolicyValidator(controller.NetworkPolicyController) @@ -1904,7 +1904,7 @@ func TestValidateAntreaNetworkPolicy(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { for feature, value := range tt.featureGates { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, feature, value)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, feature, value) } _, controller := newController(nil, nil) validator := NewNetworkPolicyValidator(controller.NetworkPolicyController) diff --git a/pkg/controller/serviceexternalip/controller.go b/pkg/controller/serviceexternalip/controller.go index 93e39923d9b..48b7d9c1d06 100644 --- a/pkg/controller/serviceexternalip/controller.go +++ b/pkg/controller/serviceexternalip/controller.go @@ -79,7 +79,7 @@ type ServiceExternalIPController struct { serviceLister corelisters.ServiceLister serviceListerSynced cache.InformerSynced // queue maintains the Service objects that need to be synced. - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[apimachinerytypes.NamespacedName] } func NewServiceExternalIPController( @@ -88,8 +88,13 @@ func NewServiceExternalIPController( externalIPAllocator externalippool.ExternalIPAllocator, ) *ServiceExternalIPController { c := &ServiceExternalIPController{ - client: client, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "serviceExternalIP"), + client: client, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[apimachinerytypes.NamespacedName](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[apimachinerytypes.NamespacedName]{ + Name: "serviceExternalIP", + }, + ), serviceInformer: serviceInformer.Informer(), serviceLister: serviceInformer.Lister(), serviceListerSynced: serviceInformer.Informer().HasSynced, @@ -293,16 +298,12 @@ func (c *ServiceExternalIPController) worker() { } func (c *ServiceExternalIPController) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) - if key, ok := obj.(apimachinerytypes.NamespacedName); !ok { - c.queue.Forget(obj) - klog.Errorf("Expected NamespacedName in work queue but got %#v", obj) - return true - } else if err := c.syncService(key); err == nil { + defer c.queue.Done(key) + if err := c.syncService(key); err == nil { // If no error occurs we Forget this item so it does not get queued again until // another change happens. c.queue.Forget(key) diff --git a/pkg/controller/stats/aggregator_test.go b/pkg/controller/stats/aggregator_test.go index da135e72c79..b4c0e6925b2 100644 --- a/pkg/controller/stats/aggregator_test.go +++ b/pkg/controller/stats/aggregator_test.go @@ -514,7 +514,7 @@ func TestAggregatorCollectListGet(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, true)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, true) stopCh := make(chan struct{}) defer close(stopCh) @@ -553,7 +553,7 @@ func TestAggregatorCollectListGet(t *testing.T) { } func TestDeleteNetworkPolicy(t *testing.T) { - defer featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, true)() + featuregatetesting.SetFeatureGateDuringTest(t, features.DefaultFeatureGate, features.AntreaPolicy, true) stopCh := make(chan struct{}) defer close(stopCh) diff --git a/pkg/controller/supportbundlecollection/controller.go b/pkg/controller/supportbundlecollection/controller.go index aabf9101f0b..d7d10ec0bde 100644 --- a/pkg/controller/supportbundlecollection/controller.go +++ b/pkg/controller/supportbundlecollection/controller.go @@ -113,7 +113,7 @@ type Controller struct { externalNodeListerSynced cache.InformerSynced // queue maintains the ExternalNode objects that need to be synced. - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] // supportBundleCollectionStore is the storage where the populated internal support bundle collections are stored. supportBundleCollectionStore storage.Interface @@ -146,8 +146,13 @@ func NewSupportBundleCollectionController( nodeListerSynced: nodeInformer.Informer().HasSynced, externalNodeLister: externalNodeInformer.Lister(), externalNodeListerSynced: externalNodeInformer.Informer().HasSynced, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "supportBundleCollection"), - supportBundleCollectionStore: supportBundleCollectionStore, + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "supportBundleCollection", + }, + ), + supportBundleCollectionStore: supportBundleCollectionStore, supportBundleCollectionAppliedToStore: cache.NewIndexer(getSupportBundleCollectionKey, cache.Indexers{ processingNodesIndex: processingNodesIndexFunc, processingExternalNodesIndex: processingExternalNodesIndexFunc, @@ -278,17 +283,13 @@ func (c *Controller) worker() { } func (c *Controller) processNextWorkItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } - defer c.queue.Done(obj) + defer c.queue.Done(key) - if key, ok := obj.(string); !ok { - c.queue.Forget(obj) - klog.Errorf("Expected string in SupportBundleCollection work queue but got %#v", obj) - return true - } else if err := c.syncSupportBundleCollection(key); err == nil { + if err := c.syncSupportBundleCollection(key); err == nil { // If no error occurs we Forget this item, so it does not get queued again until // another change happens. c.queue.Forget(key) diff --git a/pkg/controller/supportbundlecollection/controller_test.go b/pkg/controller/supportbundlecollection/controller_test.go index 678215dadd5..298d8cefbea 100644 --- a/pkg/controller/supportbundlecollection/controller_test.go +++ b/pkg/controller/supportbundlecollection/controller_test.go @@ -372,7 +372,12 @@ func TestAddSupportBundleCollection(t *testing.T) { testClient := newTestClient(nil, nil) controller := &Controller{ crdClient: testClient.crdClient, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "supportBundle"), + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "supportBundle", + }, + ), } controller.addSupportBundleCollection(tc.supportBundleCollection) if tc.expectedItem != "" { @@ -415,12 +420,11 @@ func TestSupportBundleCollectionEvents(t *testing.T) { wg.Add(1) go func() { processNextWorkItem := func() bool { - obj, quit := controller.queue.Get() + key, quit := controller.queue.Get() if quit { return false } - defer controller.queue.Done(obj) - key, _ := obj.(string) + defer controller.queue.Done(key) if _, exists := enqueuedBundleNameCountMappings[key]; !exists { enqueuedBundleNameCountMappings[key] = 0 } @@ -1664,7 +1668,7 @@ func TestUpdateStatus(t *testing.T) { syncSupportBundleCollection := func() { key, _ := controller.queue.Get() controller.queue.Done(key) - err := controller.syncSupportBundleCollection(key.(string)) + err := controller.syncSupportBundleCollection(key) assert.NoError(t, err) } diff --git a/pkg/controller/traceflow/controller.go b/pkg/controller/traceflow/controller.go index e6f34bf25de..d2a343dad03 100644 --- a/pkg/controller/traceflow/controller.go +++ b/pkg/controller/traceflow/controller.go @@ -78,7 +78,7 @@ type Controller struct { traceflowInformer crdinformers.TraceflowInformer traceflowLister crdlisters.TraceflowLister traceflowListerSynced cache.InformerSynced - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[string] runningTraceflowsMutex sync.Mutex runningTraceflows map[uint8]string // tag->traceflowName if tf.Status.Phase is Running. } @@ -92,8 +92,13 @@ func NewTraceflowController(client versioned.Interface, podInformer coreinformer traceflowInformer: traceflowInformer, traceflowLister: traceflowInformer.Lister(), traceflowListerSynced: traceflowInformer.Informer().HasSynced, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "traceflow"), - runningTraceflows: make(map[uint8]string)} + queue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "traceflow", + }, + ), + runningTraceflows: make(map[uint8]string)} // Add handlers for ClusterNetworkPolicy events. traceflowInformer.Informer().AddEventHandlerWithResyncPeriod( cache.ResourceEventHandlerFuncs{ @@ -191,7 +196,7 @@ func (c *Controller) checkTraceflowTimeout() { // change. This function returns false if and only if the work queue was shutdown (no more items // will be processed). func (c *Controller) processTraceflowItem() bool { - obj, quit := c.queue.Get() + key, quit := c.queue.Get() if quit { return false } @@ -199,20 +204,9 @@ func (c *Controller) processTraceflowItem() bool { // must remember to call Forget if we do not want this work item being re-queued. For // example, we do not call Forget if a transient error occurs, instead the item is put back // on the workqueue and attempted again after a back-off period. - defer c.queue.Done(obj) - - // We expect strings (Traceflow name) to come off the workqueue. - key, ok := obj.(string) - if !ok { - // As the item in the workqueue is actually invalid, we call Forget here else we'd - // go into a loop of attempting to process a work item that is invalid. - // This should not happen: enqueueTraceflow only enqueues strings. - c.queue.Forget(obj) - klog.Errorf("Expected string in work queue but got %#v", obj) - return true - } - err := c.syncTraceflow(key) - if err != nil { + defer c.queue.Done(key) + + if err := c.syncTraceflow(key); err != nil { klog.Errorf("Error syncing Traceflow %s, exiting. Error: %v", key, err) c.queue.AddRateLimited(key) } else { diff --git a/pkg/flowaggregator/apiserver/apiserver.go b/pkg/flowaggregator/apiserver/apiserver.go index 9aa8b6f922c..0706090cc39 100644 --- a/pkg/flowaggregator/apiserver/apiserver.go +++ b/pkg/flowaggregator/apiserver/apiserver.go @@ -15,6 +15,7 @@ package apiserver import ( + "context" "fmt" "net" "os" @@ -24,9 +25,9 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" - k8sversion "k8s.io/apimachinery/pkg/version" genericapiserver "k8s.io/apiserver/pkg/server" genericoptions "k8s.io/apiserver/pkg/server/options" + apiserverversion "k8s.io/apiserver/pkg/util/version" "antrea.io/antrea/pkg/apis" systeminstall "antrea.io/antrea/pkg/apis/system/install" @@ -63,8 +64,8 @@ type flowAggregatorAPIServer struct { GenericAPIServer *genericapiserver.GenericAPIServer } -func (s *flowAggregatorAPIServer) Run(stopCh <-chan struct{}) error { - return s.GenericAPIServer.PrepareRun().Run(stopCh) +func (s *flowAggregatorAPIServer) Run(ctx context.Context) error { + return s.GenericAPIServer.PrepareRun().RunWithContext(ctx) } func installHandlers(s *genericapiserver.GenericAPIServer, faq querier.FlowAggregatorQuerier) { @@ -121,14 +122,7 @@ func newConfig(bindPort int) (*genericapiserver.CompletedConfig, error) { if err := os.WriteFile(apis.APIServerLoopbackTokenPath, []byte(serverConfig.LoopbackClientConfig.BearerToken), 0600); err != nil { return nil, fmt.Errorf("error when writing loopback access token to file: %v", err) } - v := antreaversion.GetVersion() - serverConfig.Version = &k8sversion.Info{ - Major: fmt.Sprint(v.Major), - Minor: fmt.Sprint(v.Minor), - GitVersion: v.String(), - GitTreeState: antreaversion.GitTreeState, - GitCommit: antreaversion.GetGitSHA(), - } + serverConfig.EffectiveVersion = apiserverversion.NewEffectiveVersion(antreaversion.GetFullVersion()) completedServerCfg := serverConfig.Complete(nil) return &completedServerCfg, nil diff --git a/pkg/monitor/controller.go b/pkg/monitor/controller.go index e15efa6b200..76c4848f8a3 100644 --- a/pkg/monitor/controller.go +++ b/pkg/monitor/controller.go @@ -66,8 +66,8 @@ type controllerMonitor struct { externalNodeEnabled bool - nodeQueue workqueue.RateLimitingInterface - externalNodeQueue workqueue.RateLimitingInterface + nodeQueue workqueue.TypedRateLimitingInterface[string] + externalNodeQueue workqueue.TypedRateLimitingInterface[string] querier controllerquerier.ControllerQuerier // controllerCRD is the desired state of controller monitoring CRD which controllerMonitor expects. @@ -83,11 +83,16 @@ func NewControllerMonitor( externalNodeEnabled bool, ) *controllerMonitor { m := &controllerMonitor{ - client: client, - nodeInformer: nodeInformer, - nodeLister: nodeInformer.Lister(), - nodeListerSynced: nodeInformer.Informer().HasSynced, - nodeQueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "node"), + client: client, + nodeInformer: nodeInformer, + nodeLister: nodeInformer.Lister(), + nodeListerSynced: nodeInformer.Informer().HasSynced, + nodeQueue: workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "node", + }, + ), querier: querier, controllerCRD: nil, externalNodeEnabled: externalNodeEnabled, @@ -102,7 +107,12 @@ func NewControllerMonitor( m.externalNodeInformer = externalNodeInformer m.externalNodeLister = externalNodeInformer.Lister() m.externalNodeListerSynced = externalNodeInformer.Informer().HasSynced - m.externalNodeQueue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "externalNode") + m.externalNodeQueue = workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.NewTypedItemExponentialFailureRateLimiter[string](minRetryDelay, maxRetryDelay), + workqueue.TypedRateLimitingQueueConfig[string]{ + Name: "externalNode", + }, + ) externalNodeInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: m.enqueueExternalNode, UpdateFunc: nil, @@ -260,17 +270,13 @@ func (n *controllerMonitor) externalNodeWorker() { } func (c *controllerMonitor) processNextNodeWorkItem() bool { - obj, quit := c.nodeQueue.Get() + key, quit := c.nodeQueue.Get() if quit { return false } - defer c.nodeQueue.Done(obj) + defer c.nodeQueue.Done(key) - if key, ok := obj.(string); !ok { - c.nodeQueue.Forget(obj) - klog.Errorf("Expected string in Node work queue but got %#v", obj) - return true - } else if err := c.syncNode(key); err == nil { + if err := c.syncNode(key); err == nil { // If no error occurs we Forget this item so it does not get queued again until // another change happens. c.nodeQueue.Forget(key) @@ -283,17 +289,13 @@ func (c *controllerMonitor) processNextNodeWorkItem() bool { } func (c *controllerMonitor) processNextExternalNodeWorkItem() bool { - obj, quit := c.externalNodeQueue.Get() + key, quit := c.externalNodeQueue.Get() if quit { return false } - defer c.externalNodeQueue.Done(obj) + defer c.externalNodeQueue.Done(key) - if key, ok := obj.(string); !ok { - c.externalNodeQueue.Forget(obj) - klog.Errorf("Expected string in ExternalNode work queue but got %#v", obj) - return true - } else if err := c.syncExternalNode(key); err == nil { + if err := c.syncExternalNode(key); err == nil { // If no error occurs we Forget this item so it does not get queued again until // another change happens. c.externalNodeQueue.Forget(key) diff --git a/pkg/monitor/controller_test.go b/pkg/monitor/controller_test.go index 5d36e5eb5fa..6f965af14e5 100644 --- a/pkg/monitor/controller_test.go +++ b/pkg/monitor/controller_test.go @@ -632,8 +632,8 @@ func TestEnqueueNode(t *testing.T) { controller := newControllerMonitor(clientset) controller.controllerMonitor.enqueueNode(node) expectedkey, _ := keyFunc(node) - obj, _ := controller.controllerMonitor.nodeQueue.Get() - assert.Equal(t, expectedkey, obj.(string)) + key, _ := controller.controllerMonitor.nodeQueue.Get() + assert.Equal(t, expectedkey, key) } func TestEnqueueExternalNode(t *testing.T) { @@ -648,8 +648,8 @@ func TestEnqueueExternalNode(t *testing.T) { controller := newControllerMonitor(clientset) controller.controllerMonitor.enqueueExternalNode(externalNode) expectedkey, _ := keyFunc(externalNode) - obj, _ := controller.controllerMonitor.externalNodeQueue.Get() - assert.Equal(t, expectedkey, obj.(string)) + key, _ := controller.controllerMonitor.externalNodeQueue.Get() + assert.Equal(t, expectedkey, key) } func TestAntreaAgentInfoAPIAvailable(t *testing.T) { diff --git a/pkg/util/podstore/podstore.go b/pkg/util/podstore/podstore.go index 42d6c31d601..a20d674fd8b 100644 --- a/pkg/util/podstore/podstore.go +++ b/pkg/util/podstore/podstore.go @@ -36,7 +36,7 @@ const ( type PodStore struct { pods cache.Indexer - podsToDelete workqueue.DelayingInterface + podsToDelete workqueue.TypedDelayingInterface[*corev1.Pod] // Mapping pod.uuid to podTimestamps timestampMap map[types.UID]*podTimestamps clock clock.Clock @@ -59,8 +59,11 @@ type Interface interface { // which is useful when writing robust unit tests. func NewPodStoreWithClock(podInformer cache.SharedIndexInformer, clock clock.WithTicker) *PodStore { s := &PodStore{ - pods: cache.NewIndexer(podKeyFunc, cache.Indexers{podIPIndex: podIPIndexFunc}), - podsToDelete: workqueue.NewDelayingQueueWithCustomClock(clock, deleteQueueName), + pods: cache.NewIndexer(podKeyFunc, cache.Indexers{podIPIndex: podIPIndexFunc}), + podsToDelete: workqueue.NewTypedDelayingQueueWithConfig(workqueue.TypedDelayingQueueConfig[*corev1.Pod]{ + Name: deleteQueueName, + Clock: clock, + }), clock: clock, timestampMap: map[types.UID]*podTimestamps{}, mutex: sync.RWMutex{}, @@ -199,12 +202,12 @@ func (s *PodStore) processDeleteQueueItem() bool { defer s.mutex.Unlock() err := s.pods.Delete(pod) if err != nil { - klog.ErrorS(err, "Error when deleting Pod from deletion workqueue", "Pod", klog.KObj(pod.(*corev1.Pod))) + klog.ErrorS(err, "Error when deleting Pod from deletion workqueue", "Pod", klog.KObj(pod)) return false } - delete(s.timestampMap, pod.(*corev1.Pod).UID) + delete(s.timestampMap, pod.UID) s.podsToDelete.Done(pod) - klog.V(4).InfoS("Removed Pod from Pod Store", "Pod", klog.KObj(pod.(*corev1.Pod))) + klog.V(4).InfoS("Removed Pod from Pod Store", "Pod", klog.KObj(pod)) return true } diff --git a/pkg/util/podstore/podstore_test.go b/pkg/util/podstore/podstore_test.go index a53e42e19e5..d239b2d54ed 100644 --- a/pkg/util/podstore/podstore_test.go +++ b/pkg/util/podstore/podstore_test.go @@ -329,8 +329,11 @@ func Test_GetPodByIPAndTime(t *testing.T) { func Test_processDeleteQueueItem(t *testing.T) { fakeClock := clock.NewFakeClock(time.Now()) podStore := &PodStore{ - pods: cache.NewIndexer(podKeyFunc, cache.Indexers{podIPIndex: podIPIndexFunc}), - podsToDelete: workqueue.NewDelayingQueueWithCustomClock(fakeClock, deleteQueueName), + pods: cache.NewIndexer(podKeyFunc, cache.Indexers{podIPIndex: podIPIndexFunc}), + podsToDelete: workqueue.NewTypedDelayingQueueWithConfig(workqueue.TypedDelayingQueueConfig[*v1.Pod]{ + Name: deleteQueueName, + Clock: fakeClock, + }), timestampMap: map[types.UID]*podTimestamps{"pod1": {}}, } require.NoError(t, podStore.pods.Add(pod1))