From 7462dc422592f67c6c46588b1a49b31dbc28cd55 Mon Sep 17 00:00:00 2001 From: Xiangjing Li <55890329+xiangjingli@users.noreply.github.com> Date: Thu, 25 Apr 2024 18:04:28 -0400 Subject: [PATCH] bump go lib to 1.21 (#98) Signed-off-by: Xiangjing Li --- .github/workflows/go-postsubmit.yml | 6 +- .github/workflows/go-presubmit.yml | 6 +- .github/workflows/go-release.yml | 2 +- build/Dockerfile | 2 +- build/Dockerfile.prow | 2 +- build/Dockerfile.rhtap | 2 +- build/run-code-lint.sh | 2 +- cmd/gitopscluster/exec/manager.go | 11 +- cmd/gitopssyncresc/exec/manager.go | 11 +- .../exec/manager.go | 11 +- cmd/propagation/main.go | 19 +- common/config/.golangci.yml | 69 +++-- common/scripts/lint_go.sh | 2 +- deploy/ocm/install.sh | 2 +- go.mod | 54 ++-- go.sum | 110 ++++---- ...-management.io_managedserviceaccounts.yaml | 236 +++++++++--------- .../argocd/v1alpha1/applicationset_types.go | 6 +- pkg/apis/argocd/v1alpha1/register.go | 1 + pkg/apis/argocd/v1alpha1/repository_types.go | 2 +- pkg/apis/argocd/v1alpha1/types.go | 8 +- .../gitopscluster/gitopscluster_controller.go | 5 +- .../gitopscluster_controller_test.go | 51 +++- .../gitopssyncresc_controller.go | 11 +- .../gitopssyncresc_controller_test.go | 3 + ...ulticlusterStatusAggregation_controller.go | 2 +- ...lusterStatusAggregation_controller_test.go | 8 +- pkg/utils/kubernetes.go | 2 + pkg/utils/kubernetes_test.go | 8 +- pkg/utils/placement_test.go | 41 ++- .../application/application_controller.go | 6 +- .../application_controller_test.go | 2 +- .../application_status_controller.go | 2 + propagation-controller/application/helper.go | 5 + .../application/helper_test.go | 16 ++ 35 files changed, 419 insertions(+), 307 deletions(-) diff --git a/.github/workflows/go-postsubmit.yml b/.github/workflows/go-postsubmit.yml index 1a9b934..9ae96e1 100644 --- a/.github/workflows/go-postsubmit.yml +++ b/.github/workflows/go-postsubmit.yml @@ -8,7 +8,7 @@ on: env: # Common versions - GO_VERSION: '1.20' + GO_VERSION: '1.21' GO_REQUIRED_MIN_VERSION: '' GOPATH: '/home/runner/work/multicloud-integrations/multicloud-integrations/go' defaults: @@ -32,9 +32,9 @@ jobs: - name: test run: make test - name: report-coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: - token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} + token: ${{ secrets.CODECOV_TOKEN }} files: /home/runner/work/multicloud-integrations/multicloud-integrations/go/src/github.com/open-cluster-management/multicloud-integrations/coverage.out,/home/runner/work/multicloud-integrations/multicloud-integrations/go/src/github.com/open-cluster-management/multicloud-integrations/prop_coverage.out flags: unit name: unit diff --git a/.github/workflows/go-presubmit.yml b/.github/workflows/go-presubmit.yml index 33aa310..4ebbf22 100644 --- a/.github/workflows/go-presubmit.yml +++ b/.github/workflows/go-presubmit.yml @@ -8,7 +8,7 @@ on: env: # Common versions - GO_VERSION: '1.20' + GO_VERSION: '1.21' GO_REQUIRED_MIN_VERSION: '' GOPATH: '/home/runner/work/multicloud-integrations/multicloud-integrations/go' defaults: @@ -82,9 +82,9 @@ jobs: - name: test run: make test - name: report-coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: - token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} + token: ${{ secrets.CODECOV_TOKEN }} files: /home/runner/work/multicloud-integrations/multicloud-integrations/go/src/github.com/open-cluster-management/multicloud-integrations/coverage.out,/home/runner/work/multicloud-integrations/multicloud-integrations/go/src/github.com/open-cluster-management/multicloud-integrations/prop_coverage.out flags: unit name: unit diff --git a/.github/workflows/go-release.yml b/.github/workflows/go-release.yml index ced1a45..fd81975 100644 --- a/.github/workflows/go-release.yml +++ b/.github/workflows/go-release.yml @@ -6,7 +6,7 @@ on: - 'v*.*.*' env: # Common versions - GO_VERSION: '1.20' + GO_VERSION: '1.21' GO_REQUIRED_MIN_VERSION: '' GOPATH: '/home/runner/work/multicloud-integrations/multicloud-integrations/go' GITHUB_REF: ${{ github.ref }} diff --git a/build/Dockerfile b/build/Dockerfile index 2e8b4e9..50098be 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.ci.openshift.org/stolostron/builder:go1.20-linux AS builder +FROM registry.ci.openshift.org/stolostron/builder:go1.21-linux AS builder WORKDIR /go/src/github.com/open-cluster-management-io/multicloud-integrations COPY . . diff --git a/build/Dockerfile.prow b/build/Dockerfile.prow index f349e45..6910f09 100644 --- a/build/Dockerfile.prow +++ b/build/Dockerfile.prow @@ -1,4 +1,4 @@ -FROM registry.ci.openshift.org/stolostron/builder:go1.20-linux AS builder +FROM registry.ci.openshift.org/stolostron/builder:go1.21-linux AS builder WORKDIR /go/src/github.com/stolostron/multicloud-integrations COPY . . diff --git a/build/Dockerfile.rhtap b/build/Dockerfile.rhtap index 9c56187..8ccd6d8 100644 --- a/build/Dockerfile.rhtap +++ b/build/Dockerfile.rhtap @@ -1,4 +1,4 @@ -FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.20 AS builder +FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.21 AS builder WORKDIR /go/src/github.com/open-cluster-management-io/multicloud-integrations COPY . . diff --git a/build/run-code-lint.sh b/build/run-code-lint.sh index 57df73a..00108cd 100755 --- a/build/run-code-lint.sh +++ b/build/run-code-lint.sh @@ -22,7 +22,7 @@ gem install mdl gem install awesome_bot # Install golangci-lint -curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)"/bin v1.51.2 +curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)"/bin v1.57.2 # Start lint task make -f Makefile.prow lint-all diff --git a/cmd/gitopscluster/exec/manager.go b/cmd/gitopscluster/exec/manager.go index a33cede..5760e96 100644 --- a/cmd/gitopscluster/exec/manager.go +++ b/cmd/gitopscluster/exec/manager.go @@ -34,13 +34,13 @@ import ( "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/manager/signals" + metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" ) // Change below variables to serve metrics on different host or port. var ( - metricsHost = "0.0.0.0" - metricsPort = 8388 - operatorMetricsPort = 8688 + metricsHost = "0.0.0.0" + metricsPort = 8388 ) // RunManager starts the actual manager @@ -62,8 +62,9 @@ func RunManager() { // Create a new Cmd to provide shared dependencies and start components mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ - MetricsBindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort), - Port: operatorMetricsPort, + Metrics: metricsserver.Options{ + BindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort), + }, LeaderElection: enableLeaderElection, LeaderElectionID: "multicloud-operators-gitopscluster-leader.open-cluster-management.io", LeaderElectionNamespace: "kube-system", diff --git a/cmd/gitopssyncresc/exec/manager.go b/cmd/gitopssyncresc/exec/manager.go index a0fb2f0..60055ca 100644 --- a/cmd/gitopssyncresc/exec/manager.go +++ b/cmd/gitopssyncresc/exec/manager.go @@ -29,13 +29,13 @@ import ( "k8s.io/klog" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/manager/signals" + metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" ) // Change below variables to serve metrics on different host or port. var ( - metricsHost = "0.0.0.0" - metricsPort = 8392 - operatorMetricsPort = 8692 + metricsHost = "0.0.0.0" + metricsPort = 8392 ) // RunManager starts the actual manager @@ -57,8 +57,9 @@ func RunManager() { // Create a new Cmd to provide shared dependencies and start components mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ - MetricsBindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort), - Port: operatorMetricsPort, + Metrics: metricsserver.Options{ + BindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort), + }, LeaderElection: enableLeaderElection, LeaderElectionID: "multicloud-operators-gitopssyncresc-leader.open-cluster-management.io", LeaderElectionNamespace: "kube-system", diff --git a/cmd/multiclusterstatusaggregation/exec/manager.go b/cmd/multiclusterstatusaggregation/exec/manager.go index 3c767db..87ecf74 100644 --- a/cmd/multiclusterstatusaggregation/exec/manager.go +++ b/cmd/multiclusterstatusaggregation/exec/manager.go @@ -31,13 +31,13 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/manager/signals" + metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" ) // Change below variables to serve metrics on different host or port. var ( - metricsHost = "0.0.0.0" - metricsPort = 8383 - operatorMetricsPort = 8686 + metricsHost = "0.0.0.0" + metricsPort = 8383 ) // RunManager starts the actual manager @@ -74,8 +74,9 @@ func RunManager() { "retryPeriod", options.LeaderElectionRetryPeriod) mgr, err := ctrl.NewManager(cfg, ctrl.Options{ - MetricsBindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort), - Port: operatorMetricsPort, + Metrics: metricsserver.Options{ + BindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort), + }, LeaderElection: enableLeaderElection, LeaderElectionID: "multicloud-operators-multiclusterstatusaggregation-leader.open-cluster-management.io", LeaderElectionNamespace: "kube-system", diff --git a/cmd/propagation/main.go b/cmd/propagation/main.go index 7344ad9..42f8fcd 100644 --- a/cmd/propagation/main.go +++ b/cmd/propagation/main.go @@ -42,6 +42,7 @@ import ( argov1alpha1 "open-cluster-management.io/multicloud-integrations/pkg/apis/argocd/v1alpha1" "open-cluster-management.io/multicloud-integrations/propagation-controller/application" "sigs.k8s.io/controller-runtime/pkg/client" + metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" ) // PropagationCMDOptions for command line flag parsing @@ -62,11 +63,10 @@ var options = PropagationCMDOptions{ } var ( - scheme = runtime.NewScheme() - setupLog = ctrl.Log.WithName("setup") - metricsHost = "0.0.0.0" - metricsPort = 8386 - operatorMetricsPort = 8698 + scheme = runtime.NewScheme() + setupLog = ctrl.Log.WithName("setup") + metricsHost = "0.0.0.0" + metricsPort = 8386 ) func init() { @@ -79,6 +79,7 @@ func init() { func main() { var enableLeaderElection bool + flag.StringVar( &options.MetricsAddr, "metrics-addr", @@ -137,9 +138,10 @@ func main() { // Create a new Cmd to provide shared dependencies and start components mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ - Scheme: scheme, - MetricsBindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort), - Port: operatorMetricsPort, + Scheme: scheme, + Metrics: metricsserver.Options{ + BindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort), + }, LeaderElection: enableLeaderElection, LeaderElectionID: "multicloud-operators-propagation-leader.open-cluster-management.io", LeaderElectionNamespace: "kube-system", @@ -189,6 +191,7 @@ func main() { } setupLog.Info("starting manager") + if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil { setupLog.Error(err, "problem running manager") os.Exit(1) diff --git a/common/config/.golangci.yml b/common/config/.golangci.yml index 8d4e069..8e20ad9 100644 --- a/common/config/.golangci.yml +++ b/common/config/.golangci.yml @@ -1,38 +1,16 @@ service: # When updating this, also update the version stored in docker/build-tools/Dockerfile in the multicloudlab/tools repo. - golangci-lint-version: 1.51.x # use the fixed version to not introduce new linters unexpectedly + golangci-lint-version: 1.57.x # use the fixed version to not introduce new linters unexpectedly run: # timeout for analysis, e.g. 30s, 5m, default is 1m deadline: 20m timeout: 20m - go: '1.17' - - # which dirs to skip: they won't be analyzed; - # can use regexp here: generated.*, regexp is applied on full path; - # default value is empty list, but next dirs are always skipped independently - # from this option's value: - # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - skip-dirs: - - genfiles$ - - vendor$ - - vbh$ - - pkg/apis/argocd/v1alpha1$ - - propagation-controller/application$ - - cmd/propagation$ - - # which files to skip: they will be analyzed, but issues from them - # won't be reported. Default value is empty list, but there is - # no need to include all autogenerated files, we confidently recognize - # autogenerated files. If it's not please let us know. - skip-files: - - ".*\\.pb\\.go" - - ".*\\.gen\\.go" linters: enable-all: true disable: - - asasalint - bodyclose + - containedctx - contextcheck - cyclop - deadcode @@ -61,36 +39,61 @@ linters: - gosec - ifshort - ineffassign + - interfacebloat - interfacer - ireturn + - loggercheck - maintidx - maligned + - musttag - nakedret - nestif - nilerr - nilnil - nlreturn - noctx + - nosnakecase - nonamedreturns - nosnakecase - paralleltest - prealloc - predeclared + - rowserrcheck + - scopelint - staticcheck - structcheck - - scopelint + - sqlclosecheck - tagliatelle - tenv - testpackage - thelper + - usestdlibvars + - varcheck - varnamelen - wastedassign - wrapcheck - - varcheck + - inamedparam + - revive + - mirror + - godox - lll + - tagalign + - stylecheck fast: false linters-settings: + testifylint: + disable: + - require-error + - expected-actual + perfsprint: + errorf: false + sprintf1: false + strconcat: false + wsl: + allow-assign-and-anything: true + strict-append: false + errcheck: # report about not checking of errors in type assetions: `a := b.(MyStruct)`; # default is false: such cases aren't reported by default. @@ -111,7 +114,7 @@ linters-settings: min-confidence: 0.0 gocognit: # minimal code complexity to report, 30 by default (but we recommend 10-20) - min-complexity: 75 + min-complexity: 200 gofmt: # simplify code: gofmt with `-s` option, true by default simplify: true @@ -213,6 +216,7 @@ linters-settings: # - unnamedResult # - wrapperFunc + issues: # List of regexps of issue texts to exclude, empty list by default. # But independently from this option we use default exclude patterns, @@ -228,6 +232,17 @@ issues: - errcheck - maligned + skip-dirs: + - genfiles$ + - vendor$ + - vbh + + skip-files: + - ".*\\.pb\\.go" + - ".*\\.gen\\.go" + - ".*.helmrelease.*\\.go" + - ".*.ansiblejob.*\\.go" + # Independently from option `exclude` we use default exclude patterns, # it can be disabled by this option. To list all # excluded by default patterns execute `golangci-lint run --help`. diff --git a/common/scripts/lint_go.sh b/common/scripts/lint_go.sh index bd32bd4..d28339b 100755 --- a/common/scripts/lint_go.sh +++ b/common/scripts/lint_go.sh @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.2 +curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.2 export GOLANGCI_LINT_CACHE=/tmp/golangci-cache export GOROOT=`go env GOROOT` diff --git a/deploy/ocm/install.sh b/deploy/ocm/install.sh index b42aaa8..d876c31 100755 --- a/deploy/ocm/install.sh +++ b/deploy/ocm/install.sh @@ -9,7 +9,7 @@ KUBECTL=${KUBECTL:-kubectl} rm -rf ocm echo "############ Cloning ocm" -git clone https://github.com/open-cluster-management-io/ocm.git +git clone --depth 1 --branch release-0.13 https://github.com/open-cluster-management-io/ocm.git cd ocm || { printf "cd failed, ocm does not exist" diff --git a/go.mod b/go.mod index fe4dcc1..f39c17d 100644 --- a/go.mod +++ b/go.mod @@ -1,20 +1,20 @@ module open-cluster-management.io/multicloud-integrations -go 1.20 +go 1.21 require ( github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 - github.com/onsi/ginkgo/v2 v2.11.0 - github.com/onsi/gomega v1.27.8 + github.com/onsi/ginkgo/v2 v2.13.0 + github.com/onsi/gomega v1.29.0 github.com/spf13/pflag v1.0.5 - k8s.io/api v0.28.1 + k8s.io/api v0.29.1 k8s.io/apiextensions-apiserver v0.28.1 - k8s.io/apimachinery v0.28.1 - k8s.io/client-go v0.28.1 + k8s.io/apimachinery v0.29.1 + k8s.io/client-go v0.29.1 k8s.io/klog v1.0.0 - open-cluster-management.io/api v0.11.1-0.20230921010001-9cb6321fa748 - open-cluster-management.io/managed-serviceaccount v0.4.0 - sigs.k8s.io/controller-runtime v0.15.1 + open-cluster-management.io/api v0.13.0 + open-cluster-management.io/managed-serviceaccount v0.5.0 + sigs.k8s.io/controller-runtime v0.16.2 ) require ( @@ -22,17 +22,18 @@ require ( github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect - golang.org/x/tools v0.9.3 // indirect + golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/tools v0.16.1 // indirect ) require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/emicklei/go-restful/v3 v3.10.2 // indirect + github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/zapr v1.2.4 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect @@ -40,7 +41,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/imdario/mergo v0.3.13 // indirect @@ -58,26 +59,25 @@ require ( github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect github.com/stolostron/search-v2-api v0.0.0-20221004171925-9c1d91614943 - go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.24.0 // indirect - golang.org/x/net v0.13.0 // indirect - golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/term v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect + go.uber.org/zap v1.26.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/oauth2 v0.10.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/term v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect - gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect + gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 - k8s.io/component-base v0.28.1 // indirect - k8s.io/klog/v2 v2.100.1 - k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect - k8s.io/utils v0.0.0-20230505201702-9f6742963106 + k8s.io/component-base v0.29.1 // indirect + k8s.io/klog/v2 v2.110.1 + k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect + k8s.io/utils v0.0.0-20230726121419-3b25d923346b sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index 12d9ca2..96b35cb 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -11,8 +10,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emicklei/go-restful/v3 v3.10.2 h1:hIovbnmBTLjHXkqEBUz3HGpXZdM7ZrE9fJIZIqlJLqE= -github.com/emicklei/go-restful/v3 v3.10.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +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 v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= @@ -22,9 +21,9 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew= github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo= github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA= github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= @@ -47,8 +46,9 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 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= @@ -69,6 +69,7 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -84,10 +85,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.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= -github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= -github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= -github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= +github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= +github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/openshift/api v3.9.0+incompatible h1:fJ/KsefYuZAjmrr3+5U9yZIZbTOpVkDDLDLFresAeYs= github.com/openshift/api v3.9.0+incompatible/go.mod h1:dh9o4Fs58gpFXGSYfnVxGR9PnV53I8TW84pQaJDdGiY= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -104,6 +105,7 @@ github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= 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/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stolostron/search-v2-api v0.0.0-20221004171925-9c1d91614943 h1:dHYjtwDhyd/8s3pxcBPYCsaj/xlMxURHr55vzE/np9A= @@ -117,28 +119,30 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ 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.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +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/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= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +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/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 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= -golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= @@ -146,10 +150,10 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY= -golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= +golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= 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= @@ -163,16 +167,16 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -181,20 +185,20 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= -golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gomodules.xyz/jsonpatch/v2 v2.3.0 h1:8NFhfS6gzxNqjLIYnZxg319wZ5Qjnx4m/CcX+Klzazc= -gomodules.xyz/jsonpatch/v2 v2.3.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= +gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= +gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= @@ -209,33 +213,33 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0/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.28.1 h1:i+0O8k2NPBCPYaMB+uCkseEbawEt/eFaiRqUx8aB108= -k8s.io/api v0.28.1/go.mod h1:uBYwID+66wiL28Kn2tBjBYQdEU0Xk0z5qF8bIBqk/Dg= +k8s.io/api v0.29.1 h1:DAjwWX/9YT7NQD4INu49ROJuZAAAP/Ijki48GUPzxqw= +k8s.io/api v0.29.1/go.mod h1:7Kl10vBRUXhnQQI8YR/R327zXC8eJ7887/+Ybta+RoQ= k8s.io/apiextensions-apiserver v0.28.1 h1:l2ThkBRjrWpw4f24uq0Da2HaEgqJZ7pcgiEUTKSmQZw= k8s.io/apiextensions-apiserver v0.28.1/go.mod h1:sVvrI+P4vxh2YBBcm8n2ThjNyzU4BQGilCQ/JAY5kGs= -k8s.io/apimachinery v0.28.1 h1:EJD40og3GizBSV3mkIoXQBsws32okPOy+MkRyzh6nPY= -k8s.io/apimachinery v0.28.1/go.mod h1:X0xh/chESs2hP9koe+SdIAcXWcQ+RM5hy0ZynB+yEvw= -k8s.io/client-go v0.28.1 h1:pRhMzB8HyLfVwpngWKE8hDcXRqifh1ga2Z/PU9SXVK8= -k8s.io/client-go v0.28.1/go.mod h1:pEZA3FqOsVkCc07pFVzK076R+P/eXqsgx5zuuRWukNE= -k8s.io/component-base v0.28.1 h1:LA4AujMlK2mr0tZbQDZkjWbdhTV5bRyEyAFe0TJxlWg= -k8s.io/component-base v0.28.1/go.mod h1:jI11OyhbX21Qtbav7JkhehyBsIRfnO8oEgoAR12ArIU= +k8s.io/apimachinery v0.29.1 h1:KY4/E6km/wLBguvCZv8cKTeOwwOBqFNjwJIdMkMbbRc= +k8s.io/apimachinery v0.29.1/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= +k8s.io/client-go v0.29.1 h1:19B/+2NGEwnFLzt0uB5kNJnfTsbV8w6TgQRz9l7ti7A= +k8s.io/client-go v0.29.1/go.mod h1:TDG/psL9hdet0TI9mGyHJSgRkW3H9JZk2dNEUS7bRks= +k8s.io/component-base v0.29.1 h1:MUimqJPCRnnHsskTTjKD+IC1EHBbRCVyi37IoFBrkYw= +k8s.io/component-base v0.29.1/go.mod h1:fP9GFjxYrLERq1GcWWZAE3bqbNcDKDytn2srWuHTtKc= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= -k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= -k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ= -k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM= -k8s.io/utils v0.0.0-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU= -k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -open-cluster-management.io/api v0.11.1-0.20230921010001-9cb6321fa748 h1:OjemV/LWwBuKDZJLfEPw51w0Zbd9HKgpkxGtPclOjkQ= -open-cluster-management.io/api v0.11.1-0.20230921010001-9cb6321fa748/go.mod h1:/CZhelEH+30/pX7vXGSZOzLMX0zvjthYOkT/5ZTzVTQ= -open-cluster-management.io/managed-serviceaccount v0.4.0 h1:DPuNNR0a+sYnlvUkUB77mBNasl+fpl/vgKb1vq6+aqk= -open-cluster-management.io/managed-serviceaccount v0.4.0/go.mod h1:o8vJwxYo3FYoxM2x245LqAmwvl5/ViYk/Md+3peXLSc= -sigs.k8s.io/controller-runtime v0.15.1 h1:9UvgKD4ZJGcj24vefUFgZFP3xej/3igL9BsOUTb/+4c= -sigs.k8s.io/controller-runtime v0.15.1/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= +k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= +k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +open-cluster-management.io/api v0.13.0 h1:dlcJEZlNlE0DmSDctK2s7iWKg9l+Tgb0V78Z040nMuk= +open-cluster-management.io/api v0.13.0/go.mod h1:CuCPEzXDvOyxBB0H1d1eSeajbHqaeGEKq9c63vQc63w= +open-cluster-management.io/managed-serviceaccount v0.5.0 h1:yEFTlwPp3tecorzHLwa71mIJzwQtxcwRUnUhRF4OX0U= +open-cluster-management.io/managed-serviceaccount v0.5.0/go.mod h1:pvSKkwFynokhtV7ksN1z0BNWQ37bG8FudOfmjn55ciA= +sigs.k8s.io/controller-runtime v0.16.2 h1:mwXAVuEk3EQf478PQwQ48zGOXvW27UJc8NHktQVuIPU= +sigs.k8s.io/controller-runtime v0.16.2/go.mod h1:vpMu3LpI5sYWtujJOa2uPK61nB5rbwlN7BAB8aSLvGU= 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.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= -sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/hack/test/crds/0000_00_authentication.open-cluster-management.io_managedserviceaccounts.yaml b/hack/test/crds/0000_00_authentication.open-cluster-management.io_managedserviceaccounts.yaml index 3441bfc..647d581 100644 --- a/hack/test/crds/0000_00_authentication.open-cluster-management.io_managedserviceaccounts.yaml +++ b/hack/test/crds/0000_00_authentication.open-cluster-management.io_managedserviceaccounts.yaml @@ -1,11 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.2 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.14.0 name: managedserviceaccounts.authentication.open-cluster-management.io spec: group: authentication.open-cluster-management.io @@ -27,14 +25,19 @@ spec: API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -46,8 +49,9 @@ spec: properties: enabled: default: true - description: Enabled prescribes whether the ServiceAccount token - will be rotated from the upstream + description: |- + Enabled prescribes whether the ServiceAccount token will + be rotated from the upstream type: boolean validity: default: 8640h0m0s @@ -56,15 +60,15 @@ spec: type: string type: object ttlSecondsAfterCreation: - description: ttlSecondsAfterCreation limits the lifetime of a ManagedServiceAccount. - If the ttlSecondsAfterCreation field is set, the ManagedServiceAccount - will be automatically deleted regardless of the ManagedServiceAccount's - status. When the ManagedServiceAccount is deleted, its lifecycle - guarantees (e.g. finalizers) will be honored. If this field is unset, - the ManagedServiceAccount won't be automatically deleted. If this - field is set to zero, the ManagedServiceAccount becomes eligible - for deletion immediately after its creation. In order to use ttlSecondsAfterCreation, - the EphemeralIdentity feature gate must be enabled. + description: |- + ttlSecondsAfterCreation limits the lifetime of a ManagedServiceAccount. + If the ttlSecondsAfterCreation field is set, the ManagedServiceAccount will be + automatically deleted regardless of the ManagedServiceAccount's status. + When the ManagedServiceAccount is deleted, its lifecycle guarantees + (e.g. finalizers) will be honored. If this field is unset, the ManagedServiceAccount + won't be automatically deleted. If this field is set to zero, the + ManagedServiceAccount becomes eligible for deletion immediately after its creation. + In order to use ttlSecondsAfterCreation, the EphemeralIdentity feature gate must be enabled. exclusiveMinimum: true format: int32 minimum: 0 @@ -80,44 +84,42 @@ spec: description: Conditions is the condition list. items: description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n \ttype FooStatus struct{ \t // Represents the observations - of a foo's current state. \t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\" \t // - +patchMergeKey=type \t // +patchStrategy=merge \t // +listType=map - \t // +listMapKey=type \t Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n \t // other fields - \t}" + 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}" properties: lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. maxLength: 32768 type: string observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. format: int64 minimum: 0 type: integer reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. This field may not be empty. maxLength: 1024 minLength: 1 @@ -131,11 +133,12 @@ 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. + --- + 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) 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 @@ -152,13 +155,14 @@ spec: format: date-time type: string tokenSecretRef: - description: TokenSecretRef is a reference to the corresponding ServiceAccount's - Secret, which stores the CA certficate and token from the managed - cluster. + description: |- + TokenSecretRef is a reference to the corresponding ServiceAccount's Secret, which stores + the CA certficate and token from the managed cluster. properties: lastRefreshTimestamp: - description: LastRefreshTimestamp is the timestamp indicating - when the token in the Secret is refreshed. + description: |- + LastRefreshTimestamp is the timestamp indicating when the token in the Secret + is refreshed. format: date-time type: string name: @@ -181,14 +185,19 @@ spec: API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -200,8 +209,9 @@ spec: properties: enabled: default: true - description: Enabled prescribes whether the ServiceAccount token - will be rotated from the upstream + description: |- + Enabled prescribes whether the ServiceAccount token will + be rotated from the upstream type: boolean validity: default: 8640h0m0s @@ -210,15 +220,15 @@ spec: type: string type: object ttlSecondsAfterCreation: - description: ttlSecondsAfterCreation limits the lifetime of a ManagedServiceAccount. - If the ttlSecondsAfterCreation field is set, the ManagedServiceAccount - will be automatically deleted regardless of the ManagedServiceAccount's - status. When the ManagedServiceAccount is deleted, its lifecycle - guarantees (e.g. finalizers) will be honored. If this field is unset, - the ManagedServiceAccount won't be automatically deleted. If this - field is set to zero, the ManagedServiceAccount becomes eligible - for deletion immediately after its creation. In order to use ttlSecondsAfterCreation, - the EphemeralIdentity feature gate must be enabled. + description: |- + ttlSecondsAfterCreation limits the lifetime of a ManagedServiceAccount. + If the ttlSecondsAfterCreation field is set, the ManagedServiceAccount will be + automatically deleted regardless of the ManagedServiceAccount's status. + When the ManagedServiceAccount is deleted, its lifecycle guarantees + (e.g. finalizers) will be honored. If this field is unset, the ManagedServiceAccount + won't be automatically deleted. If this field is set to zero, the + ManagedServiceAccount becomes eligible for deletion immediately after its creation. + In order to use ttlSecondsAfterCreation, the EphemeralIdentity feature gate must be enabled. exclusiveMinimum: true format: int32 minimum: 0 @@ -234,44 +244,42 @@ spec: description: Conditions is the condition list. items: description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n \ttype FooStatus struct{ \t // Represents the observations - of a foo's current state. \t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\" \t // - +patchMergeKey=type \t // +patchStrategy=merge \t // +listType=map - \t // +listMapKey=type \t Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n \t // other fields - \t}" + 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}" properties: lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. maxLength: 32768 type: string observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. format: int64 minimum: 0 type: integer reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. This field may not be empty. maxLength: 1024 minLength: 1 @@ -285,11 +293,12 @@ 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. + --- + 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) 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 @@ -306,13 +315,14 @@ spec: format: date-time type: string tokenSecretRef: - description: TokenSecretRef is a reference to the corresponding ServiceAccount's - Secret, which stores the CA certficate and token from the managed - cluster. + description: |- + TokenSecretRef is a reference to the corresponding ServiceAccount's Secret, which stores + the CA certficate and token from the managed cluster. properties: lastRefreshTimestamp: - description: LastRefreshTimestamp is the timestamp indicating - when the token in the Secret is refreshed. + description: |- + LastRefreshTimestamp is the timestamp indicating when the token in the Secret + is refreshed. format: date-time type: string name: @@ -327,10 +337,4 @@ spec: served: true storage: true subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] \ No newline at end of file + status: {} \ No newline at end of file diff --git a/pkg/apis/argocd/v1alpha1/applicationset_types.go b/pkg/apis/argocd/v1alpha1/applicationset_types.go index 1db3970..125d434 100644 --- a/pkg/apis/argocd/v1alpha1/applicationset_types.go +++ b/pkg/apis/argocd/v1alpha1/applicationset_types.go @@ -164,7 +164,7 @@ type MatrixGenerator struct { // within the constituent generators of combination-type generators. // // NOTE: Nested matrix generator is not included directly in the CRD struct, instead it is included -// as a generic 'apiextensionsv1.JSON' object, and then marshalled into a NestedMatrixGenerator +// as a generic 'apiextensionsv1.JSON' object, and then marshaled into a NestedMatrixGenerator // when processed. type NestedMatrixGenerator struct { Generators ApplicationSetTerminalGenerators `json:"generators" protobuf:"bytes,1,name=generators"` @@ -191,7 +191,7 @@ type MergeGenerator struct { // within the constituent generators of combination-type generators. // // NOTE: Nested merge generator is not included directly in the CRD struct, instead it is included -// as a generic 'apiextensionsv1.JSON' object, and then marshalled into a NestedMergeGenerator +// as a generic 'apiextensionsv1.JSON' object, and then marshaled into a NestedMergeGenerator // when processed. type NestedMergeGenerator struct { Generators ApplicationSetTerminalGenerators `json:"generators" protobuf:"bytes,1,name=generators"` @@ -453,7 +453,7 @@ type ApplicationSetStatus struct { ApplicationStatus []ApplicationSetApplicationStatus `json:"applicationStatus,omitempty" protobuf:"bytes,2,name=applicationStatus"` } -// ApplicationSetCondition contains details about an applicationset condition, which is usally an error or warning +// ApplicationSetCondition contains details about an applicationset condition, which is usually an error or warning type ApplicationSetCondition struct { // Type is an applicationset condition type Type ApplicationSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type"` diff --git a/pkg/apis/argocd/v1alpha1/register.go b/pkg/apis/argocd/v1alpha1/register.go index 0515777..23f34d6 100644 --- a/pkg/apis/argocd/v1alpha1/register.go +++ b/pkg/apis/argocd/v1alpha1/register.go @@ -29,5 +29,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { &ApplicationSetList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil } diff --git a/pkg/apis/argocd/v1alpha1/repository_types.go b/pkg/apis/argocd/v1alpha1/repository_types.go index c4646e3..0ed73dd 100644 --- a/pkg/apis/argocd/v1alpha1/repository_types.go +++ b/pkg/apis/argocd/v1alpha1/repository_types.go @@ -50,7 +50,7 @@ type Repository struct { SSHPrivateKey string `json:"sshPrivateKey,omitempty" protobuf:"bytes,4,opt,name=sshPrivateKey"` // ConnectionState contains information about the current state of connection to the repository server ConnectionState ConnectionState `json:"connectionState,omitempty" protobuf:"bytes,5,opt,name=connectionState"` - // InsecureIgnoreHostKey should not be used anymore, Insecure is favoured + // InsecureIgnoreHostKey should not be used anymore, Insecure is favored // Used only for Git repos InsecureIgnoreHostKey bool `json:"insecureIgnoreHostKey,omitempty" protobuf:"bytes,6,opt,name=insecureIgnoreHostKey"` // Insecure specifies whether the connection to the repository ignores any errors when verifying TLS certificates or SSH host keys diff --git a/pkg/apis/argocd/v1alpha1/types.go b/pkg/apis/argocd/v1alpha1/types.go index 7ed1584..7ad1eb2 100644 --- a/pkg/apis/argocd/v1alpha1/types.go +++ b/pkg/apis/argocd/v1alpha1/types.go @@ -259,7 +259,7 @@ type ApplicationDestination struct { // Name is an alternate way of specifying the target cluster by its symbolic name Name string `json:"name,omitempty" protobuf:"bytes,3,opt,name=name"` - // nolint:govet + //nolint:govet // isServerInferred bool `json:"-"` } @@ -330,7 +330,7 @@ type SyncOperationResource struct { Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` Name string `json:"name" protobuf:"bytes,3,opt,name=name"` Namespace string `json:"namespace,omitempty" protobuf:"bytes,4,opt,name=namespace"` - // nolint:govet + //nolint:govet Exclude bool `json:"-"` } @@ -603,7 +603,7 @@ const ( ApplicationConditionOrphanedResourceWarning = "OrphanedResourceWarning" ) -// ApplicationCondition contains details about an application condition, which is usally an error or warning +// ApplicationCondition contains details about an application condition, which is usually an error or warning type ApplicationCondition struct { // Type is an application condition type Type ApplicationConditionType `json:"type" protobuf:"bytes,1,opt,name=type"` @@ -880,7 +880,7 @@ type ExecProviderConfig struct { } // ClusterConfig is the configuration attributes. This structure is subset of the go-client -// rest.Config with annotations added for marshalling. +// rest.Config with annotations added for marshaling. type ClusterConfig struct { // Server requires Basic authentication Username string `json:"username,omitempty" protobuf:"bytes,1,opt,name=username"` diff --git a/pkg/controller/gitopscluster/gitopscluster_controller.go b/pkg/controller/gitopscluster/gitopscluster_controller.go index 76a32b1..e3ec8c5 100644 --- a/pkg/controller/gitopscluster/gitopscluster_controller.go +++ b/pkg/controller/gitopscluster/gitopscluster_controller.go @@ -1206,11 +1206,11 @@ func getManagedClusterURL(managedCluster *spokeclusterv1.ManagedCluster, token s caCertPool.AppendCertsFromPEM(config.CABundle) httpClient := http.DefaultClient - // #nosec G402 + httpClient.Transport = &http.Transport{ TLSClientConfig: &tls.Config{ RootCAs: caCertPool, - MinVersion: gitopsclusterV1beta1.TLSMinVersionInt, + MinVersion: gitopsclusterV1beta1.TLSMinVersionInt, //#nosec G402 }, } @@ -1287,6 +1287,7 @@ func (r *ReconcileGitOpsCluster) createNamespaceScopedResourceFromYAML(yamlStrin return err } + klog.Infof("resource created: %s/%s\n", namespace, name) } else { klog.Error("failed to get resource: ", err) diff --git a/pkg/controller/gitopscluster/gitopscluster_controller_test.go b/pkg/controller/gitopscluster/gitopscluster_controller_test.go index d8976af..eca4bc8 100644 --- a/pkg/controller/gitopscluster/gitopscluster_controller_test.go +++ b/pkg/controller/gitopscluster/gitopscluster_controller_test.go @@ -35,6 +35,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/manager" + metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" ) var ( @@ -325,7 +326,12 @@ var ( func TestReconcileCreateSecretInArgo(t *testing.T) { g := gomega.NewGomegaWithT(t) - mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"}) + mgr, err := manager.New(cfg, manager.Options{ + Metrics: metricsserver.Options{ + BindAddress: "0", + }, + }) + g.Expect(err).NotTo(gomega.HaveOccurred()) c = mgr.GetClient() @@ -430,7 +436,11 @@ func TestReconcileCreateSecretInArgo(t *testing.T) { func TestReconcileNoSecretInInvalidArgoNamespace(t *testing.T) { g := gomega.NewGomegaWithT(t) - mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"}) + mgr, err := manager.New(cfg, manager.Options{ + Metrics: metricsserver.Options{ + BindAddress: "0", + }, + }) g.Expect(err).NotTo(gomega.HaveOccurred()) c = mgr.GetClient() @@ -513,7 +523,12 @@ func TestReconcileNoSecretInInvalidArgoNamespace(t *testing.T) { func TestReconcileCreateSecretInOpenshiftGitops(t *testing.T) { g := gomega.NewGomegaWithT(t) - mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"}) + mgr, err := manager.New(cfg, manager.Options{ + Metrics: metricsserver.Options{ + BindAddress: "0", + }, + }) + g.Expect(err).NotTo(gomega.HaveOccurred()) c = mgr.GetClient() @@ -759,7 +774,12 @@ func expectedRbacCreated(c client.Client, expectedDetails types.NamespacedName) func TestReconcileDeleteOrphanSecret(t *testing.T) { g := gomega.NewGomegaWithT(t) - mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"}) + mgr, err := manager.New(cfg, manager.Options{ + Metrics: metricsserver.Options{ + BindAddress: "0", + }, + }) + g.Expect(err).NotTo(gomega.HaveOccurred()) c = mgr.GetClient() @@ -1030,7 +1050,12 @@ func TestUnionSecretData(t *testing.T) { func TestCreateMangedClusterSecretFromManagedServiceAccount(t *testing.T) { g := gomega.NewGomegaWithT(t) - mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"}) + mgr, err := manager.New(cfg, manager.Options{ + Metrics: metricsserver.Options{ + BindAddress: "0", + }, + }) + g.Expect(err).NotTo(gomega.HaveOccurred()) c = mgr.GetClient() @@ -1237,7 +1262,12 @@ func TestGetAllNonAcmManagedClusterSecretsInArgo(t *testing.T) { g := gomega.NewGomegaWithT(t) - mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"}) + mgr, err := manager.New(cfg, manager.Options{ + Metrics: metricsserver.Options{ + BindAddress: "0", + }, + }) + g.Expect(err).NotTo(gomega.HaveOccurred()) c = mgr.GetClient() @@ -1527,7 +1557,12 @@ spec: func Test_createNamespaceScopedResourceFromYAML(t *testing.T) { g := gomega.NewGomegaWithT(t) - mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"}) + mgr, err := manager.New(cfg, manager.Options{ + Metrics: metricsserver.Options{ + BindAddress: "0", + }, + }) + g.Expect(err).NotTo(gomega.HaveOccurred()) c = mgr.GetClient() @@ -1576,6 +1611,8 @@ data: err = gitopsc.(*ReconcileGitOpsCluster).createNamespaceScopedResourceFromYAML(configMapYaml) g.Expect(err).NotTo(gomega.HaveOccurred()) + time.Sleep(time.Second * 3) + g.Expect(c.Get(context.TODO(), types.NamespacedName{Namespace: "default", Name: "test-configmap"}, cm)).NotTo(gomega.HaveOccurred()) diff --git a/pkg/controller/gitopssyncresc/gitopssyncresc_controller.go b/pkg/controller/gitopssyncresc/gitopssyncresc_controller.go index c649877..4eebf66 100644 --- a/pkg/controller/gitopssyncresc/gitopssyncresc_controller.go +++ b/pkg/controller/gitopssyncresc/gitopssyncresc_controller.go @@ -45,6 +45,7 @@ import ( "github.com/stolostron/search-v2-api/graph/model" clusterv1 "open-cluster-management.io/api/cluster/v1" + gitopsclusterV1beta1 "open-cluster-management.io/multicloud-integrations/pkg/apis/apps/v1beta1" appsetreport "open-cluster-management.io/multicloud-integrations/pkg/apis/appsetreport/v1alpha1" ) @@ -290,10 +291,10 @@ func (r *GitOpsSyncResource) getArgoAppsFromSearch(clusters []string, appsetNs, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, - // #nosec G402 + TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, - MinVersion: tls.VersionTLS12, + InsecureSkipVerify: true, //#nosec G402 + MinVersion: gitopsclusterV1beta1.TLSMinVersionInt, //#nosec G402 }, } @@ -381,14 +382,14 @@ func (r *GitOpsSyncResource) getArgoAppsFromSearch(clusters []string, appsetNs, items = searchResultData[0].(map[string]interface{})["items"].([]interface{}) } - klog.V(1).Infof("Items: %v", items) + klog.V(1).Infof("Items: %v", fmt.Sprintf("%v ", items)) var related []interface{} if r, ok := searchResultData[0].(map[string]interface{})["related"]; ok && r != nil { related = searchResultData[0].(map[string]interface{})["related"].([]interface{}) } - klog.V(1).Infof("Related: %v", related) + klog.V(1).Infof("Related: %v", fmt.Sprintf("%v ", related)) return items, related, nil } diff --git a/pkg/controller/gitopssyncresc/gitopssyncresc_controller_test.go b/pkg/controller/gitopssyncresc/gitopssyncresc_controller_test.go index 1496a6a..604e230 100644 --- a/pkg/controller/gitopssyncresc/gitopssyncresc_controller_test.go +++ b/pkg/controller/gitopssyncresc/gitopssyncresc_controller_test.go @@ -325,6 +325,7 @@ func TestGitOpsSyncResource_getSearchURL(t *testing.T) { Interval: 60, ResourceDir: "/tmp", } + if tt.service != nil { if err := c.Create(context.TODO(), tt.service, &client.CreateOptions{}); err != nil { t.Errorf("GitOpsSyncResource.getSearchURL() error creating service = %v", err) @@ -337,6 +338,7 @@ func TestGitOpsSyncResource_getSearchURL(t *testing.T) { t.Errorf("GitOpsSyncResource.getSearchURL() error = %v, wantErr %v", err, tt.wantErr) return } + if got != tt.want { t.Errorf("GitOpsSyncResource.getSearchURL() = %v, want %v", got, tt.want) } @@ -392,6 +394,7 @@ func TestGitOpsSyncResource_syncResources(t *testing.T) { ResourceDir: "/tmp", DataSender: &TestDataSender{tt.data}, } + if tt.managedcluster != nil { if err := c.Create(context.TODO(), tt.managedcluster, &client.CreateOptions{}); err != nil { t.Errorf("GitOpsSyncResource.syncResources() error creating managed cluster = %v", err) diff --git a/pkg/controller/multiclusterstatusaggregation/multiclusterStatusAggregation_controller.go b/pkg/controller/multiclusterstatusaggregation/multiclusterStatusAggregation_controller.go index d219c58..6cffeb2 100644 --- a/pkg/controller/multiclusterstatusaggregation/multiclusterStatusAggregation_controller.go +++ b/pkg/controller/multiclusterstatusaggregation/multiclusterStatusAggregation_controller.go @@ -661,7 +661,7 @@ func GetMemUsage(title string) string { runtime.ReadMemStats(&m) // For info on each, see: https://golang.org/pkg/runtime/#MemStats - usage := fmt.Sprintf("%v", title) + usage := title usage += fmt.Sprintf("\nAlloc = %v MiB", bToMb(m.Alloc)) usage += fmt.Sprintf("\n\tTotalAlloc = %v MiB", bToMb(m.TotalAlloc)) usage += fmt.Sprintf("\n\tSys = %v MiB", bToMb(m.Sys)) diff --git a/pkg/controller/multiclusterstatusaggregation/multiclusterStatusAggregation_controller_test.go b/pkg/controller/multiclusterstatusaggregation/multiclusterStatusAggregation_controller_test.go index 62195d9..e6913ec 100644 --- a/pkg/controller/multiclusterstatusaggregation/multiclusterStatusAggregation_controller_test.go +++ b/pkg/controller/multiclusterstatusaggregation/multiclusterStatusAggregation_controller_test.go @@ -26,6 +26,7 @@ import ( v1 "open-cluster-management.io/api/work/v1" appsetreportV1alpha1 "open-cluster-management.io/multicloud-integrations/pkg/apis/appsetreport/v1alpha1" argov1alpha1 "open-cluster-management.io/multicloud-integrations/pkg/apis/argocd/v1alpha1" + metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" "sigs.k8s.io/controller-runtime/pkg/manager" ) @@ -445,7 +446,12 @@ func TestReconcilePullModel(t *testing.T) { g := NewGomegaWithT(t) // Setup the Manager and Controller - mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"}) + mgr, err := manager.New(cfg, manager.Options{ + Metrics: metricsserver.Options{ + BindAddress: "0", + }, + }) + g.Expect(err).NotTo(HaveOccurred()) c = mgr.GetClient() diff --git a/pkg/utils/kubernetes.go b/pkg/utils/kubernetes.go index 536df9d..7e83d95 100644 --- a/pkg/utils/kubernetes.go +++ b/pkg/utils/kubernetes.go @@ -96,6 +96,7 @@ func CheckAndInstallCRD(crdconfig *rest.Config, pathname string) error { klog.Info("CRD ", crdobj.GetName(), " is being updated with ", pathname) crdobj.Spec.DeepCopyInto(&crd.Spec) _, err = crdClient.ApiextensionsV1().CustomResourceDefinitions().Update(context.TODO(), crd, metav1.UpdateOptions{}) + if err != nil { klog.Fatal("Updating CRD", err.Error()) return err @@ -103,6 +104,7 @@ func CheckAndInstallCRD(crdconfig *rest.Config, pathname string) error { } else { klog.Info("CRD ", crdobj.GetName(), " exists: ", pathname) } + return err } diff --git a/pkg/utils/kubernetes_test.go b/pkg/utils/kubernetes_test.go index 914e2fd..e7f3751 100644 --- a/pkg/utils/kubernetes_test.go +++ b/pkg/utils/kubernetes_test.go @@ -22,6 +22,7 @@ import ( "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/manager" + metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" ) func TestConvertLabels(t *testing.T) { @@ -48,7 +49,12 @@ func TestCheckAndInstallCRD(t *testing.T) { // Setup the Manager and Controller. Wrap the Controller Reconcile function so it writes each request to a // channel when it is finished - mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"}) + mgr, err := manager.New(cfg, manager.Options{ + Metrics: metricsserver.Options{ + BindAddress: "0", + }, + }) + g.Expect(err).NotTo(gomega.HaveOccurred()) //start manager mgr diff --git a/pkg/utils/placement_test.go b/pkg/utils/placement_test.go index 12c1a86..79e7a3e 100644 --- a/pkg/utils/placement_test.go +++ b/pkg/utils/placement_test.go @@ -16,18 +16,14 @@ package utils import ( "context" - "fmt" - "log" - "path/filepath" "testing" "time" "github.com/onsi/gomega" "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" authv1beta1 "open-cluster-management.io/managed-serviceaccount/apis/authentication/v1beta1" - "sigs.k8s.io/controller-runtime/pkg/envtest" "sigs.k8s.io/controller-runtime/pkg/manager" + metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" ) func TestIsReadyACMClusterRegistry(t *testing.T) { @@ -35,7 +31,12 @@ func TestIsReadyACMClusterRegistry(t *testing.T) { // Setup the Manager and Controller. Wrap the Controller Reconcile function so it writes each request to a // channel when it is finished. - mgr, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"}) + mgr, err := manager.New(cfg, manager.Options{ + Metrics: metricsserver.Options{ + BindAddress: "0", + }, + }) + g.Expect(err).NotTo(gomega.HaveOccurred()) ctx, cancel := context.WithTimeout(context.TODO(), 5*time.Minute) @@ -53,25 +54,18 @@ func TestIsReadyACMClusterRegistry(t *testing.T) { func TestIsReadyManagedServiceAccount(t *testing.T) { g := gomega.NewGomegaWithT(t) - tEnv := &envtest.Environment{ - CRDDirectoryPaths: []string{ - filepath.Join("..", "..", "deploy", "crds"), - filepath.Join("..", "..", "hack", "test"), - }, - } - var ( - err error - cfgSub *rest.Config + err error ) - if cfgSub, err = tEnv.Start(); err != nil { - log.Fatal(fmt.Errorf("got error while start up the envtest, err: %w", err)) - } - // Setup the Manager and Controller. Wrap the Controller Reconcile function so it writes each request to a // channel when it is finished. - mgr, err := manager.New(cfgSub, manager.Options{MetricsBindAddress: "0"}) + mgr, err := manager.New(cfg, manager.Options{ + Metrics: metricsserver.Options{ + BindAddress: "0", + }, + }) + g.Expect(err).NotTo(gomega.HaveOccurred()) ctx, cancel := context.WithTimeout(context.TODO(), 5*time.Minute) @@ -89,7 +83,12 @@ func TestIsReadyManagedServiceAccount(t *testing.T) { // Add CRD to scheme. authv1beta1.SchemeBuilder.AddToScheme(scheme.Scheme) - mgr2, err := manager.New(cfgSub, manager.Options{MetricsBindAddress: "0"}) + mgr2, err := manager.New(cfg, manager.Options{ + Metrics: metricsserver.Options{ + BindAddress: "0", + }, + }) + g.Expect(err).NotTo(gomega.HaveOccurred()) ctx2, cancel2 := context.WithTimeout(context.TODO(), 5*time.Minute) diff --git a/propagation-controller/application/application_controller.go b/propagation-controller/application/application_controller.go index 24879ee..58c4de3 100644 --- a/propagation-controller/application/application_controller.go +++ b/propagation-controller/application/application_controller.go @@ -42,7 +42,7 @@ const ( AnnotationKeyOCMManagedClusterAppNamespace = "apps.open-cluster-management.io/ocm-managed-cluster-app-namespace" // Application and ManifestWork annotation that shows which ApplicationSet is the grand parent of this work AnnotationKeyAppSet = "apps.open-cluster-management.io/hosting-applicationset" - // Application annotation that enables the skip reconcilation of an application + // Application annotation that enables the skip reconciliation of an application AnnotationKeyAppSkipReconcile = "argocd.argoproj.io/skip-reconcile" // ManifestWork annotation that shows the namespace of the hub Application. AnnotationKeyHubApplicationNamespace = "apps.open-cluster-management.io/hub-application-namespace" @@ -147,6 +147,7 @@ func (r *ApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request) // delete the ManifestWork associated with this Application var work workv1.ManifestWork err := r.Get(ctx, types.NamespacedName{Name: mwName, Namespace: managedClusterName}, &work) + if errors.IsNotFound(err) { // already deleted ManifestWork, commit the Application finalizer removal if err = r.Update(ctx, &application); err != nil { @@ -181,6 +182,7 @@ func (r *ApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request) log.Info("generating ManifestWork for Application") w, err := generateManifestWork(mwName, managedClusterName, application) + if err != nil { log.Error(err, "unable to generating ManifestWork") return ctrl.Result{}, err @@ -189,6 +191,7 @@ func (r *ApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request) // create or update the ManifestWork depends if it already exists or not var mw workv1.ManifestWork err = r.Get(ctx, types.NamespacedName{Name: mwName, Namespace: managedClusterName}, &mw) + if errors.IsNotFound(err) { err = r.Client.Create(ctx, w) if err != nil { @@ -200,6 +203,7 @@ func (r *ApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request) mw.Labels = w.Labels mw.Spec = w.Spec err = r.Client.Update(ctx, &mw) + if err != nil { log.Error(err, "unable to update ManifestWork") return ctrl.Result{}, err diff --git a/propagation-controller/application/application_controller_test.go b/propagation-controller/application/application_controller_test.go index 7b18860..54adcdd 100644 --- a/propagation-controller/application/application_controller_test.go +++ b/propagation-controller/application/application_controller_test.go @@ -140,7 +140,7 @@ var _ = Describe("Application Pull controller", func() { Expect(k8sClient.Update(ctx, &app2)).Should(Succeed()) Expect(k8sClient.Get(ctx, appKey2, &app2)).Should(Succeed()) Expect(app2.Status.Health.Status == "Healthy").Should(BeTrue()) - // TODO figure how to to verify it didn't reconcile again without using debugger + // TODO figure how to verify it didn't reconcile again without using debugger By("Deleting the Application") Expect(k8sClient.Get(ctx, appKey2, &app2)).Should(Succeed()) diff --git a/propagation-controller/application/application_status_controller.go b/propagation-controller/application/application_status_controller.go index de46f0c..5c998ef 100644 --- a/propagation-controller/application/application_status_controller.go +++ b/propagation-controller/application/application_status_controller.go @@ -85,6 +85,7 @@ func (r *ApplicationStatusReconciler) Reconcile(ctx context.Context, req ctrl.Re } log.Error(err, "unable to fetch Application") + return ctrl.Result{}, err } @@ -94,6 +95,7 @@ func (r *ApplicationStatusReconciler) Reconcile(ctx context.Context, req ctrl.Re if cc.SyncStatus != "" { newStatus.Sync.Status = argov1alpha1.SyncStatusCode(cc.SyncStatus) } + if cc.HealthStatus != "" { newStatus.Health.Status = cc.HealthStatus } diff --git a/propagation-controller/application/helper.go b/propagation-controller/application/helper.go index c87c77a..ce3ba90 100644 --- a/propagation-controller/application/helper.go +++ b/propagation-controller/application/helper.go @@ -41,6 +41,7 @@ func containsValidPullLabel(application argov1alpha1.Application) bool { if err != nil { return false } + return isPull } @@ -54,6 +55,7 @@ func containsValidPullAnnotation(application argov1alpha1.Application) bool { } managedClusterName, ok := annos[AnnotationKeyOCMManagedCluster] + return ok && len(managedClusterName) > 0 } @@ -76,6 +78,7 @@ func containsValidManifestWorkHubApplicationAnnotations(manifestWork workv1.Mani func generateAppNamespace(application argov1alpha1.Application) string { annos := application.GetAnnotations() appNamespace := annos[AnnotationKeyOCMManagedClusterAppNamespace] + if len(appNamespace) > 0 { return appNamespace } @@ -145,6 +148,7 @@ func prepareApplicationForWorkPayload(application argov1alpha1.Application) argo newApp.Spec.Destination.Server = argov1alpha1.KubernetesInternalAPIServerAddr // copy the labels except for the ocm specific labels newApp.Labels = make(map[string]string) + if len(application.Labels) > 0 { for key, value := range application.Labels { if key != LabelKeyPull { @@ -154,6 +158,7 @@ func prepareApplicationForWorkPayload(application argov1alpha1.Application) argo } // copy the annos except for the ocm specific annos newApp.Annotations = make(map[string]string) + if len(application.Annotations) > 0 { for key, value := range application.Annotations { if key != AnnotationKeyOCMManagedCluster && diff --git a/propagation-controller/application/helper_test.go b/propagation-controller/application/helper_test.go index 83603f0..f74132c 100644 --- a/propagation-controller/application/helper_test.go +++ b/propagation-controller/application/helper_test.go @@ -97,6 +97,7 @@ func Test_containsValidPullLabel(t *testing.T) { want: false, }, } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := containsValidPullLabel(tt.args.application); got != tt.want { @@ -156,6 +157,7 @@ func Test_containsValidPullAnnotation(t *testing.T) { want: false, }, } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := containsValidPullAnnotation(tt.args.application); got != tt.want { @@ -236,6 +238,7 @@ func Test_containsValidManifestWorkHubApplicationAnnotations(t *testing.T) { want: false, }, } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := containsValidManifestWorkHubApplicationAnnotations(tt.args.manifestWork); got != tt.want { @@ -296,6 +299,7 @@ func Test_generateAppNamespace(t *testing.T) { want: "argocd", }, } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := generateAppNamespace(tt.args.application); got != tt.want { @@ -327,6 +331,7 @@ func Test_generateManifestWorkName(t *testing.T) { want: "app1-abcde", }, } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := generateManifestWorkName(tt.args.application); got != tt.want { @@ -371,21 +376,26 @@ func Test_prepareApplicationForWorkPayload(t *testing.T) { }, }, } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := prepareApplicationForWorkPayload(tt.args.application) if !reflect.DeepEqual(got.Name, tt.want.Name) { t.Errorf("prepareApplicationForWorkPayload() Name = %v, want %v", got.Name, tt.want.Name) } + if !reflect.DeepEqual(got.Finalizers, tt.want.Finalizers) { t.Errorf("prepareApplicationForWorkPayload() Finalizers = %v, want %v", got.Finalizers, tt.want.Finalizers) } + if !reflect.DeepEqual(got.Namespace, tt.want.Namespace) { t.Errorf("prepareApplicationForWorkPayload() Namespace = %v, want %v", got.Namespace, tt.want.Namespace) } + if !reflect.DeepEqual(got.Spec.Destination, tt.want.Spec.Destination) { t.Errorf("prepareApplicationForWorkPayload() Destination = %v, want %v", got.Spec.Destination, tt.want.Spec.Destination) } + if got.Annotations[AnnotationKeyAppSkipReconcile] == "true" { t.Errorf("prepareApplicationForWorkPayload() contains skip reconcile annotation set to true") } @@ -412,6 +422,7 @@ func Test_generateManifestWork(t *testing.T) { namespace string application argov1alpha1.Application } + type results struct { workLabel map[string]string workAnno map[string]string @@ -441,15 +452,18 @@ func Test_generateManifestWork(t *testing.T) { }, }, } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := generateManifestWork(tt.args.name, tt.args.namespace, tt.args.application) if err != nil { t.Errorf("generateManifestWork() = got err %v", err) } + if !reflect.DeepEqual(got.Annotations, tt.want.workAnno) { t.Errorf("generateManifestWork() = %v, want %v", got.Annotations, tt.want.workAnno) } + if !reflect.DeepEqual(got.Labels, tt.want.workLabel) { t.Errorf("generateManifestWork() = %v, want %v", got.Labels, tt.want.workLabel) } @@ -478,6 +492,7 @@ func Test_GenerateManifestWorkAppSetHashLabelValue(t *testing.T) { wantErr: false, }, } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GenerateManifestWorkAppSetHashLabelValue(tt.args.appSetNamespace, tt.args.appSetName) @@ -485,6 +500,7 @@ func Test_GenerateManifestWorkAppSetHashLabelValue(t *testing.T) { t.Errorf("GenerateManifestWorkAppSetHashLabelValue() error = %v, wantErr %v", err, tt.wantErr) return } + if got != tt.want { t.Errorf("GenerateManifestWorkAppSetHashLabelValue() = %v, want %v", got, tt.want) }