From c9d636379073e42cebefddd315ba03f071be7744 Mon Sep 17 00:00:00 2001 From: Jackie <6393089+katmutua@users.noreply.github.com> Date: Thu, 1 Jun 2023 22:25:04 -0400 Subject: [PATCH] update k8s components and injest reconciler runtime changes (#458) * update k8s components and injest reconciler runtime changes * update config files * update metrics reconciler test * remove deprecated ioutil; same functionality is now provided by package io or package os * update copyright information --- .../conventions.carto.run_podintents.yaml | 78 ++ dist/cartographer-conventions.yaml | 78 ++ go.mod | 65 +- go.sum | 173 ++--- .../v1alpha1/clusterpodconvention_test.go | 92 ++- .../clusterpodconvention_validation.go | 81 +- .../conventions/v1alpha1/podintent_test.go | 20 +- .../v1alpha1/podintent_validation.go | 35 +- pkg/binding/convention.go | 2 +- pkg/binding/convention_test.go | 6 +- pkg/binding/conventions_test.go | 18 +- pkg/binding/fake/conventionserver.go | 6 +- pkg/binding/image_config_test.go | 5 +- pkg/controllers/metrics_reconciler.go | 9 +- pkg/controllers/metrics_reconciler_test.go | 67 +- pkg/controllers/podintent_reconciler.go | 53 +- pkg/controllers/podintent_reconciler_test.go | 730 +++++++++--------- pkg/dies/cert-manager/v1/zz_generated.die.go | 269 ++++++- .../conventions/v1alpha1/zz_generated.die.go | 620 +++++++++++++-- samples/convention-server/go.mod | 10 +- samples/convention-server/go.sum | 32 +- samples/dumper-server/go.mod | 17 +- samples/dumper-server/go.sum | 49 +- samples/dumper-server/server.go | 6 +- samples/spring-convention-server/go.mod | 10 +- samples/spring-convention-server/go.sum | 32 +- webhook/go.mod | 17 +- webhook/go.sum | 54 +- webhook/server.go | 9 +- 29 files changed, 1749 insertions(+), 894 deletions(-) diff --git a/config/crd/bases/conventions.carto.run_podintents.yaml b/config/crd/bases/conventions.carto.run_podintents.yaml index 7a312351..64455ad0 100644 --- a/config/crd/bases/conventions.carto.run_podintents.yaml +++ b/config/crd/bases/conventions.carto.run_podintents.yaml @@ -827,6 +827,19 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: claims: @@ -1456,6 +1469,19 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: claims: @@ -2092,6 +2118,19 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: claims: @@ -4071,6 +4110,19 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: claims: @@ -4700,6 +4752,19 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: claims: @@ -5336,6 +5401,19 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: claims: diff --git a/dist/cartographer-conventions.yaml b/dist/cartographer-conventions.yaml index 9becf6a6..b1920576 100644 --- a/dist/cartographer-conventions.yaml +++ b/dist/cartographer-conventions.yaml @@ -939,6 +939,19 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: claims: @@ -1568,6 +1581,19 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: claims: @@ -2204,6 +2230,19 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: claims: @@ -4183,6 +4222,19 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: claims: @@ -4812,6 +4864,19 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: claims: @@ -5448,6 +5513,19 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: claims: diff --git a/go.mod b/go.mod index 886e8f15..f187b3a7 100644 --- a/go.mod +++ b/go.mod @@ -5,20 +5,20 @@ go 1.19 replace github.com/vmware-tanzu/cartographer-conventions/webhook => ./webhook require ( - dies.dev v0.7.0 + dies.dev v0.8.0 github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 github.com/google/go-containerregistry v0.15.1 github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20220105220605-d9bfbcb99e52 - github.com/vmware-labs/reconciler-runtime v0.11.1 + github.com/vmware-labs/reconciler-runtime v0.12.0 github.com/vmware-tanzu/cartographer-conventions/webhook v0.2.0 go.uber.org/zap v1.24.0 - k8s.io/api v0.26.3 - k8s.io/apimachinery v0.26.3 - k8s.io/apiserver v0.26.3 - k8s.io/client-go v0.26.3 - k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 - sigs.k8s.io/controller-runtime v0.14.6 + k8s.io/api v0.27.2 + k8s.io/apimachinery v0.27.2 + k8s.io/apiserver v0.27.2 + k8s.io/client-go v0.27.2 + k8s.io/utils v0.0.0-20230209194617-a36077c30491 + sigs.k8s.io/controller-runtime v0.15.0 sigs.k8s.io/yaml v1.3.0 ) @@ -37,7 +37,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/cli v23.0.5+incompatible // indirect @@ -50,12 +50,12 @@ require ( github.com/felixge/httpsnoop v1.0.3 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-logr/zapr v1.2.3 // indirect - github.com/go-openapi/jsonpointer v0.19.5 // indirect - github.com/go-openapi/jsonreference v0.20.0 // indirect - github.com/go-openapi/swag v0.19.14 // 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.1 // indirect + github.com/go-openapi/swag v0.22.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v4 v4.2.0 // indirect + github.com/golang-jwt/jwt/v4 v4.4.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect @@ -67,8 +67,8 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.16.5 // indirect - github.com/mailru/easyjson v0.7.6 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -76,16 +76,15 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc3 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.14.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.37.0 // indirect - github.com/prometheus/procfs v0.8.0 // indirect - github.com/rogpeppe/go-internal v1.9.0 // indirect + github.com/prometheus/client_golang v1.15.1 // indirect + github.com/prometheus/client_model v0.4.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/vbatts/tar-split v0.11.3 // indirect github.com/vdemeester/k8s-pkg-credentialprovider v1.21.0-1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.1 // indirect go.opentelemetry.io/otel v1.10.0 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect @@ -97,30 +96,30 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect golang.org/x/crypto v0.1.0 // indirect - golang.org/x/net v0.9.0 // indirect + golang.org/x/net v0.10.0 // indirect golang.org/x/oauth2 v0.7.0 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.7.0 // indirect - golang.org/x/term v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/term v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect golang.org/x/time v0.3.0 // indirect - gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect + gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect gomodules.xyz/jsonpatch/v3 v3.0.1 // indirect gomodules.xyz/orderedmap v0.1.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect - google.golang.org/grpc v1.49.0 // indirect + google.golang.org/grpc v1.51.0 // indirect google.golang.org/protobuf v1.30.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.26.1 // indirect + k8s.io/apiextensions-apiserver v0.27.2 // indirect k8s.io/cloud-provider v0.21.1 // indirect - k8s.io/component-base v0.26.3 // indirect - k8s.io/klog/v2 v2.80.1 // indirect - k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect + k8s.io/component-base v0.27.2 // indirect + k8s.io/klog/v2 v2.90.1 // indirect + k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect k8s.io/legacy-cloud-providers v0.21.0 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36 // indirect - sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2 // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) diff --git a/go.sum b/go.sum index 53863828..1ad6172f 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,8 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dies.dev v0.7.0 h1:BoaW/RtYHD/TcjzQ15BY/5H4C2p8TYwRvvgUHL1oNU0= -dies.dev v0.7.0/go.mod h1:YFHw/gj/h7H/rFAYNLRs6oz825q5S1BYyUr9CvTR6wE= +dies.dev v0.8.0 h1:vpCDf6MpN94q1O+jbFeZjfjmor9naTv+hmi91m3iEw8= +dies.dev v0.8.0/go.mod h1:notbAs1nI6Ko+vIacIojolzpNVvqM9GhtU32ojtI1X0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v43.0.0+incompatible h1:/wSNCu0e6EsHFR4Qa3vBEBbicaprEHMyyga9g8RTULI= @@ -115,7 +115,6 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= @@ -154,8 +153,8 @@ github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInq github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +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/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= @@ -333,7 +332,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= @@ -359,12 +357,8 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= @@ -374,23 +368,24 @@ 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/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= -github.com/go-logr/zapr v1.2.3/go.mod h1:eIauM6P8qSvTw5o2ez6UEAfGjQKrxQTl5EoK+Qa2oG4= +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.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= -github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= -github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= +github.com/go-openapi/jsonreference v0.20.1 h1:FBLnyygC4/IZZr893oiomc9XaghoveYTrLC1F86HID8= +github.com/go-openapi/jsonreference v0.20.1/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= github.com/go-openapi/spec v0.19.5/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng= -github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= @@ -405,8 +400,9 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP 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/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= +github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= @@ -488,6 +484,7 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -558,18 +555,15 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -587,7 +581,7 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -598,8 +592,8 @@ github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -608,8 +602,8 @@ github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/matttproud/golang_protobuf_extensions v1.0.2 h1:hAHbPm5IJGijwng3PWk09JkG9WeqChjprR5s9bBZ+OM= -github.com/matttproud/golang_protobuf_extensions v1.0.2/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +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/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= @@ -643,7 +637,6 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m 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/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= @@ -658,13 +651,13 @@ github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+ github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1 h1:mFwc4LvZ0xpSvDZ3E+k8Yte0hLOMxXUlP+yXtJqkYfQ= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo/v2 v2.6.0 h1:9t9b9vRUbFq3C4qKFCGkVuq/fIHji802N1nrtkh1mNc= +github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q= github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= -github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E= +github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -707,27 +700,23 @@ github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDf github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= +github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +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.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -739,15 +728,13 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rubiojr/go-vhd v0.0.0-20200706105327-02e210299021/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -831,8 +818,8 @@ github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:tw github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= -github.com/vmware-labs/reconciler-runtime v0.11.1 h1:eU2bDUq4XWFmjICaKgnNieT8NhCicMqc5ST53R2QYug= -github.com/vmware-labs/reconciler-runtime v0.11.1/go.mod h1:IrjEBBrCnBhvvQA4RT9l1J4vYbH5+QKF3O93XU/lj3c= +github.com/vmware-labs/reconciler-runtime v0.12.0 h1:MTgJWMQ0y3LE4B/SBKXGPqRncNTXzfEpnzpTFedX9/0= +github.com/vmware-labs/reconciler-runtime v0.12.0/go.mod h1:7vyDauuuK6Wd57ZPCY+CLwofdFc6eKOSFRnAkFBa5ik= github.com/vmware/govmomi v0.20.3/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= @@ -861,8 +848,8 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.0 h1:Ajldaqhxqw/gNzQA45IKFWLdG7jZuXX/wBW1d5qvbUI= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.0/go.mod h1:9NiG9I2aHTKkcxqCILhjtyNA1QEiCjdBACv4IvrFQ+c= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.1 h1:sxoY9kG1s1WpSYNyzm24rlwH4lnRYFXUVVBmKMBfRgw= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.1/go.mod h1:9NiG9I2aHTKkcxqCILhjtyNA1QEiCjdBACv4IvrFQ+c= go.opentelemetry.io/otel v1.10.0 h1:Y7DTJMR6zs1xkS/upamJYk0SxxN4C9AqRd77jmZnyY4= go.opentelemetry.io/otel v1.10.0/go.mod h1:NbvWjCthWHKBEUMpf0/v8ZRZlni86PpGFEMA9pnQSnQ= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 h1:TaB+1rQhddO1sF71MpZOZAuSPW1klK2M8XxfrBMfK7Y= @@ -884,13 +871,12 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1001,10 +987,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1019,7 +1003,6 @@ golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210427180440-81ed05c6b58c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1090,7 +1073,6 @@ golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1118,22 +1100,18 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/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-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220906165534-d0df966e6959/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= +golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1142,7 +1120,6 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1173,7 +1150,6 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1210,13 +1186,14 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= 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.2.0 h1:4pT439QV83L+G9FkcCriY6EkpcK6r6bK+A5FBUMI7qY= -gomodules.xyz/jsonpatch/v2 v2.2.0/go.mod h1:WXp+iVDkoLQqPudfQ9GBlwB2eZ5DKOnjQZCYdOS8GPY= +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/v3 v3.0.1 h1:Te7hKxV52TKCbNYq3t84tzKav3xhThdvSsSp/W89IyI= gomodules.xyz/jsonpatch/v3 v3.0.1/go.mod h1:CBhndykehEwTOlEfnsfJwvkFQbSN8YZFr9M+cIHAJto= gomodules.xyz/orderedmap v0.1.0 h1:fM/+TGh/O1KkqGR5xjTKg6bU8OKBkg7p0Y+x/J9m8Os= @@ -1332,8 +1309,8 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1359,6 +1336,7 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/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/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -1386,7 +1364,6 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/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= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= @@ -1406,31 +1383,31 @@ k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= k8s.io/api v0.21.0/go.mod h1:+YbrhBBGgsxbF6o6Kj4KJPJnBmAKuXDeS3E18bgHNVU= k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s= -k8s.io/api v0.26.3 h1:emf74GIQMTik01Aum9dPP0gAypL8JTLl/lHa4V9RFSU= -k8s.io/api v0.26.3/go.mod h1:PXsqwPMXBSBcL1lJ9CYDKy7kIReUydukS5JiRlxC3qE= -k8s.io/apiextensions-apiserver v0.26.1 h1:cB8h1SRk6e/+i3NOrQgSFij1B2S0Y0wDoNl66bn8RMI= -k8s.io/apiextensions-apiserver v0.26.1/go.mod h1:AptjOSXDGuE0JICx/Em15PaoO7buLwTs0dGleIHixSM= +k8s.io/api v0.27.2 h1:+H17AJpUMvl+clT+BPnKf0E3ksMAzoBBg7CntpSuADo= +k8s.io/api v0.27.2/go.mod h1:ENmbocXfBT2ADujUXcBhHV55RIT31IIEvkntP6vZKS4= +k8s.io/apiextensions-apiserver v0.27.2 h1:iwhyoeS4xj9Y7v8YExhUwbVuBhMr3Q4bd/laClBV6Bo= +k8s.io/apiextensions-apiserver v0.27.2/go.mod h1:Oz9UdvGguL3ULgRdY9QMUzL2RZImotgxvGjdWRq6ZXQ= k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= k8s.io/apimachinery v0.21.0/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY= k8s.io/apimachinery v0.21.1/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY= -k8s.io/apimachinery v0.26.3 h1:dQx6PNETJ7nODU3XPtrwkfuubs6w7sX0M8n61zHIV/k= -k8s.io/apimachinery v0.26.3/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I= +k8s.io/apimachinery v0.27.2 h1:vBjGaKKieaIreI+oQwELalVG4d8f3YAMNpWLzDXkxeg= +k8s.io/apimachinery v0.27.2/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM= k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q= k8s.io/apiserver v0.21.0/go.mod h1:w2YSn4/WIwYuxG5zJmcqtRdtqgW/J2JRgFAqps3bBpg= k8s.io/apiserver v0.21.1/go.mod h1:nLLYZvMWn35glJ4/FZRhzLG/3MPxAaZTgV4FJZdr+tY= -k8s.io/apiserver v0.26.3 h1:blBpv+yOiozkPH2aqClhJmJY+rp53Tgfac4SKPDJnU4= -k8s.io/apiserver v0.26.3/go.mod h1:CJe/VoQNcXdhm67EvaVjYXxR3QyfwpceKPuPaeLibTA= +k8s.io/apiserver v0.27.2 h1:p+tjwrcQEZDrEorCZV2/qE8osGTINPuS5ZNqWAvKm5E= +k8s.io/apiserver v0.27.2/go.mod h1:EsOf39d75rMivgvvwjJ3OW/u9n1/BmUMK5otEOJrb1Y= k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0= k8s.io/client-go v0.21.0/go.mod h1:nNBytTF9qPFDEhoqgEPaarobC8QPae13bElIVHzIglA= k8s.io/client-go v0.21.1/go.mod h1:/kEw4RgW+3xnBGzvp9IWxKSNA+lXn3A7AuH3gdOAzLs= -k8s.io/client-go v0.26.3 h1:k1UY+KXfkxV2ScEL3gilKcF7761xkYsSD6BC9szIu8s= -k8s.io/client-go v0.26.3/go.mod h1:ZPNu9lm8/dbRIPAgteN30RSXea6vrCpFvq+MateTUuQ= +k8s.io/client-go v0.27.2 h1:vDLSeuYvCHKeoQRhCXjxXO45nHVv2Ip4Fe0MfioMrhE= +k8s.io/client-go v0.27.2/go.mod h1:tY0gVmUsHrAmjzHX9zs7eCjxcBsf8IiNe7KQ52biTcQ= k8s.io/cloud-provider v0.21.0/go.mod h1:z17TQgu3JgUFjcgby8sj5X86YdVK5Pbt+jm/eYMZU9M= k8s.io/cloud-provider v0.21.1 h1:V7ro0ZuxMBNYVH4lJKxCdI+h2bQ7EApC5f7sQYrQLVE= k8s.io/cloud-provider v0.21.1/go.mod h1:GgiRu7hOsZh3+VqMMbfLJJS9ZZM9A8k/YiZG8zkWpX4= @@ -1439,8 +1416,8 @@ k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGw k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= k8s.io/component-base v0.21.0/go.mod h1:qvtjz6X0USWXbgmbfXR+Agik4RZ3jv2Bgr5QnZzdPYw= k8s.io/component-base v0.21.1/go.mod h1:NgzFZ2qu4m1juby4TnrmpR8adRk6ka62YdH5DkIIyKA= -k8s.io/component-base v0.26.3 h1:oC0WMK/ggcbGDTkdcqefI4wIZRYdK3JySx9/HADpV0g= -k8s.io/component-base v0.26.3/go.mod h1:5kj1kZYwSC6ZstHJN7oHBqcJC6yyn41eR+Sqa/mQc8E= +k8s.io/component-base v0.27.2 h1:neju+7s/r5O4x4/txeUONNTS9r1HsPbyoPBAtHsDCpo= +k8s.io/component-base v0.27.2/go.mod h1:5UPk7EjfgrfgRIuDBFtsEFAe4DAvP3U+M8RTzoSJkpo= k8s.io/controller-manager v0.21.0/go.mod h1:Ohy0GRNRKPVjB8C8G+dV+4aPn26m8HYUI6ejloUBvUA= k8s.io/controller-manager v0.21.1/go.mod h1:8ugs8DCcHqybiwdVERhnnyGoS5Ksq/ea1p2B0CosHyc= k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= @@ -1452,29 +1429,29 @@ k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8 k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= -k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= -k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= +k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= -k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E= -k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4= +k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= +k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/legacy-cloud-providers v0.21.0 h1:iWf5xaX9yvYT5mkz8UB96UtISQ5IkrWeuMPMhRp01ZY= k8s.io/legacy-cloud-providers v0.21.0/go.mod h1:bNxo7gDg+PGkBmT/MFZswLTWdSWK9kAlS1s8DJca5q4= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 h1:KTgPnR10d5zhztWptI952TNtt/4u5h3IzDXkdIMuo2Y= -k8s.io/utils v0.0.0-20221128185143-99ec85e7a448/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= +k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36 h1:PUuX1qIFv309AT8hF/CdPKDmsG/hn/L8zRX7VvISM3A= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36/go.mod h1:WxjusMwXlKzfAs4p9km6XJRndVt2FROgMVCE4cdohFo= -sigs.k8s.io/controller-runtime v0.14.6 h1:oxstGVvXGNnMvY7TAESYk+lzr6S3V5VFxQ6d92KcwQA= -sigs.k8s.io/controller-runtime v0.14.6/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0= -sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k= -sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2 h1:trsWhjU5jZrx6UvFu4WzQDrN7Pga4a7Qg+zcfcj64PA= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2/go.mod h1:+qG7ISXqCDVVcyO8hLn12AKVYYUjM7ftlqsqmrhMZE0= +sigs.k8s.io/controller-runtime v0.15.0 h1:ML+5Adt3qZnMSYxZ7gAverBLNPSMQEibtzAgp0UPojU= +sigs.k8s.io/controller-runtime v0.15.0/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= +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.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= sigs.k8s.io/structured-merge-diff/v4 v4.0.3/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= sigs.k8s.io/structured-merge-diff/v4 v4.1.0/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= diff --git a/pkg/apis/conventions/v1alpha1/clusterpodconvention_test.go b/pkg/apis/conventions/v1alpha1/clusterpodconvention_test.go index 1158e1c5..8f6aa11a 100644 --- a/pkg/apis/conventions/v1alpha1/clusterpodconvention_test.go +++ b/pkg/apis/conventions/v1alpha1/clusterpodconvention_test.go @@ -1,5 +1,5 @@ /* -Copyright 2020 VMware Inc. +Copyright 2020-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/vmware-labs/reconciler-runtime/validation" admissionregistrationv1 "k8s.io/api/admissionregistration/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/validation/field" @@ -99,7 +98,7 @@ func TestClusterPodConventionValidate(t *testing.T) { for _, c := range []struct { name string target *ClusterPodConvention - expected validation.FieldErrors + expected field.ErrorList }{{ name: "empty webhook", target: &ClusterPodConvention{ @@ -108,7 +107,9 @@ func TestClusterPodConventionValidate(t *testing.T) { Priority: "Normal", }, }, - expected: validation.ErrMissingField("spec.webhook"), + expected: field.ErrorList{ + field.Required(field.NewPath("spec", "webhook"), ""), + }, }, { name: "neither URL nor service", @@ -119,9 +120,9 @@ func TestClusterPodConventionValidate(t *testing.T) { Webhook: &ClusterPodConventionWebhook{}, }, }, - expected: validation.FieldErrors{}.Also( - validation.ErrMissingOneOf("url", "service"), - ).ViaField("clientConfig").ViaField("webhook").ViaField("spec"), + expected: field.ErrorList{ + field.Required(field.NewPath("spec", "webhook", "clientConfig", "[url, service]"), "expected exactly one, got neither"), + }, }, { name: "only URL", target: &ClusterPodConvention{ @@ -138,7 +139,7 @@ func TestClusterPodConventionValidate(t *testing.T) { }, }, }, - expected: validation.FieldErrors{}, + expected: field.ErrorList{}, }, { name: "only service", target: &ClusterPodConvention{ @@ -152,7 +153,7 @@ func TestClusterPodConventionValidate(t *testing.T) { }, }, }, - expected: validation.FieldErrors{}, + expected: field.ErrorList{}, }, { name: "both url and service", target: &ClusterPodConvention{ @@ -167,9 +168,9 @@ func TestClusterPodConventionValidate(t *testing.T) { }, }, }, - expected: validation.FieldErrors{}.Also( - validation.ErrMultipleOneOf("url", "service"), - ).ViaField("clientConfig").ViaField("webhook").ViaField("spec"), + expected: field.ErrorList{ + field.Required(field.NewPath("spec", "webhook", "clientConfig", "[url, service]"), "expected exactly one, got both"), + }, }, { name: "incomplete service", target: &ClusterPodConvention{ @@ -185,12 +186,10 @@ func TestClusterPodConventionValidate(t *testing.T) { }, }, }, - expected: validation.FieldErrors{}.Also( - validation.FieldErrors{ - field.Required(field.NewPath("service.name"), "service name is required"), - field.Required(field.NewPath("service.namespace"), "service namespace is required"), - }, - ).ViaField("clientConfig").ViaField("webhook").ViaField("spec"), + expected: field.ErrorList{ + field.Required(field.NewPath("spec", "webhook", "clientConfig", "service", "name"), "service name is required"), + field.Required(field.NewPath("spec", "webhook", "clientConfig", "service", "namespace"), "service namespace is required"), + }, }, { name: "invalid URL", target: &ClusterPodConvention{ @@ -204,11 +203,9 @@ func TestClusterPodConventionValidate(t *testing.T) { }, }, }, - expected: validation.FieldErrors{}.Also( - validation.FieldErrors{ - field.Required(field.NewPath("url"), "url must be a valid URL: parse \"://example.com\": missing protocol scheme; desired format: https://host[/path]"), - }, - ).ViaField("clientConfig").ViaField("webhook").ViaField("spec"), + expected: field.ErrorList{ + field.Required(field.NewPath("spec", "webhook", "clientConfig", "url"), "url must be a valid URL: parse \"://example.com\": missing protocol scheme; desired format: https://host[/path]"), + }, }, { name: "bad matching service", target: &ClusterPodConvention{ @@ -228,12 +225,14 @@ func TestClusterPodConventionValidate(t *testing.T) { }, }, }, - expected: validation.ErrInvalidArrayValue(metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{{ - Values: []string{"foo", "bar"}, - Operator: metav1.LabelSelectorOpIn, - }}, - }, "selector", 0).ViaField("spec"), + expected: field.ErrorList{ + field.Invalid(field.NewPath("spec", "selectors").Index(0), metav1.LabelSelector{ + MatchExpressions: []metav1.LabelSelectorRequirement{{ + Values: []string{"foo", "bar"}, + Operator: metav1.LabelSelectorOpIn, + }}, + }, ""), + }, }, { name: "with certificate", target: &ClusterPodConvention{ @@ -251,7 +250,7 @@ func TestClusterPodConventionValidate(t *testing.T) { }, }, }, - expected: validation.FieldErrors{}, + expected: field.ErrorList{}, }, { name: "invalid certificate", target: &ClusterPodConvention{ @@ -269,11 +268,10 @@ func TestClusterPodConventionValidate(t *testing.T) { }, }, }, - expected: validation.FieldErrors{}.Also( - validation.FieldErrors{ - field.Required(field.NewPath("spec.webhook.certificate.namespace"), ""), - field.Required(field.NewPath("spec.webhook.certificate.name"), ""), - }), + expected: field.ErrorList{ + field.Required(field.NewPath("spec", "webhook", "certificate", "namespace"), ""), + field.Required(field.NewPath("spec", "webhook", "certificate", "name"), ""), + }, }, { name: "invalid selector target", target: &ClusterPodConvention{ @@ -288,10 +286,9 @@ func TestClusterPodConventionValidate(t *testing.T) { }, }, }, - expected: validation.FieldErrors{}.Also( - validation.FieldErrors{ - field.Invalid(field.NewPath("spec.selectorTarget"), InvalidSelectorTarget, "Accepted selector target values are \"PodIntent\" and \"PodTemplateSpec\". The default value is set to \"PodTemplateSpec\""), - }), + expected: field.ErrorList{ + field.Invalid(field.NewPath("spec", "selectorTarget"), InvalidSelectorTarget, "Accepted selector target values are \"PodIntent\" and \"PodTemplateSpec\". The default value is set to \"PodTemplateSpec\""), + }, }, { name: "wrong priority level", @@ -307,10 +304,9 @@ func TestClusterPodConventionValidate(t *testing.T) { }, }, }, - expected: validation.FieldErrors{}.Also( - validation.FieldErrors{ - field.Invalid(field.NewPath("spec.priority"), WrongPriority, "Accepted priority values \"Early\" or \"Normal\" or \"Late\""), - }), + expected: field.ErrorList{ + field.Invalid(field.NewPath("spec", "priority"), WrongPriority, "Accepted priority values \"Early\" or \"Normal\" or \"Late\""), + }, }, { name: "valid priority level", target: &ClusterPodConvention{ @@ -325,22 +321,22 @@ func TestClusterPodConventionValidate(t *testing.T) { }, }, }, - expected: validation.FieldErrors{}, + expected: field.ErrorList{}, }} { t.Run(c.name, func(t *testing.T) { - actual := c.target.Validate() + actual := c.target.validate() if diff := cmp.Diff(c.expected, actual); diff != "" { t.Errorf("Validate() (-expected, +actual) = %v", diff) } - create := c.target.ValidateCreate() + _, create := c.target.ValidateCreate() if diff := cmp.Diff(c.expected.ToAggregate(), create); diff != "" { t.Errorf("ValidateCreate() (-expected, +actual) = %v", diff) } - update := c.target.ValidateUpdate(nil) + _, update := c.target.ValidateUpdate(nil) if diff := cmp.Diff(c.expected.ToAggregate(), update); diff != "" { t.Errorf("ValidateUpdate() (-expected, +actual) = %v", diff) } - delete := c.target.ValidateDelete() + _, delete := c.target.ValidateDelete() if diff := cmp.Diff(nil, delete); diff != "" { t.Errorf("ValidateDelete() (-expected, +actual) = %v", diff) } diff --git a/pkg/apis/conventions/v1alpha1/clusterpodconvention_validation.go b/pkg/apis/conventions/v1alpha1/clusterpodconvention_validation.go index 7ce5f346..0e3dcc5c 100644 --- a/pkg/apis/conventions/v1alpha1/clusterpodconvention_validation.go +++ b/pkg/apis/conventions/v1alpha1/clusterpodconvention_validation.go @@ -1,5 +1,5 @@ /* -Copyright 2020 VMware Inc. +Copyright 2020-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,115 +17,112 @@ limitations under the License. package v1alpha1 import ( - "github.com/vmware-labs/reconciler-runtime/validation" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" apiserverwebhook "k8s.io/apiserver/pkg/util/webhook" - - admissionregistrationv1 "k8s.io/api/admissionregistration/v1" "sigs.k8s.io/controller-runtime/pkg/webhook" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) // +kubebuilder:webhook:path=/validate-conventions-carto-run-v1alpha1-clusterpodconvention,mutating=false,failurePolicy=fail,sideEffects=none,admissionReviewVersions=v1beta1,groups=conventions.carto.run,resources=clusterpodconventions,verbs=create;update,versions=v1alpha1,name=clusterpodconventions.conventions.carto.run var ( - _ webhook.Validator = &ClusterPodConvention{} - _ validation.FieldValidator = &ClusterPodConvention{} + _ webhook.Validator = &ClusterPodConvention{} ) // ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *ClusterPodConvention) ValidateCreate() error { - return r.Validate().ToAggregate() +func (r *ClusterPodConvention) ValidateCreate() (admission.Warnings, error) { + return nil, r.validate().ToAggregate() } // ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (c *ClusterPodConvention) ValidateUpdate(old runtime.Object) error { +func (c *ClusterPodConvention) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { // TODO check for immutable fields - return c.Validate().ToAggregate() + return nil, c.validate().ToAggregate() } // ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (c *ClusterPodConvention) ValidateDelete() error { - return nil +func (c *ClusterPodConvention) ValidateDelete() (admission.Warnings, error) { + return nil, nil } -func (r *ClusterPodConvention) Validate() validation.FieldErrors { - errs := validation.FieldErrors{} - return errs.Also(r.Spec.Validate().ViaField("spec")) +func (r *ClusterPodConvention) validate() field.ErrorList { + errs := field.ErrorList{} + errs = append(errs, r.Spec.validate(field.NewPath("spec"))...) + return errs } -func (s *ClusterPodConventionSpec) Validate() validation.FieldErrors { - errs := validation.FieldErrors{} +func (s *ClusterPodConventionSpec) validate(fldPath *field.Path) field.ErrorList { + errs := field.ErrorList{} for i := range s.Selectors { if _, err := metav1.LabelSelectorAsSelector(&s.Selectors[i]); err != nil { - errs = errs.Also( - validation.ErrInvalidArrayValue(s.Selectors[i], "selector", i), - ) + errs = append(errs, field.Invalid(fldPath.Child("selectors").Index(i), s.Selectors[i], "")) } } if s.Priority != EarlyPriority && s.Priority != LatePriority && s.Priority != NormalPriority { - errs = errs.Also(validation.FieldErrors{ - field.Invalid(field.NewPath("priority"), s.Priority, "Accepted priority values \"Early\" or \"Normal\" or \"Late\""), - }) + errs = append(errs, field.Invalid(fldPath.Child("priority"), s.Priority, "Accepted priority values \"Early\" or \"Normal\" or \"Late\"")) } // Webhook will be required mutually exclusive of other options that don't exist yet if s.Webhook == nil { - errs = errs.Also(validation.ErrMissingField("webhook")) + errs = append(errs, field.Required(fldPath.Child("webhook"), "")) } else { - errs = errs.Also(s.Webhook.Validate().ViaField("webhook")) + errs = append(errs, s.Webhook.validate(fldPath.Child("webhook"))...) } if s.SelectorTarget != PodTemplateSpecLabels && s.SelectorTarget != PodIntentLabels { - errs = errs.Also(validation.FieldErrors{ - field.Invalid(field.NewPath("selectorTarget"), s.SelectorTarget, + errs = append(errs, + field.Invalid(fldPath.Child("selectorTarget"), s.SelectorTarget, `Accepted selector target values are "PodIntent" and "PodTemplateSpec". The default value is set to "PodTemplateSpec"`), - }) + ) } return errs } -func (s *ClusterPodConventionWebhook) Validate() validation.FieldErrors { - errs := validation.FieldErrors{} +func (s *ClusterPodConventionWebhook) validate(fldPath *field.Path) field.ErrorList { + errs := field.ErrorList{} - errs = errs.Also(ValidateClientConfig(s.ClientConfig).ViaField("clientConfig")) - errs = errs.Also(s.Certificate.Validate().ViaField("certificate")) + errs = append(errs, validateClientConfig(fldPath.Child("clientConfig"), s.ClientConfig)...) + errs = append(errs, s.Certificate.validate(fldPath.Child("certificate"))...) return errs } -func (s *ClusterPodConventionWebhookCertificate) Validate() validation.FieldErrors { - errs := validation.FieldErrors{} +func (s *ClusterPodConventionWebhookCertificate) validate(fldPath *field.Path) field.ErrorList { + errs := field.ErrorList{} if s == nil { return errs } if s.Namespace == "" { - errs = errs.Also(validation.ErrMissingField("namespace")) + errs = append(errs, field.Required(fldPath.Child("namespace"), "")) } if s.Name == "" { - errs = errs.Also(validation.ErrMissingField("name")) + errs = append(errs, field.Required(fldPath.Child("name"), "")) } return errs } -func ValidateClientConfig(clientConfig admissionregistrationv1.WebhookClientConfig) validation.FieldErrors { - errs := validation.FieldErrors{} +func validateClientConfig(fldPath *field.Path, clientConfig admissionregistrationv1.WebhookClientConfig) field.ErrorList { + errs := field.ErrorList{} + switch { case (clientConfig.URL != nil) && (clientConfig.Service != nil): - errs = errs.Also(validation.ErrMultipleOneOf("url", "service")) + errs = append(errs, field.Required(fldPath.Child("[url, service]"), "expected exactly one, got both")) case (clientConfig.URL == nil) == (clientConfig.Service == nil): - errs = errs.Also(validation.ErrMissingOneOf("url", "service")) + errs = append(errs, field.Required(fldPath.Child("[url, service]"), "expected exactly one, got neither")) case clientConfig.URL != nil: - errs = append(errs, apiserverwebhook.ValidateWebhookURL(field.NewPath("url"), *clientConfig.URL, true)...) + errs = append(errs, apiserverwebhook.ValidateWebhookURL(fldPath.Child("url"), *clientConfig.URL, true)...) case clientConfig.Service != nil: - errs = append(errs, apiserverwebhook.ValidateWebhookService(field.NewPath("service"), clientConfig.Service.Name, clientConfig.Service.Namespace, + errs = append(errs, apiserverwebhook.ValidateWebhookService(fldPath.Child("service"), clientConfig.Service.Name, clientConfig.Service.Namespace, clientConfig.Service.Path, *clientConfig.Service.Port)...) } + return errs } diff --git a/pkg/apis/conventions/v1alpha1/podintent_test.go b/pkg/apis/conventions/v1alpha1/podintent_test.go index d4c761ca..922f7464 100644 --- a/pkg/apis/conventions/v1alpha1/podintent_test.go +++ b/pkg/apis/conventions/v1alpha1/podintent_test.go @@ -1,5 +1,5 @@ /* -Copyright 2020 VMware Inc. +Copyright 2020-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,9 +22,9 @@ import ( "github.com/google/go-cmp/cmp" "github.com/vmware-labs/reconciler-runtime/apis" rtesting "github.com/vmware-labs/reconciler-runtime/testing" - "github.com/vmware-labs/reconciler-runtime/validation" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/validation/field" ) func TestPodIntentDefault(t *testing.T) { @@ -57,11 +57,11 @@ func TestPodIntentValidate(t *testing.T) { for _, c := range []struct { name string target *PodIntent - expected validation.FieldErrors + expected field.ErrorList }{{ name: "empty", target: &PodIntent{}, - expected: validation.FieldErrors{}, + expected: field.ErrorList{}, }, { name: "empty image pull secret", target: &PodIntent{ @@ -69,22 +69,24 @@ func TestPodIntentValidate(t *testing.T) { ImagePullSecrets: []corev1.LocalObjectReference{{}}, }, }, - expected: validation.ErrMissingField("spec.imagePullSecrets[0].name"), + expected: field.ErrorList{ + field.Required(field.NewPath("spec", "imagePullSecrets").Index(0).Child("name"), ""), + }, }} { t.Run(c.name, func(t *testing.T) { - actual := c.target.Validate() + actual := c.target.validate() if diff := cmp.Diff(c.expected, actual); diff != "" { t.Errorf("Validate() (-expected, +actual) = %v", diff) } - create := c.target.ValidateCreate() + _, create := c.target.ValidateCreate() if diff := cmp.Diff(c.expected.ToAggregate(), create); diff != "" { t.Errorf("ValidateCreate() (-expected, +actual) = %v", diff) } - update := c.target.ValidateUpdate(nil) + _, update := c.target.ValidateUpdate(nil) if diff := cmp.Diff(c.expected.ToAggregate(), update); diff != "" { t.Errorf("ValidateUpdate() (-expected, +actual) = %v", diff) } - delete := c.target.ValidateDelete() + _, delete := c.target.ValidateDelete() if diff := cmp.Diff(nil, delete); diff != "" { t.Errorf("ValidateUpdate() (-expected, +actual) = %v", diff) } diff --git a/pkg/apis/conventions/v1alpha1/podintent_validation.go b/pkg/apis/conventions/v1alpha1/podintent_validation.go index 5c0a5007..499cbad3 100644 --- a/pkg/apis/conventions/v1alpha1/podintent_validation.go +++ b/pkg/apis/conventions/v1alpha1/podintent_validation.go @@ -1,5 +1,5 @@ /* -Copyright 2020 VMware Inc. +Copyright 2020-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,49 +17,48 @@ limitations under the License. package v1alpha1 import ( - "fmt" - - "github.com/vmware-labs/reconciler-runtime/validation" runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/validation/field" "sigs.k8s.io/controller-runtime/pkg/webhook" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) // +kubebuilder:webhook:path=/validate-conventions-carto-run-v1alpha1-podintent,mutating=false,failurePolicy=fail,sideEffects=none,admissionReviewVersions=v1beta1,groups=conventions.carto.run,resources=podintents,verbs=create;update,versions=v1alpha1,name=podintents.conventions.carto.run var ( - _ webhook.Validator = &PodIntent{} - _ validation.FieldValidator = &PodIntent{} + _ webhook.Validator = &PodIntent{} ) // ValidateCreate implements webhook.Validator so a webhook will be registered for the type -func (r *PodIntent) ValidateCreate() error { - return r.Validate().ToAggregate() +func (r *PodIntent) ValidateCreate() (admission.Warnings, error) { + return nil, r.validate().ToAggregate() } // ValidateUpdate implements webhook.Validator so a webhook will be registered for the type -func (r *PodIntent) ValidateUpdate(old runtime.Object) error { +func (r *PodIntent) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { // TODO check for immutable fields - return r.Validate().ToAggregate() + return nil, r.validate().ToAggregate() } // ValidateDelete implements webhook.Validator so a webhook will be registered for the type -func (r *PodIntent) ValidateDelete() error { - return nil +func (r *PodIntent) ValidateDelete() (admission.Warnings, error) { + return nil, nil } -func (r *PodIntent) Validate() validation.FieldErrors { - errs := validation.FieldErrors{} +func (r *PodIntent) validate() field.ErrorList { + errs := field.ErrorList{} - errs = errs.Also(r.Spec.Validate().ViaField("spec")) + errs = append(errs, r.Spec.validate(field.NewPath("spec"))...) return errs } -func (s *PodIntentSpec) Validate() validation.FieldErrors { - errs := validation.FieldErrors{} +func (s *PodIntentSpec) validate(fldPath *field.Path) field.ErrorList { + errs := field.ErrorList{} + for index, ips := range s.ImagePullSecrets { if ips.Name == "" { - errs = errs.Also(validation.ErrMissingField(fmt.Sprintf("imagePullSecrets[%d].name", index))) + errs = append(errs, field.Required(fldPath.Child("imagePullSecrets").Index(index).Child("name"), "")) } } // TODO diff --git a/pkg/binding/convention.go b/pkg/binding/convention.go index 23bbaabf..2292197f 100644 --- a/pkg/binding/convention.go +++ b/pkg/binding/convention.go @@ -1,5 +1,5 @@ /* -Copyright 2020 VMware Inc. +Copyright 2020-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/binding/convention_test.go b/pkg/binding/convention_test.go index 4f360a8b..4dfee35c 100644 --- a/pkg/binding/convention_test.go +++ b/pkg/binding/convention_test.go @@ -1,5 +1,5 @@ /* -Copyright 2020 VMware Inc. +Copyright 2020-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "net/url" @@ -337,7 +337,7 @@ func (f serviceResolver) ResolveEndpoint(namespace, name string, port int32) (*u func webhookHandler(w http.ResponseWriter, r *http.Request) { reqObj := &webhookv1alpha1.PodConventionContext{} if r.Body != nil { - reqBody, err := ioutil.ReadAll(r.Body) + reqBody, err := io.ReadAll(r.Body) if err != nil { w.WriteHeader(http.StatusBadRequest) return diff --git a/pkg/binding/conventions_test.go b/pkg/binding/conventions_test.go index e6a5f819..7ce31516 100644 --- a/pkg/binding/conventions_test.go +++ b/pkg/binding/conventions_test.go @@ -1,5 +1,5 @@ /* -Copyright 2021 VMware Inc. +Copyright 2021-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import ( "context" "encoding/pem" "fmt" - "io/ioutil" "net/http/httptest" "net/url" "os" @@ -35,12 +34,12 @@ import ( "github.com/google/go-containerregistry/pkg/v1/cache" "github.com/google/go-containerregistry/pkg/v1/random" "github.com/google/go-containerregistry/pkg/v1/remote" - rtesting "github.com/vmware-labs/reconciler-runtime/testing" admissionregistrationv1 "k8s.io/api/admissionregistration/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" webhooktesting "k8s.io/apiserver/pkg/admission/plugin/webhook/testing" + "k8s.io/utils/pointer" conventionsv1alpha1 "github.com/vmware-tanzu/cartographer-conventions/pkg/apis/conventions/v1alpha1" "github.com/vmware-tanzu/cartographer-conventions/pkg/binding" @@ -285,7 +284,7 @@ func TestConventionApply(t *testing.T) { ServiceResolver: fake.NewStubServiceResolver(*serverURL), } - dir, err := ioutil.TempDir("", "ggcr-cache") + dir, err := os.MkdirTemp(os.TempDir(), "ggcr-cache") if err != nil { t.Fatalf("Unable to create temp dir %v", err) } @@ -404,7 +403,7 @@ func TestConventionApply(t *testing.T) { Service: &admissionregistrationv1.ServiceReference{ Namespace: "default", Name: "webhook-test", - Path: rtesting.StringPtr("labelonly"), + Path: pointer.String("labelonly"), }, CABundle: caCert, }, @@ -478,7 +477,7 @@ func TestConventionApply(t *testing.T) { Service: &admissionregistrationv1.ServiceReference{ Namespace: "default", Name: "webhook-test", - Path: rtesting.StringPtr(fmt.Sprintf("badimage;host=%s", registryUrl.Host)), + Path: pointer.String(fmt.Sprintf("badimage;host=%s", registryUrl.Host)), }, CABundle: caCert, }, @@ -489,7 +488,7 @@ func TestConventionApply(t *testing.T) { Service: &admissionregistrationv1.ServiceReference{ Namespace: "default", Name: "webhook-test", - Path: rtesting.StringPtr("labelonly"), + Path: pointer.String("labelonly"), }, CABundle: caCert, }, @@ -513,7 +512,7 @@ func TestConventionApply(t *testing.T) { Service: &admissionregistrationv1.ServiceReference{ Namespace: "default", Name: "webhook-test", - Path: rtesting.StringPtr(fmt.Sprintf("hellosidecar;host=%s", registryUrl.Host)), + Path: pointer.String(fmt.Sprintf("hellosidecar;host=%s", registryUrl.Host)), }, CABundle: caCert, }, @@ -650,7 +649,7 @@ func TestRepositoryConfigWithAdditionalCert(t *testing.T) { ServiceResolver: fake.NewStubServiceResolver(*serverURL), } - dir, err := ioutil.TempDir("", "ggcr-cache") + dir, err := os.MkdirTemp(os.TempDir(), "ggcr-cache") if err != nil { t.Fatalf("Unable to create temp dir %v", err) } @@ -682,7 +681,6 @@ func TestRepositoryConfigWithAdditionalCert(t *testing.T) { if err != nil { t.Fatalf("Unable to get image digest: %v", err) } - digestedImage, err := name.NewDigest(rgUrl.Host + "/test@" + imageDigest.String()) if err != nil { diff --git a/pkg/binding/fake/conventionserver.go b/pkg/binding/fake/conventionserver.go index a4f5945b..8abe8ffc 100644 --- a/pkg/binding/fake/conventionserver.go +++ b/pkg/binding/fake/conventionserver.go @@ -1,5 +1,5 @@ /* -Copyright 2020 VMware Inc. +Copyright 2020-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import ( "crypto/tls" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "net/url" @@ -151,7 +151,7 @@ func NewFakeConventionServer() (*httptest.Server, []byte, error) { func webhookHandler(w http.ResponseWriter, r *http.Request) { reqObj := &webhookv1alpha1.PodConventionContext{} if r.Body != nil { - reqBody, err := ioutil.ReadAll(r.Body) + reqBody, err := io.ReadAll(r.Body) if err != nil { w.WriteHeader(http.StatusBadRequest) return diff --git a/pkg/binding/image_config_test.go b/pkg/binding/image_config_test.go index 8da5643c..18788c55 100644 --- a/pkg/binding/image_config_test.go +++ b/pkg/binding/image_config_test.go @@ -20,7 +20,6 @@ import ( "context" "encoding/pem" "fmt" - "io/ioutil" "net/http/httptest" "net/url" "os" @@ -121,7 +120,7 @@ func TestCreateImageConfigs(t *testing.T) { if err != nil { t.Fatalf("Unable to create k8s auth chain %v", err) } - dir, err := ioutil.TempDir("", "ggcr-cache") + dir, err := os.MkdirTemp(os.TempDir(), "ggcr-cache") if err != nil { t.Fatalf("Unable to create temp dir %v", err) } @@ -328,7 +327,7 @@ func TestImageConfigWithCustomCA(t *testing.T) { t.Fatalf("Unable to parse certificate %v", err) } - dir, err := ioutil.TempDir("", "ggcr-cache") + dir, err := os.MkdirTemp(os.TempDir(), "ggcr-cache") if err != nil { t.Fatalf("Unable to create temp dir %v", err) } diff --git a/pkg/controllers/metrics_reconciler.go b/pkg/controllers/metrics_reconciler.go index ce3b14cf..4354a50b 100644 --- a/pkg/controllers/metrics_reconciler.go +++ b/pkg/controllers/metrics_reconciler.go @@ -1,5 +1,5 @@ /* -Copyright 2021 VMware Inc. +Copyright 2021-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -38,7 +38,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" - "sigs.k8s.io/controller-runtime/pkg/source" conventionsv1alpha1 "github.com/vmware-tanzu/cartographer-conventions/pkg/apis/conventions/v1alpha1" ) @@ -185,7 +184,7 @@ func configMapSemanticEquals(desiredConfigMap, configMap *corev1.ConfigMap) bool func (r *MetricsReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error { enqueueConfigMap := handler.EnqueueRequestsFromMapFunc( - func(a client.Object) []reconcile.Request { + func(ctx context.Context, a client.Object) []reconcile.Request { return []reconcile.Request{ { NamespacedName: types.NamespacedName{ @@ -219,7 +218,7 @@ func (r *MetricsReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manag return cm.Namespace == r.Namespace && cm.Name == r.Name }, }). - Watches(&source.Kind{Type: &conventionsv1alpha1.ClusterPodConvention{}}, enqueueConfigMap). - Watches(&source.Kind{Type: &conventionsv1alpha1.PodIntent{}}, enqueueConfigMap). + Watches(&conventionsv1alpha1.ClusterPodConvention{}, enqueueConfigMap). + Watches(&conventionsv1alpha1.PodIntent{}, enqueueConfigMap). Complete(r) } diff --git a/pkg/controllers/metrics_reconciler_test.go b/pkg/controllers/metrics_reconciler_test.go index 5e2b44a3..cfa58638 100644 --- a/pkg/controllers/metrics_reconciler_test.go +++ b/pkg/controllers/metrics_reconciler_test.go @@ -1,5 +1,5 @@ /* -Copyright 2021 VMware Inc. +Copyright 2021-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ func TestMetricsReconciler(t *testing.T) { sanotherName := "test-another-convention" dname := "test-intent" anotherDname := "test-another-intent" - testKey := types.NamespacedName{Namespace: testNamespace, Name: testName} + request := reconcilers.Request{NamespacedName: types.NamespacedName{Namespace: testNamespace, Name: testName}} scheme := runtime.NewScheme() _ = clientgoscheme.AddToScheme(scheme) @@ -86,14 +86,12 @@ func TestMetricsReconciler(t *testing.T) { podIntentConditionReady := diemetav1.ConditionBlank.Type(conventionsv1alpha1.PodIntentConditionReady) - rts := rtesting.ReconcilerTestSuite{ - { - Name: "builders configmap does not exist", - Key: types.NamespacedName{Namespace: testNamespace, Name: "wrong-cm"}, + rts := rtesting.ReconcilerTests{ + "builders configmap does not exist": { + Request: reconcilers.Request{NamespacedName: types.NamespacedName{Namespace: testNamespace, Name: "wrong-cm"}}, }, - { - Name: "builders configmap with no resources", - Key: testKey, + "builders configmap with no resources": { + Request: request, ExpectedResult: ctrl.Result{}, ExpectCreates: []client.Object{ testMetrics. @@ -101,9 +99,8 @@ func TestMetricsReconciler(t *testing.T) { AddData("podintents_count", "0"), }, }, - { - Name: "builders configmap with exiting resources", - Key: testKey, + "builders configmap with exiting resources": { + Request: request, GivenObjects: []client.Object{ testMetrics. AddData("clusterpodconventions_names", ""). @@ -111,18 +108,16 @@ func TestMetricsReconciler(t *testing.T) { }, ExpectedResult: ctrl.Result{}, }, - { - Name: "get configmap error", - Key: testKey, + "get configmap error": { + Request: request, ShouldErr: true, WithReactors: []rtesting.ReactionFunc{ rtesting.InduceFailure("get", "ConfigMap"), }, ExpectedResult: ctrl.Result{}, }, - { - Name: "create configmap error", - Key: testKey, + "create configmap error": { + Request: request, ShouldErr: true, WithReactors: []rtesting.ReactionFunc{ rtesting.InduceFailure("create", "ConfigMap"), @@ -134,9 +129,8 @@ func TestMetricsReconciler(t *testing.T) { }, ExpectedResult: ctrl.Result{}, }, - { - Name: "update configmap error", - Key: testKey, + "update configmap error": { + Request: request, ShouldErr: true, WithReactors: []rtesting.ReactionFunc{ rtesting.InduceFailure("update", "ConfigMap"), @@ -151,9 +145,8 @@ func TestMetricsReconciler(t *testing.T) { }, ExpectedResult: ctrl.Result{}, }, - { - Name: "list cluster sources error", - Key: testKey, + "list cluster sources error": { + Request: request, ShouldErr: true, WithReactors: []rtesting.ReactionFunc{ rtesting.InduceFailure("list", "ClusterPodConventionList"), @@ -164,9 +157,8 @@ func TestMetricsReconciler(t *testing.T) { }, ExpectedResult: ctrl.Result{}, }, - { - Name: "list intent resources error", - Key: testKey, + "list intent resources error": { + Request: request, ShouldErr: true, WithReactors: []rtesting.ReactionFunc{ rtesting.InduceFailure("list", "PodIntentList"), @@ -176,19 +168,18 @@ func TestMetricsReconciler(t *testing.T) { }, ExpectedResult: ctrl.Result{}, }, - { - Name: "configmap with delete timestamp", - Key: testKey, + "configmap with delete timestamp": { + Request: request, GivenObjects: []client.Object{ testMetrics. MetadataDie(func(d *diemetav1.ObjectMetaDie) { d.DeletionTimestamp(&now) + d.Finalizers("conventions.carto.run/finalizer") }), }, }, - { - Name: "builders configmap with intent with different status", - Key: testKey, + "builders configmap with intent with different status": { + Request: request, GivenObjects: []client.Object{ intent. StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { @@ -212,9 +203,8 @@ func TestMetricsReconciler(t *testing.T) { AddData("podintents_ready_false_count", "1"), }, }, - { - Name: "builders configmap with intent resources", - Key: testKey, + "builders configmap with intent resources": { + Request: request, GivenObjects: []client.Object{ intent. StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { @@ -239,9 +229,8 @@ func TestMetricsReconciler(t *testing.T) { AddData("clusterpodconventions_names", "test-another-convention\ntest-convention"), }, }, - { - Name: "builders configmap with intent resources owner references", - Key: testKey, + "builders configmap with intent resources owner references": { + Request: request, GivenObjects: []client.Object{ anotherIntent. MetadataDie(func(d *diemetav1.ObjectMetaDie) { diff --git a/pkg/controllers/podintent_reconciler.go b/pkg/controllers/podintent_reconciler.go index b286e262..b659c9d7 100644 --- a/pkg/controllers/podintent_reconciler.go +++ b/pkg/controllers/podintent_reconciler.go @@ -1,5 +1,5 @@ /* -Copyright 2020 VMware Inc. +Copyright 2020-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -37,7 +37,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/handler" - "sigs.k8s.io/controller-runtime/pkg/source" conventionsv1alpha1 "github.com/vmware-tanzu/cartographer-conventions/pkg/apis/conventions/v1alpha1" certmanagerv1 "github.com/vmware-tanzu/cartographer-conventions/pkg/apis/thirdparty/cert-manager/v1" @@ -75,11 +74,10 @@ var ( // +kubebuilder:rbac:groups=conventions.carto.run,resources=podintents/status,verbs=get;update;patch // +kubebuilder:rbac:groups=core,resources=events,verbs=get;list;watch;create;update;patch;delete -func PodIntentReconciler(c reconcilers.Config, wc binding.WebhookConfig, rc binding.RegistryConfig) *reconcilers.ParentReconciler { - return &reconcilers.ParentReconciler{ +func PodIntentReconciler(c reconcilers.Config, wc binding.WebhookConfig, rc binding.RegistryConfig) *reconcilers.ResourceReconciler[*conventionsv1alpha1.PodIntent] { + return &reconcilers.ResourceReconciler[*conventionsv1alpha1.PodIntent]{ Name: "PodIntent", - Type: &conventionsv1alpha1.PodIntent{}, - Reconciler: reconcilers.Sequence{ + Reconciler: reconcilers.Sequence[*conventionsv1alpha1.PodIntent]{ ResolveConventions(), BuildRegistryConfig(rc), ApplyConventionsReconciler(wc), @@ -93,8 +91,8 @@ func PodIntentReconciler(c reconcilers.Config, wc binding.WebhookConfig, rc bind // +kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list;watch // +kubebuilder:rbac:groups=cert-manager.io,resources=certificaterequests,verbs=get;list;watch -func ResolveConventions() reconcilers.SubReconciler { - return &reconcilers.SyncReconciler{ +func ResolveConventions() reconcilers.SubReconciler[*conventionsv1alpha1.PodIntent] { + return &reconcilers.SyncReconciler[*conventionsv1alpha1.PodIntent]{ Name: "ResolveConventions", Sync: func(ctx context.Context, parent *conventionsv1alpha1.PodIntent) error { log := logr.FromContextOrDiscard(ctx) @@ -135,8 +133,8 @@ func ResolveConventions() reconcilers.SubReconciler { Setup: func(ctx context.Context, mgr ctrl.Manager, bldr *builder.Builder) error { // register an informer to watch ClusterPodConventions - bldr.Watches(&source.Kind{Type: &conventionsv1alpha1.ClusterPodConvention{}}, &handler.Funcs{}) - bldr.Watches(&source.Kind{Type: &certmanagerv1.CertificateRequest{}}, reconcilers.EnqueueTracked(ctx, &certmanagerv1.CertificateRequest{})) + bldr.Watches(&conventionsv1alpha1.ClusterPodConvention{}, &handler.Funcs{}) + bldr.Watches(&certmanagerv1.CertificateRequest{}, reconcilers.EnqueueTracked(ctx)) return nil }, @@ -146,24 +144,28 @@ func ResolveConventions() reconcilers.SubReconciler { // +kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list;watch // +kubebuilder:rbac:groups=core,resources=serviceaccounts,verbs=get;list;watch -func BuildRegistryConfig(rc binding.RegistryConfig) reconcilers.SubReconciler { - return &reconcilers.SyncReconciler{ +func BuildRegistryConfig(rc binding.RegistryConfig) reconcilers.SubReconciler[*conventionsv1alpha1.PodIntent] { + return &reconcilers.SyncReconciler[*conventionsv1alpha1.PodIntent]{ Name: "BuildRegistryConfig", - Sync: func(ctx context.Context, parent *conventionsv1alpha1.PodIntent) (ctrl.Result, error) { + SyncWithResult: func(ctx context.Context, parent *conventionsv1alpha1.PodIntent) (ctrl.Result, error) { log := logr.FromContextOrDiscard(ctx) c := reconcilers.RetrieveConfigOrDie(ctx) if rc.Client == nil { return ctrl.Result{}, fmt.Errorf("kubernetes client is not set") } conditionManager := parent.GetConditionSet().Manage(&parent.Status) - parentNamespacedName := types.NamespacedName{Namespace: parent.Namespace, Name: parent.Name} var imagePullSecrets []string for _, ips := range parent.Spec.ImagePullSecrets { imagePullSecrets = append(imagePullSecrets, ips.Name) // track ref for updates - key := tracker.NewKey(secretGVK, types.NamespacedName{Namespace: parent.Namespace, Name: ips.Name}) - c.Tracker.Track(ctx, key, parentNamespacedName) + ref := tracker.Reference{ + Kind: secretGVK.Kind, + APIGroup: secretGVK.Group, + Namespace: parent.Namespace, + Name: ips.Name, + } + c.Tracker.TrackReference(ref, parent) } serviceAccountName := parent.Spec.ServiceAccountName @@ -190,8 +192,13 @@ func BuildRegistryConfig(rc binding.RegistryConfig) reconcilers.SubReconciler { for _, secretReference := range sa.ImagePullSecrets { // track ref for updates - key := tracker.NewKey(secretGVK, types.NamespacedName{Namespace: parent.Namespace, Name: secretReference.Name}) - c.Tracker.Track(ctx, key, parentNamespacedName) + ref := tracker.Reference{ + Kind: secretGVK.Kind, + APIGroup: secretGVK.Group, + Namespace: parent.Namespace, + Name: secretReference.Name, + } + c.Tracker.TrackReference(ref, parent) } StashRegistryConfig(ctx, binding.RegistryConfig{ @@ -204,9 +211,9 @@ func BuildRegistryConfig(rc binding.RegistryConfig) reconcilers.SubReconciler { }, Setup: func(ctx context.Context, mgr reconcilers.Manager, bldr *reconcilers.Builder) error { // register an informer to watch Secret's metadata only. This reduces the cache size in memory. - bldr.Watches(&source.Kind{Type: &corev1.Secret{}}, reconcilers.EnqueueTracked(ctx, &corev1.Secret{}), builder.OnlyMetadata) + bldr.Watches(&corev1.Secret{}, reconcilers.EnqueueTracked(ctx), builder.OnlyMetadata) // register an informer to watch ServiceAccount - bldr.Watches(&source.Kind{Type: &corev1.ServiceAccount{}}, reconcilers.EnqueueTracked(ctx, &corev1.ServiceAccount{})) + bldr.Watches(&corev1.ServiceAccount{}, reconcilers.EnqueueTracked(ctx)) return nil }, } @@ -260,10 +267,10 @@ func getCABundle(ctx context.Context, c reconcilers.Config, certRef *conventions return caData.Bytes(), nil } -func ApplyConventionsReconciler(wc binding.WebhookConfig) reconcilers.SubReconciler { - return &reconcilers.SyncReconciler{ +func ApplyConventionsReconciler(wc binding.WebhookConfig) reconcilers.SubReconciler[*conventionsv1alpha1.PodIntent] { + return &reconcilers.SyncReconciler[*conventionsv1alpha1.PodIntent]{ Name: "ApplyConventions", - Sync: func(ctx context.Context, parent *conventionsv1alpha1.PodIntent) (ctrl.Result, error) { + SyncWithResult: func(ctx context.Context, parent *conventionsv1alpha1.PodIntent) (ctrl.Result, error) { log := logr.FromContextOrDiscard(ctx) sources := RetrieveConventions(ctx) diff --git a/pkg/controllers/podintent_reconciler_test.go b/pkg/controllers/podintent_reconciler_test.go index f54c48c5..f78d6347 100644 --- a/pkg/controllers/podintent_reconciler_test.go +++ b/pkg/controllers/podintent_reconciler_test.go @@ -1,5 +1,5 @@ /* -Copyright 2020 VMware Inc. +Copyright 2020-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ package controllers_test import ( "context" "fmt" - "io/ioutil" "net/http/httptest" "net/url" "os" @@ -45,6 +44,7 @@ import ( webhooktesting "k8s.io/apiserver/pkg/admission/plugin/webhook/testing" fakeclient "k8s.io/client-go/kubernetes/fake" clientgoscheme "k8s.io/client-go/kubernetes/scheme" + "k8s.io/utils/pointer" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" @@ -88,14 +88,14 @@ func TestPodIntentReconciler(t *testing.T) { name := "my-template" secretName := "test-secret" - key := types.NamespacedName{Namespace: namespace, Name: name} + request := reconcilers.Request{NamespacedName: types.NamespacedName{Namespace: namespace, Name: name}} image := fmt.Sprintf("%s/%s", registryUrl.Host, "img") scheme := runtime.NewScheme() _ = clientgoscheme.AddToScheme(scheme) _ = conventionsv1alpha1.AddToScheme(scheme) - dir, err := ioutil.TempDir("", "ggcr-cache") + dir, err := os.MkdirTemp(os.TempDir(), "ggcr-cache") if err != nil { t.Fatalf("Unable to create temp dir %v", err) } @@ -138,48 +138,49 @@ func TestPodIntentReconciler(t *testing.T) { d.CreationTimestamp(now) }) - rts := rtesting.ReconcilerTestSuite{{ - Name: "in sync", - Key: key, - GivenObjects: []client.Object{ - defaultSA, - secret, - parent. - SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { - d.ImagePullSecretsDie( - diecorev1.LocalObjectReferenceBlank.Name(secretName), - ) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(image) + rts := rtesting.ReconcilerTests{ + "in sync": { + Request: request, + GivenObjects: []client.Object{ + defaultSA, + secret, + parent. + SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { + d.ImagePullSecretsDie( + diecorev1.LocalObjectReferenceBlank.Name(secretName), + ) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(image) + }) }) }) - }) - }). - StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { - d.ConditionsDie( - dieconventionsv1alpha1.PodIntentConditionConventionsAppliedBlank. - Status(metav1.ConditionTrue). - Reason("Applied"), - dieconventionsv1alpha1.PodIntentConditionReadyBlank. - Status(metav1.ConditionTrue). - Reason("ConventionsApplied"), - ) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(image) + }). + StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { + d.ConditionsDie( + dieconventionsv1alpha1.PodIntentConditionConventionsAppliedBlank. + Status(metav1.ConditionTrue). + Reason("Applied"), + dieconventionsv1alpha1.PodIntentConditionReadyBlank. + Status(metav1.ConditionTrue). + Reason("ConventionsApplied"), + ) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(image) + }) }) }) - }) - }), - }, - ExpectTracks: []rtesting.TrackRequest{ - rtesting.NewTrackRequest(secret, parent, scheme), - rtesting.NewTrackRequest(defaultSA, parent, scheme), + }), + }, + ExpectTracks: []rtesting.TrackRequest{ + rtesting.NewTrackRequest(secret, parent, scheme), + rtesting.NewTrackRequest(defaultSA, parent, scheme), + }, }, - }} + } rts.Run(t, scheme, func(t *testing.T, rtc *rtesting.ReconcilerTestCase, c reconcilers.Config) reconcile.Reconciler { return controllers.PodIntentReconciler(c, wc, rc) @@ -219,13 +220,13 @@ func TestBuildRegistryConfig(t *testing.T) { secretName := "test-secret" saWithSecret := "test-sa-with-secret" - key := types.NamespacedName{Namespace: namespace, Name: name} + request := reconcilers.Request{NamespacedName: types.NamespacedName{Namespace: namespace, Name: name}} scheme := runtime.NewScheme() _ = clientgoscheme.AddToScheme(scheme) _ = conventionsv1alpha1.AddToScheme(scheme) - dir, err := ioutil.TempDir("", "ggcr-cache") + dir, err := os.MkdirTemp(os.TempDir(), "ggcr-cache") if err != nil { t.Fatalf("Unable to create temp dir %v", err) } @@ -296,270 +297,286 @@ func TestBuildRegistryConfig(t *testing.T) { d.CreationTimestamp(now) }) - rts := rtesting.ReconcilerTestSuite{{ - Name: "image pull secret", - Key: key, - GivenObjects: []client.Object{ - defaultSA, - parent. - SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { - d.ImagePullSecretsDie( - diecorev1.LocalObjectReferenceBlank.Name("test-secret"), - ) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + rts := rtesting.ReconcilerTests{ + "image pull secret": { + Request: request, + StatusSubResourceTypes: []client.Object{ + &conventionsv1alpha1.PodIntent{}, + }, + GivenObjects: []client.Object{ + defaultSA, + parent. + SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { + d.ImagePullSecretsDie( + diecorev1.LocalObjectReferenceBlank.Name("test-secret"), + ) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }), - }, - ExpectTracks: []rtesting.TrackRequest{ - rtesting.NewTrackRequest(secret, parent, scheme), - rtesting.NewTrackRequest(defaultSA, parent, scheme), - }, - ExpectEvents: []rtesting.Event{ - rtesting.NewEvent(parent, scheme, corev1.EventTypeNormal, "StatusUpdated", `Updated status`), - }, - ExpectStatusUpdates: []client.Object{ - parent. - SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { - d.ServiceAccountName(saWithSecret) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }), + }, + ExpectTracks: []rtesting.TrackRequest{ + rtesting.NewTrackRequest(secret, parent, scheme), + rtesting.NewTrackRequest(defaultSA, parent, scheme), + }, + ExpectEvents: []rtesting.Event{ + rtesting.NewEvent(parent, scheme, corev1.EventTypeNormal, "StatusUpdated", `Updated status`), + }, + ExpectStatusUpdates: []client.Object{ + parent. + SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { + d.ServiceAccountName(saWithSecret) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }). - StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { - d.ConditionsDie( - dieconventionsv1alpha1.PodIntentConditionConventionsAppliedBlank. - Status(metav1.ConditionTrue). - Reason("Applied"), - dieconventionsv1alpha1.PodIntentConditionReadyBlank. - Status(metav1.ConditionTrue). - Reason("ConventionsApplied"), - ) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }). + StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { + d.ConditionsDie( + dieconventionsv1alpha1.PodIntentConditionConventionsAppliedBlank. + Status(metav1.ConditionTrue). + Reason("Applied"), + dieconventionsv1alpha1.PodIntentConditionReadyBlank. + Status(metav1.ConditionTrue). + Reason("ConventionsApplied"), + ) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }), + }), + }, }, - }, { - Name: "service account with image pull secret", - Key: key, - GivenObjects: []client.Object{ - sa, - parent. - SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { - d.ServiceAccountName(saWithSecret) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + "service account with image pull secret": { + Request: request, + StatusSubResourceTypes: []client.Object{ + &conventionsv1alpha1.PodIntent{}, + }, + GivenObjects: []client.Object{ + sa, + parent. + SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { + d.ServiceAccountName(saWithSecret) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }). - StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }). + StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }), - }, - ExpectEvents: []rtesting.Event{ - rtesting.NewEvent(parent, scheme, corev1.EventTypeNormal, "StatusUpdated", `Updated status`), - }, - ExpectStatusUpdates: []client.Object{ - parent. - SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { - d.ServiceAccountName(saWithSecret) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }), + }, + ExpectEvents: []rtesting.Event{ + rtesting.NewEvent(parent, scheme, corev1.EventTypeNormal, "StatusUpdated", `Updated status`), + }, + ExpectStatusUpdates: []client.Object{ + parent. + SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { + d.ServiceAccountName(saWithSecret) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }). - StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { - d.ConditionsDie( - dieconventionsv1alpha1.PodIntentConditionConventionsAppliedBlank. - Status(metav1.ConditionTrue). - Reason("Applied"), - dieconventionsv1alpha1.PodIntentConditionReadyBlank. - Status(metav1.ConditionTrue). - Reason("ConventionsApplied"), - ) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }). + StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { + d.ConditionsDie( + dieconventionsv1alpha1.PodIntentConditionConventionsAppliedBlank. + Status(metav1.ConditionTrue). + Reason("Applied"), + dieconventionsv1alpha1.PodIntentConditionReadyBlank. + Status(metav1.ConditionTrue). + Reason("ConventionsApplied"), + ) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }), - }, - ExpectTracks: []rtesting.TrackRequest{ - rtesting.NewTrackRequest(sa, parent, scheme), - rtesting.NewTrackRequest(secret, parent, scheme), - }, - }, { - Name: "ServiceAccount not present in namespace", - Key: key, - ExpectEvents: []rtesting.Event{ - rtesting.NewEvent(parent, scheme, corev1.EventTypeNormal, "StatusUpdated", `Updated status`), + }), + }, + ExpectTracks: []rtesting.TrackRequest{ + rtesting.NewTrackRequest(sa, parent, scheme), + rtesting.NewTrackRequest(secret, parent, scheme), + }, }, - GivenObjects: []client.Object{ - parent. - SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { - d.ServiceAccountName("wrong-sa") - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + "ServiceAccount not present in namespace": { + Request: request, + StatusSubResourceTypes: []client.Object{ + &conventionsv1alpha1.PodIntent{}, + }, + ExpectEvents: []rtesting.Event{ + rtesting.NewEvent(parent, scheme, corev1.EventTypeNormal, "StatusUpdated", `Updated status`), + }, + GivenObjects: []client.Object{ + parent. + SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { + d.ServiceAccountName("wrong-sa") + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }), - }, - ExpectStatusUpdates: []client.Object{ - parent. - SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { - d.ImagePullSecretsDie( - diecorev1.LocalObjectReferenceBlank.Name("wrong-secret"), - ) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }), + }, + ExpectStatusUpdates: []client.Object{ + parent. + SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { + d.ImagePullSecretsDie( + diecorev1.LocalObjectReferenceBlank.Name("wrong-secret"), + ) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }). - StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { - d.ConditionsDie( - dieconventionsv1alpha1.PodIntentConditionConventionsAppliedBlank. - Status(metav1.ConditionFalse). - Reason("ImageResolutionFailed"). - Message("failed to authenticate: serviceaccounts \"wrong-sa\" not found"), - dieconventionsv1alpha1.PodIntentConditionReadyBlank. - Status(metav1.ConditionFalse). - Reason("ImageResolutionFailed"). - Message("failed to authenticate: serviceaccounts \"wrong-sa\" not found"), - ) - }), - }, - }, { - Name: "ServiceAccount not present in api reader(unlikely)", - Key: key, - ExpectEvents: []rtesting.Event{ - rtesting.NewEvent(parent, scheme, corev1.EventTypeNormal, "StatusUpdated", `Updated status`), + }). + StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { + d.ConditionsDie( + dieconventionsv1alpha1.PodIntentConditionConventionsAppliedBlank. + Status(metav1.ConditionFalse). + Reason("ImageResolutionFailed"). + Message("failed to authenticate: serviceaccounts \"wrong-sa\" not found"), + dieconventionsv1alpha1.PodIntentConditionReadyBlank. + Status(metav1.ConditionFalse). + Reason("ImageResolutionFailed"). + Message("failed to authenticate: serviceaccounts \"wrong-sa\" not found"), + ) + }), + }, }, - GivenObjects: []client.Object{ - parent. - SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { - d.ServiceAccountName(saWithSecret) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + "ServiceAccount not present in api reader(unlikely)": { + Request: request, + StatusSubResourceTypes: []client.Object{ + &conventionsv1alpha1.PodIntent{}, + }, + ExpectEvents: []rtesting.Event{ + rtesting.NewEvent(parent, scheme, corev1.EventTypeNormal, "StatusUpdated", `Updated status`), + }, + GivenObjects: []client.Object{ + parent. + SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { + d.ServiceAccountName(saWithSecret) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }), - }, - ExpectStatusUpdates: []client.Object{ - parent. - SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { - d.ServiceAccountName(saWithSecret) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }), + }, + ExpectStatusUpdates: []client.Object{ + parent. + SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { + d.ServiceAccountName(saWithSecret) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }). - StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { - d.ConditionsDie( - dieconventionsv1alpha1.PodIntentConditionConventionsAppliedBlank. - Status(metav1.ConditionFalse). - Reason("ImageResolutionFailed"). - Message("failed to authenticate: serviceaccounts \"test-sa-with-secret\" not found"), - dieconventionsv1alpha1.PodIntentConditionReadyBlank. - Status(metav1.ConditionFalse). - Reason("ImageResolutionFailed"). - Message("failed to authenticate: serviceaccounts \"test-sa-with-secret\" not found"), - ) - }), - }, - ExpectTracks: []rtesting.TrackRequest{ - rtesting.NewTrackRequest(sa, parent, scheme), - }, - }, { - Name: "secret not present in namespace", - Key: key, - ExpectEvents: []rtesting.Event{ - rtesting.NewEvent(parent, scheme, corev1.EventTypeNormal, "StatusUpdated", `Updated status`), + }). + StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { + d.ConditionsDie( + dieconventionsv1alpha1.PodIntentConditionConventionsAppliedBlank. + Status(metav1.ConditionFalse). + Reason("ImageResolutionFailed"). + Message("failed to authenticate: serviceaccounts \"test-sa-with-secret\" not found"), + dieconventionsv1alpha1.PodIntentConditionReadyBlank. + Status(metav1.ConditionFalse). + Reason("ImageResolutionFailed"). + Message("failed to authenticate: serviceaccounts \"test-sa-with-secret\" not found"), + ) + }), + }, + ExpectTracks: []rtesting.TrackRequest{ + rtesting.NewTrackRequest(sa, parent, scheme), + }, }, - ExpectStatusUpdates: []client.Object{ - parent. - SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { - d.ImagePullSecretsDie( - diecorev1.LocalObjectReferenceBlank.Name("wrong-secret"), - ) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + "secret not present in namespace": { + Request: request, + StatusSubResourceTypes: []client.Object{ + &conventionsv1alpha1.PodIntent{}, + }, + ExpectEvents: []rtesting.Event{ + rtesting.NewEvent(parent, scheme, corev1.EventTypeNormal, "StatusUpdated", `Updated status`), + }, + ExpectStatusUpdates: []client.Object{ + parent. + SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { + d.ImagePullSecretsDie( + diecorev1.LocalObjectReferenceBlank.Name("wrong-secret"), + ) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }). - StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { - d.ConditionsDie( - dieconventionsv1alpha1.PodIntentConditionConventionsAppliedBlank. - Status(metav1.ConditionFalse). - Reason("ImageResolutionFailed"). - Message("failed to authenticate: secrets \"wrong-secret\" not found"), - dieconventionsv1alpha1.PodIntentConditionReadyBlank. - Status(metav1.ConditionFalse). - Reason("ImageResolutionFailed"). - Message("failed to authenticate: secrets \"wrong-secret\" not found"), - ) - }), - }, - GivenObjects: []client.Object{ - parent. - SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { - d.ImagePullSecretsDie( - diecorev1.LocalObjectReferenceBlank.Name("wrong-secret"), - ) - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.SpecDie(func(d *diecorev1.PodSpecDie) { - d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { - d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }). + StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { + d.ConditionsDie( + dieconventionsv1alpha1.PodIntentConditionConventionsAppliedBlank. + Status(metav1.ConditionFalse). + Reason("ImageResolutionFailed"). + Message("failed to authenticate: secrets \"wrong-secret\" not found"), + dieconventionsv1alpha1.PodIntentConditionReadyBlank. + Status(metav1.ConditionFalse). + Reason("ImageResolutionFailed"). + Message("failed to authenticate: secrets \"wrong-secret\" not found"), + ) + }), + }, + GivenObjects: []client.Object{ + parent. + SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { + d.ImagePullSecretsDie( + diecorev1.LocalObjectReferenceBlank.Name("wrong-secret"), + ) + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.SpecDie(func(d *diecorev1.PodSpecDie) { + d.ContainerDie("workload", func(d *diecorev1.ContainerDie) { + d.Image(fmt.Sprintf("%s/hello", registryUrl.Host)) + }) }) }) - }) - }), - }, - ExpectTracks: []rtesting.TrackRequest{ - rtesting.NewTrackRequest(absentSecret, parent, scheme), + }), + }, + ExpectTracks: []rtesting.TrackRequest{ + rtesting.NewTrackRequest(absentSecret, parent, scheme), + }, }, - }} + } rts.Run(t, scheme, func(t *testing.T, rtc *rtesting.ReconcilerTestCase, c reconcilers.Config) reconcile.Reconciler { return controllers.PodIntentReconciler(c, wc, rc) }) @@ -615,10 +632,9 @@ func TestResolveConventions(t *testing.T) { _ = conventionsv1alpha1.AddToScheme(scheme) _ = certmanagerv1.AddToScheme(scheme) - rts := rtesting.SubReconcilerTestSuite{ - { - Name: "stash convention", - Resource: parent, + rts := rtesting.SubReconcilerTests[*conventionsv1alpha1.PodIntent]{ + "stash convention": { + Resource: parent.DieReleasePtr(), GivenObjects: []client.Object{ certReq. MetadataDie(func(d *diemetav1.ObjectMetaDie) { @@ -649,7 +665,7 @@ func TestResolveConventions(t *testing.T) { }) }), }, - ExpectResource: parent, + ExpectResource: parent.DieReleasePtr(), ExpectStashedValues: map[reconcilers.StashKey]interface{}{ controllers.ConventionsStashKey: []binding.Convention{ { @@ -663,9 +679,9 @@ func TestResolveConventions(t *testing.T) { ClientConfig: admissionregistrationv1.WebhookClientConfig{Service: serviceReference, CABundle: BadCACert}, }}, }, - }, { - Name: "error loading conventions", - Resource: parent, + }, + "error loading conventions": { + Resource: parent.DieReleasePtr(), GivenObjects: []client.Object{ testConvention. MetadataDie(func(d *diemetav1.ObjectMetaDie) { @@ -692,13 +708,13 @@ func TestResolveConventions(t *testing.T) { rtesting.InduceFailure("list", "clusterpodconventionlist"), }, ShouldErr: true, - ExpectResource: parent, + ExpectResource: parent.DieReleasePtr(), ExpectStashedValues: map[reconcilers.StashKey]interface{}{ controllers.ConventionsStashKey: nil, }, - }, { - Name: "use three most recent ready CAs", - Resource: parent, + }, + "use three most recent ready CAs": { + Resource: parent.DieReleasePtr(), GivenObjects: []client.Object{ certReq. MetadataDie(func(d *diemetav1.ObjectMetaDie) { @@ -775,7 +791,7 @@ func TestResolveConventions(t *testing.T) { }) }), }, - ExpectResource: parent, + ExpectResource: parent.DieReleasePtr(), ExpectStashedValues: map[reconcilers.StashKey]interface{}{ controllers.ConventionsStashKey: []binding.Convention{ { @@ -789,9 +805,9 @@ func TestResolveConventions(t *testing.T) { ClientConfig: admissionregistrationv1.WebhookClientConfig{Service: serviceReference, CABundle: []byte("5\n4\n3\n")}, }}, }, - }, { - Name: "cert request not present", - Resource: parent, + }, + "cert request not present": { + Resource: parent.DieReleasePtr(), GivenObjects: []client.Object{ testConvention. MetadataDie(func(d *diemetav1.ObjectMetaDie) { @@ -821,13 +837,14 @@ func TestResolveConventions(t *testing.T) { Reason("CABundleResolutionFailed"). Message(`failed to authenticate: unable to find valid certificaterequests for certificate "ns/wrong-ca" configured in convention "test-convention"`), ) - }), + }). + DieReleasePtr(), ExpectStashedValues: map[reconcilers.StashKey]interface{}{ controllers.ConventionsStashKey: nil, }, - }, { - Name: "cert request not owned by cert", - Resource: parent, + }, + "cert request not owned by cert": { + Resource: parent.DieReleasePtr(), GivenObjects: []client.Object{ certReq. MetadataDie(func(d *diemetav1.ObjectMetaDie) { @@ -861,13 +878,14 @@ func TestResolveConventions(t *testing.T) { Reason("CABundleResolutionFailed"). Message(`failed to authenticate: unable to find valid certificaterequests for certificate "test-namespace/my-cert" configured in convention "test-convention"`), ) - }), + }). + DieReleasePtr(), ExpectStashedValues: map[reconcilers.StashKey]interface{}{ controllers.ConventionsStashKey: nil, }, - }, { - Name: "cert request not ready", - Resource: parent, + }, + "cert request not ready": { + Resource: parent.DieReleasePtr(), GivenObjects: []client.Object{ certReq. StatusDie(func(d *diecertmanagerv1.CertificateRequestStatusDie) { @@ -903,13 +921,14 @@ func TestResolveConventions(t *testing.T) { Reason("CABundleResolutionFailed"). Message(`failed to authenticate: unable to find valid certificaterequests for certificate "test-namespace/my-cert" configured in convention "test-convention"`), ) - }), + }). + DieReleasePtr(), ExpectStashedValues: map[reconcilers.StashKey]interface{}{ controllers.ConventionsStashKey: nil, }, - }, { - Name: "cert request no ca", - Resource: parent, + }, + "cert request no ca": { + Resource: parent.DieReleasePtr(), GivenObjects: []client.Object{ certReq. StatusDie(func(d *diecertmanagerv1.CertificateRequestStatusDie) { @@ -945,14 +964,15 @@ func TestResolveConventions(t *testing.T) { Reason("CABundleResolutionFailed"). Message(`failed to authenticate: unable to find valid certificaterequests for certificate "test-namespace/my-cert" configured in convention "test-convention"`), ) - }), + }). + DieReleasePtr(), ExpectStashedValues: map[reconcilers.StashKey]interface{}{ controllers.ConventionsStashKey: nil, }, }, } - rts.Run(t, scheme, func(t *testing.T, rtc *rtesting.SubReconcilerTestCase, c reconcilers.Config) reconcilers.SubReconciler { + rts.Run(t, scheme, func(t *testing.T, rtc *rtesting.SubReconcilerTestCase[*conventionsv1alpha1.PodIntent], c reconcilers.Config) reconcilers.SubReconciler[*conventionsv1alpha1.PodIntent] { return controllers.ResolveConventions() }) } @@ -1021,7 +1041,7 @@ func TestApplyConventionsReconciler(t *testing.T) { if err != nil { t.Fatalf("Unable to create k8s auth chain %v", err) } - dir, err := ioutil.TempDir("", "ggcr-cache") + dir, err := os.MkdirTemp(os.TempDir(), "ggcr-cache") if err != nil { t.Fatalf("Unable to create temp dir %v", err) } @@ -1043,10 +1063,9 @@ func TestApplyConventionsReconciler(t *testing.T) { t.Fatalf("Error pushing hello.tar.gz: %v", err) } - rts := rtesting.SubReconcilerTestSuite{ - { - Name: "resolved from service", - Resource: workload, + rts := rtesting.SubReconcilerTests[*conventionsv1alpha1.PodIntent]{ + "resolved from service": { + Resource: workload.DieReleasePtr(), GivenStashedValues: map[reconcilers.StashKey]interface{}{ controllers.RegistryConfigKey: rc, controllers.ConventionsStashKey: []binding.Convention{ @@ -1086,10 +1105,10 @@ func TestApplyConventionsReconciler(t *testing.T) { Status(metav1.ConditionTrue). Reason("ConventionsApplied"), ) - }), + }). + DieReleasePtr(), }, - { - Name: "selector target and matcher defined matcheslabels in podTemplateSpec values", + "selector target and matcher defined matcheslabels in podTemplateSpec values": { Resource: workload. SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { @@ -1101,7 +1120,8 @@ func TestApplyConventionsReconciler(t *testing.T) { }). MetadataDie(func(d *diemetav1.ObjectMetaDie) { d.AddLabel("environment", "development") - }), + }). + DieReleasePtr(), GivenStashedValues: map[reconcilers.StashKey]interface{}{ controllers.RegistryConfigKey: rc, controllers.ConventionsStashKey: []binding.Convention{ @@ -1116,7 +1136,7 @@ func TestApplyConventionsReconciler(t *testing.T) { Service: &admissionregistrationv1.ServiceReference{ Namespace: "default", Name: "webhook-test", - Path: rtesting.StringPtr(fmt.Sprintf("hellosidecar;host=%s", registryUrl.Host)), + Path: pointer.String(fmt.Sprintf("hellosidecar;host=%s", registryUrl.Host)), }, CABundle: caCert, }, @@ -1132,7 +1152,7 @@ func TestApplyConventionsReconciler(t *testing.T) { Service: &admissionregistrationv1.ServiceReference{ Namespace: "default", Name: "non-matching-webhook", - Path: rtesting.StringPtr(fmt.Sprintf("hellosidecar;host=%s", registryUrl.Host)), + Path: pointer.String(fmt.Sprintf("hellosidecar;host=%s", registryUrl.Host)), }, CABundle: caCert, }, @@ -1147,9 +1167,10 @@ func TestApplyConventionsReconciler(t *testing.T) { d.AddLabel("zoo", "zebra") }) }) - }).MetadataDie(func(d *diemetav1.ObjectMetaDie) { - d.AddLabel("environment", "development") - }). + }). + MetadataDie(func(d *diemetav1.ObjectMetaDie) { + d.AddLabel("environment", "development") + }). StatusDie(func(d *dieconventionsv1alpha1.PodIntentStatusDie) { d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { d.MetadataDie(func(d *diemetav1.ObjectMetaDie) { @@ -1172,20 +1193,22 @@ func TestApplyConventionsReconciler(t *testing.T) { Status(metav1.ConditionTrue). Reason("ConventionsApplied"), ) - }), + }). + DieReleasePtr(), }, - { - Name: "multiple selector targets and matching labels exist on specified target", + "multiple selector targets and matching labels exist on specified target": { Resource: workload. MetadataDie(func(d *diemetav1.ObjectMetaDie) { d.AddLabel("intentselector", "true") - }).SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { - d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { - d.MetadataDie(func(d *diemetav1.ObjectMetaDie) { - d.AddLabel("zoo", "zebra") + }). + SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { + d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { + d.MetadataDie(func(d *diemetav1.ObjectMetaDie) { + d.AddLabel("zoo", "zebra") + }) }) - }) - }), + }). + DieReleasePtr(), GivenStashedValues: map[reconcilers.StashKey]interface{}{ controllers.RegistryConfigKey: rc, controllers.ConventionsStashKey: []binding.Convention{ @@ -1215,7 +1238,7 @@ func TestApplyConventionsReconciler(t *testing.T) { Service: &admissionregistrationv1.ServiceReference{ Namespace: "default", Name: "webhook-test", - Path: rtesting.StringPtr(fmt.Sprintf("hellosidecar;host=%s", registryUrl.Host)), + Path: pointer.String(fmt.Sprintf("hellosidecar;host=%s", registryUrl.Host)), }, CABundle: caCert, }, @@ -1231,7 +1254,7 @@ func TestApplyConventionsReconciler(t *testing.T) { Service: &admissionregistrationv1.ServiceReference{ Namespace: "default", Name: "webhook-test", - Path: rtesting.StringPtr("labelonly"), + Path: pointer.String("labelonly"), }, CABundle: caCert, }, @@ -1273,11 +1296,11 @@ func TestApplyConventionsReconciler(t *testing.T) { Status(metav1.ConditionTrue). Reason("ConventionsApplied"), ) - }), + }). + DieReleasePtr(), }, - { - Name: "apply all conventions if no convnetion matchers are set and no matching labels are available on the pod intent", - Resource: workload, + "apply all conventions if no convnetion matchers are set and no matching labels are available on the pod intent": { + Resource: workload.DieReleasePtr(), GivenStashedValues: map[reconcilers.StashKey]interface{}{ controllers.RegistryConfigKey: rc, controllers.ConventionsStashKey: []binding.Convention{ @@ -1301,7 +1324,7 @@ func TestApplyConventionsReconciler(t *testing.T) { Service: &admissionregistrationv1.ServiceReference{ Namespace: "default", Name: "webhook-test", - Path: rtesting.StringPtr(fmt.Sprintf("hellosidecar;host=%s", registryUrl.Host)), + Path: pointer.String(fmt.Sprintf("hellosidecar;host=%s", registryUrl.Host)), }, CABundle: caCert, }, @@ -1335,11 +1358,11 @@ func TestApplyConventionsReconciler(t *testing.T) { Status(metav1.ConditionTrue). Reason("ConventionsApplied"), ) - }), + }). + DieReleasePtr(), }, - { - Name: "bad matching expression", - Resource: workload, + "bad matching expression": { + Resource: workload.DieReleasePtr(), GivenStashedValues: map[reconcilers.StashKey]interface{}{ controllers.RegistryConfigKey: rc, controllers.ConventionsStashKey: []binding.Convention{ @@ -1372,10 +1395,10 @@ func TestApplyConventionsReconciler(t *testing.T) { Reason("LabelSelector"). Message("filtering conventions failed: converting label selector for clusterPodConvention \"my-conventions\" failed: key: Invalid value: \"\": name part must be non-empty; name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]')"), ) - }), + }). + DieReleasePtr(), }, - { - Name: "error applying conventions", + "error applying conventions": { Resource: workload. SpecDie(func(d *dieconventionsv1alpha1.PodIntentSpecDie) { d.TemplateDie(func(d *diecorev1.PodTemplateSpecDie) { @@ -1385,7 +1408,8 @@ func TestApplyConventionsReconciler(t *testing.T) { }) }) }) - }), + }). + DieReleasePtr(), GivenStashedValues: map[reconcilers.StashKey]interface{}{ controllers.ConventionsStashKey: []binding.Convention{ { @@ -1423,11 +1447,12 @@ func TestApplyConventionsReconciler(t *testing.T) { Reason("ConventionsApplied"). Message("fetching metadata for Images failed: image: \"ubuntu\" error: registry config keys are not set"), ) - }), + }). + DieReleasePtr(), }, } - rts.Run(t, scheme, func(t *testing.T, rtc *rtesting.SubReconcilerTestCase, c reconcilers.Config) reconcilers.SubReconciler { + rts.Run(t, scheme, func(t *testing.T, rtc *rtesting.SubReconcilerTestCase[*conventionsv1alpha1.PodIntent], c reconcilers.Config) reconcilers.SubReconciler[*conventionsv1alpha1.PodIntent] { return controllers.ApplyConventionsReconciler(wc) }) } @@ -1485,13 +1510,14 @@ func TestNilClientBuildRegistryConfig(t *testing.T) { d.CreationTimestamp(now) }) - rts := rtesting.SubReconcilerTestSuite{{ - Name: "empty client", - Resource: parent, - ShouldErr: true, - }} + rts := rtesting.SubReconcilerTests[*conventionsv1alpha1.PodIntent]{ + "empty client": { + Resource: parent.DieReleasePtr(), + ShouldErr: true, + }, + } rc := binding.RegistryConfig{} - rts.Run(t, scheme, func(t *testing.T, rtc *rtesting.SubReconcilerTestCase, c reconcilers.Config) reconcilers.SubReconciler { + rts.Run(t, scheme, func(t *testing.T, rtc *rtesting.SubReconcilerTestCase[*conventionsv1alpha1.PodIntent], c reconcilers.Config) reconcilers.SubReconciler[*conventionsv1alpha1.PodIntent] { return controllers.BuildRegistryConfig(rc) }) } diff --git a/pkg/dies/cert-manager/v1/zz_generated.die.go b/pkg/dies/cert-manager/v1/zz_generated.die.go index 5ac11a0b..065d1469 100644 --- a/pkg/dies/cert-manager/v1/zz_generated.die.go +++ b/pkg/dies/cert-manager/v1/zz_generated.die.go @@ -24,6 +24,8 @@ package v1alpha1 import ( json "encoding/json" fmtx "fmt" + osx "os" + reflectx "reflect" metav1 "dies.dev/apis/meta/v1" corev1 "k8s.io/api/core/v1" @@ -31,6 +33,8 @@ import ( unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" + jsonpath "k8s.io/client-go/util/jsonpath" + yaml "sigs.k8s.io/yaml" v1 "github.com/vmware-tanzu/cartographer-conventions/pkg/apis/thirdparty/cert-manager/v1" ) @@ -75,14 +79,42 @@ func (d *CertificateRequestDie) DieFeedPtr(r *v1.CertificateRequest) *Certificat return d.DieFeed(*r) } -// DieFeedRawExtension returns the resource managed by the die as an raw extension. -func (d *CertificateRequestDie) DieFeedRawExtension(raw runtime.RawExtension) *CertificateRequestDie { - b, _ := json.Marshal(raw) +// DieFeedJSON returns a new die with the provided JSON. Panics on error. +func (d *CertificateRequestDie) DieFeedJSON(j []byte) *CertificateRequestDie { r := v1.CertificateRequest{} - _ = json.Unmarshal(b, &r) + if err := json.Unmarshal(j, &r); err != nil { + panic(err) + } return d.DieFeed(r) } +// DieFeedYAML returns a new die with the provided YAML. Panics on error. +func (d *CertificateRequestDie) DieFeedYAML(y []byte) *CertificateRequestDie { + r := v1.CertificateRequest{} + if err := yaml.Unmarshal(y, &r); err != nil { + panic(err) + } + return d.DieFeed(r) +} + +// DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error. +func (d *CertificateRequestDie) DieFeedYAMLFile(name string) *CertificateRequestDie { + y, err := osx.ReadFile(name) + if err != nil { + panic(err) + } + return d.DieFeedYAML(y) +} + +// DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *CertificateRequestDie) DieFeedRawExtension(raw runtime.RawExtension) *CertificateRequestDie { + j, err := json.Marshal(raw) + if err != nil { + panic(err) + } + return d.DieFeedJSON(j) +} + // DieRelease returns the resource managed by the die. func (d *CertificateRequestDie) DieRelease() v1.CertificateRequest { if d.mutable { @@ -97,21 +129,45 @@ func (d *CertificateRequestDie) DieReleasePtr() *v1.CertificateRequest { return &r } -// DieReleaseUnstructured returns the resource managed by the die as an unstructured object. +// DieReleaseUnstructured returns the resource managed by the die as an unstructured object. Panics on error. func (d *CertificateRequestDie) DieReleaseUnstructured() *unstructured.Unstructured { r := d.DieReleasePtr() - u, _ := runtime.DefaultUnstructuredConverter.ToUnstructured(r) + u, err := runtime.DefaultUnstructuredConverter.ToUnstructured(r) + if err != nil { + panic(err) + } return &unstructured.Unstructured{ Object: u, } } -// DieReleaseRawExtension returns the resource managed by the die as an raw extension. -func (d *CertificateRequestDie) DieReleaseRawExtension() runtime.RawExtension { +// DieReleaseJSON returns the resource managed by the die as JSON. Panics on error. +func (d *CertificateRequestDie) DieReleaseJSON() []byte { r := d.DieReleasePtr() - b, _ := json.Marshal(r) + j, err := json.Marshal(r) + if err != nil { + panic(err) + } + return j +} + +// DieReleaseYAML returns the resource managed by the die as YAML. Panics on error. +func (d *CertificateRequestDie) DieReleaseYAML() []byte { + r := d.DieReleasePtr() + y, err := yaml.Marshal(r) + if err != nil { + panic(err) + } + return y +} + +// DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *CertificateRequestDie) DieReleaseRawExtension() runtime.RawExtension { + j := d.DieReleaseJSON() raw := runtime.RawExtension{} - _ = json.Unmarshal(b, &raw) + if err := json.Unmarshal(j, &raw); err != nil { + panic(err) + } return raw } @@ -122,6 +178,27 @@ func (d *CertificateRequestDie) DieStamp(fn func(r *v1.CertificateRequest)) *Cer return d.DieFeed(r) } +// Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type as found on the resource at the target location. +// +// Future iterations will improve type coercion from the resource to the callback argument. +func (d *CertificateRequestDie) DieStampAt(jp string, fn interface{}) *CertificateRequestDie { + return d.DieStamp(func(r *v1.CertificateRequest) { + cp := jsonpath.New("") + if err := cp.Parse(fmtx.Sprintf("{%s}", jp)); err != nil { + panic(err) + } + cr, err := cp.FindResults(r) + if err != nil { + // errors are expected if a path is not found + return + } + for _, cv := range cr[0] { + args := []reflectx.Value{cv} + reflectx.ValueOf(fn).Call(args) + } + }) +} + // DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die. func (d *CertificateRequestDie) DeepCopy() *CertificateRequestDie { r := *d.r.DeepCopy() @@ -252,14 +329,42 @@ func (d *CertificateRequestSpecDie) DieFeedPtr(r *v1.CertificateRequestSpec) *Ce return d.DieFeed(*r) } -// DieFeedRawExtension returns the resource managed by the die as an raw extension. -func (d *CertificateRequestSpecDie) DieFeedRawExtension(raw runtime.RawExtension) *CertificateRequestSpecDie { - b, _ := json.Marshal(raw) +// DieFeedJSON returns a new die with the provided JSON. Panics on error. +func (d *CertificateRequestSpecDie) DieFeedJSON(j []byte) *CertificateRequestSpecDie { r := v1.CertificateRequestSpec{} - _ = json.Unmarshal(b, &r) + if err := json.Unmarshal(j, &r); err != nil { + panic(err) + } return d.DieFeed(r) } +// DieFeedYAML returns a new die with the provided YAML. Panics on error. +func (d *CertificateRequestSpecDie) DieFeedYAML(y []byte) *CertificateRequestSpecDie { + r := v1.CertificateRequestSpec{} + if err := yaml.Unmarshal(y, &r); err != nil { + panic(err) + } + return d.DieFeed(r) +} + +// DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error. +func (d *CertificateRequestSpecDie) DieFeedYAMLFile(name string) *CertificateRequestSpecDie { + y, err := osx.ReadFile(name) + if err != nil { + panic(err) + } + return d.DieFeedYAML(y) +} + +// DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *CertificateRequestSpecDie) DieFeedRawExtension(raw runtime.RawExtension) *CertificateRequestSpecDie { + j, err := json.Marshal(raw) + if err != nil { + panic(err) + } + return d.DieFeedJSON(j) +} + // DieRelease returns the resource managed by the die. func (d *CertificateRequestSpecDie) DieRelease() v1.CertificateRequestSpec { if d.mutable { @@ -274,12 +379,33 @@ func (d *CertificateRequestSpecDie) DieReleasePtr() *v1.CertificateRequestSpec { return &r } -// DieReleaseRawExtension returns the resource managed by the die as an raw extension. -func (d *CertificateRequestSpecDie) DieReleaseRawExtension() runtime.RawExtension { +// DieReleaseJSON returns the resource managed by the die as JSON. Panics on error. +func (d *CertificateRequestSpecDie) DieReleaseJSON() []byte { + r := d.DieReleasePtr() + j, err := json.Marshal(r) + if err != nil { + panic(err) + } + return j +} + +// DieReleaseYAML returns the resource managed by the die as YAML. Panics on error. +func (d *CertificateRequestSpecDie) DieReleaseYAML() []byte { r := d.DieReleasePtr() - b, _ := json.Marshal(r) + y, err := yaml.Marshal(r) + if err != nil { + panic(err) + } + return y +} + +// DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *CertificateRequestSpecDie) DieReleaseRawExtension() runtime.RawExtension { + j := d.DieReleaseJSON() raw := runtime.RawExtension{} - _ = json.Unmarshal(b, &raw) + if err := json.Unmarshal(j, &raw); err != nil { + panic(err) + } return raw } @@ -290,6 +416,27 @@ func (d *CertificateRequestSpecDie) DieStamp(fn func(r *v1.CertificateRequestSpe return d.DieFeed(r) } +// Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type as found on the resource at the target location. +// +// Future iterations will improve type coercion from the resource to the callback argument. +func (d *CertificateRequestSpecDie) DieStampAt(jp string, fn interface{}) *CertificateRequestSpecDie { + return d.DieStamp(func(r *v1.CertificateRequestSpec) { + cp := jsonpath.New("") + if err := cp.Parse(fmtx.Sprintf("{%s}", jp)); err != nil { + panic(err) + } + cr, err := cp.FindResults(r) + if err != nil { + // errors are expected if a path is not found + return + } + for _, cv := range cr[0] { + args := []reflectx.Value{cv} + reflectx.ValueOf(fn).Call(args) + } + }) +} + // DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die. func (d *CertificateRequestSpecDie) DeepCopy() *CertificateRequestSpecDie { r := *d.r.DeepCopy() @@ -399,14 +546,42 @@ func (d *CertificateRequestStatusDie) DieFeedPtr(r *v1.CertificateRequestStatus) return d.DieFeed(*r) } -// DieFeedRawExtension returns the resource managed by the die as an raw extension. -func (d *CertificateRequestStatusDie) DieFeedRawExtension(raw runtime.RawExtension) *CertificateRequestStatusDie { - b, _ := json.Marshal(raw) +// DieFeedJSON returns a new die with the provided JSON. Panics on error. +func (d *CertificateRequestStatusDie) DieFeedJSON(j []byte) *CertificateRequestStatusDie { + r := v1.CertificateRequestStatus{} + if err := json.Unmarshal(j, &r); err != nil { + panic(err) + } + return d.DieFeed(r) +} + +// DieFeedYAML returns a new die with the provided YAML. Panics on error. +func (d *CertificateRequestStatusDie) DieFeedYAML(y []byte) *CertificateRequestStatusDie { r := v1.CertificateRequestStatus{} - _ = json.Unmarshal(b, &r) + if err := yaml.Unmarshal(y, &r); err != nil { + panic(err) + } return d.DieFeed(r) } +// DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error. +func (d *CertificateRequestStatusDie) DieFeedYAMLFile(name string) *CertificateRequestStatusDie { + y, err := osx.ReadFile(name) + if err != nil { + panic(err) + } + return d.DieFeedYAML(y) +} + +// DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *CertificateRequestStatusDie) DieFeedRawExtension(raw runtime.RawExtension) *CertificateRequestStatusDie { + j, err := json.Marshal(raw) + if err != nil { + panic(err) + } + return d.DieFeedJSON(j) +} + // DieRelease returns the resource managed by the die. func (d *CertificateRequestStatusDie) DieRelease() v1.CertificateRequestStatus { if d.mutable { @@ -421,12 +596,33 @@ func (d *CertificateRequestStatusDie) DieReleasePtr() *v1.CertificateRequestStat return &r } -// DieReleaseRawExtension returns the resource managed by the die as an raw extension. -func (d *CertificateRequestStatusDie) DieReleaseRawExtension() runtime.RawExtension { +// DieReleaseJSON returns the resource managed by the die as JSON. Panics on error. +func (d *CertificateRequestStatusDie) DieReleaseJSON() []byte { r := d.DieReleasePtr() - b, _ := json.Marshal(r) + j, err := json.Marshal(r) + if err != nil { + panic(err) + } + return j +} + +// DieReleaseYAML returns the resource managed by the die as YAML. Panics on error. +func (d *CertificateRequestStatusDie) DieReleaseYAML() []byte { + r := d.DieReleasePtr() + y, err := yaml.Marshal(r) + if err != nil { + panic(err) + } + return y +} + +// DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *CertificateRequestStatusDie) DieReleaseRawExtension() runtime.RawExtension { + j := d.DieReleaseJSON() raw := runtime.RawExtension{} - _ = json.Unmarshal(b, &raw) + if err := json.Unmarshal(j, &raw); err != nil { + panic(err) + } return raw } @@ -437,6 +633,27 @@ func (d *CertificateRequestStatusDie) DieStamp(fn func(r *v1.CertificateRequestS return d.DieFeed(r) } +// Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type as found on the resource at the target location. +// +// Future iterations will improve type coercion from the resource to the callback argument. +func (d *CertificateRequestStatusDie) DieStampAt(jp string, fn interface{}) *CertificateRequestStatusDie { + return d.DieStamp(func(r *v1.CertificateRequestStatus) { + cp := jsonpath.New("") + if err := cp.Parse(fmtx.Sprintf("{%s}", jp)); err != nil { + panic(err) + } + cr, err := cp.FindResults(r) + if err != nil { + // errors are expected if a path is not found + return + } + for _, cv := range cr[0] { + args := []reflectx.Value{cv} + reflectx.ValueOf(fn).Call(args) + } + }) +} + // DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die. func (d *CertificateRequestStatusDie) DeepCopy() *CertificateRequestStatusDie { r := *d.r.DeepCopy() diff --git a/pkg/dies/conventions/v1alpha1/zz_generated.die.go b/pkg/dies/conventions/v1alpha1/zz_generated.die.go index 50ead3c0..ba7b21d9 100644 --- a/pkg/dies/conventions/v1alpha1/zz_generated.die.go +++ b/pkg/dies/conventions/v1alpha1/zz_generated.die.go @@ -24,6 +24,8 @@ package v1alpha1 import ( json "encoding/json" fmtx "fmt" + osx "os" + reflectx "reflect" v1 "dies.dev/apis/meta/v1" apis "github.com/vmware-labs/reconciler-runtime/apis" @@ -33,6 +35,8 @@ import ( unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" + jsonpath "k8s.io/client-go/util/jsonpath" + yaml "sigs.k8s.io/yaml" conventionsv1alpha1 "github.com/vmware-tanzu/cartographer-conventions/pkg/apis/conventions/v1alpha1" ) @@ -77,14 +81,42 @@ func (d *ClusterPodConventionDie) DieFeedPtr(r *conventionsv1alpha1.ClusterPodCo return d.DieFeed(*r) } -// DieFeedRawExtension returns the resource managed by the die as an raw extension. -func (d *ClusterPodConventionDie) DieFeedRawExtension(raw runtime.RawExtension) *ClusterPodConventionDie { - b, _ := json.Marshal(raw) +// DieFeedJSON returns a new die with the provided JSON. Panics on error. +func (d *ClusterPodConventionDie) DieFeedJSON(j []byte) *ClusterPodConventionDie { r := conventionsv1alpha1.ClusterPodConvention{} - _ = json.Unmarshal(b, &r) + if err := json.Unmarshal(j, &r); err != nil { + panic(err) + } + return d.DieFeed(r) +} + +// DieFeedYAML returns a new die with the provided YAML. Panics on error. +func (d *ClusterPodConventionDie) DieFeedYAML(y []byte) *ClusterPodConventionDie { + r := conventionsv1alpha1.ClusterPodConvention{} + if err := yaml.Unmarshal(y, &r); err != nil { + panic(err) + } return d.DieFeed(r) } +// DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error. +func (d *ClusterPodConventionDie) DieFeedYAMLFile(name string) *ClusterPodConventionDie { + y, err := osx.ReadFile(name) + if err != nil { + panic(err) + } + return d.DieFeedYAML(y) +} + +// DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *ClusterPodConventionDie) DieFeedRawExtension(raw runtime.RawExtension) *ClusterPodConventionDie { + j, err := json.Marshal(raw) + if err != nil { + panic(err) + } + return d.DieFeedJSON(j) +} + // DieRelease returns the resource managed by the die. func (d *ClusterPodConventionDie) DieRelease() conventionsv1alpha1.ClusterPodConvention { if d.mutable { @@ -99,21 +131,45 @@ func (d *ClusterPodConventionDie) DieReleasePtr() *conventionsv1alpha1.ClusterPo return &r } -// DieReleaseUnstructured returns the resource managed by the die as an unstructured object. +// DieReleaseUnstructured returns the resource managed by the die as an unstructured object. Panics on error. func (d *ClusterPodConventionDie) DieReleaseUnstructured() *unstructured.Unstructured { r := d.DieReleasePtr() - u, _ := runtime.DefaultUnstructuredConverter.ToUnstructured(r) + u, err := runtime.DefaultUnstructuredConverter.ToUnstructured(r) + if err != nil { + panic(err) + } return &unstructured.Unstructured{ Object: u, } } -// DieReleaseRawExtension returns the resource managed by the die as an raw extension. -func (d *ClusterPodConventionDie) DieReleaseRawExtension() runtime.RawExtension { +// DieReleaseJSON returns the resource managed by the die as JSON. Panics on error. +func (d *ClusterPodConventionDie) DieReleaseJSON() []byte { + r := d.DieReleasePtr() + j, err := json.Marshal(r) + if err != nil { + panic(err) + } + return j +} + +// DieReleaseYAML returns the resource managed by the die as YAML. Panics on error. +func (d *ClusterPodConventionDie) DieReleaseYAML() []byte { r := d.DieReleasePtr() - b, _ := json.Marshal(r) + y, err := yaml.Marshal(r) + if err != nil { + panic(err) + } + return y +} + +// DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *ClusterPodConventionDie) DieReleaseRawExtension() runtime.RawExtension { + j := d.DieReleaseJSON() raw := runtime.RawExtension{} - _ = json.Unmarshal(b, &raw) + if err := json.Unmarshal(j, &raw); err != nil { + panic(err) + } return raw } @@ -124,6 +180,27 @@ func (d *ClusterPodConventionDie) DieStamp(fn func(r *conventionsv1alpha1.Cluste return d.DieFeed(r) } +// Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type as found on the resource at the target location. +// +// Future iterations will improve type coercion from the resource to the callback argument. +func (d *ClusterPodConventionDie) DieStampAt(jp string, fn interface{}) *ClusterPodConventionDie { + return d.DieStamp(func(r *conventionsv1alpha1.ClusterPodConvention) { + cp := jsonpath.New("") + if err := cp.Parse(fmtx.Sprintf("{%s}", jp)); err != nil { + panic(err) + } + cr, err := cp.FindResults(r) + if err != nil { + // errors are expected if a path is not found + return + } + for _, cv := range cr[0] { + args := []reflectx.Value{cv} + reflectx.ValueOf(fn).Call(args) + } + }) +} + // DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die. func (d *ClusterPodConventionDie) DeepCopy() *ClusterPodConventionDie { r := *d.r.DeepCopy() @@ -237,14 +314,42 @@ func (d *ClusterPodConventionSpecDie) DieFeedPtr(r *conventionsv1alpha1.ClusterP return d.DieFeed(*r) } -// DieFeedRawExtension returns the resource managed by the die as an raw extension. -func (d *ClusterPodConventionSpecDie) DieFeedRawExtension(raw runtime.RawExtension) *ClusterPodConventionSpecDie { - b, _ := json.Marshal(raw) +// DieFeedJSON returns a new die with the provided JSON. Panics on error. +func (d *ClusterPodConventionSpecDie) DieFeedJSON(j []byte) *ClusterPodConventionSpecDie { r := conventionsv1alpha1.ClusterPodConventionSpec{} - _ = json.Unmarshal(b, &r) + if err := json.Unmarshal(j, &r); err != nil { + panic(err) + } return d.DieFeed(r) } +// DieFeedYAML returns a new die with the provided YAML. Panics on error. +func (d *ClusterPodConventionSpecDie) DieFeedYAML(y []byte) *ClusterPodConventionSpecDie { + r := conventionsv1alpha1.ClusterPodConventionSpec{} + if err := yaml.Unmarshal(y, &r); err != nil { + panic(err) + } + return d.DieFeed(r) +} + +// DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error. +func (d *ClusterPodConventionSpecDie) DieFeedYAMLFile(name string) *ClusterPodConventionSpecDie { + y, err := osx.ReadFile(name) + if err != nil { + panic(err) + } + return d.DieFeedYAML(y) +} + +// DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *ClusterPodConventionSpecDie) DieFeedRawExtension(raw runtime.RawExtension) *ClusterPodConventionSpecDie { + j, err := json.Marshal(raw) + if err != nil { + panic(err) + } + return d.DieFeedJSON(j) +} + // DieRelease returns the resource managed by the die. func (d *ClusterPodConventionSpecDie) DieRelease() conventionsv1alpha1.ClusterPodConventionSpec { if d.mutable { @@ -259,12 +364,33 @@ func (d *ClusterPodConventionSpecDie) DieReleasePtr() *conventionsv1alpha1.Clust return &r } -// DieReleaseRawExtension returns the resource managed by the die as an raw extension. -func (d *ClusterPodConventionSpecDie) DieReleaseRawExtension() runtime.RawExtension { +// DieReleaseJSON returns the resource managed by the die as JSON. Panics on error. +func (d *ClusterPodConventionSpecDie) DieReleaseJSON() []byte { r := d.DieReleasePtr() - b, _ := json.Marshal(r) + j, err := json.Marshal(r) + if err != nil { + panic(err) + } + return j +} + +// DieReleaseYAML returns the resource managed by the die as YAML. Panics on error. +func (d *ClusterPodConventionSpecDie) DieReleaseYAML() []byte { + r := d.DieReleasePtr() + y, err := yaml.Marshal(r) + if err != nil { + panic(err) + } + return y +} + +// DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *ClusterPodConventionSpecDie) DieReleaseRawExtension() runtime.RawExtension { + j := d.DieReleaseJSON() raw := runtime.RawExtension{} - _ = json.Unmarshal(b, &raw) + if err := json.Unmarshal(j, &raw); err != nil { + panic(err) + } return raw } @@ -275,6 +401,27 @@ func (d *ClusterPodConventionSpecDie) DieStamp(fn func(r *conventionsv1alpha1.Cl return d.DieFeed(r) } +// Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type as found on the resource at the target location. +// +// Future iterations will improve type coercion from the resource to the callback argument. +func (d *ClusterPodConventionSpecDie) DieStampAt(jp string, fn interface{}) *ClusterPodConventionSpecDie { + return d.DieStamp(func(r *conventionsv1alpha1.ClusterPodConventionSpec) { + cp := jsonpath.New("") + if err := cp.Parse(fmtx.Sprintf("{%s}", jp)); err != nil { + panic(err) + } + cr, err := cp.FindResults(r) + if err != nil { + // errors are expected if a path is not found + return + } + for _, cv := range cr[0] { + args := []reflectx.Value{cv} + reflectx.ValueOf(fn).Call(args) + } + }) +} + // DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die. func (d *ClusterPodConventionSpecDie) DeepCopy() *ClusterPodConventionSpecDie { r := *d.r.DeepCopy() @@ -346,14 +493,42 @@ func (d *ClusterPodConventionWebhookDie) DieFeedPtr(r *conventionsv1alpha1.Clust return d.DieFeed(*r) } -// DieFeedRawExtension returns the resource managed by the die as an raw extension. -func (d *ClusterPodConventionWebhookDie) DieFeedRawExtension(raw runtime.RawExtension) *ClusterPodConventionWebhookDie { - b, _ := json.Marshal(raw) +// DieFeedJSON returns a new die with the provided JSON. Panics on error. +func (d *ClusterPodConventionWebhookDie) DieFeedJSON(j []byte) *ClusterPodConventionWebhookDie { r := conventionsv1alpha1.ClusterPodConventionWebhook{} - _ = json.Unmarshal(b, &r) + if err := json.Unmarshal(j, &r); err != nil { + panic(err) + } return d.DieFeed(r) } +// DieFeedYAML returns a new die with the provided YAML. Panics on error. +func (d *ClusterPodConventionWebhookDie) DieFeedYAML(y []byte) *ClusterPodConventionWebhookDie { + r := conventionsv1alpha1.ClusterPodConventionWebhook{} + if err := yaml.Unmarshal(y, &r); err != nil { + panic(err) + } + return d.DieFeed(r) +} + +// DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error. +func (d *ClusterPodConventionWebhookDie) DieFeedYAMLFile(name string) *ClusterPodConventionWebhookDie { + y, err := osx.ReadFile(name) + if err != nil { + panic(err) + } + return d.DieFeedYAML(y) +} + +// DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *ClusterPodConventionWebhookDie) DieFeedRawExtension(raw runtime.RawExtension) *ClusterPodConventionWebhookDie { + j, err := json.Marshal(raw) + if err != nil { + panic(err) + } + return d.DieFeedJSON(j) +} + // DieRelease returns the resource managed by the die. func (d *ClusterPodConventionWebhookDie) DieRelease() conventionsv1alpha1.ClusterPodConventionWebhook { if d.mutable { @@ -368,12 +543,33 @@ func (d *ClusterPodConventionWebhookDie) DieReleasePtr() *conventionsv1alpha1.Cl return &r } -// DieReleaseRawExtension returns the resource managed by the die as an raw extension. -func (d *ClusterPodConventionWebhookDie) DieReleaseRawExtension() runtime.RawExtension { +// DieReleaseJSON returns the resource managed by the die as JSON. Panics on error. +func (d *ClusterPodConventionWebhookDie) DieReleaseJSON() []byte { r := d.DieReleasePtr() - b, _ := json.Marshal(r) + j, err := json.Marshal(r) + if err != nil { + panic(err) + } + return j +} + +// DieReleaseYAML returns the resource managed by the die as YAML. Panics on error. +func (d *ClusterPodConventionWebhookDie) DieReleaseYAML() []byte { + r := d.DieReleasePtr() + y, err := yaml.Marshal(r) + if err != nil { + panic(err) + } + return y +} + +// DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *ClusterPodConventionWebhookDie) DieReleaseRawExtension() runtime.RawExtension { + j := d.DieReleaseJSON() raw := runtime.RawExtension{} - _ = json.Unmarshal(b, &raw) + if err := json.Unmarshal(j, &raw); err != nil { + panic(err) + } return raw } @@ -384,6 +580,27 @@ func (d *ClusterPodConventionWebhookDie) DieStamp(fn func(r *conventionsv1alpha1 return d.DieFeed(r) } +// Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type as found on the resource at the target location. +// +// Future iterations will improve type coercion from the resource to the callback argument. +func (d *ClusterPodConventionWebhookDie) DieStampAt(jp string, fn interface{}) *ClusterPodConventionWebhookDie { + return d.DieStamp(func(r *conventionsv1alpha1.ClusterPodConventionWebhook) { + cp := jsonpath.New("") + if err := cp.Parse(fmtx.Sprintf("{%s}", jp)); err != nil { + panic(err) + } + cr, err := cp.FindResults(r) + if err != nil { + // errors are expected if a path is not found + return + } + for _, cv := range cr[0] { + args := []reflectx.Value{cv} + reflectx.ValueOf(fn).Call(args) + } + }) +} + // DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die. func (d *ClusterPodConventionWebhookDie) DeepCopy() *ClusterPodConventionWebhookDie { r := *d.r.DeepCopy() @@ -444,14 +661,42 @@ func (d *ClusterPodConventionWebhookCertificateDie) DieFeedPtr(r *conventionsv1a return d.DieFeed(*r) } -// DieFeedRawExtension returns the resource managed by the die as an raw extension. -func (d *ClusterPodConventionWebhookCertificateDie) DieFeedRawExtension(raw runtime.RawExtension) *ClusterPodConventionWebhookCertificateDie { - b, _ := json.Marshal(raw) +// DieFeedJSON returns a new die with the provided JSON. Panics on error. +func (d *ClusterPodConventionWebhookCertificateDie) DieFeedJSON(j []byte) *ClusterPodConventionWebhookCertificateDie { + r := conventionsv1alpha1.ClusterPodConventionWebhookCertificate{} + if err := json.Unmarshal(j, &r); err != nil { + panic(err) + } + return d.DieFeed(r) +} + +// DieFeedYAML returns a new die with the provided YAML. Panics on error. +func (d *ClusterPodConventionWebhookCertificateDie) DieFeedYAML(y []byte) *ClusterPodConventionWebhookCertificateDie { r := conventionsv1alpha1.ClusterPodConventionWebhookCertificate{} - _ = json.Unmarshal(b, &r) + if err := yaml.Unmarshal(y, &r); err != nil { + panic(err) + } return d.DieFeed(r) } +// DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error. +func (d *ClusterPodConventionWebhookCertificateDie) DieFeedYAMLFile(name string) *ClusterPodConventionWebhookCertificateDie { + y, err := osx.ReadFile(name) + if err != nil { + panic(err) + } + return d.DieFeedYAML(y) +} + +// DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *ClusterPodConventionWebhookCertificateDie) DieFeedRawExtension(raw runtime.RawExtension) *ClusterPodConventionWebhookCertificateDie { + j, err := json.Marshal(raw) + if err != nil { + panic(err) + } + return d.DieFeedJSON(j) +} + // DieRelease returns the resource managed by the die. func (d *ClusterPodConventionWebhookCertificateDie) DieRelease() conventionsv1alpha1.ClusterPodConventionWebhookCertificate { if d.mutable { @@ -466,12 +711,33 @@ func (d *ClusterPodConventionWebhookCertificateDie) DieReleasePtr() *conventions return &r } -// DieReleaseRawExtension returns the resource managed by the die as an raw extension. -func (d *ClusterPodConventionWebhookCertificateDie) DieReleaseRawExtension() runtime.RawExtension { +// DieReleaseJSON returns the resource managed by the die as JSON. Panics on error. +func (d *ClusterPodConventionWebhookCertificateDie) DieReleaseJSON() []byte { r := d.DieReleasePtr() - b, _ := json.Marshal(r) + j, err := json.Marshal(r) + if err != nil { + panic(err) + } + return j +} + +// DieReleaseYAML returns the resource managed by the die as YAML. Panics on error. +func (d *ClusterPodConventionWebhookCertificateDie) DieReleaseYAML() []byte { + r := d.DieReleasePtr() + y, err := yaml.Marshal(r) + if err != nil { + panic(err) + } + return y +} + +// DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *ClusterPodConventionWebhookCertificateDie) DieReleaseRawExtension() runtime.RawExtension { + j := d.DieReleaseJSON() raw := runtime.RawExtension{} - _ = json.Unmarshal(b, &raw) + if err := json.Unmarshal(j, &raw); err != nil { + panic(err) + } return raw } @@ -482,6 +748,27 @@ func (d *ClusterPodConventionWebhookCertificateDie) DieStamp(fn func(r *conventi return d.DieFeed(r) } +// Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type as found on the resource at the target location. +// +// Future iterations will improve type coercion from the resource to the callback argument. +func (d *ClusterPodConventionWebhookCertificateDie) DieStampAt(jp string, fn interface{}) *ClusterPodConventionWebhookCertificateDie { + return d.DieStamp(func(r *conventionsv1alpha1.ClusterPodConventionWebhookCertificate) { + cp := jsonpath.New("") + if err := cp.Parse(fmtx.Sprintf("{%s}", jp)); err != nil { + panic(err) + } + cr, err := cp.FindResults(r) + if err != nil { + // errors are expected if a path is not found + return + } + for _, cv := range cr[0] { + args := []reflectx.Value{cv} + reflectx.ValueOf(fn).Call(args) + } + }) +} + // DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die. func (d *ClusterPodConventionWebhookCertificateDie) DeepCopy() *ClusterPodConventionWebhookCertificateDie { r := *d.r.DeepCopy() @@ -543,14 +830,42 @@ func (d *PodIntentDie) DieFeedPtr(r *conventionsv1alpha1.PodIntent) *PodIntentDi return d.DieFeed(*r) } -// DieFeedRawExtension returns the resource managed by the die as an raw extension. -func (d *PodIntentDie) DieFeedRawExtension(raw runtime.RawExtension) *PodIntentDie { - b, _ := json.Marshal(raw) +// DieFeedJSON returns a new die with the provided JSON. Panics on error. +func (d *PodIntentDie) DieFeedJSON(j []byte) *PodIntentDie { + r := conventionsv1alpha1.PodIntent{} + if err := json.Unmarshal(j, &r); err != nil { + panic(err) + } + return d.DieFeed(r) +} + +// DieFeedYAML returns a new die with the provided YAML. Panics on error. +func (d *PodIntentDie) DieFeedYAML(y []byte) *PodIntentDie { r := conventionsv1alpha1.PodIntent{} - _ = json.Unmarshal(b, &r) + if err := yaml.Unmarshal(y, &r); err != nil { + panic(err) + } return d.DieFeed(r) } +// DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error. +func (d *PodIntentDie) DieFeedYAMLFile(name string) *PodIntentDie { + y, err := osx.ReadFile(name) + if err != nil { + panic(err) + } + return d.DieFeedYAML(y) +} + +// DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *PodIntentDie) DieFeedRawExtension(raw runtime.RawExtension) *PodIntentDie { + j, err := json.Marshal(raw) + if err != nil { + panic(err) + } + return d.DieFeedJSON(j) +} + // DieRelease returns the resource managed by the die. func (d *PodIntentDie) DieRelease() conventionsv1alpha1.PodIntent { if d.mutable { @@ -565,21 +880,45 @@ func (d *PodIntentDie) DieReleasePtr() *conventionsv1alpha1.PodIntent { return &r } -// DieReleaseUnstructured returns the resource managed by the die as an unstructured object. +// DieReleaseUnstructured returns the resource managed by the die as an unstructured object. Panics on error. func (d *PodIntentDie) DieReleaseUnstructured() *unstructured.Unstructured { r := d.DieReleasePtr() - u, _ := runtime.DefaultUnstructuredConverter.ToUnstructured(r) + u, err := runtime.DefaultUnstructuredConverter.ToUnstructured(r) + if err != nil { + panic(err) + } return &unstructured.Unstructured{ Object: u, } } -// DieReleaseRawExtension returns the resource managed by the die as an raw extension. -func (d *PodIntentDie) DieReleaseRawExtension() runtime.RawExtension { +// DieReleaseJSON returns the resource managed by the die as JSON. Panics on error. +func (d *PodIntentDie) DieReleaseJSON() []byte { r := d.DieReleasePtr() - b, _ := json.Marshal(r) + j, err := json.Marshal(r) + if err != nil { + panic(err) + } + return j +} + +// DieReleaseYAML returns the resource managed by the die as YAML. Panics on error. +func (d *PodIntentDie) DieReleaseYAML() []byte { + r := d.DieReleasePtr() + y, err := yaml.Marshal(r) + if err != nil { + panic(err) + } + return y +} + +// DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *PodIntentDie) DieReleaseRawExtension() runtime.RawExtension { + j := d.DieReleaseJSON() raw := runtime.RawExtension{} - _ = json.Unmarshal(b, &raw) + if err := json.Unmarshal(j, &raw); err != nil { + panic(err) + } return raw } @@ -590,6 +929,27 @@ func (d *PodIntentDie) DieStamp(fn func(r *conventionsv1alpha1.PodIntent)) *PodI return d.DieFeed(r) } +// Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type as found on the resource at the target location. +// +// Future iterations will improve type coercion from the resource to the callback argument. +func (d *PodIntentDie) DieStampAt(jp string, fn interface{}) *PodIntentDie { + return d.DieStamp(func(r *conventionsv1alpha1.PodIntent) { + cp := jsonpath.New("") + if err := cp.Parse(fmtx.Sprintf("{%s}", jp)); err != nil { + panic(err) + } + cr, err := cp.FindResults(r) + if err != nil { + // errors are expected if a path is not found + return + } + for _, cv := range cr[0] { + args := []reflectx.Value{cv} + reflectx.ValueOf(fn).Call(args) + } + }) +} + // DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die. func (d *PodIntentDie) DeepCopy() *PodIntentDie { r := *d.r.DeepCopy() @@ -718,14 +1078,42 @@ func (d *PodIntentSpecDie) DieFeedPtr(r *conventionsv1alpha1.PodIntentSpec) *Pod return d.DieFeed(*r) } -// DieFeedRawExtension returns the resource managed by the die as an raw extension. -func (d *PodIntentSpecDie) DieFeedRawExtension(raw runtime.RawExtension) *PodIntentSpecDie { - b, _ := json.Marshal(raw) +// DieFeedJSON returns a new die with the provided JSON. Panics on error. +func (d *PodIntentSpecDie) DieFeedJSON(j []byte) *PodIntentSpecDie { r := conventionsv1alpha1.PodIntentSpec{} - _ = json.Unmarshal(b, &r) + if err := json.Unmarshal(j, &r); err != nil { + panic(err) + } + return d.DieFeed(r) +} + +// DieFeedYAML returns a new die with the provided YAML. Panics on error. +func (d *PodIntentSpecDie) DieFeedYAML(y []byte) *PodIntentSpecDie { + r := conventionsv1alpha1.PodIntentSpec{} + if err := yaml.Unmarshal(y, &r); err != nil { + panic(err) + } return d.DieFeed(r) } +// DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error. +func (d *PodIntentSpecDie) DieFeedYAMLFile(name string) *PodIntentSpecDie { + y, err := osx.ReadFile(name) + if err != nil { + panic(err) + } + return d.DieFeedYAML(y) +} + +// DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *PodIntentSpecDie) DieFeedRawExtension(raw runtime.RawExtension) *PodIntentSpecDie { + j, err := json.Marshal(raw) + if err != nil { + panic(err) + } + return d.DieFeedJSON(j) +} + // DieRelease returns the resource managed by the die. func (d *PodIntentSpecDie) DieRelease() conventionsv1alpha1.PodIntentSpec { if d.mutable { @@ -740,12 +1128,33 @@ func (d *PodIntentSpecDie) DieReleasePtr() *conventionsv1alpha1.PodIntentSpec { return &r } -// DieReleaseRawExtension returns the resource managed by the die as an raw extension. -func (d *PodIntentSpecDie) DieReleaseRawExtension() runtime.RawExtension { +// DieReleaseJSON returns the resource managed by the die as JSON. Panics on error. +func (d *PodIntentSpecDie) DieReleaseJSON() []byte { + r := d.DieReleasePtr() + j, err := json.Marshal(r) + if err != nil { + panic(err) + } + return j +} + +// DieReleaseYAML returns the resource managed by the die as YAML. Panics on error. +func (d *PodIntentSpecDie) DieReleaseYAML() []byte { r := d.DieReleasePtr() - b, _ := json.Marshal(r) + y, err := yaml.Marshal(r) + if err != nil { + panic(err) + } + return y +} + +// DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *PodIntentSpecDie) DieReleaseRawExtension() runtime.RawExtension { + j := d.DieReleaseJSON() raw := runtime.RawExtension{} - _ = json.Unmarshal(b, &raw) + if err := json.Unmarshal(j, &raw); err != nil { + panic(err) + } return raw } @@ -756,6 +1165,27 @@ func (d *PodIntentSpecDie) DieStamp(fn func(r *conventionsv1alpha1.PodIntentSpec return d.DieFeed(r) } +// Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type as found on the resource at the target location. +// +// Future iterations will improve type coercion from the resource to the callback argument. +func (d *PodIntentSpecDie) DieStampAt(jp string, fn interface{}) *PodIntentSpecDie { + return d.DieStamp(func(r *conventionsv1alpha1.PodIntentSpec) { + cp := jsonpath.New("") + if err := cp.Parse(fmtx.Sprintf("{%s}", jp)); err != nil { + panic(err) + } + cr, err := cp.FindResults(r) + if err != nil { + // errors are expected if a path is not found + return + } + for _, cv := range cr[0] { + args := []reflectx.Value{cv} + reflectx.ValueOf(fn).Call(args) + } + }) +} + // DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die. func (d *PodIntentSpecDie) DeepCopy() *PodIntentSpecDie { r := *d.r.DeepCopy() @@ -823,14 +1253,42 @@ func (d *PodIntentStatusDie) DieFeedPtr(r *conventionsv1alpha1.PodIntentStatus) return d.DieFeed(*r) } -// DieFeedRawExtension returns the resource managed by the die as an raw extension. -func (d *PodIntentStatusDie) DieFeedRawExtension(raw runtime.RawExtension) *PodIntentStatusDie { - b, _ := json.Marshal(raw) +// DieFeedJSON returns a new die with the provided JSON. Panics on error. +func (d *PodIntentStatusDie) DieFeedJSON(j []byte) *PodIntentStatusDie { r := conventionsv1alpha1.PodIntentStatus{} - _ = json.Unmarshal(b, &r) + if err := json.Unmarshal(j, &r); err != nil { + panic(err) + } return d.DieFeed(r) } +// DieFeedYAML returns a new die with the provided YAML. Panics on error. +func (d *PodIntentStatusDie) DieFeedYAML(y []byte) *PodIntentStatusDie { + r := conventionsv1alpha1.PodIntentStatus{} + if err := yaml.Unmarshal(y, &r); err != nil { + panic(err) + } + return d.DieFeed(r) +} + +// DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error. +func (d *PodIntentStatusDie) DieFeedYAMLFile(name string) *PodIntentStatusDie { + y, err := osx.ReadFile(name) + if err != nil { + panic(err) + } + return d.DieFeedYAML(y) +} + +// DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *PodIntentStatusDie) DieFeedRawExtension(raw runtime.RawExtension) *PodIntentStatusDie { + j, err := json.Marshal(raw) + if err != nil { + panic(err) + } + return d.DieFeedJSON(j) +} + // DieRelease returns the resource managed by the die. func (d *PodIntentStatusDie) DieRelease() conventionsv1alpha1.PodIntentStatus { if d.mutable { @@ -845,12 +1303,33 @@ func (d *PodIntentStatusDie) DieReleasePtr() *conventionsv1alpha1.PodIntentStatu return &r } -// DieReleaseRawExtension returns the resource managed by the die as an raw extension. -func (d *PodIntentStatusDie) DieReleaseRawExtension() runtime.RawExtension { +// DieReleaseJSON returns the resource managed by the die as JSON. Panics on error. +func (d *PodIntentStatusDie) DieReleaseJSON() []byte { + r := d.DieReleasePtr() + j, err := json.Marshal(r) + if err != nil { + panic(err) + } + return j +} + +// DieReleaseYAML returns the resource managed by the die as YAML. Panics on error. +func (d *PodIntentStatusDie) DieReleaseYAML() []byte { r := d.DieReleasePtr() - b, _ := json.Marshal(r) + y, err := yaml.Marshal(r) + if err != nil { + panic(err) + } + return y +} + +// DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error. +func (d *PodIntentStatusDie) DieReleaseRawExtension() runtime.RawExtension { + j := d.DieReleaseJSON() raw := runtime.RawExtension{} - _ = json.Unmarshal(b, &raw) + if err := json.Unmarshal(j, &raw); err != nil { + panic(err) + } return raw } @@ -861,6 +1340,27 @@ func (d *PodIntentStatusDie) DieStamp(fn func(r *conventionsv1alpha1.PodIntentSt return d.DieFeed(r) } +// Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type as found on the resource at the target location. +// +// Future iterations will improve type coercion from the resource to the callback argument. +func (d *PodIntentStatusDie) DieStampAt(jp string, fn interface{}) *PodIntentStatusDie { + return d.DieStamp(func(r *conventionsv1alpha1.PodIntentStatus) { + cp := jsonpath.New("") + if err := cp.Parse(fmtx.Sprintf("{%s}", jp)); err != nil { + panic(err) + } + cr, err := cp.FindResults(r) + if err != nil { + // errors are expected if a path is not found + return + } + for _, cv := range cr[0] { + args := []reflectx.Value{cv} + reflectx.ValueOf(fn).Call(args) + } + }) +} + // DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die. func (d *PodIntentStatusDie) DeepCopy() *PodIntentStatusDie { r := *d.r.DeepCopy() diff --git a/samples/convention-server/go.mod b/samples/convention-server/go.mod index b9a1d2f1..1b6ac853 100644 --- a/samples/convention-server/go.mod +++ b/samples/convention-server/go.mod @@ -9,7 +9,7 @@ require ( github.com/go-logr/zapr v1.2.4 github.com/vmware-tanzu/cartographer-conventions/webhook v0.2.0 go.uber.org/zap v1.24.0 - k8s.io/api v0.27.1 + k8s.io/api v0.27.2 ) require ( @@ -22,14 +22,14 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/text v0.9.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/apimachinery v0.27.1 // indirect + k8s.io/apimachinery v0.27.2 // indirect k8s.io/klog/v2 v2.90.1 // indirect k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect - sigs.k8s.io/controller-runtime v0.14.6 // indirect + sigs.k8s.io/controller-runtime v0.15.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) diff --git a/samples/convention-server/go.sum b/samples/convention-server/go.sum index fbb57987..94012bac 100644 --- a/samples/convention-server/go.sum +++ b/samples/convention-server/go.sum @@ -12,7 +12,7 @@ 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/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo= github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -36,8 +36,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/onsi/ginkgo/v2 v2.9.1 h1:zie5Ly042PD3bsCvsSOPvRnFwyo3rKe64TJlD6nu0mk= -github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= +github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q= +github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -60,7 +60,7 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= @@ -78,8 +78,8 @@ 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.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= 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= @@ -90,19 +90,19 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 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.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 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.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= 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= @@ -118,16 +118,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.27.1 h1:Z6zUGQ1Vd10tJ+gHcNNNgkV5emCyW+v2XTmn+CLjSd0= -k8s.io/api v0.27.1/go.mod h1:z5g/BpAiD+f6AArpqNjkY+cji8ueZDU/WV1jcj5Jk4E= -k8s.io/apimachinery v0.27.1 h1:EGuZiLI95UQQcClhanryclaQE6xjg1Bts6/L3cD7zyc= -k8s.io/apimachinery v0.27.1/go.mod h1:5ikh59fK3AJ287GUvpUsryoMFtH9zj/ARfWCo3AyXTM= +k8s.io/api v0.27.2 h1:+H17AJpUMvl+clT+BPnKf0E3ksMAzoBBg7CntpSuADo= +k8s.io/api v0.27.2/go.mod h1:ENmbocXfBT2ADujUXcBhHV55RIT31IIEvkntP6vZKS4= +k8s.io/apimachinery v0.27.2 h1:vBjGaKKieaIreI+oQwELalVG4d8f3YAMNpWLzDXkxeg= +k8s.io/apimachinery v0.27.2/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.14.6 h1:oxstGVvXGNnMvY7TAESYk+lzr6S3V5VFxQ6d92KcwQA= -sigs.k8s.io/controller-runtime v0.14.6/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0= +sigs.k8s.io/controller-runtime v0.15.0 h1:ML+5Adt3qZnMSYxZ7gAverBLNPSMQEibtzAgp0UPojU= +sigs.k8s.io/controller-runtime v0.15.0/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= 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= diff --git a/samples/dumper-server/go.mod b/samples/dumper-server/go.mod index 1be8de0d..5fe584fb 100644 --- a/samples/dumper-server/go.mod +++ b/samples/dumper-server/go.mod @@ -20,18 +20,17 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/rogpeppe/go-internal v1.6.1 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/text v0.9.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/api v0.26.3 // indirect - k8s.io/apimachinery v0.26.3 // indirect - k8s.io/klog/v2 v2.80.1 // indirect - k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 // indirect - sigs.k8s.io/controller-runtime v0.14.6 // indirect - sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect + k8s.io/api v0.27.2 // indirect + k8s.io/apimachinery v0.27.2 // indirect + k8s.io/klog/v2 v2.90.1 // indirect + k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect + sigs.k8s.io/controller-runtime v0.15.0 // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) diff --git a/samples/dumper-server/go.sum b/samples/dumper-server/go.sum index 82d547cf..2952ea39 100644 --- a/samples/dumper-server/go.sum +++ b/samples/dumper-server/go.sum @@ -12,6 +12,7 @@ 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/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo= github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -20,6 +21,7 @@ github.com/google/go-containerregistry v0.14.0/go.mod h1:aiJ2fp/SXvkWgmYHioXnbMd 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/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -34,15 +36,14 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/onsi/ginkgo/v2 v2.6.0 h1:9t9b9vRUbFq3C4qKFCGkVuq/fIHji802N1nrtkh1mNc= -github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E= +github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q= +github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -51,15 +52,15 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= 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 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= @@ -77,8 +78,8 @@ 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.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= 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= @@ -89,18 +90,19 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 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.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 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.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= 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= @@ -108,7 +110,6 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T 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= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 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= @@ -117,18 +118,18 @@ 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.26.3 h1:emf74GIQMTik01Aum9dPP0gAypL8JTLl/lHa4V9RFSU= -k8s.io/api v0.26.3/go.mod h1:PXsqwPMXBSBcL1lJ9CYDKy7kIReUydukS5JiRlxC3qE= -k8s.io/apimachinery v0.26.3 h1:dQx6PNETJ7nODU3XPtrwkfuubs6w7sX0M8n61zHIV/k= -k8s.io/apimachinery v0.26.3/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I= -k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= -k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 h1:KTgPnR10d5zhztWptI952TNtt/4u5h3IzDXkdIMuo2Y= -k8s.io/utils v0.0.0-20221128185143-99ec85e7a448/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.14.6 h1:oxstGVvXGNnMvY7TAESYk+lzr6S3V5VFxQ6d92KcwQA= -sigs.k8s.io/controller-runtime v0.14.6/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0= -sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k= -sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +k8s.io/api v0.27.2 h1:+H17AJpUMvl+clT+BPnKf0E3ksMAzoBBg7CntpSuADo= +k8s.io/api v0.27.2/go.mod h1:ENmbocXfBT2ADujUXcBhHV55RIT31IIEvkntP6vZKS4= +k8s.io/apimachinery v0.27.2 h1:vBjGaKKieaIreI+oQwELalVG4d8f3YAMNpWLzDXkxeg= +k8s.io/apimachinery v0.27.2/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= +k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= +k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/controller-runtime v0.15.0 h1:ML+5Adt3qZnMSYxZ7gAverBLNPSMQEibtzAgp0UPojU= +sigs.k8s.io/controller-runtime v0.15.0/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= +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/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= diff --git a/samples/dumper-server/server.go b/samples/dumper-server/server.go index 41bf0387..f9efe992 100644 --- a/samples/dumper-server/server.go +++ b/samples/dumper-server/server.go @@ -1,5 +1,5 @@ /* -Copyright 2022 VMware Inc. +Copyright 2022-2023 VMware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "log" "net/http" "os" @@ -38,7 +38,7 @@ import ( func conventionHandler(w http.ResponseWriter, r *http.Request) { wc := &webhookv1alpha1.PodConventionContext{} if r.Body != nil { - reqBody, err := ioutil.ReadAll(r.Body) + reqBody, err := io.ReadAll(r.Body) if err != nil { w.WriteHeader(http.StatusBadRequest) return diff --git a/samples/spring-convention-server/go.mod b/samples/spring-convention-server/go.mod index 71087d9d..6399cec8 100644 --- a/samples/spring-convention-server/go.mod +++ b/samples/spring-convention-server/go.mod @@ -12,8 +12,8 @@ require ( github.com/go-logr/zapr v1.2.4 github.com/vmware-tanzu/cartographer-conventions/webhook v0.2.0 go.uber.org/zap v1.24.0 - k8s.io/api v0.27.1 - k8s.io/apimachinery v0.27.1 + k8s.io/api v0.27.2 + k8s.io/apimachinery v0.27.2 ) require ( @@ -25,13 +25,13 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/text v0.9.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/klog/v2 v2.90.1 // indirect k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect - sigs.k8s.io/controller-runtime v0.14.6 // indirect + sigs.k8s.io/controller-runtime v0.15.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) diff --git a/samples/spring-convention-server/go.sum b/samples/spring-convention-server/go.sum index b83e8036..70cb825f 100644 --- a/samples/spring-convention-server/go.sum +++ b/samples/spring-convention-server/go.sum @@ -14,7 +14,7 @@ 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/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo= github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -38,8 +38,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/onsi/ginkgo/v2 v2.9.1 h1:zie5Ly042PD3bsCvsSOPvRnFwyo3rKe64TJlD6nu0mk= -github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= +github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q= +github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -62,7 +62,7 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= @@ -80,8 +80,8 @@ 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.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= 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= @@ -92,19 +92,19 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 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.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 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.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= 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= @@ -120,16 +120,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.27.1 h1:Z6zUGQ1Vd10tJ+gHcNNNgkV5emCyW+v2XTmn+CLjSd0= -k8s.io/api v0.27.1/go.mod h1:z5g/BpAiD+f6AArpqNjkY+cji8ueZDU/WV1jcj5Jk4E= -k8s.io/apimachinery v0.27.1 h1:EGuZiLI95UQQcClhanryclaQE6xjg1Bts6/L3cD7zyc= -k8s.io/apimachinery v0.27.1/go.mod h1:5ikh59fK3AJ287GUvpUsryoMFtH9zj/ARfWCo3AyXTM= +k8s.io/api v0.27.2 h1:+H17AJpUMvl+clT+BPnKf0E3ksMAzoBBg7CntpSuADo= +k8s.io/api v0.27.2/go.mod h1:ENmbocXfBT2ADujUXcBhHV55RIT31IIEvkntP6vZKS4= +k8s.io/apimachinery v0.27.2 h1:vBjGaKKieaIreI+oQwELalVG4d8f3YAMNpWLzDXkxeg= +k8s.io/apimachinery v0.27.2/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.14.6 h1:oxstGVvXGNnMvY7TAESYk+lzr6S3V5VFxQ6d92KcwQA= -sigs.k8s.io/controller-runtime v0.14.6/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0= +sigs.k8s.io/controller-runtime v0.15.0 h1:ML+5Adt3qZnMSYxZ7gAverBLNPSMQEibtzAgp0UPojU= +sigs.k8s.io/controller-runtime v0.15.0/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= 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= diff --git a/webhook/go.mod b/webhook/go.mod index 97fc8512..7d280f08 100644 --- a/webhook/go.mod +++ b/webhook/go.mod @@ -6,24 +6,23 @@ require ( github.com/CycloneDX/cyclonedx-go v0.6.0 github.com/go-logr/logr v1.2.4 github.com/google/go-containerregistry v0.14.0 - k8s.io/api v0.26.3 - k8s.io/apimachinery v0.26.3 - sigs.k8s.io/controller-runtime v0.14.6 + k8s.io/api v0.27.2 + k8s.io/apimachinery v0.27.2 + sigs.k8s.io/controller-runtime v0.15.0 ) require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/kr/pretty v0.3.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/text v0.9.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/klog/v2 v2.80.1 // indirect - k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 // indirect - sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect + k8s.io/klog/v2 v2.90.1 // indirect + k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) diff --git a/webhook/go.sum b/webhook/go.sum index 0eacb736..c0c652ef 100644 --- a/webhook/go.sum +++ b/webhook/go.sum @@ -2,13 +2,13 @@ github.com/CycloneDX/cyclonedx-go v0.6.0 h1:SizWGbZzFTC/O/1yh072XQBMxfvsoWqd//oK github.com/CycloneDX/cyclonedx-go v0.6.0/go.mod h1:nQCiF4Tvrg5Ieu8qPhYMvzPGMu5I7fANZkrSsJjl5mg= github.com/bradleyjkemp/cupaloy/v2 v2.7.0 h1:AT0vOjO68RcLyenLCHOGZzSNiuto7ziqzq6Q1/3xzMQ= github.com/bradleyjkemp/cupaloy/v2 v2.7.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0= -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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -17,35 +17,30 @@ github.com/google/go-containerregistry v0.14.0/go.mod h1:aiJ2fp/SXvkWgmYHioXnbMd 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/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -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= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 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= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/onsi/ginkgo/v2 v2.6.0 h1:9t9b9vRUbFq3C4qKFCGkVuq/fIHji802N1nrtkh1mNc= -github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E= +github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q= +github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU= 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.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= 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= @@ -57,31 +52,30 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 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.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= 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= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 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.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= 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= 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= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 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= @@ -89,18 +83,18 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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= -k8s.io/api v0.26.3 h1:emf74GIQMTik01Aum9dPP0gAypL8JTLl/lHa4V9RFSU= -k8s.io/api v0.26.3/go.mod h1:PXsqwPMXBSBcL1lJ9CYDKy7kIReUydukS5JiRlxC3qE= -k8s.io/apimachinery v0.26.3 h1:dQx6PNETJ7nODU3XPtrwkfuubs6w7sX0M8n61zHIV/k= -k8s.io/apimachinery v0.26.3/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I= -k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= -k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 h1:KTgPnR10d5zhztWptI952TNtt/4u5h3IzDXkdIMuo2Y= -k8s.io/utils v0.0.0-20221128185143-99ec85e7a448/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.14.6 h1:oxstGVvXGNnMvY7TAESYk+lzr6S3V5VFxQ6d92KcwQA= -sigs.k8s.io/controller-runtime v0.14.6/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0= -sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k= -sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +k8s.io/api v0.27.2 h1:+H17AJpUMvl+clT+BPnKf0E3ksMAzoBBg7CntpSuADo= +k8s.io/api v0.27.2/go.mod h1:ENmbocXfBT2ADujUXcBhHV55RIT31IIEvkntP6vZKS4= +k8s.io/apimachinery v0.27.2 h1:vBjGaKKieaIreI+oQwELalVG4d8f3YAMNpWLzDXkxeg= +k8s.io/apimachinery v0.27.2/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= +k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= +k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/controller-runtime v0.15.0 h1:ML+5Adt3qZnMSYxZ7gAverBLNPSMQEibtzAgp0UPojU= +sigs.k8s.io/controller-runtime v0.15.0/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= +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/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= diff --git a/webhook/server.go b/webhook/server.go index 250660d3..c13584e4 100644 --- a/webhook/server.go +++ b/webhook/server.go @@ -22,9 +22,10 @@ import ( "crypto/tls" "crypto/x509" "encoding/json" - "io/ioutil" + "io" "net" "net/http" + "os" "path/filepath" "sync" "time" @@ -85,7 +86,7 @@ func ConventionHandler(ctx context.Context, convention Convention) func(http.Res logger.Info("received request") wc := &webhookv1alpha1.PodConventionContext{} if r.Body != nil { - reqBody, err := ioutil.ReadAll(r.Body) + reqBody, err := io.ReadAll(r.Body) if err != nil { logger.Error(err, "error reading request body") w.WriteHeader(http.StatusBadRequest) @@ -149,11 +150,11 @@ func (w *certWatcher) Load(ctx context.Context) error { w.m.Lock() defer w.m.Unlock() - crt, err := ioutil.ReadFile(w.CrtFile) + crt, err := os.ReadFile(w.CrtFile) if err != nil { return err } - key, err := ioutil.ReadFile(w.KeyFile) + key, err := os.ReadFile(w.KeyFile) if err != nil { return err }