diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index 5ed5008bb..2c9a401e2 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.21 + go-version: 1.23.1 - name: Run golangci-lint run: make golangci diff --git a/.golangci.yml b/.golangci.yml index c8d26644d..b4e0ce985 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,9 +2,10 @@ run: tests: true timeout: 15m - skip-files: - - third_party/ - - pkg/client/ + issues: + exclude-files: + - third_party/ + - pkg/client/ skip-dirs-use-default: true linters-settings: @@ -21,6 +22,9 @@ linters-settings: - name: superfluous-else - name: var-declaration - name: duplicated-imports + gosec: + excludes: + - G115 linters: disable-all: true @@ -31,7 +35,7 @@ linters: - staticcheck - gosec - goimports - - vet + - govet - revive issues: diff --git a/Makefile b/Makefile index 7068aa97b..7f21e48cf 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ GOFLAGS := BINDIR ?= $(CURDIR)/bin GO_FILES := $(shell find . -type d -name '.cache' -prune -o -type f -name '*.go' -print) -GOLANGCI_LINT_VERSION := v1.54.0 +GOLANGCI_LINT_VERSION := v1.61.0 GOLANGCI_LINT_BINDIR := $(CURDIR)/.golangci-bin GOLANGCI_LINT_BIN := $(GOLANGCI_LINT_BINDIR)/$(GOLANGCI_LINT_VERSION)/golangci-lint @@ -146,7 +146,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi CONTROLLER_GEN = $(shell pwd)/bin/controller-gen .PHONY: 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.5) KUSTOMIZE = $(shell pwd)/bin/kustomize .PHONY: kustomize diff --git a/build/image/photon/Dockerfile b/build/image/photon/Dockerfile index 2729746e9..09a952597 100644 --- a/build/image/photon/Dockerfile +++ b/build/image/photon/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.7 as golang-build +FROM golang:1.23.1 as golang-build WORKDIR /source diff --git a/build/yaml/crd/legacy/nsx.vmware.com_nsxserviceaccounts.yaml b/build/yaml/crd/legacy/nsx.vmware.com_nsxserviceaccounts.yaml index b29d33835..579745751 100644 --- a/build/yaml/crd/legacy/nsx.vmware.com_nsxserviceaccounts.yaml +++ b/build/yaml/crd/legacy/nsx.vmware.com_nsxserviceaccounts.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.5 name: nsxserviceaccounts.nsx.vmware.com spec: group: nsx.vmware.com @@ -58,16 +58,8 @@ spec: Represents the realization status of a NSXServiceAccount's current state. Known .status.conditions.type is: "Realized" items: - description: "Condition contains details for one aspect of the current - state of this API Resource.\n---\nThis struct is intended for - direct use as an array at the field path .status.conditions. For - example,\n\n\n\ttype FooStatus struct{\n\t // Represents the - observations of a foo's current state.\n\t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // - +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t - \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t - \ // other fields\n\t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- @@ -108,12 +100,7 @@ spec: - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: type of condition in CamelCase or in foo.example.com/CamelCase. maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string diff --git a/build/yaml/crd/legacy/nsx.vmware.com_securitypolicies.yaml b/build/yaml/crd/legacy/nsx.vmware.com_securitypolicies.yaml index d3a917663..82452de7a 100644 --- a/build/yaml/crd/legacy/nsx.vmware.com_securitypolicies.yaml +++ b/build/yaml/crd/legacy/nsx.vmware.com_securitypolicies.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.5 name: securitypolicies.nsx.vmware.com spec: group: nsx.vmware.com @@ -448,7 +448,6 @@ spec: description: Port is the name or port number. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- Protocol(TCP, UDP) is the protocol to match traffic. It is TCP by default. diff --git a/build/yaml/crd/vpc/crd.nsx.vmware.com_addressbindings.yaml b/build/yaml/crd/vpc/crd.nsx.vmware.com_addressbindings.yaml index a37d751ba..2d318df26 100644 --- a/build/yaml/crd/vpc/crd.nsx.vmware.com_addressbindings.yaml +++ b/build/yaml/crd/vpc/crd.nsx.vmware.com_addressbindings.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.5 name: addressbindings.crd.nsx.vmware.com spec: group: crd.nsx.vmware.com diff --git a/build/yaml/crd/vpc/crd.nsx.vmware.com_ipaddressallocations.yaml b/build/yaml/crd/vpc/crd.nsx.vmware.com_ipaddressallocations.yaml index 9e478bd71..29f56f7db 100644 --- a/build/yaml/crd/vpc/crd.nsx.vmware.com_ipaddressallocations.yaml +++ b/build/yaml/crd/vpc/crd.nsx.vmware.com_ipaddressallocations.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.5 name: ipaddressallocations.crd.nsx.vmware.com spec: group: crd.nsx.vmware.com diff --git a/build/yaml/crd/vpc/crd.nsx.vmware.com_ipblocksinfos.yaml b/build/yaml/crd/vpc/crd.nsx.vmware.com_ipblocksinfos.yaml index 1067372d0..b1ab1be21 100644 --- a/build/yaml/crd/vpc/crd.nsx.vmware.com_ipblocksinfos.yaml +++ b/build/yaml/crd/vpc/crd.nsx.vmware.com_ipblocksinfos.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.5 name: ipblocksinfos.crd.nsx.vmware.com spec: group: crd.nsx.vmware.com diff --git a/build/yaml/crd/vpc/crd.nsx.vmware.com_networkinfos.yaml b/build/yaml/crd/vpc/crd.nsx.vmware.com_networkinfos.yaml index ab5db9b83..e7fc53f7f 100644 --- a/build/yaml/crd/vpc/crd.nsx.vmware.com_networkinfos.yaml +++ b/build/yaml/crd/vpc/crd.nsx.vmware.com_networkinfos.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.5 name: networkinfos.crd.nsx.vmware.com spec: group: crd.nsx.vmware.com diff --git a/build/yaml/crd/vpc/crd.nsx.vmware.com_securitypolicies.yaml b/build/yaml/crd/vpc/crd.nsx.vmware.com_securitypolicies.yaml index 87cc9824a..693c61879 100644 --- a/build/yaml/crd/vpc/crd.nsx.vmware.com_securitypolicies.yaml +++ b/build/yaml/crd/vpc/crd.nsx.vmware.com_securitypolicies.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.5 name: securitypolicies.crd.nsx.vmware.com spec: group: crd.nsx.vmware.com @@ -448,7 +448,6 @@ spec: description: Port is the name or port number. x-kubernetes-int-or-string: true protocol: - default: TCP description: |- Protocol(TCP, UDP) is the protocol to match traffic. It is TCP by default. diff --git a/build/yaml/crd/vpc/crd.nsx.vmware.com_staticroutes.yaml b/build/yaml/crd/vpc/crd.nsx.vmware.com_staticroutes.yaml index 40b106572..574a4b97c 100644 --- a/build/yaml/crd/vpc/crd.nsx.vmware.com_staticroutes.yaml +++ b/build/yaml/crd/vpc/crd.nsx.vmware.com_staticroutes.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.5 name: staticroutes.crd.nsx.vmware.com spec: group: crd.nsx.vmware.com diff --git a/build/yaml/crd/vpc/crd.nsx.vmware.com_subnetconnectionbindingmaps.yaml b/build/yaml/crd/vpc/crd.nsx.vmware.com_subnetconnectionbindingmaps.yaml index ab4105500..04a4dc621 100644 --- a/build/yaml/crd/vpc/crd.nsx.vmware.com_subnetconnectionbindingmaps.yaml +++ b/build/yaml/crd/vpc/crd.nsx.vmware.com_subnetconnectionbindingmaps.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.5 name: subnetconnectionbindingmaps.crd.nsx.vmware.com spec: group: crd.nsx.vmware.com diff --git a/build/yaml/crd/vpc/crd.nsx.vmware.com_subnetports.yaml b/build/yaml/crd/vpc/crd.nsx.vmware.com_subnetports.yaml index 3737aa586..9fd7d29bc 100644 --- a/build/yaml/crd/vpc/crd.nsx.vmware.com_subnetports.yaml +++ b/build/yaml/crd/vpc/crd.nsx.vmware.com_subnetports.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.5 name: subnetports.crd.nsx.vmware.com spec: group: crd.nsx.vmware.com diff --git a/build/yaml/crd/vpc/crd.nsx.vmware.com_subnets.yaml b/build/yaml/crd/vpc/crd.nsx.vmware.com_subnets.yaml index 5148f66b6..f4b65103a 100644 --- a/build/yaml/crd/vpc/crd.nsx.vmware.com_subnets.yaml +++ b/build/yaml/crd/vpc/crd.nsx.vmware.com_subnets.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.5 name: subnets.crd.nsx.vmware.com spec: group: crd.nsx.vmware.com diff --git a/build/yaml/crd/vpc/crd.nsx.vmware.com_subnetsets.yaml b/build/yaml/crd/vpc/crd.nsx.vmware.com_subnetsets.yaml index 283a13da4..05ffb230c 100644 --- a/build/yaml/crd/vpc/crd.nsx.vmware.com_subnetsets.yaml +++ b/build/yaml/crd/vpc/crd.nsx.vmware.com_subnetsets.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.5 name: subnetsets.crd.nsx.vmware.com spec: group: crd.nsx.vmware.com diff --git a/build/yaml/crd/vpc/crd.nsx.vmware.com_vpcnetworkconfigurations.yaml b/build/yaml/crd/vpc/crd.nsx.vmware.com_vpcnetworkconfigurations.yaml index 466faa9fd..9b7ca66e5 100644 --- a/build/yaml/crd/vpc/crd.nsx.vmware.com_vpcnetworkconfigurations.yaml +++ b/build/yaml/crd/vpc/crd.nsx.vmware.com_vpcnetworkconfigurations.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.5 name: vpcnetworkconfigurations.crd.nsx.vmware.com spec: group: crd.nsx.vmware.com diff --git a/go.mod b/go.mod index c38c892c8..449cc49de 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/vmware-tanzu/nsx-operator -go 1.22.5 +go 1.23.1 replace ( github.com/vmware-tanzu/nsx-operator/pkg/apis => ./pkg/apis @@ -24,10 +24,10 @@ require ( github.com/google/uuid v1.6.0 github.com/kevinburke/ssh_config v1.2.0 github.com/openlyinc/pointy v1.1.2 - github.com/prometheus/client_golang v1.16.0 - github.com/sirupsen/logrus v1.9.0 + github.com/prometheus/client_golang v1.19.1 + github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.9.0 - github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20241028071655-1650a84c7862 + github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20241112035853-5c31cb6ee66e github.com/vmware-tanzu/nsx-operator/pkg/client v0.0.0-20240102061654-537b080e159f github.com/vmware-tanzu/vm-operator/api v1.8.2 github.com/vmware/govmomi v0.27.4 @@ -40,22 +40,23 @@ require ( golang.org/x/crypto v0.24.0 golang.org/x/time v0.3.0 gopkg.in/ini.v1 v1.66.4 - k8s.io/api v0.30.3 - k8s.io/apimachinery v0.30.3 - k8s.io/client-go v0.30.3 - k8s.io/code-generator v0.30.1 - sigs.k8s.io/controller-runtime v0.18.4 + k8s.io/api v0.31.2 + k8s.io/apimachinery v0.31.2 + k8s.io/client-go v0.31.2 + k8s.io/code-generator v0.31.0 + sigs.k8s.io/controller-runtime v0.19.0 ) require ( github.com/beevik/etree v1.1.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // 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.9.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/gibson042/canonicaljson-go v1.0.3 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect @@ -71,19 +72,19 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_model v0.4.0 // indirect - github.com/prometheus/common v0.44.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.5.2 // indirect + github.com/x448/float16 v0.8.4 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect @@ -94,10 +95,11 @@ require ( golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.30.1 // indirect + k8s.io/apiextensions-apiserver v0.31.0 // indirect k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect diff --git a/go.sum b/go.sum index 7959b19db..4a3e8071b 100644 --- a/go.sum +++ b/go.sum @@ -17,8 +17,8 @@ github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs= github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -35,6 +35,8 @@ github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0 github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= 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/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/gibson042/canonicaljson-go v1.0.3 h1:EAyF8L74AWabkyUmrvEFHEt/AGFQeD6RfwbAuf0j1bI= github.com/gibson042/canonicaljson-go v1.0.3/go.mod h1:DsLpJTThXyGNO+KZlI85C1/KDcImpP67k/RKVjcaEqo= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= @@ -48,8 +50,8 @@ github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En 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-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= @@ -60,7 +62,6 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= @@ -71,8 +72,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2Rrd27c3VGxi6a/6HNq8QmHRKM= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -98,8 +99,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= 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= @@ -107,10 +106,10 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.17.1 h1:V++EzdbhI4ZV4ev0UTIj0PzhzOcReJFyJaLjtSF55M8= -github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs= -github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk= -github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg= +github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= github.com/openlyinc/pointy v1.1.2 h1:LywVV2BWC5Sp5v7FoP4bUD+2Yn5k0VNeRbU5vq9jUMY= github.com/openlyinc/pointy v1.1.2/go.mod h1:w2Sytx+0FVuMKn37xpXIAyBNhFNBIJGR/v2m7ik1WtM= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -120,18 +119,18 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= -github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= -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/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +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.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +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.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +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/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -154,6 +153,8 @@ github.com/vmware-tanzu/vm-operator/api v1.8.2/go.mod h1:vauVboD3sQxP+pb28TnI9wf github.com/vmware/govmomi v0.27.4 h1:5kY8TAkhB20lsjzrjE073eRb8+HixBI29PVMG5lxq6I= github.com/vmware/govmomi v0.27.4/go.mod h1:daTuJEcQosNMXYJOeku0qdBJP9SOLLWB3Mqz8THtv6o= github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9oS4Wk2s2u4tS29nEaDLdzvuHdB19CvSGJjPgkZJNk= +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/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= @@ -170,8 +171,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= -golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= -golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= +golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= +golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -187,7 +188,6 @@ golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -231,6 +231,8 @@ google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWn gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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/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/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= @@ -241,16 +243,16 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ= -k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04= -k8s.io/apiextensions-apiserver v0.30.1 h1:4fAJZ9985BmpJG6PkoxVRpXv9vmPUOVzl614xarePws= -k8s.io/apiextensions-apiserver v0.30.1/go.mod h1:R4GuSrlhgq43oRY9sF2IToFh7PVlF1JjfWdoG3pixk4= -k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc= -k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/client-go v0.30.3 h1:bHrJu3xQZNXIi8/MoxYtZBBWQQXwy16zqJwloXXfD3k= -k8s.io/client-go v0.30.3/go.mod h1:8d4pf8vYu665/kUbsxWAQ/JDBNWqfFeZnvFiVdmx89U= -k8s.io/code-generator v0.30.1 h1:ZsG++q5Vt0ScmKCeLhynUuWgcwFGg1Hl1AGfatqPJBI= -k8s.io/code-generator v0.30.1/go.mod h1:hFgxRsvOUg79mbpbVKfjJvRhVz1qLoe40yZDJ/hwRH4= +k8s.io/api v0.31.2 h1:3wLBbL5Uom/8Zy98GRPXpJ254nEFpl+hwndmk9RwmL0= +k8s.io/api v0.31.2/go.mod h1:bWmGvrGPssSK1ljmLzd3pwCQ9MgoTsRCuK35u6SygUk= +k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk= +k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk= +k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= +k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/client-go v0.31.2 h1:Y2F4dxU5d3AQj+ybwSMqQnpZH9F30//1ObxOKlTI9yc= +k8s.io/client-go v0.31.2/go.mod h1:NPa74jSVR/+eez2dFsEIHNa+3o09vtNaWwWwb1qSxSs= +k8s.io/code-generator v0.31.0 h1:w607nrMi1KeDKB3/F/J4lIoOgAwc+gV9ZKew4XRfMp8= +k8s.io/code-generator v0.31.0/go.mod h1:84y4w3es8rOJOUUP1rLsIiGlO1JuEaPFXQPA9e/K6U0= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1X/TByhmAoILTarmzo= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= @@ -259,8 +261,8 @@ k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7F k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= 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/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw= -sigs.k8s.io/controller-runtime v0.18.4/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= +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/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/pkg/client/clientset/versioned/typed/vpc/v1alpha1/fake/fake_subnetconnectionbindingmap.go b/pkg/client/clientset/versioned/typed/vpc/v1alpha1/fake/fake_subnetconnectionbindingmap.go new file mode 100644 index 000000000..20f62c1d1 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/vpc/v1alpha1/fake/fake_subnetconnectionbindingmap.go @@ -0,0 +1,128 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeSubnetConnectionBindingMaps implements SubnetConnectionBindingMapInterface +type FakeSubnetConnectionBindingMaps struct { + Fake *FakeCrdV1alpha1 + ns string +} + +var subnetconnectionbindingmapsResource = v1alpha1.SchemeGroupVersion.WithResource("subnetconnectionbindingmaps") + +var subnetconnectionbindingmapsKind = v1alpha1.SchemeGroupVersion.WithKind("SubnetConnectionBindingMap") + +// Get takes name of the subnetConnectionBindingMap, and returns the corresponding subnetConnectionBindingMap object, and an error if there is any. +func (c *FakeSubnetConnectionBindingMaps) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.SubnetConnectionBindingMap, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(subnetconnectionbindingmapsResource, c.ns, name), &v1alpha1.SubnetConnectionBindingMap{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.SubnetConnectionBindingMap), err +} + +// List takes label and field selectors, and returns the list of SubnetConnectionBindingMaps that match those selectors. +func (c *FakeSubnetConnectionBindingMaps) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SubnetConnectionBindingMapList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(subnetconnectionbindingmapsResource, subnetconnectionbindingmapsKind, c.ns, opts), &v1alpha1.SubnetConnectionBindingMapList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.SubnetConnectionBindingMapList{ListMeta: obj.(*v1alpha1.SubnetConnectionBindingMapList).ListMeta} + for _, item := range obj.(*v1alpha1.SubnetConnectionBindingMapList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested subnetConnectionBindingMaps. +func (c *FakeSubnetConnectionBindingMaps) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(subnetconnectionbindingmapsResource, c.ns, opts)) + +} + +// Create takes the representation of a subnetConnectionBindingMap and creates it. Returns the server's representation of the subnetConnectionBindingMap, and an error, if there is any. +func (c *FakeSubnetConnectionBindingMaps) Create(ctx context.Context, subnetConnectionBindingMap *v1alpha1.SubnetConnectionBindingMap, opts v1.CreateOptions) (result *v1alpha1.SubnetConnectionBindingMap, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(subnetconnectionbindingmapsResource, c.ns, subnetConnectionBindingMap), &v1alpha1.SubnetConnectionBindingMap{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.SubnetConnectionBindingMap), err +} + +// Update takes the representation of a subnetConnectionBindingMap and updates it. Returns the server's representation of the subnetConnectionBindingMap, and an error, if there is any. +func (c *FakeSubnetConnectionBindingMaps) Update(ctx context.Context, subnetConnectionBindingMap *v1alpha1.SubnetConnectionBindingMap, opts v1.UpdateOptions) (result *v1alpha1.SubnetConnectionBindingMap, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(subnetconnectionbindingmapsResource, c.ns, subnetConnectionBindingMap), &v1alpha1.SubnetConnectionBindingMap{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.SubnetConnectionBindingMap), 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 *FakeSubnetConnectionBindingMaps) UpdateStatus(ctx context.Context, subnetConnectionBindingMap *v1alpha1.SubnetConnectionBindingMap, opts v1.UpdateOptions) (*v1alpha1.SubnetConnectionBindingMap, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(subnetconnectionbindingmapsResource, "status", c.ns, subnetConnectionBindingMap), &v1alpha1.SubnetConnectionBindingMap{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.SubnetConnectionBindingMap), err +} + +// Delete takes name of the subnetConnectionBindingMap and deletes it. Returns an error if one occurs. +func (c *FakeSubnetConnectionBindingMaps) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(subnetconnectionbindingmapsResource, c.ns, name, opts), &v1alpha1.SubnetConnectionBindingMap{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSubnetConnectionBindingMaps) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(subnetconnectionbindingmapsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.SubnetConnectionBindingMapList{}) + return err +} + +// Patch applies the patch and returns the patched subnetConnectionBindingMap. +func (c *FakeSubnetConnectionBindingMaps) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.SubnetConnectionBindingMap, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(subnetconnectionbindingmapsResource, c.ns, name, pt, data, subresources...), &v1alpha1.SubnetConnectionBindingMap{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.SubnetConnectionBindingMap), err +} diff --git a/pkg/client/clientset/versioned/typed/vpc/v1alpha1/fake/fake_vpc_client.go b/pkg/client/clientset/versioned/typed/vpc/v1alpha1/fake/fake_vpc_client.go index f61b00f3d..b1de58415 100644 --- a/pkg/client/clientset/versioned/typed/vpc/v1alpha1/fake/fake_vpc_client.go +++ b/pkg/client/clientset/versioned/typed/vpc/v1alpha1/fake/fake_vpc_client.go @@ -43,6 +43,10 @@ func (c *FakeCrdV1alpha1) Subnets(namespace string) v1alpha1.SubnetInterface { return &FakeSubnets{c, namespace} } +func (c *FakeCrdV1alpha1) SubnetConnectionBindingMaps(namespace string) v1alpha1.SubnetConnectionBindingMapInterface { + return &FakeSubnetConnectionBindingMaps{c, namespace} +} + func (c *FakeCrdV1alpha1) SubnetPorts(namespace string) v1alpha1.SubnetPortInterface { return &FakeSubnetPorts{c, namespace} } diff --git a/pkg/client/clientset/versioned/typed/vpc/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/vpc/v1alpha1/generated_expansion.go index 113c6070f..521bd161e 100644 --- a/pkg/client/clientset/versioned/typed/vpc/v1alpha1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/vpc/v1alpha1/generated_expansion.go @@ -19,6 +19,8 @@ type StaticRouteExpansion interface{} type SubnetExpansion interface{} +type SubnetConnectionBindingMapExpansion interface{} + type SubnetPortExpansion interface{} type SubnetSetExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/vpc/v1alpha1/subnetconnectionbindingmap.go b/pkg/client/clientset/versioned/typed/vpc/v1alpha1/subnetconnectionbindingmap.go new file mode 100644 index 000000000..75f53d0c8 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/vpc/v1alpha1/subnetconnectionbindingmap.go @@ -0,0 +1,182 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + scheme "github.com/vmware-tanzu/nsx-operator/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" +) + +// SubnetConnectionBindingMapsGetter has a method to return a SubnetConnectionBindingMapInterface. +// A group's client should implement this interface. +type SubnetConnectionBindingMapsGetter interface { + SubnetConnectionBindingMaps(namespace string) SubnetConnectionBindingMapInterface +} + +// SubnetConnectionBindingMapInterface has methods to work with SubnetConnectionBindingMap resources. +type SubnetConnectionBindingMapInterface interface { + Create(ctx context.Context, subnetConnectionBindingMap *v1alpha1.SubnetConnectionBindingMap, opts v1.CreateOptions) (*v1alpha1.SubnetConnectionBindingMap, error) + Update(ctx context.Context, subnetConnectionBindingMap *v1alpha1.SubnetConnectionBindingMap, opts v1.UpdateOptions) (*v1alpha1.SubnetConnectionBindingMap, error) + UpdateStatus(ctx context.Context, subnetConnectionBindingMap *v1alpha1.SubnetConnectionBindingMap, opts v1.UpdateOptions) (*v1alpha1.SubnetConnectionBindingMap, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.SubnetConnectionBindingMap, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.SubnetConnectionBindingMapList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.SubnetConnectionBindingMap, err error) + SubnetConnectionBindingMapExpansion +} + +// subnetConnectionBindingMaps implements SubnetConnectionBindingMapInterface +type subnetConnectionBindingMaps struct { + client rest.Interface + ns string +} + +// newSubnetConnectionBindingMaps returns a SubnetConnectionBindingMaps +func newSubnetConnectionBindingMaps(c *CrdV1alpha1Client, namespace string) *subnetConnectionBindingMaps { + return &subnetConnectionBindingMaps{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the subnetConnectionBindingMap, and returns the corresponding subnetConnectionBindingMap object, and an error if there is any. +func (c *subnetConnectionBindingMaps) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.SubnetConnectionBindingMap, err error) { + result = &v1alpha1.SubnetConnectionBindingMap{} + err = c.client.Get(). + Namespace(c.ns). + Resource("subnetconnectionbindingmaps"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SubnetConnectionBindingMaps that match those selectors. +func (c *subnetConnectionBindingMaps) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SubnetConnectionBindingMapList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.SubnetConnectionBindingMapList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("subnetconnectionbindingmaps"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested subnetConnectionBindingMaps. +func (c *subnetConnectionBindingMaps) 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("subnetconnectionbindingmaps"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a subnetConnectionBindingMap and creates it. Returns the server's representation of the subnetConnectionBindingMap, and an error, if there is any. +func (c *subnetConnectionBindingMaps) Create(ctx context.Context, subnetConnectionBindingMap *v1alpha1.SubnetConnectionBindingMap, opts v1.CreateOptions) (result *v1alpha1.SubnetConnectionBindingMap, err error) { + result = &v1alpha1.SubnetConnectionBindingMap{} + err = c.client.Post(). + Namespace(c.ns). + Resource("subnetconnectionbindingmaps"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(subnetConnectionBindingMap). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a subnetConnectionBindingMap and updates it. Returns the server's representation of the subnetConnectionBindingMap, and an error, if there is any. +func (c *subnetConnectionBindingMaps) Update(ctx context.Context, subnetConnectionBindingMap *v1alpha1.SubnetConnectionBindingMap, opts v1.UpdateOptions) (result *v1alpha1.SubnetConnectionBindingMap, err error) { + result = &v1alpha1.SubnetConnectionBindingMap{} + err = c.client.Put(). + Namespace(c.ns). + Resource("subnetconnectionbindingmaps"). + Name(subnetConnectionBindingMap.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(subnetConnectionBindingMap). + 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 *subnetConnectionBindingMaps) UpdateStatus(ctx context.Context, subnetConnectionBindingMap *v1alpha1.SubnetConnectionBindingMap, opts v1.UpdateOptions) (result *v1alpha1.SubnetConnectionBindingMap, err error) { + result = &v1alpha1.SubnetConnectionBindingMap{} + err = c.client.Put(). + Namespace(c.ns). + Resource("subnetconnectionbindingmaps"). + Name(subnetConnectionBindingMap.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(subnetConnectionBindingMap). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the subnetConnectionBindingMap and deletes it. Returns an error if one occurs. +func (c *subnetConnectionBindingMaps) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("subnetconnectionbindingmaps"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *subnetConnectionBindingMaps) 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("subnetconnectionbindingmaps"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched subnetConnectionBindingMap. +func (c *subnetConnectionBindingMaps) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.SubnetConnectionBindingMap, err error) { + result = &v1alpha1.SubnetConnectionBindingMap{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("subnetconnectionbindingmaps"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/vpc/v1alpha1/vpc_client.go b/pkg/client/clientset/versioned/typed/vpc/v1alpha1/vpc_client.go index d7ba28a5f..987bbff38 100644 --- a/pkg/client/clientset/versioned/typed/vpc/v1alpha1/vpc_client.go +++ b/pkg/client/clientset/versioned/typed/vpc/v1alpha1/vpc_client.go @@ -22,6 +22,7 @@ type CrdV1alpha1Interface interface { SecurityPoliciesGetter StaticRoutesGetter SubnetsGetter + SubnetConnectionBindingMapsGetter SubnetPortsGetter SubnetSetsGetter VPCNetworkConfigurationsGetter @@ -60,6 +61,10 @@ func (c *CrdV1alpha1Client) Subnets(namespace string) SubnetInterface { return newSubnets(c, namespace) } +func (c *CrdV1alpha1Client) SubnetConnectionBindingMaps(namespace string) SubnetConnectionBindingMapInterface { + return newSubnetConnectionBindingMaps(c, namespace) +} + func (c *CrdV1alpha1Client) SubnetPorts(namespace string) SubnetPortInterface { return newSubnetPorts(c, namespace) } diff --git a/pkg/client/go.mod b/pkg/client/go.mod index 85ac652cb..a8839d7f5 100644 --- a/pkg/client/go.mod +++ b/pkg/client/go.mod @@ -1,17 +1,17 @@ module github.com/vmware-tanzu/nsx-operator/pkg/client -go 1.22.5 +go 1.23.1 require ( - github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20240813023528-cb525458c6ee - k8s.io/apimachinery v0.30.3 - k8s.io/client-go v0.30.3 + github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20241112035853-5c31cb6ee66e + k8s.io/apimachinery v0.31.2 + k8s.io/client-go v0.31.2 ) require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch v4.12.0+incompatible // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect @@ -19,6 +19,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // 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 github.com/google/uuid v1.6.0 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -28,6 +29,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/x448/float16 v0.8.4 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sys v0.21.0 // indirect @@ -35,10 +37,11 @@ require ( golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.3.0 // indirect google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/api v0.30.3 // indirect + k8s.io/api v0.31.2 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect diff --git a/pkg/client/go.sum b/pkg/client/go.sum index bd0057562..60989b9ae 100644 --- a/pkg/client/go.sum +++ b/pkg/client/go.sum @@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= -github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= 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-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= @@ -16,8 +16,8 @@ github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En 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-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= @@ -30,8 +30,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2Rrd27c3VGxi6a/6HNq8QmHRKM= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -56,16 +56,17 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= -github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= -github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= -github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk= +github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E= +github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/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/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/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/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -75,10 +76,12 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20240813023528-cb525458c6ee h1:zbDYJ7kIfZRin5ifeezrLuiNhMezUqEaRtrEcrB5/4M= -github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20240813023528-cb525458c6ee/go.mod h1:Q4JzNkNMvjo7pXtlB5/R3oME4Nhah7fAObWgghVmtxk= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20241112035853-5c31cb6ee66e h1:neOlsHeF6LDibk7/DMhWRzR0oNas1JWa8iYw53bLBZQ= +github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20241112035853-5c31cb6ee66e/go.mod h1:Q4JzNkNMvjo7pXtlB5/R3oME4Nhah7fAObWgghVmtxk= +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/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -125,6 +128,8 @@ google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWn gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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/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/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -133,12 +138,12 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ= -k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04= -k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc= -k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/client-go v0.30.3 h1:bHrJu3xQZNXIi8/MoxYtZBBWQQXwy16zqJwloXXfD3k= -k8s.io/client-go v0.30.3/go.mod h1:8d4pf8vYu665/kUbsxWAQ/JDBNWqfFeZnvFiVdmx89U= +k8s.io/api v0.31.2 h1:3wLBbL5Uom/8Zy98GRPXpJ254nEFpl+hwndmk9RwmL0= +k8s.io/api v0.31.2/go.mod h1:bWmGvrGPssSK1ljmLzd3pwCQ9MgoTsRCuK35u6SygUk= +k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= +k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/client-go v0.31.2 h1:Y2F4dxU5d3AQj+ybwSMqQnpZH9F30//1ObxOKlTI9yc= +k8s.io/client-go v0.31.2/go.mod h1:NPa74jSVR/+eez2dFsEIHNa+3o09vtNaWwWwb1qSxSs= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 4cc4a7192..8e17da8ac 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -54,6 +54,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().StaticRoutes().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("subnets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().Subnets().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("subnetconnectionbindingmaps"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().SubnetConnectionBindingMaps().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("subnetports"): return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().SubnetPorts().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("subnetsets"): diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/interface.go b/pkg/client/informers/externalversions/vpc/v1alpha1/interface.go index 296d61738..e13677fb7 100644 --- a/pkg/client/informers/externalversions/vpc/v1alpha1/interface.go +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/interface.go @@ -25,6 +25,8 @@ type Interface interface { StaticRoutes() StaticRouteInformer // Subnets returns a SubnetInformer. Subnets() SubnetInformer + // SubnetConnectionBindingMaps returns a SubnetConnectionBindingMapInformer. + SubnetConnectionBindingMaps() SubnetConnectionBindingMapInformer // SubnetPorts returns a SubnetPortInformer. SubnetPorts() SubnetPortInformer // SubnetSets returns a SubnetSetInformer. @@ -79,6 +81,11 @@ func (v *version) Subnets() SubnetInformer { return &subnetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// SubnetConnectionBindingMaps returns a SubnetConnectionBindingMapInformer. +func (v *version) SubnetConnectionBindingMaps() SubnetConnectionBindingMapInformer { + return &subnetConnectionBindingMapInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // SubnetPorts returns a SubnetPortInformer. func (v *version) SubnetPorts() SubnetPortInformer { return &subnetPortInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/subnetconnectionbindingmap.go b/pkg/client/informers/externalversions/vpc/v1alpha1/subnetconnectionbindingmap.go new file mode 100644 index 000000000..147c39083 --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/subnetconnectionbindingmap.go @@ -0,0 +1,77 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + vpcv1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/client/listers/vpc/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// SubnetConnectionBindingMapInformer provides access to a shared informer and lister for +// SubnetConnectionBindingMaps. +type SubnetConnectionBindingMapInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.SubnetConnectionBindingMapLister +} + +type subnetConnectionBindingMapInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSubnetConnectionBindingMapInformer constructs a new informer for SubnetConnectionBindingMap type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSubnetConnectionBindingMapInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSubnetConnectionBindingMapInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSubnetConnectionBindingMapInformer constructs a new informer for SubnetConnectionBindingMap type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSubnetConnectionBindingMapInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().SubnetConnectionBindingMaps(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().SubnetConnectionBindingMaps(namespace).Watch(context.TODO(), options) + }, + }, + &vpcv1alpha1.SubnetConnectionBindingMap{}, + resyncPeriod, + indexers, + ) +} + +func (f *subnetConnectionBindingMapInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSubnetConnectionBindingMapInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *subnetConnectionBindingMapInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vpcv1alpha1.SubnetConnectionBindingMap{}, f.defaultInformer) +} + +func (f *subnetConnectionBindingMapInformer) Lister() v1alpha1.SubnetConnectionBindingMapLister { + return v1alpha1.NewSubnetConnectionBindingMapLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/listers/vpc/v1alpha1/expansion_generated.go b/pkg/client/listers/vpc/v1alpha1/expansion_generated.go index 3b5ef6f01..dd356070b 100644 --- a/pkg/client/listers/vpc/v1alpha1/expansion_generated.go +++ b/pkg/client/listers/vpc/v1alpha1/expansion_generated.go @@ -61,6 +61,14 @@ type SubnetListerExpansion interface{} // SubnetNamespaceLister. type SubnetNamespaceListerExpansion interface{} +// SubnetConnectionBindingMapListerExpansion allows custom methods to be added to +// SubnetConnectionBindingMapLister. +type SubnetConnectionBindingMapListerExpansion interface{} + +// SubnetConnectionBindingMapNamespaceListerExpansion allows custom methods to be added to +// SubnetConnectionBindingMapNamespaceLister. +type SubnetConnectionBindingMapNamespaceListerExpansion interface{} + // SubnetPortListerExpansion allows custom methods to be added to // SubnetPortLister. type SubnetPortListerExpansion interface{} diff --git a/pkg/client/listers/vpc/v1alpha1/subnetconnectionbindingmap.go b/pkg/client/listers/vpc/v1alpha1/subnetconnectionbindingmap.go new file mode 100644 index 000000000..8b89c4461 --- /dev/null +++ b/pkg/client/listers/vpc/v1alpha1/subnetconnectionbindingmap.go @@ -0,0 +1,86 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SubnetConnectionBindingMapLister helps list SubnetConnectionBindingMaps. +// All objects returned here must be treated as read-only. +type SubnetConnectionBindingMapLister interface { + // List lists all SubnetConnectionBindingMaps in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.SubnetConnectionBindingMap, err error) + // SubnetConnectionBindingMaps returns an object that can list and get SubnetConnectionBindingMaps. + SubnetConnectionBindingMaps(namespace string) SubnetConnectionBindingMapNamespaceLister + SubnetConnectionBindingMapListerExpansion +} + +// subnetConnectionBindingMapLister implements the SubnetConnectionBindingMapLister interface. +type subnetConnectionBindingMapLister struct { + indexer cache.Indexer +} + +// NewSubnetConnectionBindingMapLister returns a new SubnetConnectionBindingMapLister. +func NewSubnetConnectionBindingMapLister(indexer cache.Indexer) SubnetConnectionBindingMapLister { + return &subnetConnectionBindingMapLister{indexer: indexer} +} + +// List lists all SubnetConnectionBindingMaps in the indexer. +func (s *subnetConnectionBindingMapLister) List(selector labels.Selector) (ret []*v1alpha1.SubnetConnectionBindingMap, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.SubnetConnectionBindingMap)) + }) + return ret, err +} + +// SubnetConnectionBindingMaps returns an object that can list and get SubnetConnectionBindingMaps. +func (s *subnetConnectionBindingMapLister) SubnetConnectionBindingMaps(namespace string) SubnetConnectionBindingMapNamespaceLister { + return subnetConnectionBindingMapNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SubnetConnectionBindingMapNamespaceLister helps list and get SubnetConnectionBindingMaps. +// All objects returned here must be treated as read-only. +type SubnetConnectionBindingMapNamespaceLister interface { + // List lists all SubnetConnectionBindingMaps in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.SubnetConnectionBindingMap, err error) + // Get retrieves the SubnetConnectionBindingMap from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.SubnetConnectionBindingMap, error) + SubnetConnectionBindingMapNamespaceListerExpansion +} + +// subnetConnectionBindingMapNamespaceLister implements the SubnetConnectionBindingMapNamespaceLister +// interface. +type subnetConnectionBindingMapNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all SubnetConnectionBindingMaps in the indexer for a given namespace. +func (s subnetConnectionBindingMapNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.SubnetConnectionBindingMap, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.SubnetConnectionBindingMap)) + }) + return ret, err +} + +// Get retrieves the SubnetConnectionBindingMap from the indexer for a given namespace and name. +func (s subnetConnectionBindingMapNamespaceLister) Get(name string) (*v1alpha1.SubnetConnectionBindingMap, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("subnetconnectionbindingmap"), name) + } + return obj.(*v1alpha1.SubnetConnectionBindingMap), nil +} diff --git a/pkg/controllers/networkinfo/networkinfo_controller.go b/pkg/controllers/networkinfo/networkinfo_controller.go index 8bf96f25d..404e31d00 100644 --- a/pkg/controllers/networkinfo/networkinfo_controller.go +++ b/pkg/controllers/networkinfo/networkinfo_controller.go @@ -21,7 +21,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" - "sigs.k8s.io/controller-runtime/pkg/ratelimiter" "sigs.k8s.io/controller-runtime/pkg/reconcile" "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" @@ -100,7 +99,7 @@ type NetworkInfoReconciler struct { Service *vpc.VPCService IPBlocksInfoService *ipblocksinfo.IPBlocksInfoService Recorder record.EventRecorder - queue workqueue.RateLimitingInterface + queue workqueue.TypedRateLimitingInterface[reconcile.Request] } func (r *NetworkInfoReconciler) GetVpcConnectivityProfilePathByVpcPath(vpcPath string) (string, error) { @@ -583,9 +582,9 @@ func (r *NetworkInfoReconciler) syncPreCreatedVpcIPs(ctx context.Context) { } } -func (r *NetworkInfoReconciler) getQueue(controllerName string, rateLimiter ratelimiter.RateLimiter) workqueue.RateLimitingInterface { +func (r *NetworkInfoReconciler) getQueue(controllerName string, rateLimiter workqueue.TypedRateLimiter[reconcile.Request]) workqueue.TypedRateLimitingInterface[reconcile.Request] { if r.queue == nil { - r.queue = workqueue.NewRateLimitingQueueWithConfig(rateLimiter, workqueue.RateLimitingQueueConfig{ + r.queue = workqueue.NewTypedRateLimitingQueueWithConfig(rateLimiter, workqueue.TypedRateLimitingQueueConfig[reconcile.Request]{ Name: controllerName, }) } diff --git a/pkg/controllers/networkinfo/networkinfo_controller_test.go b/pkg/controllers/networkinfo/networkinfo_controller_test.go index 711ac9a03..95265f29a 100644 --- a/pkg/controllers/networkinfo/networkinfo_controller_test.go +++ b/pkg/controllers/networkinfo/networkinfo_controller_test.go @@ -1258,19 +1258,22 @@ func TestNetworkInfoReconciler_GetVpcConnectivityProfilePathByVpcPath(t *testing } func TestSyncPreCreatedVpcIPs(t *testing.T) { - stopSig := "stop" - getQueuedReqs := func(queue workqueue.RateLimitingInterface) []reconcile.Request { + stopSig := reconcile.Request{ + NamespacedName: types.NamespacedName{ + Namespace: "stop", + }, + } + getQueuedReqs := func(queue workqueue.TypedRateLimitingInterface[reconcile.Request]) []reconcile.Request { var requests []reconcile.Request for { obj, shutdown := queue.Get() if shutdown { return requests } - if val, ok := obj.(string); ok && val == stopSig { + if obj.Namespace == "stop" { return requests } - req, _ := obj.(reconcile.Request) - requests = append(requests, req) + requests = append(requests, obj) } } @@ -1278,8 +1281,9 @@ func TestSyncPreCreatedVpcIPs(t *testing.T) { mockCtl := gomock.NewController(t) k8sClient := mock_client.NewMockClient(mockCtl) r.Client = k8sClient - r.queue = workqueue.NewRateLimitingQueueWithConfig(workqueue.DefaultControllerRateLimiter(), - workqueue.RateLimitingQueueConfig{ + r.queue = workqueue.NewTypedRateLimitingQueueWithConfig( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request](), + workqueue.TypedRateLimitingQueueConfig[reconcile.Request]{ Name: "test", }) defer r.queue.ShuttingDown() diff --git a/pkg/controllers/networkinfo/vpcnetworkconfig_handler.go b/pkg/controllers/networkinfo/vpcnetworkconfig_handler.go index e36979c27..e81b4bb07 100644 --- a/pkg/controllers/networkinfo/vpcnetworkconfig_handler.go +++ b/pkg/controllers/networkinfo/vpcnetworkconfig_handler.go @@ -34,7 +34,7 @@ type VPCNetworkConfigurationHandler struct { ipBlocksInfoService commontypes.IPBlocksInfoServiceProvider } -func (h *VPCNetworkConfigurationHandler) Create(ctx context.Context, e event.CreateEvent, _ workqueue.RateLimitingInterface) { +func (h *VPCNetworkConfigurationHandler) Create(ctx context.Context, e event.CreateEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request]) { vpcConfigCR := e.Object.(*v1alpha1.VPCNetworkConfiguration) vname := vpcConfigCR.GetName() ninfo, err := buildNetworkConfigInfo(*vpcConfigCR) @@ -50,21 +50,27 @@ func (h *VPCNetworkConfigurationHandler) Create(ctx context.Context, e event.Cre } } -func (h *VPCNetworkConfigurationHandler) Delete(ctx context.Context, e event.DeleteEvent, w workqueue.RateLimitingInterface) { +func (h *VPCNetworkConfigurationHandler) Delete(ctx context.Context, e event.DeleteEvent, w workqueue.TypedRateLimitingInterface[reconcile.Request]) { vpcConfigCR := e.Object.(*v1alpha1.VPCNetworkConfiguration) if err := h.ipBlocksInfoService.SyncIPBlocksInfo(ctx); err != nil { log.Error(err, "failed to synchronize IPBlocksInfo when deleting %s", vpcConfigCR.Name) - w.AddAfter(e.Object.GetName(), retryInterval) + req := reconcile.Request{ + NamespacedName: client.ObjectKey{ + Name: e.Object.GetName(), + Namespace: e.Object.GetNamespace(), + }, + } + w.AddAfter(req, retryInterval) } else { h.ipBlocksInfoService.ResetPeriodicSync() } } -func (h *VPCNetworkConfigurationHandler) Generic(_ context.Context, _ event.GenericEvent, _ workqueue.RateLimitingInterface) { +func (h *VPCNetworkConfigurationHandler) Generic(_ context.Context, _ event.GenericEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request]) { log.V(1).Info("VPCNetworkConfiguration generic event, do nothing") } -func (h *VPCNetworkConfigurationHandler) Update(ctx context.Context, e event.UpdateEvent, q workqueue.RateLimitingInterface) { +func (h *VPCNetworkConfigurationHandler) Update(ctx context.Context, e event.UpdateEvent, q workqueue.TypedRateLimitingInterface[reconcile.Request]) { log.V(1).Info("Start processing VPC network config update event") newNc := e.ObjectNew.(*v1alpha1.VPCNetworkConfiguration) diff --git a/pkg/controllers/networkinfo/vpcnetworkconfig_handler_test.go b/pkg/controllers/networkinfo/vpcnetworkconfig_handler_test.go index 5c7978587..cf5f5a32b 100644 --- a/pkg/controllers/networkinfo/vpcnetworkconfig_handler_test.go +++ b/pkg/controllers/networkinfo/vpcnetworkconfig_handler_test.go @@ -14,6 +14,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/event" + "sigs.k8s.io/controller-runtime/pkg/reconcile" "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" "github.com/vmware-tanzu/nsx-operator/pkg/config" @@ -244,7 +245,8 @@ func TestVPCNetworkConfigurationHandler_Create(t *testing.T) { } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) handler := createVPCNetworkConfigurationHandler(nil, nil, nil) handler.Create(context.TODO(), event.CreateEvent{Object: tc.vpcNetworkConfig}, queue) }) @@ -266,7 +268,8 @@ func TestVPCNetworkConfigurationHandler_Delete(t *testing.T) { } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) handler := createVPCNetworkConfigurationHandler(nil, nil, nil) handler.Delete(context.TODO(), event.DeleteEvent{Object: tc.vpcNetworkConfig}, queue) }) @@ -326,7 +329,8 @@ func TestVPCNetworkConfigurationHandler_Update(t *testing.T) { } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) var objs []client.Object if tc.existingNetworkInfoCR != nil { objs = append(objs, tc.existingNetworkInfoCR) @@ -353,7 +357,8 @@ func TestVPCNetworkConfigurationHandler_Generic(t *testing.T) { } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) handler := createVPCNetworkConfigurationHandler(nil, nil, nil) handler.Generic(context.TODO(), event.GenericEvent{Object: tc.vpcNetworkConfig}, queue) }) diff --git a/pkg/controllers/networkpolicy/networkpolicy_controller_test.go b/pkg/controllers/networkpolicy/networkpolicy_controller_test.go index 750a1d347..9954dbc12 100644 --- a/pkg/controllers/networkpolicy/networkpolicy_controller_test.go +++ b/pkg/controllers/networkpolicy/networkpolicy_controller_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - gomonkey "github.com/agiledragon/gomonkey/v2" + "github.com/agiledragon/gomonkey/v2" "github.com/golang/mock/gomock" "github.com/openlyinc/pointy" "github.com/stretchr/testify/assert" @@ -29,7 +29,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/manager" - "sigs.k8s.io/controller-runtime/pkg/reconcile" "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" "github.com/vmware-tanzu/nsx-operator/pkg/config" @@ -524,7 +523,7 @@ func TestStartNetworkPolicyController(t *testing.T) { patches.ApplyFunc(securitypolicy.GetSecurityService, func(service common.Service, vpcService common.VPCServiceProvider) *securitypolicy.SecurityPolicyService { return fakeService() }) - patches.ApplyMethod(reflect.TypeOf(&ctrl.Builder{}), "Complete", func(_ *ctrl.Builder, r reconcile.Reconciler) error { + patches.ApplyMethod(reflect.TypeOf(&NetworkPolicyReconciler{}), "Start", func(_ *NetworkPolicyReconciler, r ctrl.Manager) error { return nil }) return patches diff --git a/pkg/controllers/securitypolicy/namespace_handler.go b/pkg/controllers/securitypolicy/namespace_handler.go index f4a01816b..8ae07ee27 100644 --- a/pkg/controllers/securitypolicy/namespace_handler.go +++ b/pkg/controllers/securitypolicy/namespace_handler.go @@ -12,6 +12,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/predicate" + "sigs.k8s.io/controller-runtime/pkg/reconcile" "github.com/vmware-tanzu/nsx-operator/pkg/util" ) @@ -25,19 +26,19 @@ type EnqueueRequestForNamespace struct { SecurityPolicyReconciler *SecurityPolicyReconciler } -func (e *EnqueueRequestForNamespace) Create(_ context.Context, _ event.CreateEvent, _ workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForNamespace) Create(_ context.Context, _ event.CreateEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request]) { log.V(1).Info("NameSpace create event, do nothing") } -func (e *EnqueueRequestForNamespace) Delete(_ context.Context, _ event.DeleteEvent, _ workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForNamespace) Delete(_ context.Context, _ event.DeleteEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request]) { log.V(1).Info("NameSpace delete event, do nothing") } -func (e *EnqueueRequestForNamespace) Generic(_ context.Context, _ event.GenericEvent, _ workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForNamespace) Generic(_ context.Context, _ event.GenericEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request]) { log.V(1).Info("NameSpace generic event, do nothing") } -func (e *EnqueueRequestForNamespace) Update(_ context.Context, updateEvent event.UpdateEvent, l workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForNamespace) Update(_ context.Context, updateEvent event.UpdateEvent, l workqueue.TypedRateLimitingInterface[reconcile.Request]) { obj := updateEvent.ObjectNew.(*v1.Namespace) if isInSysNs, err := util.IsSystemNamespace(nil, "", obj); err != nil { log.Error(err, "Failed to fetch namespace", "namespace", obj.Name) diff --git a/pkg/controllers/securitypolicy/namespace_handler_test.go b/pkg/controllers/securitypolicy/namespace_handler_test.go index 566936328..550ca9473 100644 --- a/pkg/controllers/securitypolicy/namespace_handler_test.go +++ b/pkg/controllers/securitypolicy/namespace_handler_test.go @@ -15,6 +15,7 @@ import ( "k8s.io/client-go/util/workqueue" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/event" + "sigs.k8s.io/controller-runtime/pkg/reconcile" mock_client "github.com/vmware-tanzu/nsx-operator/pkg/mock/controller-runtime/client" ) @@ -25,7 +26,7 @@ func TestEnqueueRequestForNamespace_Create(t *testing.T) { } type args struct { createEvent event.CreateEvent - l workqueue.RateLimitingInterface + l workqueue.TypedRateLimitingInterface[reconcile.Request] } tests := []struct { name string @@ -50,7 +51,7 @@ func TestEnqueueRequestForNamespace_Delete(t *testing.T) { } type args struct { deleteEvent event.DeleteEvent - l workqueue.RateLimitingInterface + l workqueue.TypedRateLimitingInterface[reconcile.Request] } tests := []struct { name string @@ -75,7 +76,7 @@ func TestEnqueueRequestForNamespace_Generic(t *testing.T) { } type args struct { genericEvent event.GenericEvent - l workqueue.RateLimitingInterface + l workqueue.TypedRateLimitingInterface[reconcile.Request] } tests := []struct { name string @@ -129,7 +130,7 @@ func TestEnqueueRequestForNamespace_Update(t *testing.T) { return nil }) patches := gomonkey.ApplyFunc(reconcileSecurityPolicy, func(r *SecurityPolicyReconciler, client client.Client, pods []v1.Pod, - q workqueue.RateLimitingInterface, + q workqueue.TypedRateLimitingInterface[reconcile.Request], ) error { return nil }) @@ -140,7 +141,7 @@ func TestEnqueueRequestForNamespace_Update(t *testing.T) { } type args struct { updateEvent event.UpdateEvent - l workqueue.RateLimitingInterface + l workqueue.TypedRateLimitingInterface[reconcile.Request] } evt := event.UpdateEvent{ ObjectOld: &v1.Namespace{ diff --git a/pkg/controllers/securitypolicy/pod_handler.go b/pkg/controllers/securitypolicy/pod_handler.go index 3320d9ac6..ab9b2627c 100644 --- a/pkg/controllers/securitypolicy/pod_handler.go +++ b/pkg/controllers/securitypolicy/pod_handler.go @@ -13,6 +13,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/predicate" + "sigs.k8s.io/controller-runtime/pkg/reconcile" "github.com/vmware-tanzu/nsx-operator/pkg/util" ) @@ -29,23 +30,23 @@ type EnqueueRequestForPod struct { SecurityPolicyReconciler *SecurityPolicyReconciler } -func (e *EnqueueRequestForPod) Create(_ context.Context, createEvent event.CreateEvent, q workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForPod) Create(_ context.Context, createEvent event.CreateEvent, q workqueue.TypedRateLimitingInterface[reconcile.Request]) { e.Raw(createEvent, q) } -func (e *EnqueueRequestForPod) Update(_ context.Context, updateEvent event.UpdateEvent, q workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForPod) Update(_ context.Context, updateEvent event.UpdateEvent, q workqueue.TypedRateLimitingInterface[reconcile.Request]) { e.Raw(updateEvent, q) } -func (e *EnqueueRequestForPod) Delete(_ context.Context, deleteEvent event.DeleteEvent, q workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForPod) Delete(_ context.Context, deleteEvent event.DeleteEvent, q workqueue.TypedRateLimitingInterface[reconcile.Request]) { e.Raw(deleteEvent, q) } -func (e *EnqueueRequestForPod) Generic(_ context.Context, genericEvent event.GenericEvent, q workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForPod) Generic(_ context.Context, genericEvent event.GenericEvent, q workqueue.TypedRateLimitingInterface[reconcile.Request]) { e.Raw(genericEvent, q) } -func (e *EnqueueRequestForPod) Raw(evt interface{}, q workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForPod) Raw(evt interface{}, q workqueue.TypedRateLimitingInterface[reconcile.Request]) { var pods []v1.Pod var obj client.Object diff --git a/pkg/controllers/securitypolicy/pod_handler_test.go b/pkg/controllers/securitypolicy/pod_handler_test.go index 99e4863fe..541fa58d7 100644 --- a/pkg/controllers/securitypolicy/pod_handler_test.go +++ b/pkg/controllers/securitypolicy/pod_handler_test.go @@ -15,6 +15,7 @@ import ( "k8s.io/client-go/util/workqueue" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/event" + "sigs.k8s.io/controller-runtime/pkg/reconcile" "github.com/vmware-tanzu/nsx-operator/pkg/util" ) @@ -66,7 +67,7 @@ func TestEnqueueRequestForPod_Raw(t *testing.T) { } type args struct { evt interface{} - q workqueue.RateLimitingInterface + q workqueue.TypedRateLimitingInterface[reconcile.Request] } tests := []struct { name string @@ -76,7 +77,7 @@ func TestEnqueueRequestForPod_Raw(t *testing.T) { {"1", fields{}, args{evt, nil}}, } patches := gomonkey.ApplyFunc(reconcileSecurityPolicy, func(r *SecurityPolicyReconciler, client client.Client, pods []v1.Pod, - q workqueue.RateLimitingInterface, + q workqueue.TypedRateLimitingInterface[reconcile.Request], ) error { return nil }) @@ -109,7 +110,7 @@ func TestEnqueueRequestForPod_Create(t *testing.T) { } type args struct { evt event.CreateEvent - q workqueue.RateLimitingInterface + q workqueue.TypedRateLimitingInterface[reconcile.Request] } tests := []struct { name string @@ -119,7 +120,7 @@ func TestEnqueueRequestForPod_Create(t *testing.T) { {"1", fields{}, args{evt, nil}}, } patches := gomonkey.ApplyFunc(reconcileSecurityPolicy, func(r *SecurityPolicyReconciler, client client.Client, pods []v1.Pod, - q workqueue.RateLimitingInterface, + q workqueue.TypedRateLimitingInterface[reconcile.Request], ) error { return nil }) @@ -157,7 +158,7 @@ func TestEnqueueRequestForPod_Update(t *testing.T) { } type args struct { evt event.UpdateEvent - q workqueue.RateLimitingInterface + q workqueue.TypedRateLimitingInterface[reconcile.Request] } tests := []struct { name string @@ -167,7 +168,7 @@ func TestEnqueueRequestForPod_Update(t *testing.T) { {"1", fields{}, args{evt, nil}}, } patches := gomonkey.ApplyFunc(reconcileSecurityPolicy, func(r *SecurityPolicyReconciler, client client.Client, pods []v1.Pod, - q workqueue.RateLimitingInterface, + q workqueue.TypedRateLimitingInterface[reconcile.Request], ) error { return nil }) @@ -200,7 +201,7 @@ func TestEnqueueRequestForPod_Delete(t *testing.T) { } type args struct { evt event.DeleteEvent - q workqueue.RateLimitingInterface + q workqueue.TypedRateLimitingInterface[reconcile.Request] } tests := []struct { name string @@ -210,7 +211,7 @@ func TestEnqueueRequestForPod_Delete(t *testing.T) { {"1", fields{}, args{evt, nil}}, } patches := gomonkey.ApplyFunc(reconcileSecurityPolicy, func(r *SecurityPolicyReconciler, client client.Client, pods []v1.Pod, - q workqueue.RateLimitingInterface, + q workqueue.TypedRateLimitingInterface[reconcile.Request], ) error { return nil }) @@ -243,7 +244,7 @@ func TestEnqueueRequestForPod_Generic(t *testing.T) { } type args struct { evt event.GenericEvent - q workqueue.RateLimitingInterface + q workqueue.TypedRateLimitingInterface[reconcile.Request] } tests := []struct { name string @@ -253,7 +254,7 @@ func TestEnqueueRequestForPod_Generic(t *testing.T) { {"1", fields{}, args{evt, nil}}, } patches := gomonkey.ApplyFunc(reconcileSecurityPolicy, func(r *SecurityPolicyReconciler, client client.Client, pods []v1.Pod, - q workqueue.RateLimitingInterface, + q workqueue.TypedRateLimitingInterface[reconcile.Request], ) error { return nil }) diff --git a/pkg/controllers/securitypolicy/securitypolicy_controller.go b/pkg/controllers/securitypolicy/securitypolicy_controller.go index 5cc27f2b4..685df1661 100644 --- a/pkg/controllers/securitypolicy/securitypolicy_controller.go +++ b/pkg/controllers/securitypolicy/securitypolicy_controller.go @@ -438,7 +438,7 @@ func (r *SecurityPolicyReconciler) listSecurityPolciyCRIDs() (sets.Set[string], } // It is triggered by associated controller like pod, namespace, etc. -func reconcileSecurityPolicy(r *SecurityPolicyReconciler, pkgclient client.Client, pods []v1.Pod, q workqueue.RateLimitingInterface) error { +func reconcileSecurityPolicy(r *SecurityPolicyReconciler, pkgclient client.Client, pods []v1.Pod, q workqueue.TypedRateLimitingInterface[reconcile.Request]) error { podPortNames := getAllPodPortNames(pods) log.V(1).Info("POD named port", "podPortNames", podPortNames) var spList client.ObjectList @@ -470,7 +470,7 @@ func reconcileSecurityPolicy(r *SecurityPolicyReconciler, pkgclient client.Clien return nil } -func shouldReconcile(securityPolicy *v1alpha1.SecurityPolicy, q workqueue.RateLimitingInterface, podPortNames sets.Set[string]) { +func shouldReconcile(securityPolicy *v1alpha1.SecurityPolicy, q workqueue.TypedRateLimitingInterface[reconcile.Request], podPortNames sets.Set[string]) { shouldReconcile := false for _, rule := range securityPolicy.Spec.Rules { for _, port := range rule.Ports { diff --git a/pkg/controllers/securitypolicy/securitypolicy_controller_test.go b/pkg/controllers/securitypolicy/securitypolicy_controller_test.go index 1035472d2..1c289679b 100644 --- a/pkg/controllers/securitypolicy/securitypolicy_controller_test.go +++ b/pkg/controllers/securitypolicy/securitypolicy_controller_test.go @@ -17,7 +17,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/reconcile" - gomonkey "github.com/agiledragon/gomonkey/v2" + "github.com/agiledragon/gomonkey/v2" "github.com/golang/mock/gomock" "github.com/openlyinc/pointy" "github.com/stretchr/testify/assert" @@ -597,7 +597,7 @@ func TestReconcileSecurityPolicy(t *testing.T) { type args struct { client client.Client pods []v1.Pod - q workqueue.RateLimitingInterface + q workqueue.TypedRateLimitingInterface[reconcile.Request] } tests := []struct { name string @@ -888,7 +888,7 @@ func TestReconcileSecurityPolicyForVPC(t *testing.T) { type args struct { client client.Client pods []v1.Pod - q workqueue.RateLimitingInterface + q workqueue.TypedRateLimitingInterface[reconcile.Request] } tests := []struct { name string @@ -937,7 +937,7 @@ func TestStartSecurityPolicyController(t *testing.T) { patches.ApplyFunc(securitypolicy.GetSecurityService, func(service common.Service, vpcService common.VPCServiceProvider) *securitypolicy.SecurityPolicyService { return fakeService() }) - patches.ApplyMethod(reflect.TypeOf(&ctrl.Builder{}), "Complete", func(_ *ctrl.Builder, r reconcile.Reconciler) error { + patches.ApplyMethod(reflect.TypeOf(&SecurityPolicyReconciler{}), "Start", func(_ *SecurityPolicyReconciler, r ctrl.Manager) error { return nil }) return patches diff --git a/pkg/controllers/service/service_lb_controller_test.go b/pkg/controllers/service/service_lb_controller_test.go index 87da2db6c..8ee11decb 100644 --- a/pkg/controllers/service/service_lb_controller_test.go +++ b/pkg/controllers/service/service_lb_controller_test.go @@ -10,21 +10,19 @@ import ( "reflect" "testing" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/rest" - "k8s.io/client-go/tools/record" - "sigs.k8s.io/controller-runtime/pkg/manager" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - gomonkey "github.com/agiledragon/gomonkey/v2" + "github.com/agiledragon/gomonkey/v2" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" + "sigs.k8s.io/controller-runtime/pkg/manager" "github.com/vmware-tanzu/nsx-operator/pkg/config" @@ -255,7 +253,7 @@ func TestStartServiceLbController(t *testing.T) { patches.ApplyFunc(isServiceLbStatusIpModeSupported, func(c *rest.Config) bool { return true }) - patches.ApplyMethod(reflect.TypeOf(&ctrl.Builder{}), "Complete", func(_ *ctrl.Builder, r reconcile.Reconciler) error { + patches.ApplyMethod(reflect.TypeOf(&ServiceLbReconciler{}), "Start", func(_ *ServiceLbReconciler, r ctrl.Manager) error { return nil }) return patches diff --git a/pkg/controllers/subnet/namespace_handler.go b/pkg/controllers/subnet/namespace_handler.go index 6fe55f5d7..1373a693a 100644 --- a/pkg/controllers/subnet/namespace_handler.go +++ b/pkg/controllers/subnet/namespace_handler.go @@ -25,19 +25,19 @@ type EnqueueRequestForNamespace struct { Client client.Client } -func (e *EnqueueRequestForNamespace) Create(_ context.Context, _ event.CreateEvent, _ workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForNamespace) Create(_ context.Context, _ event.CreateEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request]) { log.V(1).Info("Namespace create event, do nothing") } -func (e *EnqueueRequestForNamespace) Delete(_ context.Context, _ event.DeleteEvent, _ workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForNamespace) Delete(_ context.Context, _ event.DeleteEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request]) { log.V(1).Info("Namespace delete event, do nothing") } -func (e *EnqueueRequestForNamespace) Generic(_ context.Context, _ event.GenericEvent, _ workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForNamespace) Generic(_ context.Context, _ event.GenericEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request]) { log.V(1).Info("Namespace generic event, do nothing") } -func (e *EnqueueRequestForNamespace) Update(_ context.Context, updateEvent event.UpdateEvent, l workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForNamespace) Update(_ context.Context, updateEvent event.UpdateEvent, l workqueue.TypedRateLimitingInterface[reconcile.Request]) { obj := updateEvent.ObjectNew.(*v1.Namespace) err := requeueSubnet(e.Client, obj.Name, l) if err != nil { @@ -73,7 +73,7 @@ func listSubnet(c client.Client, ctx context.Context, options ...client.ListOpti return subnetList, nil } -func requeueSubnet(c client.Client, ns string, q workqueue.RateLimitingInterface) error { +func requeueSubnet(c client.Client, ns string, q workqueue.TypedRateLimitingInterface[reconcile.Request]) error { subnetList, err := listSubnet(c, context.Background(), client.InNamespace(ns)) if err != nil { log.Error(err, "Failed to list all the Subnets") diff --git a/pkg/controllers/subnet/namespace_handler_test.go b/pkg/controllers/subnet/namespace_handler_test.go index ed084ebb8..2b4cc5385 100644 --- a/pkg/controllers/subnet/namespace_handler_test.go +++ b/pkg/controllers/subnet/namespace_handler_test.go @@ -13,6 +13,7 @@ import ( ctlclient "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/event" + "sigs.k8s.io/controller-runtime/pkg/reconcile" "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" ) @@ -20,7 +21,8 @@ import ( func TestEnqueueRequestForNamespace_Create(t *testing.T) { client := fake.NewClientBuilder().Build() e := &EnqueueRequestForNamespace{Client: client} - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) e.Create(context.TODO(), event.CreateEvent{}, queue) // No asserts here because Create does nothing, just ensuring no errors. @@ -29,7 +31,8 @@ func TestEnqueueRequestForNamespace_Create(t *testing.T) { func TestEnqueueRequestForNamespace_Delete(t *testing.T) { client := fake.NewClientBuilder().Build() e := &EnqueueRequestForNamespace{Client: client} - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) e.Delete(context.TODO(), event.DeleteEvent{}, queue) // No asserts here because Delete does nothing, just ensuring no errors. @@ -38,7 +41,8 @@ func TestEnqueueRequestForNamespace_Delete(t *testing.T) { func TestEnqueueRequestForNamespace_Generic(t *testing.T) { client := fake.NewClientBuilder().Build() e := &EnqueueRequestForNamespace{Client: client} - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) e.Generic(context.TODO(), event.GenericEvent{}, queue) // No asserts here because Generic does nothing, just ensuring no errors. @@ -62,7 +66,8 @@ func TestEnqueueRequestForNamespace_Update(t *testing.T) { client := fake.NewClientBuilder().WithObjects(newNamespace).Build() e := &EnqueueRequestForNamespace{Client: client} - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) updateEvent := event.UpdateEvent{ ObjectOld: oldNamespace, @@ -147,13 +152,15 @@ func TestRequeueSubnetSet(t *testing.T) { // Test for empty namespace (no SubnetSets found) emptyClient := fake.NewClientBuilder().Build() - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) err := requeueSubnet(emptyClient, "empty-namespace", queue) assert.NoError(t, err, "Expected no error with empty namespace") assert.Equal(t, 0, queue.Len(), "Expected no items to be requeued for empty namespace") client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(subnet).Build() - queue = workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue = workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) err = requeueSubnet(client, "test-namespace", queue) assert.NoError(t, err, "Expected no error while requeueing SubnetSets") diff --git a/pkg/controllers/subnetset/namespace_handler.go b/pkg/controllers/subnetset/namespace_handler.go index 408a35d12..f11383295 100644 --- a/pkg/controllers/subnetset/namespace_handler.go +++ b/pkg/controllers/subnetset/namespace_handler.go @@ -25,19 +25,19 @@ type EnqueueRequestForNamespace struct { Client client.Client } -func (e *EnqueueRequestForNamespace) Create(_ context.Context, _ event.CreateEvent, _ workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForNamespace) Create(_ context.Context, _ event.CreateEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request]) { log.V(1).Info("Namespace create event, do nothing") } -func (e *EnqueueRequestForNamespace) Delete(_ context.Context, _ event.DeleteEvent, _ workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForNamespace) Delete(_ context.Context, _ event.DeleteEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request]) { log.V(1).Info("Namespace delete event, do nothing") } -func (e *EnqueueRequestForNamespace) Generic(_ context.Context, _ event.GenericEvent, _ workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForNamespace) Generic(_ context.Context, _ event.GenericEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request]) { log.V(1).Info("Namespace generic event, do nothing") } -func (e *EnqueueRequestForNamespace) Update(_ context.Context, updateEvent event.UpdateEvent, l workqueue.RateLimitingInterface) { +func (e *EnqueueRequestForNamespace) Update(_ context.Context, updateEvent event.UpdateEvent, l workqueue.TypedRateLimitingInterface[reconcile.Request]) { obj := updateEvent.ObjectNew.(*v1.Namespace) err := requeueSubnetSet(e.Client, obj.Name, l) if err != nil { @@ -73,7 +73,7 @@ func listSubnetSet(c client.Client, ctx context.Context, options ...client.ListO return subnetSetList, nil } -func requeueSubnetSet(c client.Client, namespace string, q workqueue.RateLimitingInterface) error { +func requeueSubnetSet(c client.Client, namespace string, q workqueue.TypedRateLimitingInterface[reconcile.Request]) error { subnetSetList, err := listSubnetSet(c, context.Background(), client.InNamespace(namespace)) if err != nil { log.Error(err, "Failed to list all the SubnetSets") diff --git a/pkg/controllers/subnetset/namespace_handler_test.go b/pkg/controllers/subnetset/namespace_handler_test.go index ddf455d71..116f5fc86 100644 --- a/pkg/controllers/subnetset/namespace_handler_test.go +++ b/pkg/controllers/subnetset/namespace_handler_test.go @@ -13,6 +13,7 @@ import ( ctlclient "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/event" + "sigs.k8s.io/controller-runtime/pkg/reconcile" "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" ) @@ -20,7 +21,8 @@ import ( func TestEnqueueRequestForNamespace_Create(t *testing.T) { client := fake.NewClientBuilder().Build() e := &EnqueueRequestForNamespace{Client: client} - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) e.Create(context.TODO(), event.CreateEvent{}, queue) // No asserts here because Create does nothing, just ensuring no errors. @@ -29,7 +31,8 @@ func TestEnqueueRequestForNamespace_Create(t *testing.T) { func TestEnqueueRequestForNamespace_Delete(t *testing.T) { client := fake.NewClientBuilder().Build() e := &EnqueueRequestForNamespace{Client: client} - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) e.Delete(context.TODO(), event.DeleteEvent{}, queue) // No asserts here because Delete does nothing, just ensuring no errors. @@ -38,7 +41,8 @@ func TestEnqueueRequestForNamespace_Delete(t *testing.T) { func TestEnqueueRequestForNamespace_Generic(t *testing.T) { client := fake.NewClientBuilder().Build() e := &EnqueueRequestForNamespace{Client: client} - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) e.Generic(context.TODO(), event.GenericEvent{}, queue) // No asserts here because Generic does nothing, just ensuring no errors. @@ -62,7 +66,8 @@ func TestEnqueueRequestForNamespace_Update(t *testing.T) { client := fake.NewClientBuilder().WithObjects(newNamespace).Build() e := &EnqueueRequestForNamespace{Client: client} - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) updateEvent := event.UpdateEvent{ ObjectOld: oldNamespace, @@ -147,13 +152,15 @@ func TestRequeueSubnetSet(t *testing.T) { // Test for empty namespace (no SubnetSets found) emptyClient := fake.NewClientBuilder().Build() - queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue := workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) err := requeueSubnetSet(emptyClient, "empty-namespace", queue) assert.NoError(t, err, "Expected no error with empty namespace") assert.Equal(t, 0, queue.Len(), "Expected no items to be requeued for empty namespace") client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(subnetSet).Build() - queue = workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) + queue = workqueue.NewTypedRateLimitingQueue( + workqueue.DefaultTypedControllerRateLimiter[reconcile.Request]()) err = requeueSubnetSet(client, "test-namespace", queue) assert.NoError(t, err, "Expected no error while requeueing SubnetSets") diff --git a/pkg/mock/controller-runtime/client/mock_workqueue.go b/pkg/mock/controller-runtime/client/mock_workqueue.go index 8e5308bab..01db3f1a2 100644 --- a/pkg/mock/controller-runtime/client/mock_workqueue.go +++ b/pkg/mock/controller-runtime/client/mock_workqueue.go @@ -1,10 +1,11 @@ package mock_client import ( - reflect "reflect" + "reflect" "time" - gomock "github.com/golang/mock/gomock" + "github.com/golang/mock/gomock" + "sigs.k8s.io/controller-runtime/pkg/reconcile" ) type MockInterface struct { @@ -15,16 +16,16 @@ type MockInterface struct { func (m *MockInterface) ShutDownWithDrain() { } -func (m *MockInterface) AddAfter(item interface{}, duration time.Duration) { +func (m *MockInterface) AddAfter(item reconcile.Request, duration time.Duration) { } -func (m *MockInterface) AddRateLimited(item interface{}) { +func (m *MockInterface) AddRateLimited(item reconcile.Request) { } -func (m *MockInterface) Forget(item interface{}) { +func (m *MockInterface) Forget(item reconcile.Request) { } -func (m *MockInterface) NumRequeues(item interface{}) int { +func (m *MockInterface) NumRequeues(item reconcile.Request) int { return 0 } @@ -46,33 +47,33 @@ func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { } // Add mocks base method. -func (m *MockInterface) Add(arg0 interface{}) { +func (m *MockInterface) Add(arg0 reconcile.Request) { m.ctrl.T.Helper() } // Add indicates an expected call of Add. -func (mr *MockInterfaceMockRecorder) Add(arg0 interface{}) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Add(arg0 reconcile.Request) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Add", reflect.TypeOf((*MockInterface)(nil).Add), arg0) } // Done mocks base method. -func (m *MockInterface) Done(arg0 interface{}) { +func (m *MockInterface) Done(arg0 reconcile.Request) { m.ctrl.T.Helper() m.ctrl.Call(m, "Done", arg0) } // Done indicates an expected call of Done. -func (mr *MockInterfaceMockRecorder) Done(arg0 interface{}) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Done(arg0 reconcile.Request) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Done", reflect.TypeOf((*MockInterface)(nil).Done), arg0) } // Get mocks base method. -func (m *MockInterface) Get() (interface{}, bool) { +func (m *MockInterface) Get() (reconcile.Request, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get") - ret0, _ := ret[0].(interface{}) + ret0, _ := ret[0].(reconcile.Request) ret1, _ := ret[1].(bool) return ret0, ret1 } diff --git a/pkg/util/utils.go b/pkg/util/utils.go index 1b3cb5bb3..39f6ae819 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -227,12 +227,6 @@ func parseCIDRRange(cidr string) (startIP, endIP net.IP, err error) { func calculateOffsetIP(ip net.IP, offset int) (net.IP, error) { ipInt := ipToUint32(ip) ipInt += uint32(offset) - if int(ipInt) < 0 { - return nil, fmt.Errorf("resulting IP is less than 0") - } - if ipInt > 0xFFFFFFFF { - return nil, fmt.Errorf("resulting IP is greater than 255.255.255.255") - } return uint32ToIP(ipInt), nil } diff --git a/pkg/util/utils_test.go b/pkg/util/utils_test.go index a46ca0a9f..c39c19460 100644 --- a/pkg/util/utils_test.go +++ b/pkg/util/utils_test.go @@ -84,7 +84,7 @@ func TestUtil_IsNsInSystemNamespace(t *testing.T) { isCRInSysNs, err := IsSystemNamespace(client, ns.Namespace, nil) if err != nil { - t.Fatalf(err.Error()) + t.Fatalf("%s", err.Error()) } if isCRInSysNs { t.Fatalf("Non-system namespace identied as a system namespace") @@ -103,7 +103,7 @@ func TestUtil_IsNsInSystemNamespace(t *testing.T) { isCRInSysNs, err = IsSystemNamespace(client, ns.Namespace, nil) if err != nil { - t.Fatalf(err.Error()) + t.Fatalf("%s", err.Error()) } if !isCRInSysNs { t.Fatalf("System namespace not identied as a system namespace")