diff --git a/.bingo/Variables.mk b/.bingo/Variables.mk
index cd213c74f2..603e06b6be 100644
--- a/.bingo/Variables.mk
+++ b/.bingo/Variables.mk
@@ -77,6 +77,12 @@ $(KUBE_SCORE): $(BINGO_DIR)/kube-score.mod
@echo "(re)installing $(GOBIN)/kube-score-v1.20.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=kube-score.mod -o=$(GOBIN)/kube-score-v1.20.0 "github.com/zegl/kube-score/cmd/kube-score"
+MOCKGEN := $(GOBIN)/mockgen-v0.6.0
+$(MOCKGEN): $(BINGO_DIR)/mockgen.mod
+ @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
+ @echo "(re)installing $(GOBIN)/mockgen-v0.6.0"
+ @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=mockgen.mod -o=$(GOBIN)/mockgen-v0.6.0 "go.uber.org/mock/mockgen"
+
OPERATOR_SDK := $(GOBIN)/operator-sdk-v1.41.1
$(OPERATOR_SDK): $(BINGO_DIR)/operator-sdk.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
diff --git a/.bingo/mockgen.mod b/.bingo/mockgen.mod
new file mode 100644
index 0000000000..43b9663307
--- /dev/null
+++ b/.bingo/mockgen.mod
@@ -0,0 +1,5 @@
+module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
+
+go 1.26.3
+
+require go.uber.org/mock v0.6.0 // mockgen
diff --git a/.bingo/mockgen.sum b/.bingo/mockgen.sum
new file mode 100644
index 0000000000..8936eb9e33
--- /dev/null
+++ b/.bingo/mockgen.sum
@@ -0,0 +1,8 @@
+go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
+go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
+golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
+golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
+golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
+golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
+golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
+golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
diff --git a/.bingo/variables.env b/.bingo/variables.env
index 05cc4cfb52..f14fdf14bc 100644
--- a/.bingo/variables.env
+++ b/.bingo/variables.env
@@ -28,6 +28,8 @@ KIND="${GOBIN}/kind-v0.32.0"
KUBE_SCORE="${GOBIN}/kube-score-v1.20.0"
+MOCKGEN="${GOBIN}/mockgen-v0.6.0"
+
OPERATOR_SDK="${GOBIN}/operator-sdk-v1.41.1"
OPM="${GOBIN}/opm-v1.60.0"
diff --git a/AGENTS.md b/AGENTS.md
index e2481bc2cf..1a62ddcb5c 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -54,7 +54,15 @@ install and manage cluster extensions. The project follows a microservices archi
- `containers_image_openpgp` - required for image handling
**Tools (managed via .bingo/):**
-- controller-gen, golangci-lint, goreleaser, helm, kind, kustomize, setup-envtest, operator-sdk
+- controller-gen, golangci-lint, goreleaser, helm, kind, kustomize, mockgen, setup-envtest, operator-sdk
+
+**Test Mocking:**
+- **gomock** (`go.uber.org/mock`): Used for generated mock implementations. `//go:generate mockgen` directives
+ live in `internal/testutil/mock/generate.go` (external and internal exported interfaces) and at interface
+ definitions for internal unexported interfaces (source mode). Run `make generate-mocks` to regenerate.
+ All interface mocks should be gomock-generated. Test fakes that return preconfigured values without
+ interaction verification (e.g., `FakePuller`, `FakeCache` in `image/fakes.go`) are not mocks and stay
+ hand-written.
---
@@ -140,8 +148,11 @@ make manifests
# Update CRDs and reference docs (when Go-based API definitions change)
make update-crds crd-ref-docs
-# Generate code (DeepCopy methods)
+# Generate code (DeepCopy methods and mock implementations)
make generate
+
+# Regenerate mock implementations only
+make generate-mocks
```
---
diff --git a/Makefile b/Makefile
index 0b342e13f2..c76a5b3b9a 100644
--- a/Makefile
+++ b/Makefile
@@ -58,6 +58,14 @@ endif
# bingo manages consistent tooling versions for things like kind, etc.
include .bingo/Variables.mk
+# mockgen is installed by bingo with a versioned name (mockgen-v0.6.0).
+# Redefine MOCKGEN to an unversioned symlink so that go generate can find it on PATH.
+_MOCKGEN_BINGO := $(MOCKGEN)
+MOCKGEN := $(ROOT_DIR)/bin/mockgen
+$(MOCKGEN): $(_MOCKGEN_BINGO)
+ @mkdir -p $(dir $@)
+ @ln -sf $< $@
+
ifeq ($(origin KIND_CLUSTER_NAME), undefined)
KIND_CLUSTER_NAME := operator-controller
endif
@@ -152,10 +160,6 @@ lint-custom: custom-linter-build #EXHELP Call custom linter for the project
lint-api-diff: $(GOLANGCI_LINT) #HELP Validate API changes using kube-api-linter with diff-aware analysis
hack/api-lint-diff/run.sh
-.PHONY: k8s-pin
-k8s-pin: #EXHELP Pin k8s staging modules based on k8s.io/kubernetes version (in go.mod or from K8S_IO_K8S_VERSION env var) and run go mod tidy.
- K8S_IO_K8S_VERSION='$(K8S_IO_K8S_VERSION)' go run hack/tools/k8smaintainer/main.go
-
.PHONY: tidy #HELP Run go mod tidy.
tidy:
go mod tidy
@@ -201,8 +205,12 @@ manifests: update-crds $(MANIFESTS) $(HELM) #EXHELP Generate OLMv1 manifests
$(HELM) template olmv1 helm/olmv1 --values helm/tilt.yaml $(addprefix --set ,$(HELM_SETTINGS)) > /dev/null
$(HELM) template olmv1 helm/olmv1 --set "options.openshift.enabled=true" > /dev/null
+.PHONY: generate-mocks
+generate-mocks: $(MOCKGEN) #EXHELP Generate mock implementations for testing.
+ PATH="$(ROOT_DIR)/bin:$$PATH" go generate ./...
+
.PHONY: generate
-generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, DeepCopyObject, and ApplyConfiguration type implementations.
+generate: $(CONTROLLER_GEN) generate-mocks #EXHELP Generate code containing DeepCopy, DeepCopyInto, DeepCopyObject, and ApplyConfiguration type implementations.
# Need to delete the files for them to be generated properly
@find api cmd hack internal -name "zz_generated.deepcopy.go" -not -path "*/vendor/*" -delete && rm -rf applyconfigurations
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) applyconfiguration:headerFile="hack/boilerplate.go.txt" paths="./api/..."
@@ -213,7 +221,7 @@ generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyI
done
.PHONY: verify
-verify: k8s-pin kind-verify-versions fmt generate manifests update-tls-profiles crd-ref-docs update-registryv1-bundle-schema verify-bingo #HELP Verify all generated code is up-to-date. Runs k8s-pin instead of just tidy.
+verify: tidy kind-verify-versions fmt generate manifests update-tls-profiles crd-ref-docs update-registryv1-bundle-schema verify-bingo #HELP Verify all generated code is up-to-date.
git diff --exit-code
.PHONY: verify-bingo
@@ -289,7 +297,8 @@ extension-developer-e2e: export CONTAINER_RUNTIME := $(CONTAINER_RUNTIME)
extension-developer-e2e: $(OPERATOR_SDK) #EXHELP Run extension create, upgrade and delete tests.
go test -count=1 -v ./test/extension-developer-e2e/...
-UNIT_TEST_DIRS := $(shell go list ./... | grep -vE "/test/|/testutils") $(shell go list ./test/internal/...)
+UNIT_TEST_DIRS := $(shell go list ./... | grep -vE "/test/|/testutils|/testutil/mock") $(shell go list ./test/internal/...)
+COVERAGE_PKGS := $(shell go list ./... | grep -vE "/test/|/testutils|/testutil/mock" | paste -sd,)
COVERAGE_UNIT_DIR := $(ROOT_DIR)/coverage/unit
.PHONY: envtest-k8s-bins #HELP Uses setup-envtest to download and install the binaries required to run ENVTEST-test based locally at the project/bin directory.
@@ -303,7 +312,7 @@ test-unit: $(SETUP_ENVTEST) envtest-k8s-bins #HELP Run the unit tests
KUBEBUILDER_ASSETS="$(shell $(SETUP_ENVTEST) use -p path $(ENVTEST_VERSION) $(SETUP_ENVTEST_BIN_DIR_OVERRIDE))" \
CGO_ENABLED=1 go test \
-tags '$(GO_BUILD_TAGS)' \
- -cover -coverprofile ${ROOT_DIR}/coverage/unit.out \
+ -cover -coverpkg=$(COVERAGE_PKGS) -coverprofile ${ROOT_DIR}/coverage/unit.out \
-count=1 -race -short \
$(UNIT_TEST_DIRS) \
-test.gocoverdir=$(COVERAGE_UNIT_DIR)
diff --git a/api/v1/clusterextension_types.go b/api/v1/clusterextension_types.go
index 99bc160d74..58806bd4dc 100644
--- a/api/v1/clusterextension_types.go
+++ b/api/v1/clusterextension_types.go
@@ -50,8 +50,7 @@ const (
// ClusterExtensionSpec defines the desired state of ClusterExtension
type ClusterExtensionSpec struct {
// namespace specifies a Kubernetes namespace.
- // This is the namespace where the provided ServiceAccount must exist.
- // It also designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
+ // It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
// Some extensions may contain namespace-scoped resources to be applied in other namespaces.
// This namespace must exist.
//
@@ -67,14 +66,15 @@ type ClusterExtensionSpec struct {
// +required
Namespace string `json:"namespace"`
- // serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
- // that are required to manage the extension.
- // The ServiceAccount must be configured with the necessary permissions to perform these interactions.
- // The ServiceAccount must exist in the namespace referenced in the spec.
- // The serviceAccount field is required.
+ // serviceAccount is a deprecated field and is completely ignored.
+ // OLMv1 is a single-tenant system where users with ClusterExtension write access are
+ // effectively delegated cluster-admin trust. The operator-controller runs with
+ // cluster-admin privileges and uses its own service account for all cluster interactions.
//
- // +required
- ServiceAccount ServiceAccountReference `json:"serviceAccount"`
+ // Deprecated: serviceAccount is no longer used and will be removed in a future release.
+ //
+ // +optional
+ ServiceAccount ServiceAccountReference `json:"serviceAccount,omitzero"` //nolint:kubeapilinter // deprecated field uses omitzero per OpenShift convention; pointer would be a breaking API change
// source is required and selects the installation source of content for this ClusterExtension.
// Set the sourceType field to perform the selection.
@@ -150,7 +150,7 @@ type SourceConfig struct {
}
// ClusterExtensionInstallConfig is a union which selects the clusterExtension installation config.
-// ClusterExtensionInstallConfig requires the namespace and serviceAccount which should be used for the installation of packages.
+// ClusterExtensionInstallConfig requires the namespace which should be used for the installation of packages.
//
// +kubebuilder:validation:XValidation:rule="has(self.preflight)",message="at least one of [preflight] are required when install is specified"
// +union
@@ -378,12 +378,13 @@ type CatalogFilter struct {
UpgradeConstraintPolicy UpgradeConstraintPolicy `json:"upgradeConstraintPolicy,omitempty"`
}
-// ServiceAccountReference identifies the serviceAccount used fo install a ClusterExtension.
+// ServiceAccountReference is a deprecated type and is completely ignored.
+//
+// Deprecated: ServiceAccountReference is no longer used and will be removed in a future release.
type ServiceAccountReference struct {
- // name is a required, immutable reference to the name of the ServiceAccount used for installation
- // and management of the content for the package specified in the packageName field.
+ // name is a deprecated field and is completely ignored.
//
- // This ServiceAccount must exist in the installNamespace.
+ // Deprecated: name is no longer used and will be removed in a future release.
//
// The name field follows the DNS subdomain standard as defined in [RFC 1123].
// It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
@@ -403,10 +404,10 @@ type ServiceAccountReference struct {
// [RFC 1123]: https://tools.ietf.org/html/rfc1123
//
// +kubebuilder:validation:MaxLength:=253
- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="name is immutable"
- // +kubebuilder:validation:XValidation:rule="self.matches(\"^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$\")",message="name must be a valid DNS1123 subdomain. It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.), start and end with an alphanumeric character, and be no longer than 253 characters"
- // +required
- Name string `json:"name"`
+ // +kubebuilder:validation:XValidation:rule="self == oldSelf || size(self) == 0",message="name is immutable once set, but may be cleared"
+ // +kubebuilder:validation:XValidation:rule="size(self) == 0 || self.matches(\"^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$\")",message="name must be a valid DNS1123 subdomain. It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.), start and end with an alphanumeric character, and be no longer than 253 characters"
+ // +optional
+ Name string `json:"name"` //nolint:kubeapilinter // deprecated field; empty string means unset, pointer would be a breaking API change
}
// PreflightConfig holds the configuration for the preflight checks. If used, at least one preflight check must be non-nil.
diff --git a/api/v1/validation_test.go b/api/v1/validation_test.go
index f56d9c5045..10e8b6bc43 100644
--- a/api/v1/validation_test.go
+++ b/api/v1/validation_test.go
@@ -23,9 +23,6 @@ func TestValidate(t *testing.T) {
}
defaultExtensionSpec := func(s *ClusterExtensionSpec) *ClusterExtensionSpec {
s.Namespace = "ns"
- s.ServiceAccount = ServiceAccountReference{
- Name: "sa",
- }
s.Source = SourceConfig{
SourceType: SourceTypeCatalog,
Catalog: &CatalogFilter{
diff --git a/applyconfigurations/api/v1/clusterextensioninstallconfig.go b/applyconfigurations/api/v1/clusterextensioninstallconfig.go
index 4e38abc939..443ee5e35c 100644
--- a/applyconfigurations/api/v1/clusterextensioninstallconfig.go
+++ b/applyconfigurations/api/v1/clusterextensioninstallconfig.go
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
-// Code generated by controller-gen-v0.20. DO NOT EDIT.
+// Code generated by controller-gen-v0.21. DO NOT EDIT.
package v1
@@ -21,7 +21,7 @@ package v1
// with apply.
//
// ClusterExtensionInstallConfig is a union which selects the clusterExtension installation config.
-// ClusterExtensionInstallConfig requires the namespace and serviceAccount which should be used for the installation of packages.
+// ClusterExtensionInstallConfig requires the namespace which should be used for the installation of packages.
type ClusterExtensionInstallConfigApplyConfiguration struct {
// preflight is optional and configures the checks that run before installation or upgrade
// of the content for the package specified in the packageName field.
diff --git a/applyconfigurations/api/v1/clusterextensionspec.go b/applyconfigurations/api/v1/clusterextensionspec.go
index 5dfaf1883a..47d810a74a 100644
--- a/applyconfigurations/api/v1/clusterextensionspec.go
+++ b/applyconfigurations/api/v1/clusterextensionspec.go
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
-// Code generated by controller-gen-v0.20. DO NOT EDIT.
+// Code generated by controller-gen-v0.21. DO NOT EDIT.
package v1
@@ -23,8 +23,7 @@ package v1
// ClusterExtensionSpec defines the desired state of ClusterExtension
type ClusterExtensionSpecApplyConfiguration struct {
// namespace specifies a Kubernetes namespace.
- // This is the namespace where the provided ServiceAccount must exist.
- // It also designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
+ // It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
// Some extensions may contain namespace-scoped resources to be applied in other namespaces.
// This namespace must exist.
//
@@ -34,11 +33,12 @@ type ClusterExtensionSpecApplyConfiguration struct {
//
// [RFC 1123]: https://tools.ietf.org/html/rfc1123
Namespace *string `json:"namespace,omitempty"`
- // serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
- // that are required to manage the extension.
- // The ServiceAccount must be configured with the necessary permissions to perform these interactions.
- // The ServiceAccount must exist in the namespace referenced in the spec.
- // The serviceAccount field is required.
+ // serviceAccount is a deprecated field and is completely ignored.
+ // OLMv1 is a single-tenant system where users with ClusterExtension write access are
+ // effectively delegated cluster-admin trust. The operator-controller runs with
+ // cluster-admin privileges and uses its own service account for all cluster interactions.
+ //
+ // Deprecated: serviceAccount is no longer used and will be removed in a future release.
ServiceAccount *ServiceAccountReferenceApplyConfiguration `json:"serviceAccount,omitempty"`
// source is required and selects the installation source of content for this ClusterExtension.
// Set the sourceType field to perform the selection.
diff --git a/applyconfigurations/api/v1/serviceaccountreference.go b/applyconfigurations/api/v1/serviceaccountreference.go
index 436cab65ff..726d0bfacd 100644
--- a/applyconfigurations/api/v1/serviceaccountreference.go
+++ b/applyconfigurations/api/v1/serviceaccountreference.go
@@ -13,19 +13,20 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
-// Code generated by controller-gen-v0.20. DO NOT EDIT.
+// Code generated by controller-gen-v0.21. DO NOT EDIT.
package v1
// ServiceAccountReferenceApplyConfiguration represents a declarative configuration of the ServiceAccountReference type for use
// with apply.
//
-// ServiceAccountReference identifies the serviceAccount used fo install a ClusterExtension.
+// ServiceAccountReference is a deprecated type and is completely ignored.
+//
+// Deprecated: ServiceAccountReference is no longer used and will be removed in a future release.
type ServiceAccountReferenceApplyConfiguration struct {
- // name is a required, immutable reference to the name of the ServiceAccount used for installation
- // and management of the content for the package specified in the packageName field.
+ // name is a deprecated field and is completely ignored.
//
- // This ServiceAccount must exist in the installNamespace.
+ // Deprecated: name is no longer used and will be removed in a future release.
//
// The name field follows the DNS subdomain standard as defined in [RFC 1123].
// It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
diff --git a/cmd/operator-controller/main.go b/cmd/operator-controller/main.go
index aeca882f01..9d7e62b2a0 100644
--- a/cmd/operator-controller/main.go
+++ b/cmd/operator-controller/main.go
@@ -48,24 +48,23 @@ import (
crcache "sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/certwatcher"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/event"
crfinalizer "sigs.k8s.io/controller-runtime/pkg/finalizer"
+ crhandler "sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/metrics/filters"
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
+ "sigs.k8s.io/controller-runtime/pkg/predicate"
helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/operator-controller/action"
"github.com/operator-framework/operator-controller/internal/operator-controller/applier"
- "github.com/operator-framework/operator-controller/internal/operator-controller/authentication"
- "github.com/operator-framework/operator-controller/internal/operator-controller/authorization"
"github.com/operator-framework/operator-controller/internal/operator-controller/catalogmetadata/cache"
catalogclient "github.com/operator-framework/operator-controller/internal/operator-controller/catalogmetadata/client"
- "github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager"
- cmcache "github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager/cache"
"github.com/operator-framework/operator-controller/internal/operator-controller/controllers"
"github.com/operator-framework/operator-controller/internal/operator-controller/features"
"github.com/operator-framework/operator-controller/internal/operator-controller/finalizers"
@@ -119,6 +118,7 @@ type boxcutterReconcilerConfigurator struct {
imageCache imageutil.Cache
imagePuller imageutil.Puller
finalizers crfinalizer.Finalizers
+ trackingCache managedcache.TrackingCache
}
type helmReconcilerConfigurator struct {
@@ -129,7 +129,7 @@ type helmReconcilerConfigurator struct {
imageCache imageutil.Cache
imagePuller imageutil.Puller
finalizers crfinalizer.Finalizers
- watcher cmcache.Watcher
+ trackingCache managedcache.TrackingCache
}
const (
@@ -460,15 +460,41 @@ func run() error {
crdupgradesafety.NewPreflight(aeClient.CustomResourceDefinitions()),
}
+ trackingCache, err := managedcache.NewTrackingCache(
+ ctrl.Log.WithName("trackingCache"),
+ mgr.GetConfig(),
+ crcache.Options{
+ Scheme: mgr.GetScheme(), Mapper: mgr.GetRESTMapper(),
+ },
+ )
+ if err != nil {
+ setupLog.Error(err, "unable to create tracking cache")
+ return err
+ }
+ if err := mgr.Add(trackingCache); err != nil {
+ setupLog.Error(err, "unable to add tracking cache to manager")
+ return err
+ }
+
var ctrlBuilderOpts []controllers.ControllerBuilderOption
if features.OperatorControllerFeatureGate.Enabled(features.BoxcutterRuntime) {
ctrlBuilderOpts = append(ctrlBuilderOpts, controllers.WithOwns(&ocv1.ClusterObjectSet{}))
+ } else {
+ ctrlBuilderOpts = append(ctrlBuilderOpts, controllers.WithWatchesRawSource(
+ trackingCache.Source(
+ crhandler.EnqueueRequestForOwner(mgr.GetScheme(), mgr.GetRESTMapper(), &ocv1.ClusterExtension{}),
+ predicate.ResourceVersionChangedPredicate{},
+ predicate.Funcs{
+ CreateFunc: func(event.TypedCreateEvent[client.Object]) bool { return false },
+ },
+ ),
+ ))
}
ceReconciler := &controllers.ClusterExtensionReconciler{
Client: cl,
}
- ceController, err := ceReconciler.SetupWithManager(mgr, ctrlBuilderOpts...)
+ _, err = ceReconciler.SetupWithManager(mgr, ctrlBuilderOpts...)
if err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ClusterExtension")
return err
@@ -492,6 +518,7 @@ func run() error {
imageCache: imageCache,
imagePuller: imagePuller,
finalizers: clusterExtensionFinalizers,
+ trackingCache: trackingCache,
}
} else {
cerCfg = &helmReconcilerConfigurator{
@@ -502,7 +529,7 @@ func run() error {
imageCache: imageCache,
imagePuller: imagePuller,
finalizers: clusterExtensionFinalizers,
- watcher: ceController,
+ trackingCache: trackingCache,
}
}
if err := cerCfg.Configure(ceReconciler); err != nil {
@@ -600,12 +627,6 @@ func (c *boxcutterReconcilerConfigurator) Configure(ceReconciler *controllers.Cl
return err
}
- // determine if PreAuthorizer should be enabled based on feature gate
- var preAuth authorization.PreAuthorizer
- if features.OperatorControllerFeatureGate.Enabled(features.PreflightPermissions) {
- preAuth = authorization.NewRBACPreAuthorizer(c.mgr.GetClient())
- }
-
// TODO: better scheme handling - which types do we want to support?
_ = apiextensionsv1.AddToScheme(c.mgr.GetScheme())
rg := &applier.SimpleRevisionGenerator{
@@ -618,7 +639,6 @@ func (c *boxcutterReconcilerConfigurator) Configure(ceReconciler *controllers.Cl
Scheme: c.mgr.GetScheme(),
RevisionGenerator: rg,
Preflights: c.preflights,
- PreAuthorizer: preAuth,
FieldOwner: fieldOwner,
SystemNamespace: cfg.systemNamespace,
}
@@ -633,7 +653,7 @@ func (c *boxcutterReconcilerConfigurator) Configure(ceReconciler *controllers.Cl
ceReconciler.ReconcileSteps = []controllers.ReconcileStepFunc{
controllers.HandleFinalizers(c.finalizers),
controllers.ValidateClusterExtension(
- controllers.ServiceAccountValidator(coreClient),
+ controllers.ServiceAccountDeprecationWarning(),
),
controllers.MigrateStorage(storageMigrator),
controllers.RetrieveRevisionStates(revisionStatesGetter),
@@ -650,34 +670,13 @@ func (c *boxcutterReconcilerConfigurator) Configure(ceReconciler *controllers.Cl
// Wrap the discovery client with caching to reduce memory usage from repeated OpenAPI schema fetches
discoveryClient := memory.NewMemCacheClient(baseDiscoveryClient)
- trackingCache, err := managedcache.NewTrackingCache(
- ctrl.Log.WithName("trackingCache"),
- c.mgr.GetConfig(),
- crcache.Options{
- Scheme: c.mgr.GetScheme(), Mapper: c.mgr.GetRESTMapper(),
- },
- )
- if err != nil {
- return fmt.Errorf("unable to create boxcutter tracking cache: %v", err)
- }
- if err := c.mgr.Add(trackingCache); err != nil {
- return fmt.Errorf("unable to add tracking cache to manager: %v", err)
- }
-
- cerCoreClient, err := corev1client.NewForConfig(c.mgr.GetConfig())
- if err != nil {
- return fmt.Errorf("unable to create client for ClusterObjectSet controller: %w", err)
- }
- cerTokenGetter := authentication.NewTokenGetter(cerCoreClient, authentication.WithExpirationDuration(1*time.Hour))
-
revisionEngineFactory, err := controllers.NewDefaultRevisionEngineFactory(
c.mgr.GetScheme(),
- trackingCache,
+ c.trackingCache,
discoveryClient,
c.mgr.GetRESTMapper(),
fieldOwnerPrefix,
c.mgr.GetConfig(),
- cerTokenGetter,
)
if err != nil {
return fmt.Errorf("unable to create revision engine factory: %w", err)
@@ -691,7 +690,7 @@ func (c *boxcutterReconcilerConfigurator) Configure(ceReconciler *controllers.Cl
if err = (&controllers.ClusterObjectSetReconciler{
Client: cosClient,
RevisionEngineFactory: revisionEngineFactory,
- TrackingCache: trackingCache,
+ TrackingCache: c.trackingCache,
}).SetupWithManager(c.mgr); err != nil {
return fmt.Errorf("unable to setup ClusterObjectSet controller: %w", err)
}
@@ -703,19 +702,12 @@ func (c *helmReconcilerConfigurator) Configure(ceReconciler *controllers.Cluster
if err != nil {
return fmt.Errorf("unable to create core client: %w", err)
}
- tokenGetter := authentication.NewTokenGetter(coreClient, authentication.WithExpirationDuration(1*time.Hour))
- clientRestConfigMapper := action.ServiceAccountRestConfigMapper(tokenGetter)
- if features.OperatorControllerFeatureGate.Enabled(features.SyntheticPermissions) {
- clientRestConfigMapper = action.SyntheticUserRestConfigMapper(clientRestConfigMapper)
- }
-
cfgGetter, err := helmclient.NewActionConfigGetter(c.mgr.GetConfig(), c.mgr.GetRESTMapper(),
helmclient.StorageDriverMapper(action.ChunkedStorageDriverMapper(coreClient, c.mgr.GetAPIReader(), cfg.systemNamespace)),
helmclient.ClientNamespaceMapper(func(obj client.Object) (string, error) {
ext := obj.(*ocv1.ClusterExtension)
return ext.Spec.Namespace, nil
}),
- helmclient.ClientRestConfigMapper(clientRestConfigMapper),
)
if err != nil {
return fmt.Errorf("unable to create helm action config getter: %w", err)
@@ -728,28 +720,14 @@ func (c *helmReconcilerConfigurator) Configure(ceReconciler *controllers.Cluster
return fmt.Errorf("unable to create helm action client getter: %w", err)
}
- // determine if PreAuthorizer should be enabled based on feature gate
- var preAuth authorization.PreAuthorizer
- if features.OperatorControllerFeatureGate.Enabled(features.PreflightPermissions) {
- preAuth = authorization.NewRBACPreAuthorizer(
- c.mgr.GetClient(),
- // Additional verbs / bundle manifest that are expected by the content manager to watch those resources
- authorization.WithClusterCollectionVerbs("list", "watch"),
- )
- }
-
- cm := contentmanager.NewManager(clientRestConfigMapper, c.mgr.GetConfig(), c.mgr.GetRESTMapper())
err = c.finalizers.Register(controllers.ClusterExtensionCleanupContentManagerCacheFinalizer, finalizers.FinalizerFunc(func(ctx context.Context, obj client.Object) (crfinalizer.Result, error) {
- ext := obj.(*ocv1.ClusterExtension)
- err := cm.Delete(ext)
- return crfinalizer.Result{}, err
+ return crfinalizer.Result{}, c.trackingCache.Free(ctx, obj)
}))
if err != nil {
setupLog.Error(err, "unable to register content manager cleanup finalizer")
return err
}
- // now initialize the helmApplier, assigning the potentially nil preAuth
appl := &applier.Helm{
ActionClientGetter: acg,
Preflights: c.preflights,
@@ -757,15 +735,13 @@ func (c *helmReconcilerConfigurator) Configure(ceReconciler *controllers.Cluster
ManifestProvider: c.regv1ManifestProvider,
},
HelmReleaseToObjectsConverter: &applier.HelmReleaseToObjectsConverter{},
- PreAuthorizer: preAuth,
- Watcher: c.watcher,
- Manager: cm,
+ TrackingCache: c.trackingCache,
}
revisionStatesGetter := &controllers.HelmRevisionStatesGetter{ActionClientGetter: acg}
ceReconciler.ReconcileSteps = []controllers.ReconcileStepFunc{
controllers.HandleFinalizers(c.finalizers),
controllers.ValidateClusterExtension(
- controllers.ServiceAccountValidator(coreClient),
+ controllers.ServiceAccountDeprecationWarning(),
),
controllers.RetrieveRevisionStates(revisionStatesGetter),
controllers.ResolveBundle(c.resolver, c.mgr.GetClient()),
diff --git a/docs/api-reference/olmv1-api-reference.md b/docs/api-reference/olmv1-api-reference.md
index 37be2e3ac3..f442251263 100644
--- a/docs/api-reference/olmv1-api-reference.md
+++ b/docs/api-reference/olmv1-api-reference.md
@@ -298,7 +298,7 @@ _Appears in:_
ClusterExtensionInstallConfig is a union which selects the clusterExtension installation config.
-ClusterExtensionInstallConfig requires the namespace and serviceAccount which should be used for the installation of packages.
+ClusterExtensionInstallConfig requires the namespace which should be used for the installation of packages.
@@ -359,8 +359,8 @@ _Appears in:_
| Field | Description | Default | Validation |
| --- | --- | --- | --- |
-| `namespace` _string_ | namespace specifies a Kubernetes namespace.
This is the namespace where the provided ServiceAccount must exist.
It also designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
This namespace must exist.
The namespace field is required, immutable, and follows the DNS label standard as defined in [RFC 1123].
It must contain only lowercase alphanumeric characters or hyphens (-), start and end with an alphanumeric character,
and be no longer than 63 characters.
[RFC 1123]: https://tools.ietf.org/html/rfc1123 | | MaxLength: 63
Required: \{\}
|
-| `serviceAccount` _[ServiceAccountReference](#serviceaccountreference)_ | serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
that are required to manage the extension.
The ServiceAccount must be configured with the necessary permissions to perform these interactions.
The ServiceAccount must exist in the namespace referenced in the spec.
The serviceAccount field is required. | | Required: \{\}
|
+| `namespace` _string_ | namespace specifies a Kubernetes namespace.
It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
This namespace must exist.
The namespace field is required, immutable, and follows the DNS label standard as defined in [RFC 1123].
It must contain only lowercase alphanumeric characters or hyphens (-), start and end with an alphanumeric character,
and be no longer than 63 characters.
[RFC 1123]: https://tools.ietf.org/html/rfc1123 | | MaxLength: 63
Required: \{\}
|
+| `serviceAccount` _[ServiceAccountReference](#serviceaccountreference)_ | serviceAccount is a deprecated field and is completely ignored.
OLMv1 is a single-tenant system where users with ClusterExtension write access are
effectively delegated cluster-admin trust. The operator-controller runs with
cluster-admin privileges and uses its own service account for all cluster interactions.
Deprecated: serviceAccount is no longer used and will be removed in a future release. | | Optional: \{\}
|
| `source` _[SourceConfig](#sourceconfig)_ | source is required and selects the installation source of content for this ClusterExtension.
Set the sourceType field to perform the selection.
Catalog is currently the only implemented sourceType.
Setting sourceType to "Catalog" requires the catalog field to also be defined.
Below is a minimal example of a source definition (in yaml):
source:
sourceType: Catalog
catalog:
packageName: example-package | | Required: \{\}
|
| `install` _[ClusterExtensionInstallConfig](#clusterextensioninstallconfig)_ | install is optional and configures installation options for the ClusterExtension,
such as the pre-flight check configuration. | | Optional: \{\}
|
| `config` _[ClusterExtensionConfig](#clusterextensionconfig)_ | config is optional and specifies bundle-specific configuration.
Configuration is bundle-specific and a bundle may provide a configuration schema.
When not specified, the default configuration of the resolved bundle is used.
config is validated against a configuration schema provided by the resolved bundle. If the bundle does not provide
a configuration schema the bundle is deemed to not be configurable. More information on how
to configure bundles can be found in the OLM documentation associated with your current OLM version.
| | Optional: \{\}
|
@@ -586,7 +586,9 @@ _Appears in:_
-ServiceAccountReference identifies the serviceAccount used fo install a ClusterExtension.
+ServiceAccountReference is a deprecated type and is completely ignored.
+
+Deprecated: ServiceAccountReference is no longer used and will be removed in a future release.
@@ -595,7 +597,7 @@ _Appears in:_
| Field | Description | Default | Validation |
| --- | --- | --- | --- |
-| `name` _string_ | name is a required, immutable reference to the name of the ServiceAccount used for installation
and management of the content for the package specified in the packageName field.
This ServiceAccount must exist in the installNamespace.
The name field follows the DNS subdomain standard as defined in [RFC 1123].
It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
start and end with an alphanumeric character, and be no longer than 253 characters.
Some examples of valid values are:
- some-serviceaccount
- 123-serviceaccount
- 1-serviceaccount-2
- someserviceaccount
- some.serviceaccount
Some examples of invalid values are:
- -some-serviceaccount
- some-serviceaccount-
[RFC 1123]: https://tools.ietf.org/html/rfc1123 | | MaxLength: 253
Required: \{\}
|
+| `name` _string_ | name is a deprecated field and is completely ignored.
Deprecated: name is no longer used and will be removed in a future release.
The name field follows the DNS subdomain standard as defined in [RFC 1123].
It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
start and end with an alphanumeric character, and be no longer than 253 characters.
Some examples of valid values are:
- some-serviceaccount
- 123-serviceaccount
- 1-serviceaccount-2
- someserviceaccount
- some.serviceaccount
Some examples of invalid values are:
- -some-serviceaccount
- some-serviceaccount-
[RFC 1123]: https://tools.ietf.org/html/rfc1123 | | MaxLength: 253
Optional: \{\}
|
#### SourceConfig
diff --git a/docs/concepts/controlling-catalog-selection.md b/docs/concepts/controlling-catalog-selection.md
index 384b7faf34..e4d77ae7d5 100644
--- a/docs/concepts/controlling-catalog-selection.md
+++ b/docs/concepts/controlling-catalog-selection.md
@@ -24,8 +24,6 @@ metadata:
name: argocd
spec:
namespace: argocd
- serviceAccount:
- name: argocd-installer
source:
sourceType: Catalog
catalog:
@@ -50,8 +48,6 @@ metadata:
name: argocd
spec:
namespace: argocd
- serviceAccount:
- name: argocd-installer
source:
sourceType: Catalog
catalog:
@@ -72,8 +68,6 @@ metadata:
name: argocd
spec:
namespace: argocd
- serviceAccount:
- name: argocd-installer
source:
sourceType: Catalog
catalog:
@@ -102,8 +96,6 @@ metadata:
name: argocd
spec:
namespace: argocd
- serviceAccount:
- name: argocd-installer
source:
sourceType: Catalog
catalog:
@@ -127,8 +119,6 @@ metadata:
name: argocd
spec:
namespace: argocd
- serviceAccount:
- name: argocd-installer
source:
sourceType: Catalog
catalog:
@@ -226,8 +216,6 @@ If the system cannot resolve to a single bundle due to ambiguity, it will genera
name: install-my-operator
spec:
namespace: my-operator-ns
- serviceAccount:
- name: my-operator-installer
source:
sourceType: Catalog
catalog:
diff --git a/docs/concepts/crd-upgrade-safety.md b/docs/concepts/crd-upgrade-safety.md
index 53aef8f69e..7eeb532d77 100644
--- a/docs/concepts/crd-upgrade-safety.md
+++ b/docs/concepts/crd-upgrade-safety.md
@@ -62,8 +62,6 @@ metadata:
name: argocd
spec:
namespace: argocd
- serviceAccount:
- name: argocd-installer
source:
sourceType: Catalog
catalog:
diff --git a/docs/concepts/permission-model.md b/docs/concepts/permission-model.md
deleted file mode 100644
index cc23b7c959..0000000000
--- a/docs/concepts/permission-model.md
+++ /dev/null
@@ -1,29 +0,0 @@
-#### OLMv1 Permission Model
-
-Here we aim to describe the OLMv1 permission model. OLMv1 itself does not have cluster-wide admin permissions. Therefore, each cluster extension must specify a service account with sufficient permissions to install and manage it. While this service account is distinct from any service account defined in the bundle, it will need sufficient privileges to create and assign the required RBAC. Therefore, the cluster extension service account's privileges would be a superset of the privileges required by the service account in the bundle.
-
-To understand the permission model, lets see the scope of the the service accounts associated with ClusterExtension deployment:
-
-#### Service Account associated with the ClusterExtension CR
-
-1) The ClusterExtension CR defines a service account to deploy and manage the ClusterExtension lifecycle and can be derived using the [document](../howto/derive-service-account.md). It is specified in the ClusterExtension [yaml](../tutorials/install-extension#L71) while deploying a ClusterExtension.
-2) The purpose of the service account specified in the ClusterExtension spec is to manage the cluster extension lifecycle. Its permissions are the cumulative of the permissions required for managing the cluster extension lifecycle and any RBAC that maybe included in the extension bundle.
-3) Since the extension bundle contains its own RBAC, it means the ClusterExtension service account requires either:
-- the same set of permissions that are defined in the RBAC that it is trying to create.
-- bind/escalate verbs for RBAC, see https://kubernetes.io/docs/reference/access-authn-authz/rbac/#privilege-escalation-prevention-and-bootstrapping
-
-#### Service Account/(s) part of the Extension Bundle
-1) The contents of the extension bundle may contain more service accounts and RBAC.
-2) The OLMv1 operator-controller creates the service account/(s) defined as part of the extension bundle with the required RBAC for the controller business logic.
-
-##### Example:
-
-Lets consider deployment of the ArgoCD operator. The ClusterExtension ClusterResource specifies a service account as part of its spec, usually denoted as the ClusterExtension installer service account.
-The ArgoCD operator specifies the `argocd-operator-controller-manager` [service account](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator.v0.6.0.clusterserviceversion.yaml#L1124) with necessary RBAC for the bundle resources and OLMv1 creates it as part of this extension bundle deployment.
-
-The extension bundle CSV contains the [permissions](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator.v0.6.0.clusterserviceversion.yaml#L1091) and [cluster permissions](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator.v0.6.0.clusterserviceversion.yaml#L872) allow the operator to manage and run the controller logic. These permissions are assigned to the `argocd-operator-controller-manager` service account when the operator bundle is deployed.
-
-OLM v1 will assign all the RBAC specified in the extension bundle to the above service account.
-The ClusterExtension installer service account will need all the RBAC specified for the `argocd-operator-controller-manager` and additional RBAC for deploying the ClusterExtension.
-
-**Note**: The ClusterExtension permissions are not propogated to the deployment. The ClusterExtension service account and the bundle's service accounts have different purposes and naming conflicts between the two service accounts can lead to failure of ClusterExtension deployment.
diff --git a/docs/concepts/upgrade-support.md b/docs/concepts/upgrade-support.md
index 8ad7d589ad..2bb41173af 100644
--- a/docs/concepts/upgrade-support.md
+++ b/docs/concepts/upgrade-support.md
@@ -46,8 +46,6 @@ metadata:
name:
spec:
namespace:
- serviceAccount:
- name:
source:
sourceType: Catalog
catalog:
@@ -98,8 +96,6 @@ metadata:
name: extension-sample
spec:
namespace: argocd
- serviceAccount:
- name: argocd-installer
source:
sourceType: Catalog
catalog:
diff --git a/docs/draft/howto/configure-bundles.md b/docs/draft/howto/configure-bundles.md
index 1cdd82739d..a2d43f61a6 100644
--- a/docs/draft/howto/configure-bundles.md
+++ b/docs/draft/howto/configure-bundles.md
@@ -104,8 +104,6 @@ metadata:
name: my-operator
spec:
namespace: my-operator-ns # <--- Install Namespace
- serviceAccount:
- name: my-sa
config:
configType: Inline
inline:
@@ -128,8 +126,6 @@ metadata:
name: monitor-operator
spec:
namespace: ops-system # <--- Install Namespace
- serviceAccount:
- name: monitor-operator-installer
source:
sourceType: Catalog
catalog:
@@ -151,8 +147,6 @@ metadata:
spec:
namespace: operators
# No config provided = Operator watches the entire cluster (AllNamespaces)
- serviceAccount:
- name: global-operator-installer
source:
sourceType: Catalog
catalog:
diff --git a/docs/draft/howto/customize-operator-deployments.md b/docs/draft/howto/customize-operator-deployments.md
index 59932b42fb..8c14585e41 100644
--- a/docs/draft/howto/customize-operator-deployments.md
+++ b/docs/draft/howto/customize-operator-deployments.md
@@ -48,8 +48,6 @@ metadata:
name: my-operator
spec:
namespace: my-namespace
- serviceAccount:
- name: my-operator-sa
source:
sourceType: Catalog
catalog:
@@ -236,8 +234,6 @@ metadata:
name: production-operator
spec:
namespace: production-operators
- serviceAccount:
- name: production-operator-installer
source:
sourceType: Catalog
catalog:
@@ -344,8 +340,6 @@ metadata:
name: my-operator
spec:
namespace: operators
- serviceAccount:
- name: my-operator-installer
source:
sourceType: Catalog
catalog:
diff --git a/docs/draft/howto/enable-helm-chart-support.md b/docs/draft/howto/enable-helm-chart-support.md
index 44d083707c..860690c898 100644
--- a/docs/draft/howto/enable-helm-chart-support.md
+++ b/docs/draft/howto/enable-helm-chart-support.md
@@ -396,8 +396,6 @@ In addition to the OCI registry, you will need a ClusterCatalog in the Kubernete
namespace: metrics-server-system
spec:
namespace: metrics-server-system
- serviceAccount:
- name: metrics-server-installer
source:
sourceType: Catalog
catalog:
diff --git a/docs/draft/howto/rbac-permissions-checking.md b/docs/draft/howto/rbac-permissions-checking.md
deleted file mode 100644
index 04c13bf0ce..0000000000
--- a/docs/draft/howto/rbac-permissions-checking.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# How To Get Your Cluster Extension RBAC Right — Working with the Preflight Permissions Check
-
-Cluster Extensions in Operator Lifecycle Manager (OLM) v1 are installed and managed via a **service account** that you (the cluster admin) provide. Unlike OLM v0, OLM v1 itself doesn’t have cluster-admin privileges to grant Operators the access they need – **you** must ensure the service account has all necessary Role-Based Access Control (RBAC) permissions. If the service account is missing permissions, the extension’s installation will fail or hang. To address this, the **operator-controller** now performs a **preflight permissions check** before installing an extension. This check identifies any missing RBAC permissions up front and surfaces them to you so that you can fix the issues.
-
-## Understanding the Preflight Permissions Check
-
-When you create a `ClusterExtension` Custom Resource (CR) to install an Operator extension, the operator-controller will do a dry-run of the installation and verify that the specified service account can perform all the actions required by that extension. This includes creating all the Kubernetes objects in the bundle (Deployments, Services, CRDs, etc.), as well as creating any RBAC roles or bindings that the extension’s bundle defines.
-
-If any required permission is missing, the preflight check will **fail fast** *before* attempting the real installation. Instead of proceeding, the operator-controller records which permissions are missing. You’ll find this information in two places:
-
-- **ClusterExtension Status Conditions:** The `ClusterExtension` CR will have a condition (such as **Progressing** or **Installing**) with a message describing the missing permissions. The condition’s reason may be set to “Retrying” (meaning the controller will periodically retry the install) and the message will start with “pre-authorization failed: …”.
-- **Operator-Controller Logs:** The same message is also logged by the operator-controller pod. If you have access to the operator-controller’s logs (in namespace `olm-controller` on OpenShift), you can see the detailed RBAC errors there as well.
-
-### Interpreting the Preflight Check Output
-
-The preflight check’s output enumerates the **RBAC rules** that the service account is missing. Each missing permission is listed in a structured format. For example, a message might say:
-
-```
-service account requires the following permissions to manage cluster extension:
- Namespace:"" APIGroups:[] Resources:[services] Verbs:[list,watch]
- Namespace:"pipelines" APIGroups:[] Resources:[secrets] Verbs:[get]
-```
-
-Let’s break down how to read this output:
-
-- **`Namespace:""`** – An empty namespace in quotes means the permission is needed at the **cluster scope** (not limited to a single namespace). In the example above, `Namespace:""` for Services indicates the service account needs the ability to list/watch Services cluster-wide.
-- **`APIGroups:[]`** – An empty API group (`[]`) means the **core API group** (no group). For instance, core resources like Services, Secrets, ConfigMaps have `APIGroups:[]`. If the resource is part of a named API group (e.g. `apps`, `apiextensions.k8s.io`), that group would be listed here.
-- **`Resources:[...]`** – The resource type that’s missing permissions. e.g. `services`, `secrets`, `customresourcedefinitions`.
-- **`Verbs:[...]`** – The specific actions (verbs) that the service account is not allowed to do for that resource. Multiple verbs listed together means none of those verbs are permitted (and are all required).
-
-A few special cases to note:
-
-- **Privilege Escalation Cases:** If the extension’s bundle includes the creation of a Role or ClusterRole, the service account needs to have at least the permissions it is trying to grant. If not, the preflight check will report those verbs as missing to prevent privilege escalation.
-- **Missing Role References (Resolution Errors):** If an Operator’s bundle references an existing ClusterRole or Role that is not found, the preflight check will report an “authorization evaluation error” listing the missing role.
-
-## Resolving Common RBAC Permission Errors
-
-Once you understand what each missing permission is, the fix is usually straightforward: **grant the service account those permissions**. Here are common scenarios and how to address them:
-
-- **Missing resource permissions (verbs):** Update or create a (Cluster)Role and RoleBinding/ClusterRoleBinding to grant the missing verbs on the resources in the specified namespaces or at cluster scope.
-- **Privilege escalation missing permissions:** Treat these missing verbs as required for the installer as well, granting the service account those rights so it can create the roles it needs.
-- **Missing roles/clusterroles:** Ensure any referenced roles exist by creating them or adjusting the extension’s expectations.
-
-## Demo Scenario (OpenShift)
-
-Below is an example demo you can run on OpenShift to see the preflight check in action:
-
-1. **Create a minimal ServiceAccount and ClusterRole** that lacks key permissions (e.g., missing list/watch on Services and create on CRDs).
-2. **Apply a ClusterExtension** pointing to the Pipelines Operator package, specifying the above service account.
-3. **Describe the ClusterExtension** (`oc describe clusterextension pipelines-operator`) to see the preflight “pre-authorization failed” errors listing missing permissions.
-4. **Update the ClusterRole** to include the missing verbs.
-5. **Reapply the role** and observe the ClusterExtension status clear and the operator proceed with installation.
-
-By following this guide and using the preflight output, you can iteratively grant exactly the permissions needed—no more, no less—ensuring your cluster extensions install reliably and securely.
diff --git a/docs/draft/howto/single-ownnamespace-install.md b/docs/draft/howto/single-ownnamespace-install.md
index e2ad3efebe..85f15138af 100644
--- a/docs/draft/howto/single-ownnamespace-install.md
+++ b/docs/draft/howto/single-ownnamespace-install.md
@@ -104,8 +104,6 @@ metadata:
name: argocd
spec:
namespace: argocd
- serviceAccount:
- name: argocd-installer
config:
inline:
watchNamespace: argocd-watch
@@ -125,8 +123,6 @@ metadata:
name: argocd
spec:
namespace: argocd
- serviceAccount:
- name: argocd-installer
config:
inline:
watchNamespace: argocd
diff --git a/docs/draft/howto/use-synthetic-permissions.md b/docs/draft/howto/use-synthetic-permissions.md
deleted file mode 100644
index 9820ad2b6e..0000000000
--- a/docs/draft/howto/use-synthetic-permissions.md
+++ /dev/null
@@ -1,133 +0,0 @@
-## Synthetic User Permissions
-
-!!! note
-This feature is still in *alpha* the `SyntheticPermissions` feature-gate must be enabled to make use of it.
-See the instructions below on how to enable it.
-
-Synthetic user permissions enables fine-grained configuration of ClusterExtension management client RBAC permissions.
-User can not only configure RBAC permissions governing the management across all ClusterExtensions, but also on a
-case-by-case basis.
-
-### Run OLM v1with Experimental Features Enabled
-
-```terminal title=Enable Experimental Features in a New Kind Cluster
-make run-experimental
-```
-
-```terminal title=Wait for rollout to complete
-kubectl rollout status -n olmv1-system deployment/operator-controller-controller-manager
-```
-
-### How does it work?
-
-When managing a ClusterExtension, OLM will assume the identity of user "olm:clusterextensions:"
-and group "olm:clusterextensions" limiting Kubernetes API access scope to those defined for this user and group. These
-users and group do not exist beyond being defined in Cluster/RoleBinding(s) and can only be impersonated by clients with
- `impersonate` verb permissions on the `users` and `groups` resources.
-
-### Demo
-
-[](https://asciinema.org/a/Jbtt8nkV8Dm7vriHxq7sxiVvi)
-
-#### Examples:
-
-##### ClusterExtension management as cluster-admin
-
-To enable ClusterExtensions management as cluster-admin, bind the `cluster-admin` cluster role to the `olm:clusterextensions`
-group:
-
-```
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
- name: clusterextensions-group-admin-binding
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: cluster-admin
-subjects:
-- kind: Group
- name: "olm:clusterextensions"
-```
-
-##### Scoped olm:clusterextension group + Added perms on specific extensions
-
-Give ClusterExtension management group broad permissions to manage ClusterExtensions denying potentially dangerous
-permissions such as being able to read cluster wide secrets:
-
-```
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: clusterextension-installer
-rules:
- - apiGroups: [ olm.operatorframework.io ]
- resources: [ clusterextensions/finalizers ]
- verbs: [ update ]
- - apiGroups: [ apiextensions.k8s.io ]
- resources: [ customresourcedefinitions ]
- verbs: [ create, list, watch, get, update, patch, delete ]
- - apiGroups: [ rbac.authorization.k8s.io ]
- resources: [ clusterroles, roles, clusterrolebindings, rolebindings ]
- verbs: [ create, list, watch, get, update, patch, delete ]
- - apiGroups: [""]
- resources: [configmaps, endpoints, events, pods, pod/logs, serviceaccounts, services, services/finalizers, namespaces, persistentvolumeclaims]
- verbs: ['*']
- - apiGroups: [apps]
- resources: [ '*' ]
- verbs: ['*']
- - apiGroups: [ batch ]
- resources: [ '*' ]
- verbs: [ '*' ]
- - apiGroups: [ networking.k8s.io ]
- resources: [ '*' ]
- verbs: [ '*' ]
- - apiGroups: [authentication.k8s.io]
- resources: [tokenreviews, subjectaccessreviews]
- verbs: [create]
-```
-
-```
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
- name: clusterextension-installer-binding
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: clusterextension-installer
-subjects:
-- kind: Group
- name: "olm:clusterextensions"
-```
-
-Give a specific ClusterExtension secrets access, maybe even on specific namespaces:
-
-```
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: clusterextension-privileged
-rules:
-- apiGroups: [""]
- resources: [secrets]
- verbs: ['*']
-```
-
-```
-apiVersion: rbac.authorization.k8s.io/v1
-kind: RoleBinding
-metadata:
- name: clusterextension-privileged-binding
- namespace:
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: clusterextension-privileged
-subjects:
-- kind: User
- name: "olm:clusterextensions:argocd-operator"
-```
-
-Note: In this example the ClusterExtension user (or group) will still need to be updated to be able to manage
-the CRs coming from the argocd operator. Some look ahead and RBAC permission wrangling will still be required.
diff --git a/docs/draft/project/personas.md b/docs/draft/project/personas.md
index 16bf9dd6f5..8da24211bc 100644
--- a/docs/draft/project/personas.md
+++ b/docs/draft/project/personas.md
@@ -25,12 +25,11 @@ Here `extension` represents any individual OLMv1 installable, including (but not
*What does it do?*
-- Creates enabling infrastructure for extension lifecycle (service accounts, etc.)
+- Creates enabling infrastructure for extension lifecycle (namespaces, etc.)
- Installs extensions
- Upgrades extensions
- Removes extensions
- Browses extensions offered in installed `ClusterCatalogs`
-- Derives minimum privilege for installation
- filters visibility on installable extensions
- Verifies that extension health is detectable to desired sensors
diff --git a/docs/getting-started/olmv1_getting_started.md b/docs/getting-started/olmv1_getting_started.md
index de6f35f147..152cd4dfaa 100644
--- a/docs/getting-started/olmv1_getting_started.md
+++ b/docs/getting-started/olmv1_getting_started.md
@@ -58,13 +58,11 @@ kubectl wait --for=condition=Serving=True clustercatalog/operatorhubio --timeout
### Install a Cluster Extension
For simplicity, the following example manifest includes all necessary resources to install the ArgoCD operator.
-The manifest includes installation namespace, installer service account and associated minimal set of RBAC permissions
-needed for installation, and the ClusterExtension resource, which specifies the name and version of the extension to install.
-More information on installing extensions can be found [here](../tutorials/install-extension.md).
+The manifest includes installation namespace and the ClusterExtension resource, which specifies the name and
+version of the extension to install. More information on installing extensions can be found [here](../tutorials/install-extension.md).
```bash
-# Apply the sample ClusterExtension. Manifest already includes
-# namespace and adequately privileged service account
+# Apply the sample ClusterExtension. Manifest already includes namespace
kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-controller/main/config/samples/olm_v1_clusterextension.yaml
```
@@ -94,20 +92,9 @@ kubectl delete clusterextension/argocd
### Cleanup
-Extension installation requires the creation of a namespace, an installer service account, and its RBAC. Once the
-extension is uninstalled, these resources can be cleaned up.
+Extension installation requires the creation of a namespace. Once the extension is uninstalled, the namespace can be removed.
```bash
-# Delete namespace, and by extension, the installer service account, Role, and RoleBinding
+# Delete the namespace
kubectl delete namespace argocd
```
-
-```bash
-# Delete installer service account cluster roles
-kubectl delete clusterrole argocd-installer-clusterrole && kubectl delete clusterrole argocd-installer-rbac-clusterrole
-```
-
-```bash
-# Delete installer service account cluster role bindings
-kubectl delete clusterrolebinding argocd-installer-binding && kubectl delete clusterrolebinding argocd-installer-rbac-binding
-```
diff --git a/docs/howto/derive-service-account.md b/docs/howto/derive-service-account.md
deleted file mode 100644
index c1c1204da2..0000000000
--- a/docs/howto/derive-service-account.md
+++ /dev/null
@@ -1,357 +0,0 @@
-# Derive minimal ServiceAccount required for ClusterExtension Installation and Management
-
-OLM v1 does not have permission to install extensions on a cluster by default. In order to install a [supported bundle](../project/olmv1_limitations.md),
-OLM must be provided a ServiceAccount configured with the appropriate permissions.
-
-This document serves as a guide for how to derive the RBAC necessary to install a bundle.
-
-## Required RBAC
-
-The required permissions for the installation and management of a cluster extension can be determined by examining the contents of its bundle image.
-This bundle image contains all the manifests that make up the extension (e.g. `CustomResourceDefinition`s, `Service`s, `Secret`s, `ConfigMap`s, `Deployment`s etc.)
-as well as a [`ClusterServiceVersion`](https://olm.operatorframework.io/docs/concepts/crds/clusterserviceversion/) (CSV) that describes the extension and its service account's permission requirements.
-
-The service account must have permissions to:
-
- - create and manage the extension's `CustomResourceDefinition`s
- - create and manage the resources packaged in the bundle
- - grant the extension controller's service account the permissions it requires for its operation
- - create and manage the extension controller's service account
- - create and manage the `Role`s, `RoleBinding`s, `ClusterRole`s, and `ClusterRoleBinding`s associated with the extension controller's service account
- - create and manage the extension controller's deployment
-
-Additionally, for clusters that use the [OwnerReferencesPermissionEnforcement](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#ownerreferencespermissionenforcement) admission plug-in, the service account must also have permissions to:
-
- - update finalizers on the ClusterExtension to be able to set blockOwnerDeletion and ownerReferences
-
-It is good security practice to follow the [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege), and scope permissions to specific resource names, wherever possible.
-Keep in mind, that it is not possible to scope `create`, `list`, and `watch` permissions to specific resource names.
-
-Depending on the scope, each permission will need to be added to either a `ClusterRole` or a `Role` and then bound to the service account with a `ClusterRoleBinding` or a `RoleBinding`.
-
-## Example
-
-The following example illustrates the process of deriving the minimal RBAC required to install the [ArgoCD Operator](https://operatorhub.io/operator/argocd-operator) [v0.6.0](https://operatorhub.io/operator/argocd-operator/alpha/argocd-operator.v0.6.0) provided by [OperatorHub.io](https://operatorhub.io/).
-The final permission set can be found in the [ClusterExtension sample manifest](https://github.com/operator-framework/operator-controller/blob/main/config/samples/olm_v1_clusterextension.yaml) in the [samples](https://github.com/operator-framework/operator-controller/blob/main/config/samples/olm_v1_clusterextension.yaml) directory.
-
-The bundle includes the following manifests, which can be found [here](https://github.com/argoproj-labs/argocd-operator/tree/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0):
-
-* `ClusterServiceVersion`:
- - [argocd-operator.v0.6.0.clusterserviceversion.yaml](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator.v0.6.0.clusterserviceversion.yaml)
-* `CustomResourceDefinition`s:
- - [argoproj.io_applicationsets.yaml](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argoproj.io_applicationsets.yaml)
- - [argoproj.io_applications.yaml](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argoproj.io_applications.yaml)
- - [argoproj.io_appprojects.yaml](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argoproj.io_appprojects.yaml)
- - [argoproj.io_argocdexports.yaml](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argoproj.io_argocdexports.yaml)
- - [argoproj.io_argocds.yaml](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argoproj.io_argocds.yaml)
-* Additional resources:
- - [argocd-operator-controller-manager-metrics-service_v1_service.yaml](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator-controller-manager-metrics-service_v1_service.yaml)
- - [argocd-operator-manager-config_v1_configmap.yaml](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator-manager-config_v1_configmap.yaml)
- - [argocd-operator-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml)
-
-The `ClusterServiceVersion` defines a single `Deployment` in `spec.install.deployments` named `argocd-operator-controller-manager` with a `ServiceAccount` of the same name.
-It declares the following cluster-scoped permissions in `spec.install.clusterPermissions`, and its namespace-scoped permissions in `spec.install.permissions`.
-
-### Derive permissions for the installer service account `ClusterRole`
-
-#### Step 1. RBAC creation and management permissions
-
-The installer service account must create and manage the `ClusterRole`s and `ClusterRoleBinding`s for the extension controller(s).
-Therefore, it must have the following permissions:
-
-```yaml
-- apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create, list, watch]
-- apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, update, patch, delete]
- resourceNames: [, ...]
-- apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create, list, watch]
-- apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, update, patch, delete]
- resourceNames: [, ...]
-```
-
-!!! note
- The `resourceNames` field should be populated with the names of the `ClusterRole`s and `ClusterRoleBinding`s created by OLM v1.
- These names are generated with the following format: `.`. Since it is not a trivial task
- to generate these names ahead of time, it is recommended to use a wildcard `*` in the `resourceNames` field for the installation.
- Then, update the `resourceNames` fields by inspecting the cluster for the generated resource names. For instance, for `ClusterRole`s:
-
-```terminal
-kubectl get clusterroles | grep argocd
-```
-
-Example output:
-
-```terminal
-argocd-installer-clusterrole 2024-09-30T08:02:09Z
-argocd-installer-rbac-clusterrole 2024-09-30T08:02:09Z
-argocd-operator-metrics-reader 2024-09-30T08:02:12Z
-# The following are the generated ClusterRoles
-argocd-operator.v0-1dhiybrldl1gyksid1dk2dqjsc72psdybc7iyvse5gpx 2024-09-30T08:02:12Z
-argocd-operator.v0-22gmilmgp91wu25is5i2ec598hni8owq3l71bbkl7iz3 2024-09-30T08:02:12Z
-```
-
-The same can be done for `ClusterRoleBindings`.
-
-#### Step 2. `CustomResourceDefinition` permissions
-
-The installer service account must be able to create and manage the `CustomResourceDefinition`s for the extension, as well
-as grant the extension controller's service account the permissions it needs to manage its CRDs.
-
-```yaml
-- apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
-- apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- # Scoped to the CRDs in the bundle
- resourceNames: [applications.argoproj.io, appprojects.argoproj.io, argocds.argoproj.io, argocdexports.argoproj.io, applicationsets.argoproj.io]
-```
-
-#### Step 3. `OwnerReferencesPermissionEnforcement` permissions
-
-For clusters that use `OwnerReferencesPermissionEnforcement`, the installer service account must be able to update finalizers on the ClusterExtension to be able to set blockOwnerDeletion and ownerReferences for clusters that use `OwnerReferencesPermissionEnforcement`.
-This is only a requirement for clusters that use the [OwnerReferencesPermissionEnforcement](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#ownerreferencespermissionenforcement) admission plug-in.
-
-```yaml
-- apiGroups: [olm.operatorframework.io]
- resources: [clusterextensions/finalizers]
- verbs: [update]
- # Scoped to the name of the ClusterExtension
- resourceNames: [argocd-operator.v0.6.0]
-```
-
-#### Step 4. Bundled cluster-scoped resource permissions
-
-Permissions must be added for the creation and management of any cluster-scoped resources included in the bundle.
-In this example, the ArgoCD bundle contains a `ClusterRole` called `argocd-operator-metrics-reader`. Given that
-`ClusterRole` permissions have already been created in [Step 1](#step-1-rbac-creation-and-management-permissions), it
-is sufficient to add the `argocd-operator-metrics-reader`resource name to the `resourceName` list of the pre-existing rule:
-
-```yaml
-- apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, update, patch, delete]
- resourceNames: [, ..., argocd-operator-metrics-reader]
-```
-
-#### Step 5. Operator permissions declared in the ClusterServiceVersion
-
-Include all permissions defined in the `.spec.install.permissions` ([reference](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator.v0.6.0.clusterserviceversion.yaml#L1091)) and `.spec.install.clusterPermissions` ([reference](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator.v0.6.0.clusterserviceversion.yaml#L872)) stanzas in the bundle's `ClusterServiceVersion`.
-These permissions are required by the extension controller, and therefore the installer service account must be able to grant them.
-
-!!! note
- There may be overlap between the rules defined in each stanza. Overlapping rules needn't be added twice.
-
-```yaml
-# from .spec.install.clusterPermissions
-- apiGroups: [""]
- resources: ["configmaps", "endpoints", "events", "namespaces", "persistentvolumeclaims", "pods", "secrets", "serviceaccounts", "services", "services/finalizers"]
- verbs: ["*"]
-- apiGroups: [""]
- resources: ["pods", "pods/log"]
- verbs: ["get"]
-- apiGroups: ["apps"]
- resources: ["daemonsets", "deployments", "replicasets", "statefulsets"]
- verbs: ["*"]
-- apiGroups: ["apps"]
- resourceNames: ["argocd-operator"]
- resources: ["deployments/finalizers"]
- verbs: ["update"]
-- apiGroups: ["apps.openshift.io"]
- resources: ["deploymentconfigs"]
- verbs: ["*"]
-- apiGroups: ["argoproj.io"]
- resources: ["applications", "appprojects"]
- verbs: ["*"]
-- apiGroups: ["argoproj.io"]
- resources: ["argocdexports", "argocdexports/finalizers", "argocdexports/status"]
- verbs: ["*"]
-- apiGroups: ["argoproj.io"]
- resources: ["argocds", "argocds/finalizers", "argocds/status"]
- verbs: ["*"]
-- apiGroups: ["autoscaling"]
- resources: ["horizontalpodautoscalers"]
- verbs: ["*"]
-- apiGroups: ["batch"]
- resources: ["cronjobs", "jobs"]
- verbs: ["*"]
-- apiGroups: ["config.openshift.io"]
- resources: ["clusterversions"]
- verbs: ["get", "list", "watch"]
-- apiGroups: ["monitoring.coreos.com"]
- resources: ["prometheuses", "servicemonitors"]
- verbs: ["*"]
-- apiGroups: ["networking.k8s.io"]
- resources: ["ingresses"]
- verbs: ["*"]
-- apiGroups: ["oauth.openshift.io"]
- resources: ["oauthclients"]
- verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]
-- apiGroups: ["rbac.authorization.k8s.io"]
- resources: ["*"]
- verbs: ["*"]
-- apiGroups: ["rbac.authorization.k8s.io"]
- resources: ["clusterrolebindings", "clusterroles"]
- verbs: ["*"]
-- apiGroups: ["route.openshift.io"]
- resources: ["routes", "routes/custom-host"]
- verbs: ["*"]
-- apiGroups: ["template.openshift.io"]
- resources: ["templateconfigs", "templateinstances", "templates"]
- verbs: ["*"]
-- apiGroups: ["authentication.k8s.io"]
- resources: ["tokenreviews"]
- verbs: ["create"]
-- apiGroups: ["authorization.k8s.io"]
- resources: ["subjectaccessreviews"]
- verbs: ["create"]
-
-# copied from .spec.install.permissions
-- apiGroups: ["coordination.k8s.io"]
- resources: ["leases"]
- verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
-# overlapping permissions:
-# - apiGroups: [""]
-# resources: ["configmaps"]
-# verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
-# - apiGroups: [""]
-# resources: ["events"]
-# verbs: ["create", "patch"]
-```
-
-### Derive permissions for the installer service account `Role`
-
-The following steps detail how to define the namespace-scoped permissions needed by the installer service account's `Role`.
-The installer service account must create and manage the `RoleBinding`s for the extension controller(s).
-
-#### Step 1. `Deployment` permissions
-
-The installer service account must be able to create and manage the `Deployment`s for the extension controller(s).
-The `Deployment` name(s) can be found in the `ClusterServiceVersion` resource packed in the bundle under `.spec.install.deployments` ([reference](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator.v0.6.0.clusterserviceversion.yaml#L1029)).
-This example's `ClusterServiceVersion` can be found [here](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator.v0.6.0.clusterserviceversion.yaml).
-
-```yaml
-- apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
-- apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, update, patch, delete]
- # scoped to the extension controller deployment name
- resourceNames: [argocd-operator-controller-manager]
-```
-
-#### Step 2: `ServiceAccount` permissions
-
-The installer service account must be able to create and manage the `ServiceAccount`(s) for the extension controller(s).
-The `ServiceAccount` name(s) can be found in deployment template in the `ClusterServiceVersion` resource packed in the bundle under `.spec.install.deployments`.
-This example's `ClusterServiceVersion` can be found [here](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator.v0.6.0.clusterserviceversion.yaml).
-
-```yaml
-- apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [create, list, watch]
-- apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, update, patch, delete]
- # scoped to the extension controller's deployment service account
- resourceNames: [argocd-operator-controller-manager]
-```
-
-#### Step 3. Bundled namespace-scoped resource permissions
-
-The installer service account must also create and manage other namespace-scoped resources included in the bundle.
-In this example, the bundle also includes two additional namespace-scoped resources:
-
- * the [argocd-operator-controller-manager-metrics-service](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator-controller-manager-metrics-service_v1_service.yaml) `Service`, and
- * the [argocd-operator-manager-config](https://github.com/argoproj-labs/argocd-operator/blob/da6b8a7e68f71920de9545152714b9066990fc4b/deploy/olm-catalog/argocd-operator/0.6.0/argocd-operator-manager-config_v1_configmap.yaml) `ConfigMap`
-
-Therefore, the following permissions must be given to the installer service account:
-
-```yaml
-- apiGroups: [""]
- resources: [services]
- verbs: [create]
-- apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, update, patch, delete]
- # scoped to the service name
- resourceNames: [argocd-operator-controller-manager-metrics-service]
-- apiGroups: [""]
- resources: [configmaps]
- verbs: [create]
-- apiGroups: [""]
- resources: [configmaps]
- verbs: [get, list, watch, update, patch, delete]
- # scoped to the configmap name
- resourceNames: [argocd-operator-manager-config]
-```
-
-### Putting it all together
-
-Once the installer service account required cluster-scoped and namespace-scoped permissions have been collected:
-
-1. Create the installation namespace
-2. Create the installer `ServiceAccount`
-3. Create the installer `ClusterRole`
-4. Create the `ClusterRoleBinding` between the installer service account and its cluster role
-5. Create the installer `Role`
-6. Create the `RoleBinding` between the installer service account and its role
-7. Create the `ClusterExtension`
-
-A manifest with the full set of resources can be found [here](https://github.com/operator-framework/operator-controller/blob/main/config/samples/olm_v1_clusterextension.yaml).
-
-## Alternatives
-
-We understand that manually determining the minimum RBAC required for installation/upgrade of a `ClusterExtension` quite complex and protracted.
-In the near future, OLM v1 will provide tools and automation in order to simplify this process while maintaining our security posture.
-For users wishing to test out OLM v1 in a non-production settings, we offer the following alternatives:
-
-### Give the installer service account admin privileges
-
-The `cluster-admin` `ClusterRole` can be bound to the installer service account giving it full permissions to the cluster.
-While this obviates the need to determine the minimal RBAC required for installation, it is also dangerous. It is highly recommended
-that this alternative only be used in test clusters. Never in production.
-
-Below is an example ClusterRoleBinding using the cluster-admin ClusterRole:
-
-```terminal
-# Create ClusterRole
-kubectl apply -f - <
spec:
namespace:
- serviceAccount:
- name:
source:
sourceType: Catalog
catalog:
@@ -67,11 +50,6 @@ For information on determining the ServiceAccount's permission, please see [Deri
: Specifies a name for the namespace in which the bundle of content for the package referenced
in the packageName field will be applied.
- `serviceAccount_name`
- : serviceAccount name is a required reference to a ServiceAccount that exists
- in the `namespace_name`. The provided ServiceAccount is used to install and
- manage the content for the package specified in the packageName field.
-
!!! warning
Currently, the following limitations affect the installation of extensions:
@@ -118,8 +96,6 @@ For information on determining the ServiceAccount's permission, please see [Deri
UID: bde55f03-abe2-48af-8c09-28d32df878ad
Spec:
Namespace: argocd
- Service Account:
- Name: argocd-installer
Source:
Catalog:
Package Name: argocd-operator
diff --git a/docs/tutorials/uninstall-extension.md b/docs/tutorials/uninstall-extension.md
index 2345e0edec..119c0dbffd 100644
--- a/docs/tutorials/uninstall-extension.md
+++ b/docs/tutorials/uninstall-extension.md
@@ -40,4 +40,4 @@ You can uninstall a Kubernetes extension and its associated custom resource defi
### Cleanup
-* Remove the extension namespace, and installer service account cluster-scoped RBAC resources (if applicable).
+* Remove the extension namespace (if applicable).
diff --git a/docs/tutorials/upgrade-extension.md b/docs/tutorials/upgrade-extension.md
index b8b2aa5aad..9e1adc8517 100644
--- a/docs/tutorials/upgrade-extension.md
+++ b/docs/tutorials/upgrade-extension.md
@@ -14,7 +14,6 @@ For information on downgrading an extension, see [Downgrade an Extension](downgr
* You have a ClusterExtension installed
* The target version is compatible with OLM v1 (see [OLM v1 limitations](../project/olmv1_limitations.md))
* Any changes to the CustomResourceDefinition in the new version meet compatibility requirements (see [CRD upgrade safety](../concepts/crd-upgrade-safety.md))
-* The installer ServiceAccount's RBAC permissions are adequate for the target version (see [Minimal RBAC for Installer Service Account](../howto/derive-service-account.md))
* You are not attempting to upgrade between minor versions with a major version of zero (see [Upgrades within the major version zero](../concepts/upgrade-support.md#upgrades-within-the-major-version-zero))
For more detailed information see [Upgrade Support](../concepts/upgrade-support.md).
@@ -33,266 +32,12 @@ saving it to a local file and then running `kubectl apply -f FILENAME`:
metadata:
name: argocd
---
- apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: argocd-installer
- namespace: argocd
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: argocd-installer-binding
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: argocd-installer-clusterrole
- subjects:
- - kind: ServiceAccount
- name: argocd-installer
- namespace: argocd
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: argocd-installer-clusterrole
- rules:
- # Allow ClusterExtension to set blockOwnerDeletion ownerReferences
- - apiGroups: [olm.operatorframework.io]
- resources: [clusterextensions/finalizers]
- verbs: [update]
- resourceNames: [argocd]
- # Manage ArgoCD CRDs
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- resourceNames:
- - appprojects.argoproj.io
- - argocds.argoproj.io
- - applications.argoproj.io
- - argocdexports.argoproj.io
- - applicationsets.argoproj.io
- # Manage ArgoCD ClusterRoles and ClusterRoleBindings
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create, list, watch]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, update, patch, delete]
- resourceNames:
- - argocd-operator.v0-1dhiybrldl1gyksid1dk2dqjsc72psdybc7iyvse5gpx
- - argocd-operator-metrics-reader
- - argocd-operator.v0-22gmilmgp91wu25is5i2ec598hni8owq3l71bbkl7iz3
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create, list, watch]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, update, patch, delete]
- resourceNames:
- - argocd-operator.v0-1dhiybrldl1gyksid1dk2dqjsc72psdybc7iyvse5gpx
- - argocd-operator.v0-22gmilmgp91wu25is5i2ec598hni8owq3l71bbkl7iz3
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: argocd-installer-rbac-binding
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: argocd-installer-rbac-clusterrole
- subjects:
- - kind: ServiceAccount
- name: argocd-installer
- namespace: argocd
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: argocd-installer-rbac-clusterrole
- rules:
- - apiGroups: [""]
- resources: [configmaps]
- verbs: ['*']
- - apiGroups: [""]
- resources: [endpoints]
- verbs: ['*']
- - apiGroups: [""]
- resources: [events]
- verbs: ['*']
- - apiGroups: [""]
- resources: [namespaces]
- verbs: ['*']
- - apiGroups: [""]
- resources: [persistentvolumeclaims]
- verbs: ['*']
- - apiGroups: [""]
- resources: [pods]
- verbs: ['*', get]
- - apiGroups: [""]
- resources: [pods/log]
- verbs: [get]
- - apiGroups: [""]
- resources: [secrets]
- verbs: ['*']
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: ['*']
- - apiGroups: [""]
- resources: [services]
- verbs: ['*']
- - apiGroups: [""]
- resources: [services/finalizers]
- verbs: ['*']
- - apiGroups: [apps]
- resources: [daemonsets]
- verbs: ['*']
- - apiGroups: [apps]
- resources: [deployments]
- verbs: ['*']
- - apiGroups: [apps]
- resources: [deployments/finalizers]
- resourceNames: [argocd-operator]
- verbs: [update]
- - apiGroups: [apps]
- resources: [replicasets]
- verbs: ['*']
- - apiGroups: [apps]
- resources: [statefulsets]
- verbs: ['*']
- - apiGroups: [apps.openshift.io]
- resources: [deploymentconfigs]
- verbs: ['*']
- - apiGroups: [argoproj.io]
- resources: [applications]
- verbs: ['*']
- - apiGroups: [argoproj.io]
- resources: [appprojects]
- verbs: ['*']
- - apiGroups: [argoproj.io]
- resources: [argocdexports]
- verbs: ['*']
- - apiGroups: [argoproj.io]
- resources: [argocdexports/finalizers]
- verbs: ['*']
- - apiGroups: [argoproj.io]
- resources: [argocdexports/status]
- verbs: ['*']
- - apiGroups: [argoproj.io]
- resources: [argocds]
- verbs: ['*']
- - apiGroups: [argoproj.io]
- resources: [argocds/finalizers]
- verbs: ['*']
- - apiGroups: [argoproj.io]
- resources: [argocds/status]
- verbs: ['*']
- - apiGroups: [authentication.k8s.io]
- resources: [tokenreviews]
- verbs: [create]
- - apiGroups: [authorization.k8s.io]
- resources: [subjectaccessreviews]
- verbs: [create]
- - apiGroups: [autoscaling]
- resources: [horizontalpodautoscalers]
- verbs: ['*']
- - apiGroups: [batch]
- resources: [cronjobs]
- verbs: ['*']
- - apiGroups: [batch]
- resources: [jobs]
- verbs: ['*']
- - apiGroups: [config.openshift.io]
- resources: [clusterversions]
- verbs: [get, list, watch]
- - apiGroups: [monitoring.coreos.com]
- resources: [prometheuses]
- verbs: ['*']
- - apiGroups: [monitoring.coreos.com]
- resources: [servicemonitors]
- verbs: ['*']
- - apiGroups: [networking.k8s.io]
- resources: [ingresses]
- verbs: ['*']
- - apiGroups: [rbac.authorization.k8s.io]
- resources: ['*']
- verbs: ['*']
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: ['*']
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: ['*']
- - apiGroups: [route.openshift.io]
- resources: [routes]
- verbs: ['*']
- - apiGroups: [route.openshift.io]
- resources: [routes/custom-host]
- verbs: ['*']
- - apiGroups: ["coordination.k8s.io"]
- resources: ["leases"]
- verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: argocd-installer-role
- namespace: argocd
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [create, list, watch]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, update, patch, delete]
- resourceNames: [argocd-operator-controller-manager]
- - apiGroups: [""]
- resources: [configmaps]
- verbs: [create, list, watch]
- - apiGroups: [""]
- resources: [configmaps]
- verbs: [get, update, patch, delete]
- resourceNames: [argocd-operator-manager-config]
- - apiGroups: [""]
- resources: [services]
- verbs: [create, list, watch]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, update, patch, delete]
- resourceNames: [argocd-operator-controller-manager-metrics-service]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create, list, watch]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, update, patch, delete]
- resourceNames: [argocd-operator-controller-manager]
- ---
- apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: argocd-installer-binding
- namespace: argocd
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: argocd-installer-role
- subjects:
- - kind: ServiceAccount
- name: argocd-installer
- namespace: argocd
- ---
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: argocd
spec:
namespace: argocd
- serviceAccount:
- name: argocd-installer
source:
sourceType: Catalog
catalog:
@@ -328,8 +73,6 @@ kubectl get clusterextension argocd -o jsonpath-as-json="{.status.install}"
name: argocd
spec:
namespace: argocd
- serviceAccount:
- name: argocd-installer
source:
sourceType: Catalog
catalog:
diff --git a/go.mod b/go.mod
index 6c4cb77c64..4ca52b776c 100644
--- a/go.mod
+++ b/go.mod
@@ -31,8 +31,8 @@ require (
github.com/spf13/pflag v1.0.10
github.com/stretchr/testify v1.11.1
go.podman.io/image/v5 v5.40.0
+ go.uber.org/mock v0.6.0
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f
- golang.org/x/mod v0.37.0
golang.org/x/sync v0.21.0
golang.org/x/tools v0.45.0
helm.sh/helm/v3 v3.21.0
@@ -44,7 +44,6 @@ require (
k8s.io/client-go v1.5.2
k8s.io/component-base v0.36.1
k8s.io/klog/v2 v2.140.0
- k8s.io/kubernetes v1.36.1
k8s.io/utils v0.0.0-20260319190234-28399d86e0b5
pkg.package-operator.run/boxcutter v0.13.1
sigs.k8s.io/controller-runtime v0.24.1
@@ -54,10 +53,7 @@ require (
sigs.k8s.io/yaml v1.6.0
)
-require (
- k8s.io/component-helpers v0.36.1 // indirect
- k8s.io/kube-openapi v0.0.0-20260427204847-8949caaa1199 // indirect
-)
+require k8s.io/kube-openapi v0.0.0-20260427204847-8949caaa1199 // indirect
require (
cel.dev/expr v0.25.1 // indirect
@@ -205,7 +201,6 @@ require (
github.com/smallstep/pkcs7 v0.2.1 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/stefanberger/go-pkcs11uri v0.0.0-20230803200340-78284954bff6 // indirect
- github.com/stretchr/objx v0.5.3 // indirect
github.com/ulikunitz/xz v0.5.15 // indirect
github.com/vbatts/tar-split v0.12.3 // indirect
github.com/vbauerster/mpb/v8 v8.12.0 // indirect
@@ -227,6 +222,7 @@ require (
go.yaml.in/yaml/v2 v2.4.4 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.51.0 // indirect
+ golang.org/x/mod v0.37.0 // indirect
golang.org/x/net v0.55.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sys v0.46.0 // indirect
@@ -244,7 +240,6 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
- k8s.io/controller-manager v0.33.2 // indirect
k8s.io/kubectl v0.36.1 // indirect
k8s.io/streaming v0.36.1 // indirect
oras.land/oras-go/v2 v2.6.1 // indirect
@@ -270,54 +265,12 @@ replace k8s.io/cli-runtime => k8s.io/cli-runtime v0.36.1
replace k8s.io/client-go => k8s.io/client-go v0.36.1
-replace k8s.io/cloud-provider => k8s.io/cloud-provider v0.36.1
-
-replace k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.36.1
-
-replace k8s.io/code-generator => k8s.io/code-generator v0.36.1
-
replace k8s.io/component-base => k8s.io/component-base v0.36.1
replace k8s.io/component-helpers => k8s.io/component-helpers v0.36.1
replace k8s.io/controller-manager => k8s.io/controller-manager v0.36.1
-replace k8s.io/cri-api => k8s.io/cri-api v0.36.1
-
-replace k8s.io/cri-client => k8s.io/cri-client v0.36.1
-
-replace k8s.io/cri-streaming => k8s.io/cri-streaming v0.36.1
-
-replace k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.36.1
-
-replace k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.36.1
-
-replace k8s.io/endpointslice => k8s.io/endpointslice v0.36.1
-
-replace k8s.io/externaljwt => k8s.io/externaljwt v0.36.1
-
-replace k8s.io/kms => k8s.io/kms v0.36.1
-
-replace k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.36.1
-
-replace k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.36.1
-
-replace k8s.io/kube-proxy => k8s.io/kube-proxy v0.36.1
-
-replace k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.36.1
-
replace k8s.io/kubectl => k8s.io/kubectl v0.36.1
-replace k8s.io/kubelet => k8s.io/kubelet v0.36.1
-
-replace k8s.io/kubernetes => k8s.io/kubernetes v1.36.1
-
-replace k8s.io/metrics => k8s.io/metrics v0.36.1
-
-replace k8s.io/mount-utils => k8s.io/mount-utils v0.36.1
-
-replace k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.36.1
-
-replace k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.36.1
-
replace k8s.io/streaming => k8s.io/streaming v0.36.1
diff --git a/go.sum b/go.sum
index e294ca90d3..9861b45b98 100644
--- a/go.sum
+++ b/go.sum
@@ -584,6 +584,8 @@ go.podman.io/storage v1.63.0 h1:bj/pAWFhChbuBmejzno0iQLhU7FevGVXepRXm5pFGeA=
go.podman.io/storage v1.63.0/go.mod h1:z4Z9K+7GhKjWL/Y1O17+4f8a1KGijVeC9hr3tymhSOs=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
+go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
+go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
@@ -785,18 +787,12 @@ k8s.io/client-go v0.36.1 h1:FN/K8QIT2CEDt+2WB2HnWrUANZ50AP5GII43/SP2JR0=
k8s.io/client-go v0.36.1/go.mod h1:s6rAnCtTGYDQnpNjEhSaISV+2O8jwruZ6m3QOYBFbtU=
k8s.io/component-base v0.36.1 h1:iG6GsELftXqTNG9HG6kiVjatSgAw1sf5pJ6R5a6N0kA=
k8s.io/component-base v0.36.1/go.mod h1:nf9XPlntRdqO6WMeEWAA5F93Y4ICZQdeT9GeqLDB3JI=
-k8s.io/component-helpers v0.36.1 h1:BTrr5fzNSm8TkQfXrKT3N9ioWwiC4n2FTIwGTUo/ccg=
-k8s.io/component-helpers v0.36.1/go.mod h1:s38HnzKQRurbUnhI5IV8GwyL/a3lVuNCYZMTd+rITMM=
-k8s.io/controller-manager v0.36.1 h1:d1ifPnAe3FFSnnvcDQiM93bGroFT1lF72GEBKsl+cbg=
-k8s.io/controller-manager v0.36.1/go.mod h1:jeJUuFlgbgohGJWrm59Wdlgo3WqxssWXgD2sU6HG/Vo=
k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc=
k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0=
k8s.io/kube-openapi v0.0.0-20260427204847-8949caaa1199 h1:sWu4Td5mgJlwunsUydnhKEAfNUHM7hm1wfKEQmD7G5c=
k8s.io/kube-openapi v0.0.0-20260427204847-8949caaa1199/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0=
k8s.io/kubectl v0.36.1 h1:96HqS9twIdHM0MlJLTwbo14b9kUKPkOzZ4tlRDLv4qI=
k8s.io/kubectl v0.36.1/go.mod h1:/DGPAIewKsFWF9VFgGvkPhao2Ev4SNuE3BioZo8yPbk=
-k8s.io/kubernetes v1.36.1 h1:Mt7NKigaZ2KmOmCLhX81lGlH9JU5wjXnYhXnxAun9XA=
-k8s.io/kubernetes v1.36.1/go.mod h1:MLdeJ3qw2CWH9BFml5GvptxQVQckz54fJOZ/WuixpFE=
k8s.io/streaming v0.36.1 h1:L+K68n4Gg940BGNNYtUBvL1WTLL0YnKT3s+P1MNAmR4=
k8s.io/streaming v0.36.1/go.mod h1:z6fV3D+NVkoeqRMtWwlUZK6U17SY/LqNzOxWL6GyR/s=
k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 h1:kBawHLSnx/mYHmRnNUf9d4CpjREbeZuxoSGOX/J+aYM=
diff --git a/hack/demo/own-namespace-demo-script.sh b/hack/demo/own-namespace-demo-script.sh
index c83c0eb0c4..03daff7b1b 100755
--- a/hack/demo/own-namespace-demo-script.sh
+++ b/hack/demo/own-namespace-demo-script.sh
@@ -21,12 +21,6 @@ kubectl rollout status -n olmv1-system deployment/operator-controller-controller
# create install namespace
kubectl create ns argocd-system
-# create installer service account
-kubectl create serviceaccount -n argocd-system argocd-installer
-
-# give installer service account admin privileges (not for production environments)
-kubectl create clusterrolebinding argocd-installer-crb --clusterrole=cluster-admin --serviceaccount=argocd-system:argocd-installer
-
# install cluster extension in own namespace install mode (watch-namespace == install namespace == argocd-system)
cat ${DEMO_RESOURCE_DIR}/own-namespace-demo.yaml
@@ -55,7 +49,6 @@ echo "Demo completed successfully!"
echo "Cleaning up demo resources..."
kubectl delete clusterextension argocd-operator --ignore-not-found=true
kubectl delete namespace argocd-system --ignore-not-found=true
-kubectl delete clusterrolebinding argocd-installer-crb --ignore-not-found=true
# restore standard manifests and reset deployment (removes experimental feature gates)
echo "Restoring standard manifests..."
diff --git a/hack/demo/resources/own-namespace-demo.yaml b/hack/demo/resources/own-namespace-demo.yaml
index b22db7aa04..01bb6c52d5 100644
--- a/hack/demo/resources/own-namespace-demo.yaml
+++ b/hack/demo/resources/own-namespace-demo.yaml
@@ -4,8 +4,6 @@ metadata:
name: argocd-operator
spec:
namespace: argocd-system
- serviceAccount:
- name: argocd-installer
source:
sourceType: Catalog
catalog:
diff --git a/hack/demo/resources/single-namespace-demo.yaml b/hack/demo/resources/single-namespace-demo.yaml
index 9c1ac17f9f..bad9f4019c 100644
--- a/hack/demo/resources/single-namespace-demo.yaml
+++ b/hack/demo/resources/single-namespace-demo.yaml
@@ -4,8 +4,6 @@ metadata:
name: argocd-operator
spec:
namespace: argocd-system
- serviceAccount:
- name: argocd-installer
config:
configType: Inline
inline:
diff --git a/hack/demo/resources/synthetic-user-perms/argocd-clusterextension.yaml b/hack/demo/resources/synthetic-user-perms/argocd-clusterextension.yaml
deleted file mode 100644
index 7eb5a7082b..0000000000
--- a/hack/demo/resources/synthetic-user-perms/argocd-clusterextension.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
-apiVersion: olm.operatorframework.io/v1
-kind: ClusterExtension
-metadata:
- name: argocd-operator
-spec:
- namespace: argocd-system
- serviceAccount:
- name: "olm.synthetic-user"
- source:
- sourceType: Catalog
- catalog:
- packageName: argocd-operator
- version: 0.6.0
diff --git a/hack/demo/resources/synthetic-user-perms/cegroup-admin-binding.yaml b/hack/demo/resources/synthetic-user-perms/cegroup-admin-binding.yaml
deleted file mode 100644
index d0ab570f7b..0000000000
--- a/hack/demo/resources/synthetic-user-perms/cegroup-admin-binding.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
- name: clusterextensions-group-admin-binding
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: cluster-admin
-subjects:
- - kind: Group
- name: "olm:clusterextensions"
diff --git a/hack/demo/resources/webhook-provider-certmanager/webhook-operator-extension.yaml b/hack/demo/resources/webhook-provider-certmanager/webhook-operator-extension.yaml
index 19b7eceb08..1f5ccd31ea 100644
--- a/hack/demo/resources/webhook-provider-certmanager/webhook-operator-extension.yaml
+++ b/hack/demo/resources/webhook-provider-certmanager/webhook-operator-extension.yaml
@@ -4,8 +4,6 @@ metadata:
name: webhook-operator
spec:
namespace: webhook-operator
- serviceAccount:
- name: webhook-operator-installer
source:
catalog:
packageName: webhook-operator
diff --git a/hack/demo/single-namespace-demo-script.sh b/hack/demo/single-namespace-demo-script.sh
index 4daa66856b..39193d4a51 100755
--- a/hack/demo/single-namespace-demo-script.sh
+++ b/hack/demo/single-namespace-demo-script.sh
@@ -21,12 +21,6 @@ kubectl rollout status -n olmv1-system deployment/operator-controller-controller
# create install namespace
kubectl create ns argocd-system
-# create installer service account
-kubectl create serviceaccount -n argocd-system argocd-installer
-
-# give installer service account admin privileges (not for production environments)
-kubectl create clusterrolebinding argocd-installer-crb --clusterrole=cluster-admin --serviceaccount=argocd-system:argocd-installer
-
# create watch namespace
kubectl create namespace argocd
@@ -58,7 +52,6 @@ echo "Demo completed successfully!"
echo "Cleaning up demo resources..."
kubectl delete clusterextension argocd-operator --ignore-not-found=true
kubectl delete namespace argocd-system argocd --ignore-not-found=true
-kubectl delete clusterrolebinding argocd-installer-crb --ignore-not-found=true
# restore standard manifests and reset deployment (removes experimental feature gates)
echo "Restoring standard manifests..."
diff --git a/hack/demo/synthetic-user-cluster-admin-demo-script.sh b/hack/demo/synthetic-user-cluster-admin-demo-script.sh
deleted file mode 100755
index 4790e46e77..0000000000
--- a/hack/demo/synthetic-user-cluster-admin-demo-script.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env bash
-
-#
-# Welcome to the SingleNamespace install mode demo
-#
-trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
-
-# enable 'SyntheticPermissions' feature
-kubectl kustomize config/overlays/featuregate/synthetic-user-permissions | kubectl apply -f -
-
-# wait for operator-controller to become available
-kubectl rollout status -n olmv1-system deployment/operator-controller-controller-manager
-
-# create install namespace
-kubectl create ns argocd-system
-
-# give cluster extension group cluster admin privileges - all cluster extensions installer users will be cluster admin
-bat --style=plain ${DEMO_RESOURCE_DIR}/synthetic-user-perms/cegroup-admin-binding.yaml
-
-# apply cluster role binding
-kubectl apply -f ${DEMO_RESOURCE_DIR}/synthetic-user-perms/cegroup-admin-binding.yaml
-
-# install cluster extension - for now .spec.serviceAccount = "olm.synthetic-user"
-bat --style=plain ${DEMO_RESOURCE_DIR}/synthetic-user-perms/argocd-clusterextension.yaml
-
-# apply cluster extension
-kubectl apply -f ${DEMO_RESOURCE_DIR}/synthetic-user-perms/argocd-clusterextension.yaml
-
-# wait for cluster extension installation to succeed
-kubectl wait --for=condition=Installed clusterextension/argocd-operator --timeout="60s"
diff --git a/hack/demo/webhook-provider-certmanager-demo-script.sh b/hack/demo/webhook-provider-certmanager-demo-script.sh
index ba723ca6a8..f708e2c3b7 100755
--- a/hack/demo/webhook-provider-certmanager-demo-script.sh
+++ b/hack/demo/webhook-provider-certmanager-demo-script.sh
@@ -21,12 +21,6 @@ kubectl wait --for=condition=Serving clustercatalog/webhook-operator-catalog --t
# create install namespace
kubectl create ns webhook-operator
-# create installer service account
-kubectl create serviceaccount -n webhook-operator webhook-operator-installer
-
-# give installer service account admin privileges
-kubectl create clusterrolebinding webhook-operator-installer-crb --clusterrole=cluster-admin --serviceaccount=webhook-operator:webhook-operator-installer
-
# install webhook operator clusterextension
cat ${DEMO_RESOURCE_DIR}/webhook-provider-certmanager/webhook-operator-extension.yaml
diff --git a/hack/tools/k8smaintainer/README.md b/hack/tools/k8smaintainer/README.md
deleted file mode 100644
index a8162704da..0000000000
--- a/hack/tools/k8smaintainer/README.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# Kubernetes Staging Module Version Synchronization Tool
-
-## Purpose
-This tool ensures that if `k8s.io/kubernetes` changes version in your `go.mod`, all related staging modules (e.g., `k8s.io/api`, `k8s.io/apimachinery`) are automatically pinned to the corresponding published version. Recent improvements include an environment variable override and refined logic for version resolution.
-
-## How It Works
-
-1. **Parsing and Filtering:**
- - Reads and parses your `go.mod` file.
- - Removes existing `replace` directives for `k8s.io/` modules to avoid stale mappings.
-
-2. **Determine Kubernetes Version:**
- - **Environment Variable Override:**
- If the environment variable `K8S_IO_K8S_VERSION` is set, its value is validated (using semver standards) and used as the target version for `k8s.io/kubernetes`. The tool then runs `go get k8s.io/kubernetes@` to update the dependency.
- - **Default Behavior:**
- If `K8S_IO_K8S_VERSION` is not set, the tool reads the version of `k8s.io/kubernetes` from the `go.mod` file.
-
-3. **Compute the Target Staging Version:**
- - Converts a Kubernetes version in the form `v1.xx.yy` into the staging version format `v0.xx.yy`.
- - If the target staging version is unavailable, the tool attempts to fall back to the previous patch version.
-
-4. **Updating Module Replace Directives:**
- - Retrieves the full dependency graph using `go list -m -json all`.
- - Identifies relevant `k8s.io/*` modules (skipping the main module and version-suffixed modules).
- - Removes outdated `replace` directives (ignoring local path replacements).
- - Adds new `replace` directives to pin modules—including `k8s.io/kubernetes`—to the computed staging version.
-
-5. **Finalizing Changes:**
- - Writes the updated `go.mod` file.
- - Runs `go mod tidy` to clean up dependencies.
- - Executes `go mod download k8s.io/kubernetes` to update `go.sum`.
- - Logs any issues, such as modules remaining at an untagged version (`v0.0.0`), which may indicate upstream tagging problems.
-
-## Environment Variables
-
-- **K8S_IO_K8S_VERSION (optional):**
- When set, this environment variable overrides the Kubernetes version found in `go.mod`. The tool validates this semver string, updates the dependency using `go get`, and processes modules accordingly.
-
-## Additional Notes
-
-- The tool ensures consistency across all `k8s.io/*` modules, even if they are not explicitly listed in `go.mod`.
-- If a suitable staging version is not found, a warning is logged and the closest valid version is used.
-- All operations are logged, which helps in troubleshooting and verifying the process.
\ No newline at end of file
diff --git a/hack/tools/k8smaintainer/main.go b/hack/tools/k8smaintainer/main.go
deleted file mode 100644
index 978c884a61..0000000000
--- a/hack/tools/k8smaintainer/main.go
+++ /dev/null
@@ -1,410 +0,0 @@
-package main
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io/fs"
- "log"
- "os"
- "os/exec"
- "path/filepath"
- "sort"
- "strings"
-
- "github.com/blang/semver/v4"
- "golang.org/x/mod/modfile"
- "golang.org/x/mod/module"
-)
-
-const (
- k8sRepo = "k8s.io/kubernetes"
- expectedMajorMinorParts = 2
- goModFilename = "go.mod"
- goModFilePerms = fs.FileMode(0600)
- minGoListVersionFields = 2
- minPatchNumberToDecrementFrom = 1 // We can only decrement patch if it's 1 or greater (to get 0 or greater)
- k8sVersionEnvVar = "K8S_IO_K8S_VERSION"
-)
-
-//nolint:gochecknoglobals
-var goExe = "go"
-
-// readAndParseGoMod reads and parses the go.mod file.
-func readAndParseGoMod(filename string) (*modfile.File, error) {
- modBytes, err := os.ReadFile(filename)
- if err != nil {
- return nil, fmt.Errorf("error reading %s: %w", filename, err)
- }
- modF, err := modfile.Parse(filename, modBytes, nil)
- if err != nil {
- return nil, fmt.Errorf("error parsing %s: %w", filename, err)
- }
- return modF, nil
-}
-
-// getK8sVersionFromEnv processes the version specified via environment variable.
-// It validates the version and runs `go get` to update the dependency.
-func getK8sVersionFromEnv(targetK8sVer string) (string, error) {
- log.Printf("Found target %s version override from env var %s: %s", k8sRepo, k8sVersionEnvVar, targetK8sVer)
- if _, err := semver.ParseTolerant(targetK8sVer); err != nil {
- return "", fmt.Errorf("invalid semver specified in %s: %s (%w)", k8sVersionEnvVar, targetK8sVer, err)
- }
- // Update the go.mod file first
- log.Printf("Running 'go get %s@%s' to update the main dependency...", k8sRepo, targetK8sVer)
- getArgs := fmt.Sprintf("%s@%s", k8sRepo, targetK8sVer)
- if _, err := runGoCommand("get", getArgs); err != nil {
- return "", fmt.Errorf("error running 'go get %s': %w", getArgs, err)
- }
- return targetK8sVer, nil // Return the validated version
-}
-
-// getK8sVersionFromMod reads the go.mod file to find the current version of k8s.io/kubernetes.
-// It returns the version string if found, or an empty string (and nil error) if not found.
-func getK8sVersionFromMod() (string, error) {
- modF, err := readAndParseGoMod(goModFilename)
- if err != nil {
- return "", err // Propagate error from reading/parsing
- }
-
- // Find k8s.io/kubernetes version
- for _, req := range modF.Require {
- if req.Mod.Path == k8sRepo {
- log.Printf("Found existing %s version in %s: %s", k8sRepo, goModFilename, req.Mod.Version)
- return req.Mod.Version, nil // Return found version
- }
- }
- // Not found case - return empty string, no error (as per original logic)
- log.Printf("INFO: %s not found in %s require block. Nothing to do.", k8sRepo, goModFilename)
- return "", nil
-}
-
-func main() {
- log.SetFlags(0)
- if os.Getenv("GOEXE") != "" {
- goExe = os.Getenv("GOEXE")
- }
-
- wd, err := os.Getwd()
- if err != nil {
- log.Fatalf("Error getting working directory: %v", err)
- }
- modRoot := findModRoot(wd)
- if modRoot == "" {
- log.Fatalf("Failed to find %s in %s or parent directories", goModFilename, wd)
- }
- if err := os.Chdir(modRoot); err != nil {
- log.Fatalf("Error changing directory to %s: %v", modRoot, err)
- }
- log.Printf("Running in module root: %s", modRoot)
-
- var k8sVer string
-
- // Determine the target k8s version using helper functions
- targetK8sVerEnv := os.Getenv(k8sVersionEnvVar)
- if targetK8sVerEnv != "" {
- // Process version from environment variable
- k8sVer, err = getK8sVersionFromEnv(targetK8sVerEnv)
- if err != nil {
- log.Fatalf("Failed to process k8s version from environment variable %s: %v", k8sVersionEnvVar, err)
- }
- } else {
- // Process version from go.mod file
- k8sVer, err = getK8sVersionFromMod()
- if err != nil {
- log.Fatalf("Failed to get k8s version from %s: %v", goModFilename, err)
- }
- // Handle the "not found" case where getK8sVersionFromMod returns "", nil
- if k8sVer == "" {
- os.Exit(0) // Exit gracefully as requested
- }
- }
-
- // Calculate target staging version
- k8sSemVer, err := semver.ParseTolerant(k8sVer)
- if err != nil {
- // This should ideally not happen if validation passed earlier, but check anyway.
- log.Fatalf("Invalid semver for %s: %s (%v)", k8sRepo, k8sVer, err) // Adjusted log format slightly
- }
-
- if k8sSemVer.Major != 1 {
- log.Fatalf("Expected k8s version %s to have major version 1", k8sVer)
- }
- targetSemVer := semver.Version{Major: 0, Minor: k8sSemVer.Minor, Patch: k8sSemVer.Patch}
- // Prepend 'v' as expected by Go modules and the rest of the script logic
- targetStagingVer := "v" + targetSemVer.String()
-
- // Validate the constructed staging version string
- if _, err := semver.ParseTolerant(targetStagingVer); err != nil {
- log.Fatalf("Calculated invalid staging semver: %s from k8s version %s (%v)", targetStagingVer, k8sVer, err) // Adjusted log format slightly
- }
- log.Printf("Target staging version calculated: %s", targetStagingVer)
-
- // Run `go list -m -json all`
- type Module struct {
- Path string
- Version string
- Replace *Module
- Main bool
- }
- log.Println("Running 'go list -m -json all'...")
- output, err := runGoCommand("list", "-m", "-json", "all")
- if err != nil {
- // Try downloading first if list fails
- log.Println("'go list' failed, trying 'go mod download'...")
- if _, downloadErr := runGoCommand("mod", "download"); downloadErr != nil {
- log.Fatalf("Error running 'go mod download' after list failed: %v", downloadErr)
- }
- output, err = runGoCommand("list", "-m", "-json", "all")
- if err != nil {
- log.Fatalf("Error running 'go list -m -json all' even after download: %v", err)
- }
- }
-
- // Iterate, identify k8s.io/* staging modules, and determine version to pin
- pins := make(map[string]string) // Module path -> version to pin
- decoder := json.NewDecoder(bytes.NewReader(output))
- for decoder.More() {
- var mod Module
- if err := decoder.Decode(&mod); err != nil {
- log.Fatalf("Error decoding go list output: %v", err)
- }
-
- // Skip main module, non-k8s modules, k8s.io/kubernetes itself, and versioned modules like k8s.io/client-go/v2
- _, pathSuffix, _ := module.SplitPathVersion(mod.Path) // Check if path has a version suffix like /v2, /v3 etc.
- if mod.Main || !strings.HasPrefix(mod.Path, "k8s.io/") || mod.Path == k8sRepo || pathSuffix != "" {
- continue
- }
-
- // Use replacement path if it exists, but skip local file replacements
- effectivePath := mod.Path
- if mod.Replace != nil {
- // Heuristic: Assume module paths have a domain-like structure (e.g., 'xxx.yyy/zzz') in the first segment.
- // Local paths usually don't (e.g., '../othermod', './local').
- parts := strings.SplitN(mod.Replace.Path, "/", 2)
- if len(parts) > 0 && !strings.Contains(parts[0], ".") {
- log.Printf("Skipping local replace: %s => %s", mod.Path, mod.Replace.Path)
- continue
- }
- effectivePath = mod.Replace.Path
- }
-
- // Check existence of target version, fallback to previous patch if needed
- determinedVer, err := getLatestExistingVersion(effectivePath, targetStagingVer)
- if err != nil {
- log.Printf("WARNING: Error checking versions for %s: %v. Skipping pinning.", effectivePath, err)
- continue
- }
-
- if determinedVer == "" {
- log.Printf("WARNING: Neither target version %s nor its predecessor found for %s. Skipping pinning.", targetStagingVer, effectivePath)
- continue
- }
-
- if determinedVer != targetStagingVer {
- log.Printf("INFO: Target version %s not found for %s. Using existing predecessor version %s.", targetStagingVer, effectivePath, determinedVer)
- }
-
- // map the original module path (as seen in the dependency graph) to the desired version for the 'replace' directive
- pins[mod.Path] = determinedVer
- }
-
- // Add k8s.io/kubernetes itself to the pins map (ensures it's covered by the replace logic)
- pins[k8sRepo] = k8sVer
- log.Printf("Identified %d k8s.io/* modules to manage.", len(pins))
-
- // Parse go.mod again (needed in case `go list` or `go get` modified it)
- modF, err := readAndParseGoMod(goModFilename)
- if err != nil {
- log.Fatal(err) // Error already formatted by helper function
- }
-
- // Remove all existing k8s.io/* replaces that target other modules (not local paths)
- log.Println("Removing existing k8s.io/* module replace directives...")
- var replacesToRemove []string
- for _, rep := range modF.Replace {
- // Only remove replaces targeting k8s.io/* modules (not local replacements like ../staging)
- // Check that the old path starts with k8s.io/ and the new path looks like a module path (contains '.')
- if strings.HasPrefix(rep.Old.Path, "k8s.io/") && strings.Contains(rep.New.Path, ".") {
- replacesToRemove = append(replacesToRemove, rep.Old.Path)
- } else if strings.HasPrefix(rep.Old.Path, "k8s.io/") {
- log.Printf("Note: Found existing non-module replace for %s, leaving untouched: %s => %s %s", rep.Old.Path, rep.Old.Path, rep.New.Path, rep.New.Version)
- }
- }
- if len(replacesToRemove) > 0 {
- for _, path := range replacesToRemove {
- log.Printf("Removing replace for: %s", path)
- // Drop replace expects oldPath and oldVersion. Version is empty for path-only replaces.
- if err := modF.DropReplace(path, ""); err != nil {
- // Tolerate errors if the replace was already somehow removed or structure changed
- log.Printf("Note: Error dropping replace for %s (might be benign): %v", path, err)
- }
- }
- } else {
- log.Println("No existing k8s.io/* module replaces found to remove.")
- }
-
- // Add new replace directives
- log.Println("Adding determined replace directives...")
- // Sort for deterministic output
- sortedPaths := make([]string, 0, len(pins))
- for path := range pins {
- sortedPaths = append(sortedPaths, path)
- }
- sort.Strings(sortedPaths)
-
- for _, path := range sortedPaths {
- version := pins[path]
- // Add replace for the module path itself (e.g., k8s.io/api => k8s.io/api v0.32.3)
- if err := modF.AddReplace(path, "", path, version); err != nil {
- log.Fatalf("Error adding replace for %s => %s %s: %v", path, path, version, err)
- }
- log.Printf("Adding replace: %s => %s %s", path, path, version)
- }
-
- // Write go.mod
- log.Println("Writing updated go.mod...")
- modF.Cleanup() // Sort blocks, remove redundant directives etc.
- newModBytes, err := modF.Format()
- if err != nil {
- log.Fatalf("Error formatting go.mod: %v", err)
- }
- if err := os.WriteFile(goModFilename, newModBytes, goModFilePerms); err != nil {
- log.Fatalf("Error writing %s: %v", goModFilename, err)
- }
-
- // Run `go mod tidy`
- goVer := ""
- if modF.Go != nil { // Ensure Go directive exists before accessing Version
- goVer = modF.Go.Version
- }
- tidyArgs := []string{"mod", "tidy"}
- if goVer != "" {
- tidyArgs = append(tidyArgs, fmt.Sprintf("-go=%s", goVer))
- }
- log.Printf("Running '%s %s'...", goExe, strings.Join(tidyArgs, " "))
- if _, err := runGoCommand(tidyArgs...); err != nil {
- log.Fatalf("Error running 'go mod tidy': %v", err)
- }
-
- // Run `go mod download k8s.io/kubernetes`
- log.Printf("Running '%s mod download %s'...", goExe, k8sRepo)
- if _, err := runGoCommand("mod", "download", k8sRepo); err != nil {
- // This might not be fatal, could be network issues, but log it prominently
- log.Printf("WARNING: Error running 'go mod download %s': %v", k8sRepo, err)
- }
-
- log.Println("Successfully updated k8s dependencies.")
-}
-
-// findModRoot searches for go.mod in dir and parent directories
-func findModRoot(dir string) string {
- for {
- if _, err := os.Stat(filepath.Join(dir, goModFilename)); err == nil {
- return dir
- }
- parent := filepath.Dir(dir)
- if parent == dir {
- return "" // Reached root
- }
- dir = parent
- }
-}
-
-// runGoCommand executes a go command and returns its stdout or an error
-func runGoCommand(args ...string) ([]byte, error) {
- cmd := exec.Command(goExe, args...)
- cmd.Env = append(os.Environ(), "GO111MODULE=on") // Ensure module mode
- var stdout, stderr bytes.Buffer
- cmd.Stdout = &stdout
- cmd.Stderr = &stderr
- log.Printf("Executing: %s %s", goExe, strings.Join(args, " "))
- if err := cmd.Run(); err != nil {
- if stderr.Len() > 0 {
- log.Printf("Stderr:\n%s", stderr.String())
- }
- return nil, fmt.Errorf("command '%s %s' failed: %w", goExe, strings.Join(args, " "), err)
- }
- return stdout.Bytes(), nil
-}
-
-// getModuleVersions retrieves the list of available versions for a module
-func getModuleVersions(modulePath string) ([]string, error) {
- output, err := runGoCommand("list", "-m", "-versions", modulePath)
- // Combine output and error message for checking because 'go list' sometimes writes errors to stdout
- combinedOutput := string(output)
- if err != nil {
- if !strings.Contains(combinedOutput, err.Error()) {
- combinedOutput += err.Error()
- }
- }
-
- // Check if the error/output indicates "no matching versions" - this is not a fatal error for our logic
- if strings.Contains(combinedOutput, "no matching versions") || strings.Contains(combinedOutput, "no required module provides package") {
- log.Printf("INFO: No versions found for module %s via 'go list'.", modulePath)
- return []string{}, nil // Return empty list, not an error
- }
- // If there was an actual error beyond "no matching versions"
- if err != nil {
- return nil, fmt.Errorf("error listing versions for %s: %w", modulePath, err)
- }
-
- fields := strings.Fields(string(output))
- if len(fields) < minGoListVersionFields {
- log.Printf("INFO: No versions listed for module %s (output: '%s')", modulePath, string(output))
- return []string{}, nil // No versions listed (e.g., just the module path)
- }
- return fields[1:], nil // First field is the module path
-}
-
-// getLatestExistingVersion checks for targetVer and its predecessor, returning the latest one that exists
-func getLatestExistingVersion(modulePath, targetVer string) (string, error) {
- availableVersions, err := getModuleVersions(modulePath)
- if err != nil {
- return "", err
- }
-
- foundTarget := false
- for _, v := range availableVersions {
- if v == targetVer {
- foundTarget = true
- break
- }
- }
-
- if foundTarget {
- return targetVer, nil // Target version exists
- }
-
- // Target not found, try previous patch version
- targetSemVer, err := semver.ParseTolerant(targetVer)
- if err != nil {
- log.Printf("Could not parse target version %s for module %s: %v. Cannot determine predecessor.", targetVer, modulePath, err)
- return "", nil // Cannot determine predecessor
- }
-
- // Only try to decrement if the patch number is >= the minimum required to do so
- if targetSemVer.Patch < uint64(minPatchNumberToDecrementFrom) {
- log.Printf("Patch version %d is less than %d for %s, cannot determine predecessor.", targetSemVer.Patch, minPatchNumberToDecrementFrom, targetVer)
- return "", nil // Cannot determine predecessor (e.g., target was v0.32.0)
- }
-
- prevSemVer := targetSemVer
- prevSemVer.Patch--
- prevPatchVer := "v" + prevSemVer.String()
-
- foundPrev := false
- for _, v := range availableVersions {
- if v == prevPatchVer {
- foundPrev = true
- break
- }
- }
-
- if foundPrev {
- return prevPatchVer, nil // Predecessor version exists
- }
-
- // Neither found
- return "", nil
-}
diff --git a/helm/experimental.yaml b/helm/experimental.yaml
index 53c636fded..3e8984a7ae 100644
--- a/helm/experimental.yaml
+++ b/helm/experimental.yaml
@@ -15,11 +15,9 @@ options:
- BundleReleaseSupport
- DeploymentConfig
- HelmChartSupport
- - PreflightPermissions
- SingleOwnNamespaceInstallSupport
- WebhookProviderCertManager
disabled:
- - SyntheticPermissions
- WebhookProviderOpenshiftServiceCA
# List of enabled experimental features for catalogd
# Use with {{- if has "FeatureGate" .Values.options.catalogd.features.enabled }}
diff --git a/helm/olmv1/base/operator-controller/crd/experimental/olm.operatorframework.io_clusterextensions.yaml b/helm/olmv1/base/operator-controller/crd/experimental/olm.operatorframework.io_clusterextensions.yaml
index 8e5f53f62c..e8cb0002da 100644
--- a/helm/olmv1/base/operator-controller/crd/experimental/olm.operatorframework.io_clusterextensions.yaml
+++ b/helm/olmv1/base/operator-controller/crd/experimental/olm.operatorframework.io_clusterextensions.yaml
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
- controller-gen.kubebuilder.io/version: v0.20.1
+ controller-gen.kubebuilder.io/version: v0.21.0
olm.operatorframework.io/generator: experimental
name: clusterextensions.olm.operatorframework.io
spec:
@@ -148,8 +148,7 @@ spec:
namespace:
description: |-
namespace specifies a Kubernetes namespace.
- This is the namespace where the provided ServiceAccount must exist.
- It also designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
+ It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
This namespace must exist.
@@ -177,18 +176,18 @@ spec:
type: integer
serviceAccount:
description: |-
- serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
- that are required to manage the extension.
- The ServiceAccount must be configured with the necessary permissions to perform these interactions.
- The ServiceAccount must exist in the namespace referenced in the spec.
- The serviceAccount field is required.
+ serviceAccount is a deprecated field and is completely ignored.
+ OLMv1 is a single-tenant system where users with ClusterExtension write access are
+ effectively delegated cluster-admin trust. The operator-controller runs with
+ cluster-admin privileges and uses its own service account for all cluster interactions.
+
+ Deprecated: serviceAccount is no longer used and will be removed in a future release.
properties:
name:
description: |-
- name is a required, immutable reference to the name of the ServiceAccount used for installation
- and management of the content for the package specified in the packageName field.
+ name is a deprecated field and is completely ignored.
- This ServiceAccount must exist in the installNamespace.
+ Deprecated: name is no longer used and will be removed in a future release.
The name field follows the DNS subdomain standard as defined in [RFC 1123].
It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
@@ -209,15 +208,13 @@ spec:
maxLength: 253
type: string
x-kubernetes-validations:
- - message: name is immutable
- rule: self == oldSelf
+ - message: name is immutable once set, but may be cleared
+ rule: self == oldSelf || size(self) == 0
- message: name must be a valid DNS1123 subdomain. It must contain
only lowercase alphanumeric characters, hyphens (-) or periods
(.), start and end with an alphanumeric character, and be
no longer than 253 characters
- rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
- required:
- - name
+ rule: size(self) == 0 || self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
type: object
source:
description: |-
@@ -495,7 +492,6 @@ spec:
has(self.catalog) : !has(self.catalog)'
required:
- namespace
- - serviceAccount
- source
type: object
status:
diff --git a/helm/olmv1/base/operator-controller/crd/standard/olm.operatorframework.io_clusterextensions.yaml b/helm/olmv1/base/operator-controller/crd/standard/olm.operatorframework.io_clusterextensions.yaml
index aca133f732..17efa4b3d0 100644
--- a/helm/olmv1/base/operator-controller/crd/standard/olm.operatorframework.io_clusterextensions.yaml
+++ b/helm/olmv1/base/operator-controller/crd/standard/olm.operatorframework.io_clusterextensions.yaml
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
- controller-gen.kubebuilder.io/version: v0.20.1
+ controller-gen.kubebuilder.io/version: v0.21.0
olm.operatorframework.io/generator: standard
name: clusterextensions.olm.operatorframework.io
spec:
@@ -110,8 +110,7 @@ spec:
namespace:
description: |-
namespace specifies a Kubernetes namespace.
- This is the namespace where the provided ServiceAccount must exist.
- It also designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
+ It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
This namespace must exist.
@@ -129,18 +128,18 @@ spec:
rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")
serviceAccount:
description: |-
- serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
- that are required to manage the extension.
- The ServiceAccount must be configured with the necessary permissions to perform these interactions.
- The ServiceAccount must exist in the namespace referenced in the spec.
- The serviceAccount field is required.
+ serviceAccount is a deprecated field and is completely ignored.
+ OLMv1 is a single-tenant system where users with ClusterExtension write access are
+ effectively delegated cluster-admin trust. The operator-controller runs with
+ cluster-admin privileges and uses its own service account for all cluster interactions.
+
+ Deprecated: serviceAccount is no longer used and will be removed in a future release.
properties:
name:
description: |-
- name is a required, immutable reference to the name of the ServiceAccount used for installation
- and management of the content for the package specified in the packageName field.
+ name is a deprecated field and is completely ignored.
- This ServiceAccount must exist in the installNamespace.
+ Deprecated: name is no longer used and will be removed in a future release.
The name field follows the DNS subdomain standard as defined in [RFC 1123].
It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
@@ -161,15 +160,13 @@ spec:
maxLength: 253
type: string
x-kubernetes-validations:
- - message: name is immutable
- rule: self == oldSelf
+ - message: name is immutable once set, but may be cleared
+ rule: self == oldSelf || size(self) == 0
- message: name must be a valid DNS1123 subdomain. It must contain
only lowercase alphanumeric characters, hyphens (-) or periods
(.), start and end with an alphanumeric character, and be
no longer than 253 characters
- rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
- required:
- - name
+ rule: size(self) == 0 || self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
type: object
source:
description: |-
@@ -447,7 +444,6 @@ spec:
has(self.catalog) : !has(self.catalog)'
required:
- namespace
- - serviceAccount
- source
type: object
status:
diff --git a/helm/olmv1/templates/rbac/clusterrole-operator-controller-manager-role.yml b/helm/olmv1/templates/rbac/clusterrole-operator-controller-manager-role.yml
deleted file mode 100644
index 1d096c82b5..0000000000
--- a/helm/olmv1/templates/rbac/clusterrole-operator-controller-manager-role.yml
+++ /dev/null
@@ -1,121 +0,0 @@
-{{- if and .Values.options.operatorController.enabled (not (has "BoxcutterRuntime" .Values.operatorConrollerFeatures)) }}
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: operator-controller-manager-role
- labels:
- app.kubernetes.io/name: operator-controller
- {{- include "olmv1.labels" . | nindent 4 }}
- annotations:
- {{- include "olmv1.annotations" . | nindent 4 }}
-rules:
- - apiGroups:
- - ""
- resources:
- - serviceaccounts/token
- verbs:
- - create
- - apiGroups:
- - ""
- resources:
- - serviceaccounts
- verbs:
- - get
- - apiGroups:
- - apiextensions.k8s.io
- resources:
- - customresourcedefinitions
- verbs:
- - get
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clustercatalogs
- verbs:
- - get
- - list
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions
- verbs:
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/finalizers
- verbs:
- - update
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/status
- verbs:
- - patch
- - update
- - apiGroups:
- - rbac.authorization.k8s.io
- resources:
- - clusterrolebindings
- - clusterroles
- - rolebindings
- - roles
- verbs:
- - list
- - watch
- {{- if .Values.options.openshift.enabled }}
- - apiGroups:
- - security.openshift.io
- resources:
- - securitycontextconstraints
- resourceNames:
- - privileged
- verbs:
- - use
- {{- end }}
- {{- if has "BoxcutterRuntime" .Values.options.operatorController.features.enabled }}
- - apiGroups:
- - "*"
- resources:
- - "*"
- verbs:
- - list
- - watch
- - apiGroups:
- - ""
- resources:
- - secrets
- verbs:
- - get
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterobjectsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterobjectsets/status
- verbs:
- - patch
- - update
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterobjectsets/finalizers
- verbs:
- - update
- {{- end }}
-{{- end }}
diff --git a/helm/olmv1/templates/rbac/clusterrolebinding-operator-controller-manager-rolebinding.yml b/helm/olmv1/templates/rbac/clusterrolebinding-operator-controller-manager-rolebinding.yml
index 5d1beeb57c..e9e2666921 100644
--- a/helm/olmv1/templates/rbac/clusterrolebinding-operator-controller-manager-rolebinding.yml
+++ b/helm/olmv1/templates/rbac/clusterrolebinding-operator-controller-manager-rolebinding.yml
@@ -8,15 +8,11 @@ metadata:
labels:
app.kubernetes.io/name: operator-controller
{{- include "olmv1.labels" $ | nindent 4 }}
-{{- if has "BoxcutterRuntime" .Values.options.operatorController.features.enabled }}
- name: operator-controller-manager-admin-rolebinding
-{{- else }}
- name: operator-controller-manager-rolebinding
-{{- end }}
+ name: operator-controller-cluster-admin-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
- name: operator-controller-manager-role
+ name: cluster-admin
subjects:
- kind: ServiceAccount
name: operator-controller-controller-manager
diff --git a/helm/olmv1/templates/validatingadmissionpolicy-clusterextension-serviceaccount-deprecated.yml b/helm/olmv1/templates/validatingadmissionpolicy-clusterextension-serviceaccount-deprecated.yml
new file mode 100644
index 0000000000..37c611e227
--- /dev/null
+++ b/helm/olmv1/templates/validatingadmissionpolicy-clusterextension-serviceaccount-deprecated.yml
@@ -0,0 +1,26 @@
+{{- if .Values.options.operatorController.enabled }}
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicy
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ {{- include "olmv1.labels" . | nindent 4 }}
+ annotations:
+ {{- include "olmv1.annotations" . | nindent 4 }}
+spec:
+ matchConstraints:
+ resourceRules:
+ - apiGroups:
+ - olm.operatorframework.io
+ apiVersions:
+ - v1
+ operations:
+ - CREATE
+ - UPDATE
+ resources:
+ - clusterextensions
+ validations:
+ - expression: "!has(object.spec.serviceAccount) || !has(object.spec.serviceAccount.name) || object.spec.serviceAccount.name == ''"
+ message: "spec.serviceAccount is deprecated, ignored, and will be removed in a future release. The operator-controller's cluster-admin service account is used for all cluster interactions."
+{{- end }}
diff --git a/helm/olmv1/templates/validatingadmissionpolicybinding-clusterextension-serviceaccount-deprecated.yml b/helm/olmv1/templates/validatingadmissionpolicybinding-clusterextension-serviceaccount-deprecated.yml
new file mode 100644
index 0000000000..c9ffa4f5df
--- /dev/null
+++ b/helm/olmv1/templates/validatingadmissionpolicybinding-clusterextension-serviceaccount-deprecated.yml
@@ -0,0 +1,15 @@
+{{- if .Values.options.operatorController.enabled }}
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicyBinding
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ {{- include "olmv1.labels" . | nindent 4 }}
+ annotations:
+ {{- include "olmv1.annotations" . | nindent 4 }}
+spec:
+ policyName: clusterextension-serviceaccount-deprecated
+ validationActions:
+ - Warn
+{{- end }}
diff --git a/helm/olmv1/values.yaml b/helm/olmv1/values.yaml
index 1458be7d2b..b39f4453e0 100644
--- a/helm/olmv1/values.yaml
+++ b/helm/olmv1/values.yaml
@@ -18,9 +18,7 @@ options:
- BundleReleaseSupport
- DeploymentConfig
- HelmChartSupport
- - PreflightPermissions
- SingleOwnNamespaceInstallSupport
- - SyntheticPermissions
- WebhookProviderOpenshiftServiceCA
podDisruptionBudget:
enabled: true
diff --git a/helm/tilt.yaml b/helm/tilt.yaml
index aaed7c71fb..177f735afd 100644
--- a/helm/tilt.yaml
+++ b/helm/tilt.yaml
@@ -15,7 +15,6 @@ options:
features:
enabled:
- SingleOwnNamespaceInstallSupport
- - PreflightPermissions
- HelmChartSupport
disabled:
- WebhookProviderOpenshiftServiceCA
diff --git a/internal/catalogd/controllers/core/clustercatalog_controller_test.go b/internal/catalogd/controllers/core/clustercatalog_controller_test.go
index 76efafa228..f6cbe46dfb 100644
--- a/internal/catalogd/controllers/core/clustercatalog_controller_test.go
+++ b/internal/catalogd/controllers/core/clustercatalog_controller_test.go
@@ -4,8 +4,6 @@ import (
"context"
"errors"
"fmt"
- "io/fs"
- "net/http"
"testing"
"testing/fstest"
"time"
@@ -15,6 +13,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.podman.io/image/v5/docker/reference"
+ "go.uber.org/mock/gomock"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
@@ -24,41 +23,25 @@ import (
ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/catalogd/storage"
imageutil "github.com/operator-framework/operator-controller/internal/shared/util/image"
+ mockstorage "github.com/operator-framework/operator-controller/internal/testutil/mock/storage"
)
-var _ storage.Instance = &MockStore{}
-
-type MockStore struct {
- shouldError bool
-}
-
-func (m MockStore) Store(_ context.Context, _ string, _ fs.FS) error {
- if m.shouldError {
- return errors.New("mockstore store error")
- }
- return nil
-}
-
-func (m MockStore) Delete(_ string) error {
- if m.shouldError {
- return errors.New("mockstore delete error")
+func newMockStore(ctrl *gomock.Controller, shouldError bool) *mockstorage.MockInstance {
+ m := mockstorage.NewMockInstance(ctrl)
+ if shouldError {
+ m.EXPECT().Store(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("mockstore store error")).AnyTimes()
+ m.EXPECT().Delete(gomock.Any()).Return(errors.New("mockstore delete error")).AnyTimes()
+ } else {
+ m.EXPECT().Store(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
+ m.EXPECT().Delete(gomock.Any()).Return(nil).AnyTimes()
}
- return nil
-}
-
-func (m MockStore) BaseURL(_ string) string {
- return "URL"
-}
-
-func (m MockStore) StorageServerHandler() http.Handler {
- panic("not needed")
-}
-
-func (m MockStore) ContentExists(_ string) bool {
- return true
+ m.EXPECT().BaseURL(gomock.Any()).Return("URL").AnyTimes()
+ m.EXPECT().ContentExists(gomock.Any()).Return(true).AnyTimes()
+ return m
}
func TestCatalogdControllerReconcile(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
for _, tt := range []struct {
name string
catalog *ocv1.ClusterCatalog
@@ -70,8 +53,8 @@ func TestCatalogdControllerReconcile(t *testing.T) {
}{
{
name: "invalid source type, returns error",
- puller: &imageutil.MockPuller{},
- store: &MockStore{},
+ puller: &imageutil.FakePuller{},
+ store: newMockStore(mockCtrl, false),
catalog: &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog",
@@ -108,10 +91,10 @@ func TestCatalogdControllerReconcile(t *testing.T) {
{
name: "valid source type, unpack returns error, status updated to reflect error state and error is returned",
expectedError: fmt.Errorf("source catalog content: %w", fmt.Errorf("mockpuller error")),
- puller: &imageutil.MockPuller{
+ puller: &imageutil.FakePuller{
Error: errors.New("mockpuller error"),
},
- store: &MockStore{},
+ store: newMockStore(mockCtrl, false),
catalog: &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog",
@@ -153,10 +136,10 @@ func TestCatalogdControllerReconcile(t *testing.T) {
{
name: "valid source type, unpack returns terminal error, status updated to reflect terminal error state(Blocked) and error is returned",
expectedError: fmt.Errorf("source catalog content: %w", reconcile.TerminalError(fmt.Errorf("mockpuller terminal error"))),
- puller: &imageutil.MockPuller{
+ puller: &imageutil.FakePuller{
Error: reconcile.TerminalError(errors.New("mockpuller terminal error")),
},
- store: &MockStore{},
+ store: newMockStore(mockCtrl, false),
catalog: &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog",
@@ -197,11 +180,11 @@ func TestCatalogdControllerReconcile(t *testing.T) {
},
{
name: "valid source type, unpack state == Unpacked, should reflect in status that it's progressing, and is serving",
- puller: &imageutil.MockPuller{
+ puller: &imageutil.FakePuller{
ImageFS: &fstest.MapFS{},
Ref: mustRef(t, "my.org/someimage@sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
},
- store: &MockStore{},
+ store: newMockStore(mockCtrl, false),
catalog: &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog",
@@ -256,12 +239,10 @@ func TestCatalogdControllerReconcile(t *testing.T) {
{
name: "valid source type, unpack state == Unpacked, storage fails, failure reflected in status and error returned",
expectedError: fmt.Errorf("error storing fbc: mockstore store error"),
- puller: &imageutil.MockPuller{
+ puller: &imageutil.FakePuller{
ImageFS: &fstest.MapFS{},
},
- store: &MockStore{
- shouldError: true,
- },
+ store: newMockStore(mockCtrl, true),
catalog: &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog",
@@ -302,10 +283,10 @@ func TestCatalogdControllerReconcile(t *testing.T) {
},
{
name: "storage finalizer not set, storage finalizer gets set",
- puller: &imageutil.MockPuller{
+ puller: &imageutil.FakePuller{
ImageFS: &fstest.MapFS{},
},
- store: &MockStore{},
+ store: newMockStore(mockCtrl, false),
catalog: &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog",
@@ -336,10 +317,10 @@ func TestCatalogdControllerReconcile(t *testing.T) {
},
{
name: "storage finalizer set, catalog deletion timestamp is not zero (or nil), finalizer removed",
- puller: &imageutil.MockPuller{
+ puller: &imageutil.FakePuller{
ImageFS: &fstest.MapFS{},
},
- store: &MockStore{},
+ store: newMockStore(mockCtrl, false),
catalog: &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog",
@@ -409,12 +390,10 @@ func TestCatalogdControllerReconcile(t *testing.T) {
{
name: "storage finalizer set, catalog deletion timestamp is not zero (or nil), storage delete failed, error returned, finalizer not removed and catalog continues serving",
expectedError: fmt.Errorf("finalizer %q failed: %w", fbcDeletionFinalizer, fmt.Errorf("mockstore delete error")),
- puller: &imageutil.MockPuller{
+ puller: &imageutil.FakePuller{
ImageFS: &fstest.MapFS{},
},
- store: &MockStore{
- shouldError: true,
- },
+ store: newMockStore(mockCtrl, true),
catalog: &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog",
@@ -479,11 +458,9 @@ func TestCatalogdControllerReconcile(t *testing.T) {
{
name: "storage finalizer set, catalog deletion timestamp is not zero (or nil), unpack cleanup failed, error returned, finalizer not removed but catalog stops serving",
expectedError: fmt.Errorf("finalizer %q failed: %w", fbcDeletionFinalizer, fmt.Errorf("mockcache delete error")),
- puller: &imageutil.MockPuller{},
- cache: &imageutil.MockCache{DeleteErr: fmt.Errorf("mockcache delete error")},
- store: &MockStore{
- shouldError: false,
- },
+ puller: &imageutil.FakePuller{},
+ cache: &imageutil.FakeCache{DeleteErr: fmt.Errorf("mockcache delete error")},
+ store: newMockStore(mockCtrl, false),
catalog: &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog",
@@ -545,10 +522,10 @@ func TestCatalogdControllerReconcile(t *testing.T) {
},
{
name: "catalog availability set to disabled, status.urls should get unset",
- puller: &imageutil.MockPuller{
+ puller: &imageutil.FakePuller{
ImageFS: &fstest.MapFS{},
},
- store: &MockStore{},
+ store: newMockStore(mockCtrl, false),
catalog: &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog",
@@ -616,10 +593,10 @@ func TestCatalogdControllerReconcile(t *testing.T) {
},
{
name: "catalog availability set to disabled, finalizer should get removed",
- puller: &imageutil.MockPuller{
+ puller: &imageutil.FakePuller{
ImageFS: &fstest.MapFS{},
},
- store: &MockStore{},
+ store: newMockStore(mockCtrl, false),
catalog: &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog",
@@ -689,10 +666,10 @@ func TestCatalogdControllerReconcile(t *testing.T) {
},
{
name: "after catalog availability set to enable, finalizer should be added",
- puller: &imageutil.MockPuller{
+ puller: &imageutil.FakePuller{
ImageFS: &fstest.MapFS{},
},
- store: &MockStore{},
+ store: newMockStore(mockCtrl, false),
catalog: &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog",
@@ -810,7 +787,7 @@ func TestCatalogdControllerReconcile(t *testing.T) {
storedCatalogs: map[string]storedCatalogData{},
}
if reconciler.ImageCache == nil {
- reconciler.ImageCache = &imageutil.MockCache{}
+ reconciler.ImageCache = &imageutil.FakeCache{}
}
require.NoError(t, reconciler.setupFinalizers())
ctx := context.Background()
@@ -896,6 +873,7 @@ func TestPollingRequeue(t *testing.T) {
},
} {
t.Run(name, func(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
ref := mustRef(t, "my.org/someimage@sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
tc.catalog.Status = ocv1.ClusterCatalogStatus{
Conditions: []metav1.Condition{
@@ -911,11 +889,11 @@ func TestPollingRequeue(t *testing.T) {
}
reconciler := &ClusterCatalogReconciler{
Client: nil,
- ImagePuller: &imageutil.MockPuller{
+ ImagePuller: &imageutil.FakePuller{
ImageFS: &fstest.MapFS{},
Ref: ref,
},
- Storage: &MockStore{},
+ Storage: newMockStore(mockCtrl, false),
storedCatalogs: map[string]storedCatalogData{
tc.catalog.Name: {
ref: ref,
@@ -1132,14 +1110,15 @@ func TestPollingReconcilerUnpack(t *testing.T) {
},
} {
t.Run(name, func(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
scd := tc.storedCatalogData
if scd == nil {
scd = map[string]storedCatalogData{}
}
reconciler := &ClusterCatalogReconciler{
Client: nil,
- ImagePuller: &imageutil.MockPuller{Error: errors.New("mockpuller error")},
- Storage: &MockStore{},
+ ImagePuller: &imageutil.FakePuller{Error: errors.New("mockpuller error")},
+ Storage: newMockStore(mockCtrl, false),
storedCatalogs: scd,
}
require.NoError(t, reconciler.setupFinalizers())
diff --git a/internal/catalogd/server/handlers_test.go b/internal/catalogd/server/handlers_test.go
index d565de277c..6a8d7acd17 100644
--- a/internal/catalogd/server/handlers_test.go
+++ b/internal/catalogd/server/handlers_test.go
@@ -1,4 +1,4 @@
-package server
+package server_test
import (
"bytes"
@@ -13,59 +13,26 @@ import (
"testing"
"github.com/graphql-go/graphql"
+ "go.uber.org/mock/gomock"
- gql "github.com/operator-framework/operator-controller/internal/catalogd/graphql"
+ "github.com/operator-framework/operator-controller/internal/catalogd/server"
+ mockcatalogdserver "github.com/operator-framework/operator-controller/internal/testutil/mock/catalogdserver"
+ mockcatalogdservice "github.com/operator-framework/operator-controller/internal/testutil/mock/catalogdservice"
)
-// mockCatalogStore implements CatalogStore for testing
-type mockCatalogStore struct {
- catalogFile *os.File
- catalogStat os.FileInfo
- catalogFS fs.FS
- getDataErr error
- getFSErr error
-}
-
-func (m *mockCatalogStore) GetCatalogData(catalog string) (*os.File, os.FileInfo, error) {
- return m.catalogFile, m.catalogStat, m.getDataErr
-}
-
-func (m *mockCatalogStore) GetCatalogFS(catalog string) (fs.FS, error) {
- return m.catalogFS, m.getFSErr
-}
-
-func (m *mockCatalogStore) GetIndex(catalog string) (Index, error) {
- return nil, nil
-}
-
-// mockGraphQLService implements service.GraphQLService for testing
-type mockGraphQLService struct {
- executeResult *graphql.Result
- executeErr error
-}
-
-func (m *mockGraphQLService) GetSchema(catalog string, catalogFS fs.FS) (*gql.DynamicSchema, error) {
- return nil, nil
-}
-
-func (m *mockGraphQLService) ExecuteQuery(catalog string, catalogFS fs.FS, query string) (*graphql.Result, error) {
- return m.executeResult, m.executeErr
-}
-
-func (m *mockGraphQLService) InvalidateCache(catalog string) {}
-
func TestHandleV1GraphQL_MethodNotAllowed(t *testing.T) {
+ ctrl := gomock.NewController(t)
rootURL, _ := url.Parse("http://localhost/")
- store := &mockCatalogStore{}
- graphqlSvc := &mockGraphQLService{}
+ store := mockcatalogdserver.NewMockCatalogStore(ctrl)
+ graphqlSvc := mockcatalogdservice.NewMockGraphQLService(ctrl)
- handlers := NewCatalogHandlers(store, graphqlSvc, rootURL, MetasHandlerDisabled, GraphQLQueriesEnabled)
+ handlers := server.NewCatalogHandlers(store, graphqlSvc, rootURL, server.MetasHandlerDisabled, server.GraphQLQueriesEnabled)
+ handler := handlers.Handler()
req := httptest.NewRequest(http.MethodGet, "/test-catalog/api/v1/graphql", nil)
- req.SetPathValue("catalog", "test-catalog")
w := httptest.NewRecorder()
- handlers.handleV1GraphQL(w, req)
+ handler.ServeHTTP(w, req)
if w.Code != http.StatusMethodNotAllowed {
t.Errorf("Expected status %d, got %d", http.StatusMethodNotAllowed, w.Code)
@@ -73,17 +40,18 @@ func TestHandleV1GraphQL_MethodNotAllowed(t *testing.T) {
}
func TestHandleV1GraphQL_InvalidCatalogName(t *testing.T) {
+ ctrl := gomock.NewController(t)
rootURL, _ := url.Parse("http://localhost/")
- store := &mockCatalogStore{}
- graphqlSvc := &mockGraphQLService{}
+ store := mockcatalogdserver.NewMockCatalogStore(ctrl)
+ graphqlSvc := mockcatalogdservice.NewMockGraphQLService(ctrl)
- handlers := NewCatalogHandlers(store, graphqlSvc, rootURL, MetasHandlerDisabled, GraphQLQueriesEnabled)
+ handlers := server.NewCatalogHandlers(store, graphqlSvc, rootURL, server.MetasHandlerDisabled, server.GraphQLQueriesEnabled)
+ handler := handlers.Handler()
req := httptest.NewRequest(http.MethodPost, "/INVALID-CATALOG-NAME/api/v1/graphql", strings.NewReader(`{"query": "{ summary { totalSchemas } }"}`))
- req.SetPathValue("catalog", "INVALID-CATALOG-NAME")
w := httptest.NewRecorder()
- handlers.handleV1GraphQL(w, req)
+ handler.ServeHTTP(w, req)
if w.Code != http.StatusBadRequest {
t.Errorf("Expected status %d, got %d", http.StatusBadRequest, w.Code)
@@ -91,17 +59,18 @@ func TestHandleV1GraphQL_InvalidCatalogName(t *testing.T) {
}
func TestHandleV1GraphQL_InvalidJSON(t *testing.T) {
+ ctrl := gomock.NewController(t)
rootURL, _ := url.Parse("http://localhost/")
- store := &mockCatalogStore{}
- graphqlSvc := &mockGraphQLService{}
+ store := mockcatalogdserver.NewMockCatalogStore(ctrl)
+ graphqlSvc := mockcatalogdservice.NewMockGraphQLService(ctrl)
- handlers := NewCatalogHandlers(store, graphqlSvc, rootURL, MetasHandlerDisabled, GraphQLQueriesEnabled)
+ handlers := server.NewCatalogHandlers(store, graphqlSvc, rootURL, server.MetasHandlerDisabled, server.GraphQLQueriesEnabled)
+ handler := handlers.Handler()
req := httptest.NewRequest(http.MethodPost, "/test-catalog/api/v1/graphql", strings.NewReader(`{invalid json`))
- req.SetPathValue("catalog", "test-catalog")
w := httptest.NewRecorder()
- handlers.handleV1GraphQL(w, req)
+ handler.ServeHTTP(w, req)
if w.Code != http.StatusBadRequest {
t.Errorf("Expected status %d, got %d", http.StatusBadRequest, w.Code)
@@ -109,17 +78,18 @@ func TestHandleV1GraphQL_InvalidJSON(t *testing.T) {
}
func TestHandleV1GraphQL_EmptyQuery(t *testing.T) {
+ ctrl := gomock.NewController(t)
rootURL, _ := url.Parse("http://localhost/")
- store := &mockCatalogStore{}
- graphqlSvc := &mockGraphQLService{}
+ store := mockcatalogdserver.NewMockCatalogStore(ctrl)
+ graphqlSvc := mockcatalogdservice.NewMockGraphQLService(ctrl)
- handlers := NewCatalogHandlers(store, graphqlSvc, rootURL, MetasHandlerDisabled, GraphQLQueriesEnabled)
+ handlers := server.NewCatalogHandlers(store, graphqlSvc, rootURL, server.MetasHandlerDisabled, server.GraphQLQueriesEnabled)
+ handler := handlers.Handler()
req := httptest.NewRequest(http.MethodPost, "/test-catalog/api/v1/graphql", strings.NewReader(`{"query": ""}`))
- req.SetPathValue("catalog", "test-catalog")
w := httptest.NewRecorder()
- handlers.handleV1GraphQL(w, req)
+ handler.ServeHTTP(w, req)
if w.Code != http.StatusBadRequest {
t.Errorf("Expected status %d, got %d", http.StatusBadRequest, w.Code)
@@ -130,19 +100,20 @@ func TestHandleV1GraphQL_EmptyQuery(t *testing.T) {
}
func TestHandleV1GraphQL_QueryTooLarge(t *testing.T) {
+ ctrl := gomock.NewController(t)
rootURL, _ := url.Parse("http://localhost/")
- store := &mockCatalogStore{}
- graphqlSvc := &mockGraphQLService{}
+ store := mockcatalogdserver.NewMockCatalogStore(ctrl)
+ graphqlSvc := mockcatalogdservice.NewMockGraphQLService(ctrl)
- handlers := NewCatalogHandlers(store, graphqlSvc, rootURL, MetasHandlerDisabled, GraphQLQueriesEnabled)
+ handlers := server.NewCatalogHandlers(store, graphqlSvc, rootURL, server.MetasHandlerDisabled, server.GraphQLQueriesEnabled)
+ handler := handlers.Handler()
// Create a query larger than 100KB
largeQuery := strings.Repeat("a", 100001)
req := httptest.NewRequest(http.MethodPost, "/test-catalog/api/v1/graphql", strings.NewReader(`{"query": "`+largeQuery+`"}`))
- req.SetPathValue("catalog", "test-catalog")
w := httptest.NewRecorder()
- handlers.handleV1GraphQL(w, req)
+ handler.ServeHTTP(w, req)
if w.Code != http.StatusBadRequest {
t.Errorf("Expected status %d, got %d", http.StatusBadRequest, w.Code)
@@ -150,19 +121,20 @@ func TestHandleV1GraphQL_QueryTooLarge(t *testing.T) {
}
func TestHandleV1GraphQL_BodyTooLarge(t *testing.T) {
+ ctrl := gomock.NewController(t)
rootURL, _ := url.Parse("http://localhost/")
- store := &mockCatalogStore{}
- graphqlSvc := &mockGraphQLService{}
+ store := mockcatalogdserver.NewMockCatalogStore(ctrl)
+ graphqlSvc := mockcatalogdservice.NewMockGraphQLService(ctrl)
- handlers := NewCatalogHandlers(store, graphqlSvc, rootURL, MetasHandlerDisabled, GraphQLQueriesEnabled)
+ handlers := server.NewCatalogHandlers(store, graphqlSvc, rootURL, server.MetasHandlerDisabled, server.GraphQLQueriesEnabled)
+ handler := handlers.Handler()
// Create a body larger than 1MB
largeBody := strings.Repeat("a", 1<<20+1)
req := httptest.NewRequest(http.MethodPost, "/test-catalog/api/v1/graphql", strings.NewReader(largeBody))
- req.SetPathValue("catalog", "test-catalog")
w := httptest.NewRecorder()
- handlers.handleV1GraphQL(w, req)
+ handler.ServeHTTP(w, req)
// MaxBytesReader should cause this to fail during decode
if w.Code != http.StatusBadRequest {
@@ -171,15 +143,15 @@ func TestHandleV1GraphQL_BodyTooLarge(t *testing.T) {
}
func TestHandleV1GraphQL_Success(t *testing.T) {
+ ctrl := gomock.NewController(t)
rootURL, _ := url.Parse("http://localhost/")
// Create a temporary directory for the mock filesystem
tmpDir := t.TempDir()
catalogFS := os.DirFS(tmpDir)
- store := &mockCatalogStore{
- catalogFS: catalogFS,
- }
+ store := mockcatalogdserver.NewMockCatalogStore(ctrl)
+ store.EXPECT().GetCatalogFS("test-catalog").Return(catalogFS, nil)
expectedResult := &graphql.Result{
Data: map[string]interface{}{
@@ -189,18 +161,17 @@ func TestHandleV1GraphQL_Success(t *testing.T) {
},
}
- graphqlSvc := &mockGraphQLService{
- executeResult: expectedResult,
- }
+ graphqlSvc := mockcatalogdservice.NewMockGraphQLService(ctrl)
+ graphqlSvc.EXPECT().ExecuteQuery("test-catalog", catalogFS, "{ summary { totalSchemas } }").Return(expectedResult, nil)
- handlers := NewCatalogHandlers(store, graphqlSvc, rootURL, MetasHandlerDisabled, GraphQLQueriesEnabled)
+ handlers := server.NewCatalogHandlers(store, graphqlSvc, rootURL, server.MetasHandlerDisabled, server.GraphQLQueriesEnabled)
+ handler := handlers.Handler()
query := `{"query": "{ summary { totalSchemas } }"}`
req := httptest.NewRequest(http.MethodPost, "/test-catalog/api/v1/graphql", strings.NewReader(query))
- req.SetPathValue("catalog", "test-catalog")
w := httptest.NewRecorder()
- handlers.handleV1GraphQL(w, req)
+ handler.ServeHTTP(w, req)
if w.Code != http.StatusOK {
t.Errorf("Expected status %d, got %d", http.StatusOK, w.Code)
@@ -231,22 +202,22 @@ func TestHandleV1GraphQL_Success(t *testing.T) {
}
func TestHandleV1GraphQL_GetCatalogFSError(t *testing.T) {
+ ctrl := gomock.NewController(t)
rootURL, _ := url.Parse("http://localhost/")
- store := &mockCatalogStore{
- getFSErr: fs.ErrNotExist,
- }
+ store := mockcatalogdserver.NewMockCatalogStore(ctrl)
+ store.EXPECT().GetCatalogFS("test-catalog").Return(nil, fs.ErrNotExist)
- graphqlSvc := &mockGraphQLService{}
+ graphqlSvc := mockcatalogdservice.NewMockGraphQLService(ctrl)
- handlers := NewCatalogHandlers(store, graphqlSvc, rootURL, MetasHandlerDisabled, GraphQLQueriesEnabled)
+ handlers := server.NewCatalogHandlers(store, graphqlSvc, rootURL, server.MetasHandlerDisabled, server.GraphQLQueriesEnabled)
+ handler := handlers.Handler()
query := `{"query": "{ summary { totalSchemas } }"}`
req := httptest.NewRequest(http.MethodPost, "/test-catalog/api/v1/graphql", strings.NewReader(query))
- req.SetPathValue("catalog", "test-catalog")
w := httptest.NewRecorder()
- handlers.handleV1GraphQL(w, req)
+ handler.ServeHTTP(w, req)
if w.Code != http.StatusNotFound {
t.Errorf("Expected status %d, got %d", http.StatusNotFound, w.Code)
@@ -254,27 +225,26 @@ func TestHandleV1GraphQL_GetCatalogFSError(t *testing.T) {
}
func TestHandleV1GraphQL_ExecuteQueryError(t *testing.T) {
+ ctrl := gomock.NewController(t)
rootURL, _ := url.Parse("http://localhost/")
tmpDir := t.TempDir()
catalogFS := os.DirFS(tmpDir)
- store := &mockCatalogStore{
- catalogFS: catalogFS,
- }
+ store := mockcatalogdserver.NewMockCatalogStore(ctrl)
+ store.EXPECT().GetCatalogFS("test-catalog").Return(catalogFS, nil)
- graphqlSvc := &mockGraphQLService{
- executeErr: context.DeadlineExceeded,
- }
+ graphqlSvc := mockcatalogdservice.NewMockGraphQLService(ctrl)
+ graphqlSvc.EXPECT().ExecuteQuery("test-catalog", catalogFS, "{ summary { totalSchemas } }").Return(nil, context.DeadlineExceeded)
- handlers := NewCatalogHandlers(store, graphqlSvc, rootURL, MetasHandlerDisabled, GraphQLQueriesEnabled)
+ handlers := server.NewCatalogHandlers(store, graphqlSvc, rootURL, server.MetasHandlerDisabled, server.GraphQLQueriesEnabled)
+ handler := handlers.Handler()
query := `{"query": "{ summary { totalSchemas } }"}`
req := httptest.NewRequest(http.MethodPost, "/test-catalog/api/v1/graphql", strings.NewReader(query))
- req.SetPathValue("catalog", "test-catalog")
w := httptest.NewRecorder()
- handlers.handleV1GraphQL(w, req)
+ handler.ServeHTTP(w, req)
if w.Code != http.StatusInternalServerError {
t.Errorf("Expected status %d, got %d", http.StatusInternalServerError, w.Code)
@@ -282,16 +252,19 @@ func TestHandleV1GraphQL_ExecuteQueryError(t *testing.T) {
}
func TestAllowedMethodsHandler_POSTOnlyForGraphQL(t *testing.T) {
+ ctrl := gomock.NewController(t)
rootURL, _ := url.Parse("http://localhost/")
- store := &mockCatalogStore{}
- graphqlSvc := &mockGraphQLService{}
+ store := mockcatalogdserver.NewMockCatalogStore(ctrl)
+ store.EXPECT().GetCatalogFS("test-catalog").Return(nil, nil)
+
+ graphqlSvc := mockcatalogdservice.NewMockGraphQLService(ctrl)
+ graphqlSvc.EXPECT().ExecuteQuery("test-catalog", nil, "{ summary { totalSchemas } }").Return(nil, nil)
- handlers := NewCatalogHandlers(store, graphqlSvc, rootURL, MetasHandlerDisabled, GraphQLQueriesEnabled)
+ handlers := server.NewCatalogHandlers(store, graphqlSvc, rootURL, server.MetasHandlerDisabled, server.GraphQLQueriesEnabled)
handler := handlers.Handler()
// Test POST to GraphQL endpoint - should be allowed
graphqlReq := httptest.NewRequest(http.MethodPost, "/test-catalog/api/v1/graphql", bytes.NewReader([]byte(`{"query": "{ summary { totalSchemas } }"}`)))
- graphqlReq.SetPathValue("catalog", "test-catalog")
w := httptest.NewRecorder()
handler.ServeHTTP(w, graphqlReq)
diff --git a/internal/catalogd/serverutil/serverutil_test.go b/internal/catalogd/serverutil/serverutil_test.go
index 439b726ed5..57ebf94f82 100644
--- a/internal/catalogd/serverutil/serverutil_test.go
+++ b/internal/catalogd/serverutil/serverutil_test.go
@@ -11,7 +11,6 @@ import (
"crypto/x509/pkix"
"encoding/pem"
"io"
- "io/fs"
"math/big"
"net"
"net/http"
@@ -23,6 +22,9 @@ import (
"github.com/go-logr/logr"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
+
+ mockstorage "github.com/operator-framework/operator-controller/internal/testutil/mock/storage"
)
func TestStorageServerHandlerWrapped_Gzip(t *testing.T) {
@@ -61,10 +63,9 @@ func TestStorageServerHandlerWrapped_Gzip(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
// Create a mock storage instance that returns our test content
- mockStorage := &mockStorageInstance{
- content: tt.responseContent,
- }
+ mockStorage := newMockStorageInstance(mockCtrl, tt.responseContent)
cfg := CatalogServerConfig{
LocalStorage: mockStorage,
@@ -109,33 +110,19 @@ func TestStorageServerHandlerWrapped_Gzip(t *testing.T) {
}
}
-// mockStorageInstance implements storage.Instance interface for testing
-type mockStorageInstance struct {
- content string
-}
-
-func (m *mockStorageInstance) StorageServerHandler() http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- _, err := w.Write([]byte(m.content))
+func newMockStorageInstance(ctrl *gomock.Controller, content string) *mockstorage.MockInstance {
+ m := mockstorage.NewMockInstance(ctrl)
+ m.EXPECT().StorageServerHandler().Return(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ _, err := w.Write([]byte(content))
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
- })
-}
-
-func (m *mockStorageInstance) Store(ctx context.Context, catalogName string, fs fs.FS) error {
- return nil
-}
-
-func (m *mockStorageInstance) Delete(catalogName string) error {
- return nil
-}
-
-func (m *mockStorageInstance) ContentExists(catalog string) bool {
- return true
-}
-func (m *mockStorageInstance) BaseURL(catalog string) string {
- return ""
+ })).AnyTimes()
+ m.EXPECT().Store(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
+ m.EXPECT().Delete(gomock.Any()).Return(nil).AnyTimes()
+ m.EXPECT().ContentExists(gomock.Any()).Return(true).AnyTimes()
+ m.EXPECT().BaseURL(gomock.Any()).Return("").AnyTimes()
+ return m
}
// writeTempCert generates a self-signed TLS certificate and writes the PEM-encoded
@@ -196,7 +183,8 @@ func TestCatalogServerTLSOptsApplied(t *testing.T) {
observedMinVersion = c.MinVersion
}
- mockStorage := &mockStorageInstance{}
+ mockCtrl := gomock.NewController(t)
+ mockStorage := newMockStorageInstance(mockCtrl, "")
cfg := CatalogServerConfig{
CatalogAddr: "127.0.0.1:0",
CertFile: certFile,
@@ -246,7 +234,8 @@ func TestCatalogServerTLSOptsApplied(t *testing.T) {
func TestCatalogServerTLSOptsCertSourceRequired(t *testing.T) {
certFile, keyFile := writeTempCert(t)
- mockStorage := &mockStorageInstance{}
+ mockCtrl := gomock.NewController(t)
+ mockStorage := newMockStorageInstance(mockCtrl, "")
cfg := CatalogServerConfig{
CatalogAddr: "127.0.0.1:0",
CertFile: certFile,
diff --git a/internal/operator-controller/action/helm_test.go b/internal/operator-controller/action/helm_test.go
index 25f7f71950..086a8cc92f 100644
--- a/internal/operator-controller/action/helm_test.go
+++ b/internal/operator-controller/action/helm_test.go
@@ -7,88 +7,13 @@ import (
"testing"
"github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
- "helm.sh/helm/v3/pkg/action"
- "helm.sh/helm/v3/pkg/chart"
- "helm.sh/helm/v3/pkg/release"
+ "go.uber.org/mock/gomock"
"sigs.k8s.io/controller-runtime/pkg/client"
- actionclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
+ mockhelmclient "github.com/operator-framework/operator-controller/internal/testutil/mock/helmclient"
)
-var _ actionclient.ActionInterface = &mockActionClient{}
-
-type mockActionClient struct {
- mock.Mock
-}
-
-func (m *mockActionClient) Get(name string, opts ...actionclient.GetOption) (*release.Release, error) {
- args := m.Called(name, opts)
- if args.Get(0) == nil {
- return nil, args.Error(1)
- }
- return args.Get(0).(*release.Release), args.Error(1)
-}
-
-func (m *mockActionClient) History(name string, opts ...actionclient.HistoryOption) ([]*release.Release, error) {
- args := m.Called(name, opts)
- if args.Get(0) == nil {
- return nil, args.Error(1)
- }
- rel := []*release.Release{
- args.Get(0).(*release.Release),
- }
- return rel, args.Error(1)
-}
-
-func (m *mockActionClient) Install(name, namespace string, chrt *chart.Chart, vals map[string]interface{}, opts ...actionclient.InstallOption) (*release.Release, error) {
- args := m.Called(name, namespace, chrt, vals, opts)
- if args.Get(0) == nil {
- return nil, args.Error(1)
- }
- return args.Get(0).(*release.Release), args.Error(1)
-}
-
-func (m *mockActionClient) Upgrade(name, namespace string, chrt *chart.Chart, vals map[string]interface{}, opts ...actionclient.UpgradeOption) (*release.Release, error) {
- args := m.Called(name, namespace, chrt, vals, opts)
- if args.Get(0) == nil {
- return nil, args.Error(1)
- }
- return args.Get(0).(*release.Release), args.Error(1)
-}
-
-func (m *mockActionClient) Uninstall(name string, opts ...actionclient.UninstallOption) (*release.UninstallReleaseResponse, error) {
- args := m.Called(name, opts)
- if args.Get(0) == nil {
- return nil, args.Error(1)
- }
- return args.Get(0).(*release.UninstallReleaseResponse), args.Error(1)
-}
-
-func (m *mockActionClient) Reconcile(rel *release.Release) error {
- args := m.Called(rel)
- return args.Error(0)
-}
-
-func (m *mockActionClient) Config() *action.Configuration {
- return nil
-}
-
-var _ actionclient.ActionClientGetter = &mockActionClientGetter{}
-
-type mockActionClientGetter struct {
- mock.Mock
-}
-
-func (m *mockActionClientGetter) ActionClientFor(ctx context.Context, obj client.Object) (actionclient.ActionInterface, error) {
- args := m.Called(ctx, obj)
- if args.Get(0) == nil {
- return nil, args.Error(1)
- }
- return args.Get(0).(actionclient.ActionInterface), args.Error(1)
-}
-
func TestActionClientErrorTranslation(t *testing.T) {
originalError := fmt.Errorf("some error")
expectedErr := fmt.Errorf("something other error")
@@ -96,13 +21,15 @@ func TestActionClientErrorTranslation(t *testing.T) {
return expectedErr
}
- ac := new(mockActionClient)
- ac.On("Get", mock.Anything, mock.Anything).Return(nil, originalError)
- ac.On("History", mock.Anything, mock.Anything).Return(nil, originalError)
- ac.On("Install", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil, originalError)
- ac.On("Uninstall", mock.Anything, mock.Anything).Return(nil, originalError)
- ac.On("Upgrade", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil, originalError)
- ac.On("Reconcile", mock.Anything, mock.Anything).Return(originalError)
+ ctrl := gomock.NewController(t)
+ ac := mockhelmclient.NewMockActionInterface(ctrl)
+
+ ac.EXPECT().Get(gomock.Any(), gomock.Any()).Return(nil, originalError).AnyTimes()
+ ac.EXPECT().History(gomock.Any(), gomock.Any()).Return(nil, originalError).AnyTimes()
+ ac.EXPECT().Install(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, originalError).AnyTimes()
+ ac.EXPECT().Uninstall(gomock.Any(), gomock.Any()).Return(nil, originalError).AnyTimes()
+ ac.EXPECT().Upgrade(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, originalError).AnyTimes()
+ ac.EXPECT().Reconcile(gomock.Any()).Return(originalError).AnyTimes()
wrappedAc := NewWrappedActionClient(ac, errTranslator)
@@ -132,23 +59,20 @@ func TestActionClientErrorTranslation(t *testing.T) {
}
func TestActionClientFor(t *testing.T) {
- // Create a mock for the ActionClientGetter
- mockActionClientGetter := new(mockActionClientGetter)
- mockActionInterface := new(mockActionClient)
+ ctrl := gomock.NewController(t)
+ mockACG := mockhelmclient.NewMockActionClientGetter(ctrl)
+ mockAI := mockhelmclient.NewMockActionInterface(ctrl)
testError := errors.New("test error")
- // Set up expectations for the mock
- mockActionClientGetter.On("ActionClientFor", mock.Anything, mock.Anything).Return(mockActionInterface, nil).Once()
- mockActionClientGetter.On("ActionClientFor", mock.Anything, mock.Anything).Return(nil, testError).Once()
+ first := mockACG.EXPECT().ActionClientFor(gomock.Any(), gomock.Any()).Return(mockAI, nil)
+ mockACG.EXPECT().ActionClientFor(gomock.Any(), gomock.Any()).Return(nil, testError).After(first)
- // Create an instance of ActionClientGetter with the mock
acg := ActionClientGetter{
- ActionClientGetter: mockActionClientGetter,
+ ActionClientGetter: mockACG,
}
- // Define a test context and object
ctx := context.Background()
- var obj client.Object // Replace with an actual client.Object implementation
+ var obj client.Object
// Test the successful case
actionClient, err := acg.ActionClientFor(ctx, obj)
diff --git a/internal/operator-controller/action/restconfig.go b/internal/operator-controller/action/restconfig.go
deleted file mode 100644
index 05e25f707d..0000000000
--- a/internal/operator-controller/action/restconfig.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package action
-
-import (
- "context"
- "fmt"
- "net/http"
-
- "k8s.io/apimachinery/pkg/types"
- "k8s.io/client-go/rest"
- "k8s.io/client-go/transport"
- "sigs.k8s.io/controller-runtime/pkg/client"
-
- ocv1 "github.com/operator-framework/operator-controller/api/v1"
- "github.com/operator-framework/operator-controller/internal/operator-controller/authentication"
-)
-
-const syntheticServiceAccountName = "olm.synthetic-user"
-
-// SyntheticUserRestConfigMapper returns an AuthConfigMapper that that impersonates synthetic users and groups for Object o.
-// o is expected to be a ClusterExtension. If the service account defined in o is different from 'olm.synthetic-user', the
-// defaultAuthMapper will be used
-func SyntheticUserRestConfigMapper(defaultAuthMapper func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error)) func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
- return func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
- cExt, err := validate(o, c)
- if err != nil {
- return nil, err
- }
- if cExt.Spec.ServiceAccount.Name != syntheticServiceAccountName {
- return defaultAuthMapper(ctx, cExt, c)
- }
- cc := rest.CopyConfig(c)
- cc.Wrap(func(rt http.RoundTripper) http.RoundTripper {
- return transport.NewImpersonatingRoundTripper(authentication.SyntheticImpersonationConfig(*cExt), rt)
- })
- return cc, nil
- }
-}
-
-// ServiceAccountRestConfigMapper returns an AuthConfigMapper scoped to the service account defined in o, which is expected to
-// be a ClusterExtension
-func ServiceAccountRestConfigMapper(tokenGetter *authentication.TokenGetter) func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
- return func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
- cExt, err := validate(o, c)
- if err != nil {
- return nil, err
- }
- saConfig := rest.AnonymousClientConfig(c)
- saConfig.Wrap(func(rt http.RoundTripper) http.RoundTripper {
- return &authentication.TokenInjectingRoundTripper{
- Tripper: rt,
- TokenGetter: tokenGetter,
- Key: types.NamespacedName{
- Name: cExt.Spec.ServiceAccount.Name,
- Namespace: cExt.Spec.Namespace,
- },
- }
- })
- return saConfig, nil
- }
-}
-
-func validate(o client.Object, c *rest.Config) (*ocv1.ClusterExtension, error) {
- if c == nil {
- return nil, fmt.Errorf("rest config is nil")
- }
- if o == nil {
- return nil, fmt.Errorf("object is nil")
- }
- cExt, ok := o.(*ocv1.ClusterExtension)
- if !ok {
- return nil, fmt.Errorf("object is not a ClusterExtension")
- }
- return cExt, nil
-}
diff --git a/internal/operator-controller/action/restconfig_test.go b/internal/operator-controller/action/restconfig_test.go
deleted file mode 100644
index 4c9f786719..0000000000
--- a/internal/operator-controller/action/restconfig_test.go
+++ /dev/null
@@ -1,177 +0,0 @@
-package action_test
-
-import (
- "context"
- "errors"
- "net/http"
- "testing"
-
- "github.com/stretchr/testify/require"
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/types"
- "k8s.io/client-go/rest"
- "sigs.k8s.io/controller-runtime/pkg/client"
-
- ocv1 "github.com/operator-framework/operator-controller/api/v1"
- "github.com/operator-framework/operator-controller/internal/operator-controller/action"
- "github.com/operator-framework/operator-controller/internal/operator-controller/authentication"
-)
-
-func Test_ServiceAccountRestConfigMapper(t *testing.T) {
- for _, tc := range []struct {
- description string
- obj client.Object
- cfg *rest.Config
- expectedError error
- }{
- {
- description: "return error if object is nil",
- cfg: &rest.Config{},
- expectedError: errors.New("object is nil"),
- }, {
- description: "return error if cfg is nil",
- obj: &ocv1.ClusterExtension{},
- expectedError: errors.New("rest config is nil"),
- }, {
- description: "return error if object is not a ClusterExtension",
- obj: &corev1.Secret{},
- cfg: &rest.Config{},
- expectedError: errors.New("object is not a ClusterExtension"),
- }, {
- description: "succeeds if object is not a ClusterExtension",
- obj: &ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{
- Name: "my-clusterextension",
- },
- Spec: ocv1.ClusterExtensionSpec{
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "my-service-account",
- },
- Namespace: "my-namespace",
- },
- },
- cfg: &rest.Config{},
- },
- } {
- t.Run(tc.description, func(t *testing.T) {
- tokenGetter := &authentication.TokenGetter{}
- saMapper := action.ServiceAccountRestConfigMapper(tokenGetter)
- actualCfg, err := saMapper(context.Background(), tc.obj, tc.cfg)
- if tc.expectedError != nil {
- require.Nil(t, actualCfg)
- require.EqualError(t, err, tc.expectedError.Error())
- } else {
- require.NoError(t, err)
- transport, err := rest.TransportFor(actualCfg)
- require.NoError(t, err)
- require.NotNil(t, transport)
- tokenInjectionRoundTripper, ok := transport.(*authentication.TokenInjectingRoundTripper)
- require.True(t, ok)
- require.Equal(t, tokenGetter, tokenInjectionRoundTripper.TokenGetter)
- require.Equal(t, types.NamespacedName{Name: "my-service-account", Namespace: "my-namespace"}, tokenInjectionRoundTripper.Key)
- }
- })
- }
-}
-
-func Test_SyntheticUserRestConfigMapper_Fails(t *testing.T) {
- for _, tc := range []struct {
- description string
- obj client.Object
- cfg *rest.Config
- expectedError error
- }{
- {
- description: "return error if object is nil",
- cfg: &rest.Config{},
- expectedError: errors.New("object is nil"),
- }, {
- description: "return error if cfg is nil",
- obj: &ocv1.ClusterExtension{},
- expectedError: errors.New("rest config is nil"),
- }, {
- description: "return error if object is not a ClusterExtension",
- obj: &corev1.Secret{},
- cfg: &rest.Config{},
- expectedError: errors.New("object is not a ClusterExtension"),
- },
- } {
- t.Run(tc.description, func(t *testing.T) {
- tokenGetter := &authentication.TokenGetter{}
- saMapper := action.ServiceAccountRestConfigMapper(tokenGetter)
- actualCfg, err := saMapper(context.Background(), tc.obj, tc.cfg)
- if tc.expectedError != nil {
- require.Nil(t, actualCfg)
- require.EqualError(t, err, tc.expectedError.Error())
- } else {
- require.NoError(t, err)
- transport, err := rest.TransportFor(actualCfg)
- require.NoError(t, err)
- require.NotNil(t, transport)
- tokenInjectionRoundTripper, ok := transport.(*authentication.TokenInjectingRoundTripper)
- require.True(t, ok)
- require.Equal(t, tokenGetter, tokenInjectionRoundTripper.TokenGetter)
- require.Equal(t, types.NamespacedName{Name: "my-service-account", Namespace: "my-namespace"}, tokenInjectionRoundTripper.Key)
- }
- })
- }
-}
-func Test_SyntheticUserRestConfigMapper_UsesDefaultConfigMapper(t *testing.T) {
- isDefaultRequestMapperUsed := false
- defaultServiceMapper := func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
- isDefaultRequestMapperUsed = true
- return c, nil
- }
- syntheticAuthServiceMapper := action.SyntheticUserRestConfigMapper(defaultServiceMapper)
- obj := &ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{
- Name: "my-clusterextension",
- },
- Spec: ocv1.ClusterExtensionSpec{
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "my-service-account",
- },
- Namespace: "my-namespace",
- },
- }
- actualCfg, err := syntheticAuthServiceMapper(context.Background(), obj, &rest.Config{})
- require.NoError(t, err)
- require.NotNil(t, actualCfg)
- require.True(t, isDefaultRequestMapperUsed)
-}
-
-func Test_SyntheticUserRestConfigMapper_UsesSyntheticAuthMapper(t *testing.T) {
- syntheticAuthServiceMapper := action.SyntheticUserRestConfigMapper(func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
- return c, nil
- })
- obj := &ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{
- Name: "my-clusterextension",
- },
- Spec: ocv1.ClusterExtensionSpec{
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "olm.synthetic-user",
- },
- Namespace: "my-namespace",
- },
- }
- actualCfg, err := syntheticAuthServiceMapper(context.Background(), obj, &rest.Config{})
- require.NoError(t, err)
- require.NotNil(t, actualCfg)
-
- // test that the impersonation headers are appropriately injected into the request
- // by wrapping a fake round tripper around the returned configurations transport
- // nolint:bodyclose
- _, _ = actualCfg.WrapTransport(fakeRoundTripper(func(req *http.Request) (*http.Response, error) {
- require.Equal(t, "olm:clusterextension:my-clusterextension", req.Header.Get("Impersonate-User"))
- require.Equal(t, "olm:clusterextensions", req.Header.Get("Impersonate-Group"))
- return &http.Response{}, nil
- })).RoundTrip(&http.Request{})
-}
-
-type fakeRoundTripper func(req *http.Request) (*http.Response, error)
-
-func (f fakeRoundTripper) RoundTrip(request *http.Request) (*http.Response, error) {
- return f(request)
-}
diff --git a/internal/operator-controller/applier/boxcutter.go b/internal/operator-controller/applier/boxcutter.go
index efd2c01a19..a52fa21c7e 100644
--- a/internal/operator-controller/applier/boxcutter.go
+++ b/internal/operator-controller/applier/boxcutter.go
@@ -1,12 +1,10 @@
package applier
import (
- "bytes"
"cmp"
"context"
"errors"
"fmt"
- "io"
"io/fs"
"maps"
"slices"
@@ -24,9 +22,6 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
- "k8s.io/apiserver/pkg/authentication/user"
- "k8s.io/apiserver/pkg/authorization/authorizer"
- "k8s.io/cli-runtime/pkg/printers"
metav1ac "k8s.io/client-go/applyconfigurations/meta/v1"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -38,7 +33,6 @@ import (
ocv1 "github.com/operator-framework/operator-controller/api/v1"
ocv1ac "github.com/operator-framework/operator-controller/applyconfigurations/api/v1"
- "github.com/operator-framework/operator-controller/internal/operator-controller/authorization"
"github.com/operator-framework/operator-controller/internal/operator-controller/labels"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/bundle/source"
"github.com/operator-framework/operator-controller/internal/shared/util/cache"
@@ -239,8 +233,6 @@ func (r *SimpleRevisionGenerator) buildClusterObjectSet(
if annotations == nil {
annotations = make(map[string]string)
}
- annotations[labels.ServiceAccountNameKey] = ext.Spec.ServiceAccount.Name
- annotations[labels.ServiceAccountNamespaceKey] = ext.Spec.Namespace
phases := PhaseSort(objects)
@@ -458,7 +450,6 @@ type Boxcutter struct {
Scheme *runtime.Scheme
RevisionGenerator ClusterObjectSetGenerator
Preflights []Preflight
- PreAuthorizer authorization.PreAuthorizer
FieldOwner string
SystemNamespace string
}
@@ -528,8 +519,7 @@ func (bc *Boxcutter) Apply(ctx context.Context, contentFS fs.FS, ext *ocv1.Clust
}
replaceInlineWithRefs(desiredRevision, packResult)
- // SSA patch (refs-vs-refs). Skip pre-auth — just checking for changes.
- // createExternalizedRevision runs its own pre-auth if upgrade is needed.
+ // SSA patch (refs-vs-refs) — just checking for changes.
err = bc.Client.Apply(ctx, desiredRevision, client.FieldOwner(bc.FieldOwner), client.ForceOwnership)
// Restore inline objects for preflights + createExternalizedRevision
@@ -598,11 +588,6 @@ func (bc *Boxcutter) createExternalizedRevision(ctx context.Context, ext *ocv1.C
return fmt.Errorf("garbage collecting old revisions: %w", err)
}
- // Run pre-authorization on the inline revision (before replacing objects with refs)
- if err := bc.runPreAuthorizationChecks(ctx, getUserInfo(ext), desiredRevision); err != nil {
- return fmt.Errorf("creating new Revision: %w", err)
- }
-
// Externalize: pack inline objects into Secrets and replace with refs
phases := extractPhasesForPacking(desiredRevision.Spec.Phases)
packer := &SecretPacker{
@@ -625,7 +610,7 @@ func (bc *Boxcutter) createExternalizedRevision(ctx context.Context, ext *ocv1.C
}
}
- // Step 2: Create COS with refs via SSA (pre-auth already ran above)
+ // Step 2: Create COS with refs via SSA
if err := bc.Client.Apply(ctx, desiredRevision, client.FieldOwner(bc.FieldOwner), client.ForceOwnership); err != nil {
return fmt.Errorf("creating new Revision: %w", err)
}
@@ -637,23 +622,6 @@ func (bc *Boxcutter) createExternalizedRevision(ctx context.Context, ext *ocv1.C
return nil
}
-// runPreAuthorizationChecks runs PreAuthorization checks if the PreAuthorizer is set. An error will be returned if
-// the ClusterExtension service account does not have the necessary permissions to manage the revision's resources
-func (bc *Boxcutter) runPreAuthorizationChecks(ctx context.Context, user user.Info, rev *ocv1ac.ClusterObjectSetApplyConfiguration) error {
- if bc.PreAuthorizer == nil {
- return nil
- }
-
- // collect the revision manifests
- manifestReader, err := revisionManifestReader(rev)
- if err != nil {
- return err
- }
-
- // run preauthorization check
- return formatPreAuthorizerOutput(bc.PreAuthorizer.PreAuthorize(ctx, user, manifestReader, revisionManagementPerms(rev)))
-}
-
// garbageCollectOldRevisions deletes archived revisions beyond ClusterObjectSetRetentionLimit.
// Active revisions are never deleted. revisionList must be sorted oldest to newest.
func (bc *Boxcutter) garbageCollectOldRevisions(ctx context.Context, revisionList []ocv1.ClusterObjectSet) error {
@@ -836,35 +804,6 @@ func getObjects(rev *ocv1ac.ClusterObjectSetApplyConfiguration) []client.Object
return objs
}
-// revisionManifestReader returns an io.Reader containing all manifests in the revision
-func revisionManifestReader(rev *ocv1ac.ClusterObjectSetApplyConfiguration) (io.Reader, error) {
- printer := printers.YAMLPrinter{}
- buf := new(bytes.Buffer)
- for _, obj := range getObjects(rev) {
- buf.WriteString("---\n")
- if err := printer.PrintObj(obj, buf); err != nil {
- return nil, err
- }
- }
- return buf, nil
-}
-
-func revisionManagementPerms(rev *ocv1ac.ClusterObjectSetApplyConfiguration) func(user.Info) []authorizer.AttributesRecord {
- return func(user user.Info) []authorizer.AttributesRecord {
- return []authorizer.AttributesRecord{
- {
- User: user,
- Name: *rev.GetName(),
- APIGroup: ocv1.GroupVersion.Group,
- APIVersion: ocv1.GroupVersion.Version,
- Resource: "clusterobjectsets/finalizers",
- ResourceRequest: true,
- Verb: "update",
- },
- }
- }
-}
-
func mergeStringMaps(m1, m2 map[string]string) map[string]string {
merged := make(map[string]string, len(m1)+len(m2))
maps.Copy(merged, m1)
diff --git a/internal/operator-controller/applier/boxcutter_test.go b/internal/operator-controller/applier/boxcutter_test.go
index 31cfc81557..25963c9a01 100644
--- a/internal/operator-controller/applier/boxcutter_test.go
+++ b/internal/operator-controller/applier/boxcutter_test.go
@@ -4,28 +4,24 @@ import (
"context"
"errors"
"fmt"
- "io"
"io/fs"
"strings"
"testing"
"testing/fstest"
"github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/storage/driver"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
- rbacv1 "k8s.io/api/rbac/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
apimeta "k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"
- "k8s.io/apiserver/pkg/authentication/user"
- "k8s.io/apiserver/pkg/authorization/authorizer"
k8scheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -35,10 +31,11 @@ import (
ocv1 "github.com/operator-framework/operator-controller/api/v1"
ocv1ac "github.com/operator-framework/operator-controller/applyconfigurations/api/v1"
"github.com/operator-framework/operator-controller/internal/operator-controller/applier"
- "github.com/operator-framework/operator-controller/internal/operator-controller/authorization"
"github.com/operator-framework/operator-controller/internal/operator-controller/labels"
bundlecsv "github.com/operator-framework/operator-controller/internal/testing/bundle/csv"
bundlefs "github.com/operator-framework/operator-controller/internal/testing/bundle/fs"
+ mockapplier "github.com/operator-framework/operator-controller/internal/testutil/mock/applier"
+ mockctrlclient "github.com/operator-framework/operator-controller/internal/testutil/mock/ctrlclient"
)
var (
@@ -85,9 +82,6 @@ func Test_SimpleRevisionGenerator_GenerateRevisionFromHelmRelease(t *testing.T)
},
Spec: ocv1.ClusterExtensionSpec{
Namespace: "test-namespace",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "test-sa",
- },
},
}
@@ -100,12 +94,10 @@ func Test_SimpleRevisionGenerator_GenerateRevisionFromHelmRelease(t *testing.T)
expected := ocv1ac.ClusterObjectSet("test-123-1").
WithAnnotations(map[string]string{
- "olm.operatorframework.io/bundle-name": "my-bundle",
- "olm.operatorframework.io/bundle-reference": "bundle-ref",
- "olm.operatorframework.io/bundle-version": "1.2.0",
- "olm.operatorframework.io/package-name": "my-package",
- "olm.operatorframework.io/service-account-name": "test-sa",
- "olm.operatorframework.io/service-account-namespace": "test-namespace",
+ "olm.operatorframework.io/bundle-name": "my-bundle",
+ "olm.operatorframework.io/bundle-reference": "bundle-ref",
+ "olm.operatorframework.io/bundle-version": "1.2.0",
+ "olm.operatorframework.io/package-name": "my-package",
}).
WithLabels(map[string]string{
labels.OwnerKindKey: ocv1.ClusterExtensionKind,
@@ -163,37 +155,35 @@ func Test_SimpleRevisionGenerator_GenerateRevisionFromHelmRelease(t *testing.T)
}
func Test_SimpleRevisionGenerator_GenerateRevision(t *testing.T) {
- r := &FakeManifestProvider{
- GetFn: func(_ fs.FS, _ *ocv1.ClusterExtension) ([]client.Object, error) {
- return []client.Object{
- &corev1.Service{
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-service",
- },
- },
- &appsv1.Deployment{
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-deployment",
- Namespace: "test-ns",
- Labels: map[string]string{"my-label": "my-label-value"},
- Annotations: map[string]string{"my-annotation": "my-annotation-value"},
- // Fields to be sanitized
- Finalizers: []string{"test"},
- OwnerReferences: []metav1.OwnerReference{{Kind: "TestOwner"}},
- CreationTimestamp: metav1.Time{Time: metav1.Now().Time},
- UID: "1a2b3c4d",
- ResourceVersion: "12345",
- Generation: 123,
- ManagedFields: []metav1.ManagedFieldsEntry{{Manager: "test-manager"}},
- DeletionTimestamp: &metav1.Time{Time: metav1.Now().Time},
- DeletionGracePeriodSeconds: func(i int64) *int64 { return &i }(30),
- }, Status: appsv1.DeploymentStatus{
- Replicas: 3,
- },
- },
- }, nil
+ ctrl := gomock.NewController(t)
+ r := mockapplier.NewMockManifestProvider(ctrl)
+ r.EXPECT().Get(gomock.Any(), gomock.Any()).Return([]client.Object{
+ &corev1.Service{
+ ObjectMeta: metav1.ObjectMeta{
+ Name: "test-service",
+ },
},
- }
+ &appsv1.Deployment{
+ ObjectMeta: metav1.ObjectMeta{
+ Name: "test-deployment",
+ Namespace: "test-ns",
+ Labels: map[string]string{"my-label": "my-label-value"},
+ Annotations: map[string]string{"my-annotation": "my-annotation-value"},
+ // Fields to be sanitized
+ Finalizers: []string{"test"},
+ OwnerReferences: []metav1.OwnerReference{{Kind: "TestOwner"}},
+ CreationTimestamp: metav1.Time{Time: metav1.Now().Time},
+ UID: "1a2b3c4d",
+ ResourceVersion: "12345",
+ Generation: 123,
+ ManagedFields: []metav1.ManagedFieldsEntry{{Manager: "test-manager"}},
+ DeletionTimestamp: &metav1.Time{Time: metav1.Now().Time},
+ DeletionGracePeriodSeconds: func(i int64) *int64 { return &i }(30),
+ }, Status: appsv1.DeploymentStatus{
+ Replicas: 3,
+ },
+ },
+ }, nil).AnyTimes()
b := applier.SimpleRevisionGenerator{
Scheme: k8scheme.Scheme,
@@ -206,9 +196,6 @@ func Test_SimpleRevisionGenerator_GenerateRevision(t *testing.T) {
},
Spec: ocv1.ClusterExtensionSpec{
Namespace: "test-namespace",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "test-sa",
- },
},
}
@@ -285,11 +272,9 @@ func Test_SimpleRevisionGenerator_GenerateRevision(t *testing.T) {
}
func Test_SimpleRevisionGenerator_GenerateRevision_BundleAnnotations(t *testing.T) {
- r := &FakeManifestProvider{
- GetFn: func(_ fs.FS, _ *ocv1.ClusterExtension) ([]client.Object, error) {
- return []client.Object{}, nil
- },
- }
+ ctrl := gomock.NewController(t)
+ r := mockapplier.NewMockManifestProvider(ctrl)
+ r.EXPECT().Get(gomock.Any(), gomock.Any()).Return([]client.Object{}, nil).AnyTimes()
b := applier.SimpleRevisionGenerator{
Scheme: k8scheme.Scheme,
@@ -302,9 +287,6 @@ func Test_SimpleRevisionGenerator_GenerateRevision_BundleAnnotations(t *testing.
},
Spec: ocv1.ClusterExtensionSpec{
Namespace: "test-namespace",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "test-sa",
- },
},
}
@@ -371,14 +353,15 @@ func Test_SimpleRevisionGenerator_Renderer_Integration(t *testing.T) {
Name: "test-extension",
},
}
- r := &FakeManifestProvider{
- GetFn: func(b fs.FS, e *ocv1.ClusterExtension) ([]client.Object, error) {
+ ctrl := gomock.NewController(t)
+ r := mockapplier.NewMockManifestProvider(ctrl)
+ r.EXPECT().Get(dummyBundle, ext).DoAndReturn(
+ func(b fs.FS, e *ocv1.ClusterExtension) ([]client.Object, error) {
t.Log("by checking renderer was called with the correct parameters")
require.Equal(t, dummyBundle, b)
require.Equal(t, ext, e)
return nil, nil
- },
- }
+ }).AnyTimes()
b := applier.SimpleRevisionGenerator{
Scheme: k8scheme.Scheme,
ManifestProvider: r,
@@ -407,11 +390,9 @@ func Test_SimpleRevisionGenerator_AppliesObjectLabelsAndRevisionAnnotations(t *t
},
},
}
- r := &FakeManifestProvider{
- GetFn: func(b fs.FS, e *ocv1.ClusterExtension) ([]client.Object, error) {
- return renderedObjs, nil
- },
- }
+ ctrl := gomock.NewController(t)
+ r := mockapplier.NewMockManifestProvider(ctrl)
+ r.EXPECT().Get(gomock.Any(), gomock.Any()).Return(renderedObjs, nil).AnyTimes()
b := applier.SimpleRevisionGenerator{
Scheme: k8scheme.Scheme,
@@ -424,8 +405,7 @@ func Test_SimpleRevisionGenerator_AppliesObjectLabelsAndRevisionAnnotations(t *t
rev, err := b.GenerateRevision(t.Context(), dummyBundle, &ocv1.ClusterExtension{
Spec: ocv1.ClusterExtensionSpec{
- Namespace: "test-namespace",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "test-sa"},
+ Namespace: "test-namespace",
},
}, map[string]string{
"some": "value",
@@ -445,11 +425,9 @@ func Test_SimpleRevisionGenerator_AppliesObjectLabelsAndRevisionAnnotations(t *t
}
func Test_SimpleRevisionGenerator_PropagatesProgressDeadlineMinutes(t *testing.T) {
- r := &FakeManifestProvider{
- GetFn: func(b fs.FS, e *ocv1.ClusterExtension) ([]client.Object, error) {
- return []client.Object{}, nil
- },
- }
+ ctrl := gomock.NewController(t)
+ r := mockapplier.NewMockManifestProvider(ctrl)
+ r.EXPECT().Get(gomock.Any(), gomock.Any()).Return([]client.Object{}, nil).AnyTimes()
b := applier.SimpleRevisionGenerator{
Scheme: k8scheme.Scheme,
@@ -486,8 +464,7 @@ func Test_SimpleRevisionGenerator_PropagatesProgressDeadlineMinutes(t *testing.T
Name: "test-extension",
},
Spec: ocv1.ClusterExtensionSpec{
- Namespace: "test-namespace",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "test-sa"},
+ Namespace: "test-namespace",
},
}
empty := map[string]string{}
@@ -504,11 +481,10 @@ func Test_SimpleRevisionGenerator_PropagatesProgressDeadlineMinutes(t *testing.T
}
func Test_SimpleRevisionGenerator_Failure(t *testing.T) {
- r := &FakeManifestProvider{
- GetFn: func(b fs.FS, e *ocv1.ClusterExtension) ([]client.Object, error) {
- return nil, fmt.Errorf("some-error")
- },
- }
+ ctrl := gomock.NewController(t)
+ r := mockapplier.NewMockManifestProvider(ctrl)
+ r.EXPECT().Get(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("some-error")).AnyTimes()
+
b := applier.SimpleRevisionGenerator{
Scheme: k8scheme.Scheme,
ManifestProvider: r,
@@ -516,8 +492,7 @@ func Test_SimpleRevisionGenerator_Failure(t *testing.T) {
rev, err := b.GenerateRevision(t.Context(), fstest.MapFS{}, &ocv1.ClusterExtension{
Spec: ocv1.ClusterExtensionSpec{
- Namespace: "test-namespace",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "test-sa"},
+ Namespace: "test-namespace",
},
}, map[string]string{}, map[string]string{})
require.Nil(t, rev)
@@ -591,7 +566,7 @@ func TestBoxcutter_Apply(t *testing.T) {
}
testCases := []struct {
name string
- mockBuilder applier.ClusterObjectSetGenerator
+ mockBuilder func(t *testing.T) applier.ClusterObjectSetGenerator
existingObjs []client.Object
expectedErr string
validate func(t *testing.T, c client.Client)
@@ -599,32 +574,37 @@ func TestBoxcutter_Apply(t *testing.T) {
}{
{
name: "first revision",
- mockBuilder: &mockBundleRevisionBuilder{
- makeRevisionFunc: func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
- return ocv1ac.ClusterObjectSet("").
- WithAnnotations(revisionAnnotations).
- WithLabels(map[string]string{
- labels.OwnerNameKey: ext.Name,
- }).
- WithSpec(ocv1ac.ClusterObjectSetSpec().
- WithPhases(
- ocv1ac.ClusterObjectSetPhase().
- WithName(string(applier.PhaseDeploy)).
- WithObjects(
- ocv1ac.ClusterObjectSetObject().
- WithObject(unstructured.Unstructured{
- Object: map[string]interface{}{
- "apiVersion": "v1",
- "kind": "ConfigMap",
- "metadata": map[string]interface{}{
- "name": "test-cm",
+ mockBuilder: func(t *testing.T) applier.ClusterObjectSetGenerator {
+ ctrl := gomock.NewController(t)
+ m := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ m.EXPECT().GenerateRevision(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
+ return ocv1ac.ClusterObjectSet("").
+ WithAnnotations(revisionAnnotations).
+ WithLabels(map[string]string{
+ labels.OwnerNameKey: ext.Name,
+ }).
+ WithSpec(ocv1ac.ClusterObjectSetSpec().
+ WithPhases(
+ ocv1ac.ClusterObjectSetPhase().
+ WithName(string(applier.PhaseDeploy)).
+ WithObjects(
+ ocv1ac.ClusterObjectSetObject().
+ WithObject(unstructured.Unstructured{
+ Object: map[string]interface{}{
+ "apiVersion": "v1",
+ "kind": "ConfigMap",
+ "metadata": map[string]interface{}{
+ "name": "test-cm",
+ },
},
- },
- }),
- ),
- ),
- ), nil
- },
+ }),
+ ),
+ ),
+ ), nil
+ }).AnyTimes()
+ m.EXPECT().GenerateRevisionFromHelmRelease(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
+ return m
},
validate: func(t *testing.T, c client.Client) {
revList := &ocv1.ClusterObjectSetList{}
@@ -642,32 +622,37 @@ func TestBoxcutter_Apply(t *testing.T) {
},
{
name: "no change, revision exists",
- mockBuilder: &mockBundleRevisionBuilder{
- makeRevisionFunc: func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
- return ocv1ac.ClusterObjectSet("").
- WithAnnotations(revisionAnnotations).
- WithLabels(map[string]string{
- labels.OwnerNameKey: ext.Name,
- }).
- WithSpec(ocv1ac.ClusterObjectSetSpec().
- WithPhases(
- ocv1ac.ClusterObjectSetPhase().
- WithName(string(applier.PhaseDeploy)).
- WithObjects(
- ocv1ac.ClusterObjectSetObject().
- WithObject(unstructured.Unstructured{
- Object: map[string]interface{}{
- "apiVersion": "v1",
- "kind": "ConfigMap",
- "metadata": map[string]interface{}{
- "name": "test-cm",
+ mockBuilder: func(t *testing.T) applier.ClusterObjectSetGenerator {
+ ctrl := gomock.NewController(t)
+ m := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ m.EXPECT().GenerateRevision(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
+ return ocv1ac.ClusterObjectSet("").
+ WithAnnotations(revisionAnnotations).
+ WithLabels(map[string]string{
+ labels.OwnerNameKey: ext.Name,
+ }).
+ WithSpec(ocv1ac.ClusterObjectSetSpec().
+ WithPhases(
+ ocv1ac.ClusterObjectSetPhase().
+ WithName(string(applier.PhaseDeploy)).
+ WithObjects(
+ ocv1ac.ClusterObjectSetObject().
+ WithObject(unstructured.Unstructured{
+ Object: map[string]interface{}{
+ "apiVersion": "v1",
+ "kind": "ConfigMap",
+ "metadata": map[string]interface{}{
+ "name": "test-cm",
+ },
},
- },
- }),
- ),
- ),
- ), nil
- },
+ }),
+ ),
+ ),
+ ), nil
+ }).AnyTimes()
+ m.EXPECT().GenerateRevisionFromHelmRelease(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
+ return m
},
existingObjs: []client.Object{
defaultDesiredRevision,
@@ -683,32 +668,37 @@ func TestBoxcutter_Apply(t *testing.T) {
},
{
name: "new revision created when objects in new revision are different",
- mockBuilder: &mockBundleRevisionBuilder{
- makeRevisionFunc: func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
- return ocv1ac.ClusterObjectSet("").
- WithAnnotations(revisionAnnotations).
- WithLabels(map[string]string{
- labels.OwnerNameKey: ext.Name,
- }).
- WithSpec(ocv1ac.ClusterObjectSetSpec().
- WithPhases(
- ocv1ac.ClusterObjectSetPhase().
- WithName(string(applier.PhaseDeploy)).
- WithObjects(
- ocv1ac.ClusterObjectSetObject().
- WithObject(unstructured.Unstructured{
- Object: map[string]interface{}{
- "apiVersion": "v1",
- "kind": "Secret",
- "metadata": map[string]interface{}{
- "name": "new-secret",
+ mockBuilder: func(t *testing.T) applier.ClusterObjectSetGenerator {
+ ctrl := gomock.NewController(t)
+ m := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ m.EXPECT().GenerateRevision(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
+ return ocv1ac.ClusterObjectSet("").
+ WithAnnotations(revisionAnnotations).
+ WithLabels(map[string]string{
+ labels.OwnerNameKey: ext.Name,
+ }).
+ WithSpec(ocv1ac.ClusterObjectSetSpec().
+ WithPhases(
+ ocv1ac.ClusterObjectSetPhase().
+ WithName(string(applier.PhaseDeploy)).
+ WithObjects(
+ ocv1ac.ClusterObjectSetObject().
+ WithObject(unstructured.Unstructured{
+ Object: map[string]interface{}{
+ "apiVersion": "v1",
+ "kind": "Secret",
+ "metadata": map[string]interface{}{
+ "name": "new-secret",
+ },
},
- },
- }),
- ),
- ),
- ), nil
- },
+ }),
+ ),
+ ),
+ ), nil
+ }).AnyTimes()
+ m.EXPECT().GenerateRevisionFromHelmRelease(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
+ return m
},
clientIterceptor: allowedRevisionValue(2),
existingObjs: []client.Object{
@@ -736,10 +726,12 @@ func TestBoxcutter_Apply(t *testing.T) {
},
{
name: "error from GenerateRevision",
- mockBuilder: &mockBundleRevisionBuilder{
- makeRevisionFunc: func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
- return nil, errors.New("render boom")
- },
+ mockBuilder: func(t *testing.T) applier.ClusterObjectSetGenerator {
+ ctrl := gomock.NewController(t)
+ m := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ m.EXPECT().GenerateRevision(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, errors.New("render boom")).AnyTimes()
+ m.EXPECT().GenerateRevisionFromHelmRelease(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
+ return m
},
expectedErr: "render boom",
validate: func(t *testing.T, c client.Client) {
@@ -752,15 +744,20 @@ func TestBoxcutter_Apply(t *testing.T) {
},
{
name: "keep at most 5 past revisions",
- mockBuilder: &mockBundleRevisionBuilder{
- makeRevisionFunc: func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
- return ocv1ac.ClusterObjectSet("").
- WithAnnotations(revisionAnnotations).
- WithLabels(map[string]string{
- labels.OwnerNameKey: ext.Name,
- }).
- WithSpec(ocv1ac.ClusterObjectSetSpec()), nil
- },
+ mockBuilder: func(t *testing.T) applier.ClusterObjectSetGenerator {
+ ctrl := gomock.NewController(t)
+ m := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ m.EXPECT().GenerateRevision(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
+ return ocv1ac.ClusterObjectSet("").
+ WithAnnotations(revisionAnnotations).
+ WithLabels(map[string]string{
+ labels.OwnerNameKey: ext.Name,
+ }).
+ WithSpec(ocv1ac.ClusterObjectSetSpec()), nil
+ }).AnyTimes()
+ m.EXPECT().GenerateRevisionFromHelmRelease(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
+ return m
},
existingObjs: []client.Object{
&ocv1.ClusterObjectSet{
@@ -853,15 +850,20 @@ func TestBoxcutter_Apply(t *testing.T) {
},
{
name: "keep active revisions when they are out of limit",
- mockBuilder: &mockBundleRevisionBuilder{
- makeRevisionFunc: func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
- return ocv1ac.ClusterObjectSet("").
- WithAnnotations(revisionAnnotations).
- WithLabels(map[string]string{
- labels.OwnerNameKey: ext.Name,
- }).
- WithSpec(ocv1ac.ClusterObjectSetSpec()), nil
- },
+ mockBuilder: func(t *testing.T) applier.ClusterObjectSetGenerator {
+ ctrl := gomock.NewController(t)
+ m := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ m.EXPECT().GenerateRevision(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
+ return ocv1ac.ClusterObjectSet("").
+ WithAnnotations(revisionAnnotations).
+ WithLabels(map[string]string{
+ labels.OwnerNameKey: ext.Name,
+ }).
+ WithSpec(ocv1ac.ClusterObjectSetSpec()), nil
+ }).AnyTimes()
+ m.EXPECT().GenerateRevisionFromHelmRelease(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
+ return m
},
existingObjs: []client.Object{
&ocv1.ClusterObjectSet{
@@ -970,32 +972,37 @@ func TestBoxcutter_Apply(t *testing.T) {
},
{
name: "annotation-only update (same phases, different annotations)",
- mockBuilder: &mockBundleRevisionBuilder{
- makeRevisionFunc: func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
- return ocv1ac.ClusterObjectSet("").
- WithAnnotations(revisionAnnotations).
- WithLabels(map[string]string{
- labels.OwnerNameKey: ext.Name,
- }).
- WithSpec(ocv1ac.ClusterObjectSetSpec().
- WithPhases(
- ocv1ac.ClusterObjectSetPhase().
- WithName(string(applier.PhaseDeploy)).
- WithObjects(
- ocv1ac.ClusterObjectSetObject().
- WithObject(unstructured.Unstructured{
- Object: map[string]interface{}{
- "apiVersion": "v1",
- "kind": "ConfigMap",
- "metadata": map[string]interface{}{
- "name": "test-cm",
+ mockBuilder: func(t *testing.T) applier.ClusterObjectSetGenerator {
+ ctrl := gomock.NewController(t)
+ m := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ m.EXPECT().GenerateRevision(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
+ return ocv1ac.ClusterObjectSet("").
+ WithAnnotations(revisionAnnotations).
+ WithLabels(map[string]string{
+ labels.OwnerNameKey: ext.Name,
+ }).
+ WithSpec(ocv1ac.ClusterObjectSetSpec().
+ WithPhases(
+ ocv1ac.ClusterObjectSetPhase().
+ WithName(string(applier.PhaseDeploy)).
+ WithObjects(
+ ocv1ac.ClusterObjectSetObject().
+ WithObject(unstructured.Unstructured{
+ Object: map[string]interface{}{
+ "apiVersion": "v1",
+ "kind": "ConfigMap",
+ "metadata": map[string]interface{}{
+ "name": "test-cm",
+ },
},
- },
- }),
- ),
- ),
- ), nil
- },
+ }),
+ ),
+ ),
+ ), nil
+ }).AnyTimes()
+ m.EXPECT().GenerateRevisionFromHelmRelease(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
+ return m
},
existingObjs: []client.Object{
ext,
@@ -1064,7 +1071,7 @@ func TestBoxcutter_Apply(t *testing.T) {
boxcutter := &applier.Boxcutter{
Client: fakeClient,
Scheme: testScheme,
- RevisionGenerator: tc.mockBuilder,
+ RevisionGenerator: tc.mockBuilder(t),
FieldOwner: "test-owner",
SystemNamespace: "olmv1-system",
}
@@ -1107,255 +1114,91 @@ func TestBoxcutter_Apply(t *testing.T) {
}
}
-func Test_PreAuthorizer_Integration(t *testing.T) {
- testScheme := runtime.NewScheme()
- require.NoError(t, ocv1.AddToScheme(testScheme))
- require.NoError(t, corev1.AddToScheme(testScheme))
-
- // This is the revision that the mock builder will produce by default.
- // We calculate its hash to use in the tests.
- ext := &ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-ext",
- UID: "test-uid",
- },
- Spec: ocv1.ClusterExtensionSpec{
- Namespace: "test-namespace",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "test-sa",
- },
- },
- }
- fakeClient := fake.NewClientBuilder().WithScheme(testScheme).Build()
- dummyGenerator := &mockBundleRevisionBuilder{
- makeRevisionFunc: func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotation map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
- return ocv1ac.ClusterObjectSet("").
- WithSpec(ocv1ac.ClusterObjectSetSpec().
- WithPhases(
- ocv1ac.ClusterObjectSetPhase().
- WithName("some-phase").
- WithObjects(
- ocv1ac.ClusterObjectSetObject().
- WithObject(unstructured.Unstructured{
- Object: map[string]interface{}{
- "apiVersion": "v1",
- "kind": "ConfigMap",
- "data": map[string]string{
- "test-data": "test-data",
- },
- },
- }),
- ),
- ),
- ), nil
- },
+func TestBoxcutterStorageMigrator(t *testing.T) {
+ // defaultHelmRevisionResult returns the default result for GenerateRevisionFromHelmRelease in storage migrator tests.
+ defaultHelmRevisionResult := func(ext *ocv1.ClusterExtension) *ocv1ac.ClusterObjectSetApplyConfiguration {
+ return ocv1ac.ClusterObjectSet("test-revision").
+ WithLabels(map[string]string{
+ labels.OwnerNameKey: ext.Name,
+ }).
+ WithSpec(ocv1ac.ClusterObjectSetSpec())
}
- dummyBundleFs := fstest.MapFS{}
- revisionAnnotations := map[string]string{}
- for _, tc := range []struct {
- name string
- preAuthorizer func(t *testing.T) authorization.PreAuthorizer
- validate func(t *testing.T, err error)
- }{
- {
- name: "preauthorizer called with correct parameters",
- preAuthorizer: func(t *testing.T) authorization.PreAuthorizer {
- return &mockPreAuthorizer{
- fn: func(ctx context.Context, user user.Info, reader io.Reader, additionalRequiredPerms ...authorization.UserAuthorizerAttributesFactory) ([]authorization.ScopedPolicyRules, error) {
- require.Equal(t, "system:serviceaccount:test-namespace:test-sa", user.GetName())
- require.Empty(t, user.GetUID())
- require.Nil(t, user.GetExtra())
- require.Empty(t, user.GetGroups())
-
- t.Log("has correct additional permissions")
- require.Len(t, additionalRequiredPerms, 1)
- perms := additionalRequiredPerms[0](user)
-
- require.Len(t, perms, 1)
- require.Equal(t, authorizer.AttributesRecord{
- User: user,
- Name: "test-ext-1",
- APIGroup: "olm.operatorframework.io",
- APIVersion: "v1",
- Resource: "clusterobjectsets/finalizers",
- ResourceRequest: true,
- Verb: "update",
- }, perms[0])
-
- t.Log("has correct manifest reader")
- manifests, err := io.ReadAll(reader)
- require.NoError(t, err)
- require.Equal(t, "---\napiVersion: v1\ndata:\n test-data: test-data\nkind: ConfigMap\n", string(manifests))
- return nil, nil
- },
- }
- },
- }, {
- name: "preauthorizer errors are returned",
- preAuthorizer: func(t *testing.T) authorization.PreAuthorizer {
- return &mockPreAuthorizer{
- fn: func(ctx context.Context, user user.Info, reader io.Reader, additionalRequiredPerms ...authorization.UserAuthorizerAttributesFactory) ([]authorization.ScopedPolicyRules, error) {
- return nil, errors.New("test error")
- },
- }
- },
- validate: func(t *testing.T, err error) {
- require.Error(t, err)
- require.Contains(t, err.Error(), "pre-authorization failed")
- require.Contains(t, err.Error(), "authorization evaluation error: test error")
- },
- }, {
- name: "preauthorizer missing permissions are returned as an error",
- preAuthorizer: func(t *testing.T) authorization.PreAuthorizer {
- return &mockPreAuthorizer{
- fn: func(ctx context.Context, user user.Info, reader io.Reader, additionalRequiredPerms ...authorization.UserAuthorizerAttributesFactory) ([]authorization.ScopedPolicyRules, error) {
- return []authorization.ScopedPolicyRules{
- {
- Namespace: "",
- MissingRules: []rbacv1.PolicyRule{
- {
- APIGroups: []string{""},
- Resources: []string{"pods"},
- Verbs: []string{"get", "list", "watch"},
- },
- },
- },
- }, nil
- },
- }
- },
- validate: func(t *testing.T, err error) {
- require.Error(t, err)
- require.Contains(t, err.Error(), "pre-authorization failed")
- require.Contains(t, err.Error(), "service account requires the following permissions")
- require.Contains(t, err.Error(), "Resources:[pods]")
- require.Contains(t, err.Error(), "Verbs:[get,list,watch]")
- },
- }, {
- name: "preauthorizer missing permissions and errors are combined and returned as an error",
- preAuthorizer: func(t *testing.T) authorization.PreAuthorizer {
- return &mockPreAuthorizer{
- fn: func(ctx context.Context, user user.Info, reader io.Reader, additionalRequiredPerms ...authorization.UserAuthorizerAttributesFactory) ([]authorization.ScopedPolicyRules, error) {
- return []authorization.ScopedPolicyRules{
- {
- Namespace: "",
- MissingRules: []rbacv1.PolicyRule{
- {
- APIGroups: []string{""},
- Resources: []string{"pods"},
- Verbs: []string{"get", "list", "watch"},
- },
- },
- },
- }, errors.New("test error")
- },
- }
- },
- validate: func(t *testing.T, err error) {
- require.Error(t, err)
- require.Contains(t, err.Error(), "pre-authorization failed")
- require.Contains(t, err.Error(), "service account requires the following permissions")
- require.Contains(t, err.Error(), "Resources:[pods]")
- require.Contains(t, err.Error(), "Verbs:[get,list,watch]")
- require.Contains(t, err.Error(), "authorization evaluation error: test error")
- },
- }, {
- name: "successful call to preauthorizer does not block applier",
- preAuthorizer: func(t *testing.T) authorization.PreAuthorizer {
- return &mockPreAuthorizer{
- fn: func(ctx context.Context, user user.Info, reader io.Reader, additionalRequiredPerms ...authorization.UserAuthorizerAttributesFactory) ([]authorization.ScopedPolicyRules, error) {
- return nil, nil
- },
- }
- },
- validate: func(t *testing.T, err error) {
- require.NoError(t, err)
- },
- },
- } {
- t.Run(tc.name, func(t *testing.T) {
- boxcutter := &applier.Boxcutter{
- Client: fakeClient,
- Scheme: testScheme,
- FieldOwner: "test-owner",
- RevisionGenerator: dummyGenerator,
- PreAuthorizer: tc.preAuthorizer(t),
- SystemNamespace: "olmv1-system",
- }
- completed, status, err := boxcutter.Apply(t.Context(), dummyBundleFs, ext, nil, revisionAnnotations)
- if tc.validate != nil {
- tc.validate(t, err)
- }
- _ = completed
- _ = status
- })
+ // newStorageMigratorGenerator creates a gomock ClusterObjectSetGenerator for storage migrator tests.
+ // GenerateRevision is not expected to be called. GenerateRevisionFromHelmRelease returns the default result.
+ newStorageMigratorGenerator := func(t *testing.T) *mockapplier.MockClusterObjectSetGenerator {
+ ctrl := gomock.NewController(t)
+ m := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ m.EXPECT().GenerateRevisionFromHelmRelease(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(ctx context.Context, helmRelease *release.Release, e *ocv1.ClusterExtension, objectLabels map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
+ return defaultHelmRevisionResult(e), nil
+ }).AnyTimes()
+ return m
}
-}
-func TestBoxcutterStorageMigrator(t *testing.T) {
t.Run("creates revision", func(t *testing.T) {
testScheme := runtime.NewScheme()
require.NoError(t, ocv1.AddToScheme(testScheme))
- brb := &mockBundleRevisionBuilder{}
- mag := &mockActionGetter{
+ ext := &ocv1.ClusterExtension{
+ ObjectMeta: metav1.ObjectMeta{Name: "test123"},
+ }
+ ctrl := gomock.NewController(t)
+ brb := newStorageMigratorGenerator(t)
+ mag := newMockActionGetter(ctrl, mockActionGetterConfig{
currentRel: &release.Release{
Name: "test123",
Info: &release.Info{Status: release.StatusDeployed},
},
- }
- client := &clientMock{}
+ })
+ mockClient := mockctrlclient.NewMockClient(ctrl)
+ mockStatusWriter := mockctrlclient.NewMockSubResourceWriter(ctrl)
+ mockClient.EXPECT().Status().Return(mockStatusWriter).AnyTimes()
+
sm := &applier.BoxcutterStorageMigrator{
RevisionGenerator: brb,
ActionClientGetter: mag,
- Client: client,
+ Client: mockClient,
Scheme: testScheme,
FieldOwner: "test-owner",
}
- ext := &ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{Name: "test123"},
- }
-
- client.
- On("List", mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSetList"), mock.Anything).
+ mockClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any()).
Return(nil)
- client.
- On("Apply", mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSetApplyConfiguration"), mock.Anything).
- Once().
- Run(func(args mock.Arguments) {
+ mockClient.EXPECT().Apply(gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, obj runtime.ApplyConfiguration, opts ...client.ApplyOption) error {
// Verify the migration marker label is set before apply
- rev := args.Get(1).(*ocv1ac.ClusterObjectSetApplyConfiguration)
+ rev := obj.(*ocv1ac.ClusterObjectSetApplyConfiguration)
require.Equal(t, "true", rev.Labels[labels.MigratedFromHelmKey], "Migration marker label should be set")
- }).
- Return(nil)
- client.
- On("Get", mock.Anything, mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSet"), mock.Anything).
- Once().
- Run(func(args mock.Arguments) {
+ return nil
+ })
+ mockClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
// Simulate Get() returning the created revision with server-managed fields
- rev := args.Get(2).(*ocv1.ClusterObjectSet)
+ rev := obj.(*ocv1.ClusterObjectSet)
rev.Name = "test-revision"
rev.Generation = 1
rev.ResourceVersion = "1"
rev.Labels = map[string]string{
labels.MigratedFromHelmKey: "true",
}
- }).
- Return(nil)
+ return nil
+ })
+
+ var updatedObj client.Object
+ mockStatusWriter.EXPECT().Update(gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error {
+ updatedObj = obj
+ return nil
+ })
err := sm.Migrate(t.Context(), ext, map[string]string{"my-label": "my-value"})
require.NoError(t, err)
- client.AssertExpectations(t)
-
// Verify the migrated revision has Succeeded=True status with Succeeded reason and a migration message
- statusWriter := client.Status().(*statusWriterMock)
- require.True(t, statusWriter.updateCalled, "Status().Update() should be called during migration")
- require.NotNil(t, statusWriter.updatedObj, "Updated object should not be nil")
+ require.NotNil(t, updatedObj, "Updated object should not be nil")
- rev, ok := statusWriter.updatedObj.(*ocv1.ClusterObjectSet)
+ rev, ok := updatedObj.(*ocv1.ClusterObjectSet)
require.True(t, ok, "Updated object should be a ClusterObjectSet")
succeededCond := apimeta.FindStatusCondition(rev.Status.Conditions, ocv1.ClusterObjectSetTypeSucceeded)
@@ -1370,21 +1213,24 @@ func TestBoxcutterStorageMigrator(t *testing.T) {
testScheme := runtime.NewScheme()
require.NoError(t, ocv1.AddToScheme(testScheme))
- brb := &mockBundleRevisionBuilder{}
- mag := &mockActionGetter{}
- client := &clientMock{}
+ ext := &ocv1.ClusterExtension{
+ ObjectMeta: metav1.ObjectMeta{Name: "test123"},
+ }
+ // GenerateRevisionFromHelmRelease should not be called when revisions already exist
+ ctrl := gomock.NewController(t)
+ brb := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ mag := newMockActionGetter(ctrl, mockActionGetterConfig{})
+
+ mockClient := mockctrlclient.NewMockClient(ctrl)
+
sm := &applier.BoxcutterStorageMigrator{
RevisionGenerator: brb,
ActionClientGetter: mag,
- Client: client,
+ Client: mockClient,
Scheme: testScheme,
FieldOwner: "test-owner",
}
- ext := &ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{Name: "test123"},
- }
-
existingRev := ocv1.ClusterObjectSet{
ObjectMeta: metav1.ObjectMeta{
Name: "test-revision",
@@ -1407,39 +1253,40 @@ func TestBoxcutterStorageMigrator(t *testing.T) {
},
}
- client.
- On("List", mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSetList"), mock.Anything).
- Run(func(args mock.Arguments) {
- list := args.Get(1).(*ocv1.ClusterObjectSetList)
- list.Items = []ocv1.ClusterObjectSet{existingRev}
- }).
- Return(nil)
+ mockClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
+ cosList := list.(*ocv1.ClusterObjectSetList)
+ cosList.Items = []ocv1.ClusterObjectSet{existingRev}
+ return nil
+ })
err := sm.Migrate(t.Context(), ext, map[string]string{"my-label": "my-value"})
require.NoError(t, err)
-
- client.AssertExpectations(t)
})
t.Run("sets status when revision exists but status is missing", func(t *testing.T) {
testScheme := runtime.NewScheme()
require.NoError(t, ocv1.AddToScheme(testScheme))
- brb := &mockBundleRevisionBuilder{}
- mag := &mockActionGetter{}
- client := &clientMock{}
+ ext := &ocv1.ClusterExtension{
+ ObjectMeta: metav1.ObjectMeta{Name: "test123"},
+ }
+ ctrl := gomock.NewController(t)
+ brb := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ mag := newMockActionGetter(ctrl, mockActionGetterConfig{})
+
+ mockClient := mockctrlclient.NewMockClient(ctrl)
+ mockStatusWriter := mockctrlclient.NewMockSubResourceWriter(ctrl)
+ mockClient.EXPECT().Status().Return(mockStatusWriter).AnyTimes()
+
sm := &applier.BoxcutterStorageMigrator{
RevisionGenerator: brb,
ActionClientGetter: mag,
- Client: client,
+ Client: mockClient,
Scheme: testScheme,
FieldOwner: "test-owner",
}
- ext := &ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{Name: "test123"},
- }
-
existingRev := ocv1.ClusterObjectSet{
ObjectMeta: metav1.ObjectMeta{
Name: "test-revision",
@@ -1454,33 +1301,34 @@ func TestBoxcutterStorageMigrator(t *testing.T) {
// Status is empty - simulating the case where creation succeeded but status update failed
}
- client.
- On("List", mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSetList"), mock.Anything).
- Run(func(args mock.Arguments) {
- list := args.Get(1).(*ocv1.ClusterObjectSetList)
- list.Items = []ocv1.ClusterObjectSet{existingRev}
- }).
- Return(nil)
+ mockClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
+ cosList := list.(*ocv1.ClusterObjectSetList)
+ cosList.Items = []ocv1.ClusterObjectSet{existingRev}
+ return nil
+ })
- client.
- On("Get", mock.Anything, mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSet"), mock.Anything).
- Run(func(args mock.Arguments) {
- rev := args.Get(2).(*ocv1.ClusterObjectSet)
+ mockClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
+ rev := obj.(*ocv1.ClusterObjectSet)
*rev = existingRev
- }).
- Return(nil)
+ return nil
+ })
+
+ var updatedObj client.Object
+ mockStatusWriter.EXPECT().Update(gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error {
+ updatedObj = obj
+ return nil
+ })
err := sm.Migrate(t.Context(), ext, map[string]string{"my-label": "my-value"})
require.NoError(t, err)
- client.AssertExpectations(t)
-
// Verify the status was set
- statusWriter := client.Status().(*statusWriterMock)
- require.True(t, statusWriter.updateCalled, "Status().Update() should be called to set missing status")
- require.NotNil(t, statusWriter.updatedObj, "Updated object should not be nil")
+ require.NotNil(t, updatedObj, "Updated object should not be nil")
- rev, ok := statusWriter.updatedObj.(*ocv1.ClusterObjectSet)
+ rev, ok := updatedObj.(*ocv1.ClusterObjectSet)
require.True(t, ok, "Updated object should be a ClusterObjectSet")
succeededCond := apimeta.FindStatusCondition(rev.Status.Conditions, ocv1.ClusterObjectSetTypeSucceeded)
@@ -1493,21 +1341,25 @@ func TestBoxcutterStorageMigrator(t *testing.T) {
testScheme := runtime.NewScheme()
require.NoError(t, ocv1.AddToScheme(testScheme))
- brb := &mockBundleRevisionBuilder{}
- mag := &mockActionGetter{}
- client := &clientMock{}
+ ext := &ocv1.ClusterExtension{
+ ObjectMeta: metav1.ObjectMeta{Name: "test123"},
+ }
+ ctrl := gomock.NewController(t)
+ brb := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ mag := newMockActionGetter(ctrl, mockActionGetterConfig{})
+
+ mockClient := mockctrlclient.NewMockClient(ctrl)
+ mockStatusWriter := mockctrlclient.NewMockSubResourceWriter(ctrl)
+ mockClient.EXPECT().Status().Return(mockStatusWriter).AnyTimes()
+
sm := &applier.BoxcutterStorageMigrator{
RevisionGenerator: brb,
ActionClientGetter: mag,
- Client: client,
+ Client: mockClient,
Scheme: testScheme,
FieldOwner: "test-owner",
}
- ext := &ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{Name: "test123"},
- }
-
// Migrated revision with Succeeded=False (e.g., from a previous failed status update attempt)
// This simulates a revision whose Succeeded condition should be corrected from False to True during migration.
existingRev := ocv1.ClusterObjectSet{
@@ -1532,33 +1384,34 @@ func TestBoxcutterStorageMigrator(t *testing.T) {
},
}
- client.
- On("List", mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSetList"), mock.Anything).
- Run(func(args mock.Arguments) {
- list := args.Get(1).(*ocv1.ClusterObjectSetList)
- list.Items = []ocv1.ClusterObjectSet{existingRev}
- }).
- Return(nil)
+ mockClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
+ cosList := list.(*ocv1.ClusterObjectSetList)
+ cosList.Items = []ocv1.ClusterObjectSet{existingRev}
+ return nil
+ })
- client.
- On("Get", mock.Anything, mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSet"), mock.Anything).
- Run(func(args mock.Arguments) {
- rev := args.Get(2).(*ocv1.ClusterObjectSet)
+ mockClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
+ rev := obj.(*ocv1.ClusterObjectSet)
*rev = existingRev
- }).
- Return(nil)
+ return nil
+ })
+
+ var updatedObj client.Object
+ mockStatusWriter.EXPECT().Update(gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error {
+ updatedObj = obj
+ return nil
+ })
err := sm.Migrate(t.Context(), ext, map[string]string{"my-label": "my-value"})
require.NoError(t, err)
- client.AssertExpectations(t)
-
// Verify the status was updated from False to True
- statusWriter := client.Status().(*statusWriterMock)
- require.True(t, statusWriter.updateCalled, "Status().Update() should be called to update False to True")
- require.NotNil(t, statusWriter.updatedObj, "Updated object should not be nil")
+ require.NotNil(t, updatedObj, "Updated object should not be nil")
- rev, ok := statusWriter.updatedObj.(*ocv1.ClusterObjectSet)
+ rev, ok := updatedObj.(*ocv1.ClusterObjectSet)
require.True(t, ok, "Updated object should be a ClusterObjectSet")
succeededCond := apimeta.FindStatusCondition(rev.Status.Conditions, ocv1.ClusterObjectSetTypeSucceeded)
@@ -1571,21 +1424,23 @@ func TestBoxcutterStorageMigrator(t *testing.T) {
testScheme := runtime.NewScheme()
require.NoError(t, ocv1.AddToScheme(testScheme))
- brb := &mockBundleRevisionBuilder{}
- mag := &mockActionGetter{}
- client := &clientMock{}
+ ext := &ocv1.ClusterExtension{
+ ObjectMeta: metav1.ObjectMeta{Name: "test123"},
+ }
+ ctrl := gomock.NewController(t)
+ brb := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ mag := newMockActionGetter(ctrl, mockActionGetterConfig{})
+
+ mockClient := mockctrlclient.NewMockClient(ctrl)
+
sm := &applier.BoxcutterStorageMigrator{
RevisionGenerator: brb,
ActionClientGetter: mag,
- Client: client,
+ Client: mockClient,
Scheme: testScheme,
FieldOwner: "test-owner",
}
- ext := &ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{Name: "test123"},
- }
-
// Revision 1 created by normal Boxcutter operation (no migration label)
// This simulates the first rollout - status should NOT be set as it may still be in progress
existingRev := ocv1.ClusterObjectSet{
@@ -1599,40 +1454,50 @@ func TestBoxcutterStorageMigrator(t *testing.T) {
},
}
- client.
- On("List", mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSetList"), mock.Anything).
- Run(func(args mock.Arguments) {
- list := args.Get(1).(*ocv1.ClusterObjectSetList)
- list.Items = []ocv1.ClusterObjectSet{existingRev}
- }).
- Return(nil)
+ mockClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
+ cosList := list.(*ocv1.ClusterObjectSetList)
+ cosList.Items = []ocv1.ClusterObjectSet{existingRev}
+ return nil
+ })
// The migration flow calls Get() to re-fetch the revision before checking its status.
// Even for non-migrated revisions, Get() is called to determine if status needs to be set.
- client.
- On("Get", mock.Anything, mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSet"), mock.Anything).
- Run(func(args mock.Arguments) {
- rev := args.Get(2).(*ocv1.ClusterObjectSet)
+ mockClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
+ rev := obj.(*ocv1.ClusterObjectSet)
*rev = existingRev
- }).
- Return(nil)
+ return nil
+ })
+
+ // Status() and Update() should NOT be called for non-migrated revisions.
+ // gomock will fail if any unexpected calls are made.
err := sm.Migrate(t.Context(), ext, map[string]string{"my-label": "my-value"})
require.NoError(t, err)
-
- client.AssertExpectations(t)
-
- // Verify the status was NOT set for non-migrated revision
- statusWriter := client.Status().(*statusWriterMock)
- require.False(t, statusWriter.updateCalled, "Status().Update() should NOT be called for non-migrated revisions")
})
t.Run("migrates from most recent deployed release when latest is failed", func(t *testing.T) {
testScheme := runtime.NewScheme()
require.NoError(t, ocv1.AddToScheme(testScheme))
- brb := &mockBundleRevisionBuilder{}
- mag := &mockActionGetter{
+ ext := &ocv1.ClusterExtension{
+ ObjectMeta: metav1.ObjectMeta{Name: "test123"},
+ }
+ expectedRelease := &release.Release{
+ Name: "test123",
+ Version: 2,
+ Info: &release.Info{Status: release.StatusDeployed},
+ }
+
+ ctrl := gomock.NewController(t)
+ brb := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ brb.EXPECT().GenerateRevisionFromHelmRelease(gomock.Any(), expectedRelease, gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, helmRelease *release.Release, e *ocv1.ClusterExtension, objectLabels map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
+ return defaultHelmRevisionResult(e), nil
+ }).Times(1)
+
+ mag := newMockActionGetter(ctrl, mockActionGetterConfig{
currentRel: &release.Release{
Name: "test123",
Version: 3,
@@ -1644,74 +1509,64 @@ func TestBoxcutterStorageMigrator(t *testing.T) {
Version: 3,
Info: &release.Info{Status: release.StatusFailed},
},
- {
- Name: "test123",
- Version: 2,
- Info: &release.Info{Status: release.StatusDeployed},
- },
+ expectedRelease,
{
Name: "test123",
Version: 1,
Info: &release.Info{Status: release.StatusSuperseded},
},
},
- }
- client := &clientMock{}
+ })
+
+ mockClient := mockctrlclient.NewMockClient(ctrl)
+ mockStatusWriter := mockctrlclient.NewMockSubResourceWriter(ctrl)
+ mockClient.EXPECT().Status().Return(mockStatusWriter).AnyTimes()
+
sm := &applier.BoxcutterStorageMigrator{
RevisionGenerator: brb,
ActionClientGetter: mag,
- Client: client,
+ Client: mockClient,
Scheme: testScheme,
FieldOwner: "test-owner",
}
- ext := &ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{Name: "test123"},
- }
-
- client.
- On("List", mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSetList"), mock.Anything).
+ mockClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any()).
Return(nil)
- client.
- On("Apply", mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSetApplyConfiguration"), mock.Anything).
- Once().
- Run(func(args mock.Arguments) {
+ mockClient.EXPECT().Apply(gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, obj runtime.ApplyConfiguration, opts ...client.ApplyOption) error {
// Verify the migration marker label is set before apply
- rev := args.Get(1).(*ocv1ac.ClusterObjectSetApplyConfiguration)
+ rev := obj.(*ocv1ac.ClusterObjectSetApplyConfiguration)
require.Equal(t, "true", rev.Labels[labels.MigratedFromHelmKey], "Migration marker label should be set")
- }).
- Return(nil)
+ return nil
+ })
- client.
- On("Get", mock.Anything, mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSet"), mock.Anything).
- Run(func(args mock.Arguments) {
- rev := args.Get(2).(*ocv1.ClusterObjectSet)
- rev.ObjectMeta.Name = "test-revision"
- rev.ObjectMeta.Generation = 1
- rev.ObjectMeta.ResourceVersion = "1"
+ mockClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
+ rev := obj.(*ocv1.ClusterObjectSet)
+ rev.Name = "test-revision"
+ rev.Generation = 1
+ rev.ResourceVersion = "1"
rev.Labels = map[string]string{
labels.MigratedFromHelmKey: "true",
}
- }).
- Return(nil)
+ return nil
+ })
+
+ var updatedObj client.Object
+ mockStatusWriter.EXPECT().Update(gomock.Any(), gomock.Any(), gomock.Any()).
+ DoAndReturn(func(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error {
+ updatedObj = obj
+ return nil
+ })
err := sm.Migrate(t.Context(), ext, map[string]string{"my-label": "my-value"})
require.NoError(t, err)
- client.AssertExpectations(t)
-
- // Verify the correct release (version 2, deployed) was used instead of version 3 (failed)
- require.NotNil(t, brb.helmReleaseUsed, "GenerateRevisionFromHelmRelease should have been called")
- assert.Equal(t, 2, brb.helmReleaseUsed.Version, "Should use version 2 (deployed), not version 3 (failed)")
- assert.Equal(t, release.StatusDeployed, brb.helmReleaseUsed.Info.Status, "Should use deployed release")
-
// Verify the migrated revision has Succeeded=True status
- statusWriter := client.Status().(*statusWriterMock)
- require.True(t, statusWriter.updateCalled, "Status().Update() should be called during migration")
- require.NotNil(t, statusWriter.updatedObj, "Updated object should not be nil")
+ require.NotNil(t, updatedObj, "Updated object should not be nil")
- rev, ok := statusWriter.updatedObj.(*ocv1.ClusterObjectSet)
+ rev, ok := updatedObj.(*ocv1.ClusterObjectSet)
require.True(t, ok, "Updated object should be a ClusterObjectSet")
succeededCond := apimeta.FindStatusCondition(rev.Status.Conditions, ocv1.ClusterObjectSetTypeSucceeded)
@@ -1723,8 +1578,13 @@ func TestBoxcutterStorageMigrator(t *testing.T) {
testScheme := runtime.NewScheme()
require.NoError(t, ocv1.AddToScheme(testScheme))
- brb := &mockBundleRevisionBuilder{}
- mag := &mockActionGetter{
+ ext := &ocv1.ClusterExtension{
+ ObjectMeta: metav1.ObjectMeta{Name: "test123"},
+ }
+ ctrl := gomock.NewController(t)
+ // GenerateRevisionFromHelmRelease should NOT be called when no deployed release exists
+ brb := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ mag := newMockActionGetter(ctrl, mockActionGetterConfig{
currentRel: &release.Release{
Name: "test123",
Info: &release.Info{Status: release.StatusFailed},
@@ -1741,143 +1601,53 @@ func TestBoxcutterStorageMigrator(t *testing.T) {
Info: &release.Info{Status: release.StatusFailed},
},
},
- }
- client := &clientMock{}
+ })
+
+ mockClient := mockctrlclient.NewMockClient(ctrl)
+
sm := &applier.BoxcutterStorageMigrator{
RevisionGenerator: brb,
ActionClientGetter: mag,
- Client: client,
+ Client: mockClient,
Scheme: testScheme,
FieldOwner: "test-owner",
}
- ext := &ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{Name: "test123"},
- }
-
- client.
- On("List", mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSetList"), mock.Anything).
+ mockClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any()).
Return(nil)
err := sm.Migrate(t.Context(), ext, map[string]string{"my-label": "my-value"})
require.NoError(t, err)
-
- client.AssertExpectations(t)
- // brb.GenerateRevisionFromHelmRelease should NOT have been called
- require.False(t, brb.generateRevisionFromHelmReleaseCalled, "GenerateRevisionFromHelmRelease should NOT be called when no deployed release exists")
+ // gomock will verify GenerateRevisionFromHelmRelease was NOT called (no expectation set)
})
t.Run("does not create revision when no helm release", func(t *testing.T) {
testScheme := runtime.NewScheme()
require.NoError(t, ocv1.AddToScheme(testScheme))
- brb := &mockBundleRevisionBuilder{}
- mag := &mockActionGetter{
- getClientErr: driver.ErrReleaseNotFound,
+ ext := &ocv1.ClusterExtension{
+ ObjectMeta: metav1.ObjectMeta{Name: "test123"},
}
- client := &clientMock{}
+ ctrl := gomock.NewController(t)
+ brb := mockapplier.NewMockClusterObjectSetGenerator(ctrl)
+ mag := newMockActionGetter(ctrl, mockActionGetterConfig{
+ getClientErr: driver.ErrReleaseNotFound,
+ })
+
+ mockClient := mockctrlclient.NewMockClient(ctrl)
+
sm := &applier.BoxcutterStorageMigrator{
RevisionGenerator: brb,
ActionClientGetter: mag,
- Client: client,
+ Client: mockClient,
Scheme: testScheme,
FieldOwner: "test-owner",
}
- ext := &ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{Name: "test123"},
- }
-
- client.
- On("List", mock.Anything, mock.AnythingOfType("*v1.ClusterObjectSetList"), mock.Anything).
+ mockClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any()).
Return(nil)
err := sm.Migrate(t.Context(), ext, map[string]string{"my-label": "my-value"})
require.NoError(t, err)
-
- client.AssertExpectations(t)
})
}
-
-// mockBundleRevisionBuilder is a mock implementation of the ClusterObjectSetGenerator for testing.
-type mockBundleRevisionBuilder struct {
- makeRevisionFunc func(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotation map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error)
- generateRevisionFromHelmReleaseCalled bool
- helmReleaseUsed *release.Release
-}
-
-func (m *mockBundleRevisionBuilder) GenerateRevision(ctx context.Context, bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
- return m.makeRevisionFunc(ctx, bundleFS, ext, objectLabels, revisionAnnotations)
-}
-
-func (m *mockBundleRevisionBuilder) GenerateRevisionFromHelmRelease(
- ctx context.Context,
- helmRelease *release.Release, ext *ocv1.ClusterExtension,
- objectLabels map[string]string,
-) (*ocv1ac.ClusterObjectSetApplyConfiguration, error) {
- m.generateRevisionFromHelmReleaseCalled = true
- m.helmReleaseUsed = helmRelease
- return ocv1ac.ClusterObjectSet("test-revision").
- WithLabels(map[string]string{
- labels.OwnerNameKey: ext.Name,
- }).
- WithSpec(ocv1ac.ClusterObjectSetSpec()), nil
-}
-
-type clientMock struct {
- mock.Mock
- statusWriter *statusWriterMock
-}
-
-func (m *clientMock) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
- args := m.Called(ctx, list, opts)
- return args.Error(0)
-}
-
-func (m *clientMock) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
- args := m.Called(ctx, key, obj, opts)
- return args.Error(0)
-}
-
-func (m *clientMock) Apply(ctx context.Context, obj runtime.ApplyConfiguration, opts ...client.ApplyOption) error {
- args := m.Called(ctx, obj, opts)
- return args.Error(0)
-}
-
-func (m *clientMock) Status() client.StatusWriter {
- if m.statusWriter == nil {
- m.statusWriter = &statusWriterMock{mock: &m.Mock}
- }
- return m.statusWriter
-}
-
-type statusWriterMock struct {
- mock *mock.Mock
- updatedObj client.Object
- updateCalled bool
- applyCalled bool
-}
-
-func (s *statusWriterMock) Update(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error {
- // Capture the status update for test verification
- s.updatedObj = obj
- s.updateCalled = true
- return nil
-}
-
-func (s *statusWriterMock) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.SubResourcePatchOption) error {
- return nil
-}
-
-func (s *statusWriterMock) Create(ctx context.Context, obj client.Object, subResource client.Object, opts ...client.SubResourceCreateOption) error {
- return nil
-}
-
-// Apply is required by controller-runtime v0.23.0+ StatusWriter interface
-func (s *statusWriterMock) Apply(ctx context.Context, obj runtime.ApplyConfiguration, opts ...client.SubResourceApplyOption) error {
- // Track Apply calls to detect unexpected usage in tests
- s.applyCalled = true
- // Apply is not currently used by the code under test, but tracking the call
- // helps ensure tests fail if this assumption changes
- return fmt.Errorf("unexpected call to StatusWriter.Apply() - this method is not expected to be used in these tests")
-}
diff --git a/internal/operator-controller/applier/helm.go b/internal/operator-controller/applier/helm.go
index ab6e58a363..0b5f2e2a29 100644
--- a/internal/operator-controller/applier/helm.go
+++ b/internal/operator-controller/applier/helm.go
@@ -7,7 +7,6 @@ import (
"fmt"
"io"
"io/fs"
- "slices"
"strings"
"helm.sh/helm/v3/pkg/action"
@@ -16,25 +15,26 @@ import (
"helm.sh/helm/v3/pkg/postrender"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/storage/driver"
- rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/apimachinery/pkg/util/sets"
apimachyaml "k8s.io/apimachinery/pkg/util/yaml"
- "k8s.io/apiserver/pkg/authentication/user"
- "k8s.io/apiserver/pkg/authorization/authorizer"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
- "github.com/operator-framework/operator-controller/internal/operator-controller/authorization"
- "github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager"
- "github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager/cache"
"github.com/operator-framework/operator-controller/internal/operator-controller/features"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util"
imageutil "github.com/operator-framework/operator-controller/internal/shared/util/image"
)
+type trackingCache interface {
+ Watch(ctx context.Context, user client.Object, gvks sets.Set[schema.GroupVersionKind]) error
+ Free(ctx context.Context, user client.Object) error
+}
+
// HelmChartProvider provides helm charts from bundle sources and cluster extensions
type HelmChartProvider interface {
Get(bundle fs.FS, clusterExtension *ocv1.ClusterExtension) (*chart.Chart, error)
@@ -62,25 +62,10 @@ func (h HelmReleaseToObjectsConverter) GetObjectsFromRelease(rel *release.Releas
type Helm struct {
ActionClientGetter helmclient.ActionClientGetter
Preflights []Preflight
- PreAuthorizer authorization.PreAuthorizer
HelmChartProvider HelmChartProvider
HelmReleaseToObjectsConverter HelmReleaseToObjectsConverterInterface
- Manager contentmanager.Manager
- Watcher cache.Watcher
-}
-
-// runPreAuthorizationChecks performs pre-authorization checks for a Helm release
-// it renders a client-only release, checks permissions using the PreAuthorizer
-// and returns an error if authorization fails or required permissions are missing
-func (h *Helm) runPreAuthorizationChecks(ctx context.Context, ext *ocv1.ClusterExtension, chart *chart.Chart, values chartutil.Values, post postrender.PostRenderer) error {
- tmplRel, err := h.renderClientOnlyRelease(ctx, ext, chart, values, post)
- if err != nil {
- return fmt.Errorf("error rendering content for pre-authorization checks: %w", err)
- }
-
- manifestManager := getUserInfo(ext)
- return formatPreAuthorizerOutput(h.PreAuthorizer.PreAuthorize(ctx, manifestManager, strings.NewReader(tmplRel.Manifest), extManagementPerms(ext)))
+ TrackingCache trackingCache
}
func (h *Helm) Apply(ctx context.Context, contentFS fs.FS, ext *ocv1.ClusterExtension, objectLabels map[string]string, storageLabels map[string]string) (bool, string, error) {
@@ -104,14 +89,6 @@ func (h *Helm) Apply(ctx context.Context, contentFS fs.FS, ext *ocv1.ClusterExte
labels: objectLabels,
}
- if h.PreAuthorizer != nil {
- err := h.runPreAuthorizationChecks(ctx, ext, chrt, values, post)
- if err != nil {
- // Return the pre-authorization error directly
- return false, "", err
- }
- }
-
ac, err := h.ActionClientGetter.ActionClientFor(ctx, ext)
if err != nil {
return false, "", err
@@ -175,13 +152,12 @@ func (h *Helm) Apply(ctx context.Context, contentFS fs.FS, ext *ocv1.ClusterExte
if err != nil {
return true, "", err
}
- klog.FromContext(ctx).Info("watching managed objects")
- cache, err := h.Manager.Get(ctx, ext)
- if err != nil {
- return true, "", err
+ if h.TrackingCache == nil {
+ return true, "", fmt.Errorf("TrackingCache not initialized, cannot set up drift detection watches")
}
-
- if err := cache.Watch(ctx, h.Watcher, relObjects...); err != nil {
+ klog.FromContext(ctx).Info("watching managed objects")
+ gvks := gvksForObjects(relObjects)
+ if err := h.TrackingCache.Watch(ctx, ext, gvks); err != nil {
return true, "", err
}
@@ -221,22 +197,12 @@ func (h *Helm) reconcileExistingRelease(ctx context.Context, ac helmclient.Actio
logger.V(1).Info("setting up drift detection watches on managed objects")
- // Defensive nil checks to prevent panics if Manager or Watcher not properly initialized
- if h.Manager == nil {
- logger.Error(fmt.Errorf("manager is nil"), "Manager not initialized, cannot set up drift detection watches (resources are applied but drift detection disabled)")
- return true, "", nil
- }
- cache, err := h.Manager.Get(ctx, ext)
- if err != nil {
- logger.Error(err, "failed to get managed content cache, cannot set up drift detection watches (resources are applied but drift detection disabled)")
+ if h.TrackingCache == nil {
+ logger.Error(fmt.Errorf("tracking cache is nil"), "TrackingCache not initialized, cannot set up drift detection watches (resources are applied but drift detection disabled)")
return true, "", nil
}
-
- if h.Watcher == nil {
- logger.Error(fmt.Errorf("watcher is nil"), "Watcher not initialized, cannot set up drift detection watches (resources are applied but drift detection disabled)")
- return true, "", nil
- }
- if err := cache.Watch(ctx, h.Watcher, relObjects...); err != nil {
+ gvks := gvksForObjects(relObjects)
+ if err := h.TrackingCache.Watch(ctx, ext, gvks); err != nil {
logger.Error(err, "failed to set up drift detection watches (resources are applied but drift detection disabled)")
return true, "", nil
}
@@ -261,34 +227,6 @@ func (h *Helm) buildHelmChart(bundleFS fs.FS, ext *ocv1.ClusterExtension) (*char
return h.HelmChartProvider.Get(bundleFS, ext)
}
-func (h *Helm) renderClientOnlyRelease(ctx context.Context, ext *ocv1.ClusterExtension, chrt *chart.Chart, values chartutil.Values, post postrender.PostRenderer) (*release.Release, error) {
- // We need to get a separate action client because our work below
- // permanently modifies the underlying action.Configuration for ClientOnly mode.
- ac, err := h.ActionClientGetter.ActionClientFor(ctx, ext)
- if err != nil {
- return nil, err
- }
-
- isUpgrade := false
- currentRelease, err := ac.Get(ext.GetName())
- if err != nil && !errors.Is(err, driver.ErrReleaseNotFound) {
- return nil, err
- }
- if currentRelease != nil {
- isUpgrade = true
- }
-
- return ac.Install(ext.GetName(), ext.Spec.Namespace, chrt, values, func(i *action.Install) error {
- i.DryRun = true
- i.ReleaseName = ext.GetName()
- i.Replace = true
- i.ClientOnly = true
- i.IncludeCRDs = true
- i.IsUpgrade = isUpgrade
- return nil
- }, helmclient.AppendInstallPostRenderer(post))
-}
-
func (h *Helm) getReleaseState(cl helmclient.ActionInterface, ext *ocv1.ClusterExtension, chrt *chart.Chart, values chartutil.Values, post postrender.PostRenderer) (*release.Release, *release.Release, string, error) {
currentRelease, err := cl.Get(ext.GetName())
if errors.Is(err, driver.ErrReleaseNotFound) {
@@ -354,73 +292,10 @@ func (p *postrenderer) Run(renderedManifests *bytes.Buffer) (*bytes.Buffer, erro
return &buf, nil
}
-func ruleDescription(ns string, rule rbacv1.PolicyRule) string {
- var sb strings.Builder
- sb.WriteString(fmt.Sprintf("Namespace:%q", ns))
-
- if len(rule.APIGroups) > 0 {
- sb.WriteString(fmt.Sprintf(" APIGroups:[%s]", strings.Join(slices.Sorted(slices.Values(rule.APIGroups)), ",")))
- }
- if len(rule.Resources) > 0 {
- sb.WriteString(fmt.Sprintf(" Resources:[%s]", strings.Join(slices.Sorted(slices.Values(rule.Resources)), ",")))
- }
- if len(rule.ResourceNames) > 0 {
- sb.WriteString(fmt.Sprintf(" ResourceNames:[%s]", strings.Join(slices.Sorted(slices.Values(rule.ResourceNames)), ",")))
- }
- if len(rule.Verbs) > 0 {
- sb.WriteString(fmt.Sprintf(" Verbs:[%s]", strings.Join(slices.Sorted(slices.Values(rule.Verbs)), ",")))
- }
- if len(rule.NonResourceURLs) > 0 {
- sb.WriteString(fmt.Sprintf(" NonResourceURLs:[%s]", strings.Join(slices.Sorted(slices.Values(rule.NonResourceURLs)), ",")))
- }
- return sb.String()
-}
-
-// formatPreAuthorizerOutput formats the output of PreAuthorizer.PreAuthorize calls into a consistent and deterministic error.
-// If the call returns no missing rules, and no error, nil is returned.
-func formatPreAuthorizerOutput(missingRules []authorization.ScopedPolicyRules, authErr error) error {
- var preAuthErrors []error
- if len(missingRules) > 0 {
- totalMissingRules := 0
- for _, policyRules := range missingRules {
- totalMissingRules += len(policyRules.MissingRules)
- }
- missingRuleDescriptions := make([]string, 0, totalMissingRules)
- for _, policyRules := range missingRules {
- for _, rule := range policyRules.MissingRules {
- missingRuleDescriptions = append(missingRuleDescriptions, ruleDescription(policyRules.Namespace, rule))
- }
- }
- slices.Sort(missingRuleDescriptions)
- // This phrase is explicitly checked by external testing
- preAuthErrors = append(preAuthErrors, fmt.Errorf("service account requires the following permissions to manage cluster extension:\n %s", strings.Join(missingRuleDescriptions, "\n ")))
- }
- if authErr != nil {
- preAuthErrors = append(preAuthErrors, fmt.Errorf("authorization evaluation error: %w", authErr))
- }
- if len(preAuthErrors) > 0 {
- // This phrase is explicitly checked by external testing
- return fmt.Errorf("pre-authorization failed: %v", errors.Join(preAuthErrors...))
- }
- return nil
-}
-
-func getUserInfo(ext *ocv1.ClusterExtension) user.Info {
- return &user.DefaultInfo{Name: fmt.Sprintf("system:serviceaccount:%s:%s", ext.Spec.Namespace, ext.Spec.ServiceAccount.Name)}
-}
-
-func extManagementPerms(ext *ocv1.ClusterExtension) func(user.Info) []authorizer.AttributesRecord {
- return func(user user.Info) []authorizer.AttributesRecord {
- return []authorizer.AttributesRecord{
- {
- User: user,
- Name: ext.Name,
- APIGroup: ocv1.GroupVersion.Group,
- APIVersion: ocv1.GroupVersion.Version,
- Resource: "clusterextensions/finalizers",
- ResourceRequest: true,
- Verb: "update",
- },
- }
+func gvksForObjects(objs []client.Object) sets.Set[schema.GroupVersionKind] {
+ gvks := sets.New[schema.GroupVersionKind]()
+ for _, obj := range objs {
+ gvks.Insert(obj.GetObjectKind().GroupVersionKind())
}
+ return gvks
}
diff --git a/internal/operator-controller/applier/helm_test.go b/internal/operator-controller/applier/helm_test.go
index 3e3ef7479b..1aa9c0bf13 100644
--- a/internal/operator-controller/applier/helm_test.go
+++ b/internal/operator-controller/applier/helm_test.go
@@ -3,68 +3,100 @@ package applier_test
import (
"context"
"errors"
- "io"
"io/fs"
"os"
"testing"
"testing/fstest"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/storage/driver"
- rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apiserver/pkg/authentication/user"
- "k8s.io/apiserver/pkg/authorization/authorizer"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/apimachinery/pkg/util/sets"
"sigs.k8s.io/controller-runtime/pkg/client"
helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/operator-controller/applier"
- "github.com/operator-framework/operator-controller/internal/operator-controller/authorization"
- "github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager"
- cmcache "github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager/cache"
+ mockhelmclient "github.com/operator-framework/operator-controller/internal/testutil/mock/helmclient"
)
-var _ contentmanager.Manager = (*mockManagedContentCacheManager)(nil)
-
-type mockManagedContentCacheManager struct {
- err error
- cache cmcache.Cache
+type mockActionGetterConfig struct {
+ actionClientForErr error
+ getClientErr error
+ historyErr error
+ installErr error
+ dryRunInstallErr error
+ upgradeErr error
+ dryRunUpgradeErr error
+ reconcileErr error
+ desiredRel *release.Release
+ currentRel *release.Release
+ history []*release.Release
}
-func (m *mockManagedContentCacheManager) Get(_ context.Context, _ *ocv1.ClusterExtension) (cmcache.Cache, error) {
- if m.err != nil {
- return nil, m.err
+func newMockActionGetter(ctrl *gomock.Controller, cfg mockActionGetterConfig) *mockhelmclient.MockActionClientGetterAndInterface {
+ m := mockhelmclient.NewMockActionClientGetterAndInterface(ctrl)
+
+ if cfg.actionClientForErr != nil {
+ m.EXPECT().ActionClientFor(gomock.Any(), gomock.Any()).Return(nil, cfg.actionClientForErr).AnyTimes()
+ } else {
+ m.EXPECT().ActionClientFor(gomock.Any(), gomock.Any()).Return(m, nil).AnyTimes()
}
- return m.cache, nil
-}
-func (m *mockManagedContentCacheManager) Delete(_ *ocv1.ClusterExtension) error {
- return m.err
+ m.EXPECT().Get(gomock.Any(), gomock.Any()).Return(cfg.currentRel, cfg.getClientErr).AnyTimes()
+ m.EXPECT().History(gomock.Any(), gomock.Any()).Return(cfg.history, cfg.historyErr).AnyTimes()
+ m.EXPECT().Config().Return(nil).AnyTimes()
+ m.EXPECT().Reconcile(gomock.Any()).Return(cfg.reconcileErr).AnyTimes()
+ m.EXPECT().Uninstall(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
+
+ m.EXPECT().Install(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(name, ns string, chrt *chart.Chart, vals map[string]interface{}, opts ...helmclient.InstallOption) (*release.Release, error) {
+ i := action.Install{}
+ for _, opt := range opts {
+ if err := opt(&i); err != nil {
+ return nil, err
+ }
+ }
+ if i.DryRun {
+ return cfg.desiredRel, cfg.dryRunInstallErr
+ }
+ return cfg.desiredRel, cfg.installErr
+ }).AnyTimes()
+
+ m.EXPECT().Upgrade(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(name, ns string, chrt *chart.Chart, vals map[string]interface{}, opts ...helmclient.UpgradeOption) (*release.Release, error) {
+ u := action.Upgrade{}
+ for _, opt := range opts {
+ if err := opt(&u); err != nil {
+ return nil, err
+ }
+ }
+ if u.DryRun {
+ return cfg.desiredRel, cfg.dryRunUpgradeErr
+ }
+ return cfg.desiredRel, cfg.upgradeErr
+ }).AnyTimes()
+
+ return m
}
-type mockManagedContentCache struct {
- err error
+type mockTrackingCache struct {
+ watchErr error
+ freeErr error
}
-var _ cmcache.Cache = (*mockManagedContentCache)(nil)
-
-func (m *mockManagedContentCache) Close() error {
- if m.err != nil {
- return m.err
- }
- return nil
+func (m *mockTrackingCache) Watch(_ context.Context, _ client.Object, _ sets.Set[schema.GroupVersionKind]) error {
+ return m.watchErr
}
-func (m *mockManagedContentCache) Watch(_ context.Context, _ cmcache.Watcher, _ ...client.Object) error {
- if m.err != nil {
- return m.err
- }
- return nil
+func (m *mockTrackingCache) Free(_ context.Context, _ client.Object) error {
+ return m.freeErr
}
type mockPreflight struct {
@@ -72,14 +104,6 @@ type mockPreflight struct {
upgradeErr error
}
-type mockPreAuthorizer struct {
- fn func(context.Context, user.Info, io.Reader, ...authorization.UserAuthorizerAttributesFactory) ([]authorization.ScopedPolicyRules, error)
-}
-
-func (p *mockPreAuthorizer) PreAuthorize(ctx context.Context, manifestManager user.Info, manifestReader io.Reader, additionalRequiredPerms ...authorization.UserAuthorizerAttributesFactory) ([]authorization.ScopedPolicyRules, error) {
- return p.fn(ctx, manifestManager, manifestReader, additionalRequiredPerms...)
-}
-
func (mp *mockPreflight) Install(context.Context, []client.Object) error {
return mp.installErr
}
@@ -203,40 +227,10 @@ spec:
},
Spec: ocv1.ClusterExtensionSpec{
Namespace: "test-namespace",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "test-sa",
- },
},
}
testObjectLabels = map[string]string{"object": "label"}
testStorageLabels = map[string]string{"storage": "label"}
- errPreAuth = errors.New("problem running preauthorization")
- missingRBAC = []authorization.ScopedPolicyRules{
- {
- Namespace: "",
- MissingRules: []rbacv1.PolicyRule{
- {
- Verbs: []string{"list", "watch"},
- APIGroups: []string{""},
- Resources: []string{"services"},
- ResourceNames: []string(nil),
- NonResourceURLs: []string(nil)},
- },
- },
- {
- Namespace: "test-namespace",
- MissingRules: []rbacv1.PolicyRule{
- {
- Verbs: []string{"create"},
- APIGroups: []string{"*"},
- Resources: []string{"certificates"}},
- },
- },
- }
-
- errMissingRBAC = `pre-authorization failed: service account requires the following permissions to manage cluster extension:
- Namespace:"" APIGroups:[] Resources:[services] Verbs:[list,watch]
- Namespace:"test-namespace" APIGroups:[*] Resources:[certificates] Verbs:[create]`
)
func TestApply_Base(t *testing.T) {
@@ -346,9 +340,7 @@ func TestApply_Installation(t *testing.T) {
ActionClientGetter: mockAcg,
HelmChartProvider: DummyHelmChartProvider,
HelmReleaseToObjectsConverter: mockHelmReleaseToObjectsConverter{},
- Manager: &mockManagedContentCacheManager{
- cache: &mockManagedContentCache{},
- },
+ TrackingCache: &mockTrackingCache{},
}
installSucceeded, installStatus, err := helmApplier.Apply(context.TODO(), validFS, testCE, testObjectLabels, testStorageLabels)
@@ -356,201 +348,24 @@ func TestApply_Installation(t *testing.T) {
require.Empty(t, installStatus)
require.True(t, installSucceeded)
})
-}
-
-func TestApply_InstallationWithPreflightPermissionsEnabled(t *testing.T) {
- t.Run("preauthorizer called with correct parameters", func(t *testing.T) {
- mockAcg := &mockActionGetter{
- getClientErr: driver.ErrReleaseNotFound,
- installErr: errors.New("failed installing chart"),
- desiredRel: &release.Release{
- Info: &release.Info{Status: release.StatusDeployed},
- Manifest: validManifest,
- },
- }
- mockPf := &mockPreflight{installErr: errors.New("failed during install pre-flight check")}
- helmApplier := applier.Helm{
- ActionClientGetter: mockAcg,
- Preflights: []applier.Preflight{mockPf},
- PreAuthorizer: &mockPreAuthorizer{
- fn: func(ctx context.Context, user user.Info, reader io.Reader, additionalRequiredPerms ...authorization.UserAuthorizerAttributesFactory) ([]authorization.ScopedPolicyRules, error) {
- t.Log("has correct user")
- require.Equal(t, "system:serviceaccount:test-namespace:test-sa", user.GetName())
- require.Empty(t, user.GetUID())
- require.Nil(t, user.GetExtra())
- require.Empty(t, user.GetGroups())
-
- t.Log("has correct additional permissions")
- require.Len(t, additionalRequiredPerms, 1)
- perms := additionalRequiredPerms[0](user)
-
- require.Len(t, perms, 1)
- require.Equal(t, authorizer.AttributesRecord{
- User: user,
- Name: "test-ext",
- APIGroup: "olm.operatorframework.io",
- APIVersion: "v1",
- Resource: "clusterextensions/finalizers",
- ResourceRequest: true,
- Verb: "update",
- }, perms[0])
- return nil, nil
- },
- },
- HelmChartProvider: DummyHelmChartProvider,
- HelmReleaseToObjectsConverter: mockHelmReleaseToObjectsConverter{},
- }
-
- _, _, err := helmApplier.Apply(context.TODO(), validFS, testCE, testObjectLabels, testStorageLabels)
- require.Error(t, err)
- })
-
- t.Run("fails during dry-run installation", func(t *testing.T) {
- mockAcg := &mockActionGetter{
- getClientErr: driver.ErrReleaseNotFound,
- dryRunInstallErr: errors.New("failed attempting to dry-run install chart"),
- }
- helmApplier := applier.Helm{
- ActionClientGetter: mockAcg,
- HelmChartProvider: DummyHelmChartProvider,
- }
-
- installSucceeded, installStatus, err := helmApplier.Apply(context.TODO(), validFS, testCE, testObjectLabels, testStorageLabels)
- require.Error(t, err)
- require.ErrorContains(t, err, "attempting to dry-run install chart")
- require.False(t, installSucceeded)
- require.Empty(t, installStatus)
- })
- t.Run("fails during pre-flight installation", func(t *testing.T) {
+ t.Run("fails when TrackingCache is nil", func(t *testing.T) {
mockAcg := &mockActionGetter{
getClientErr: driver.ErrReleaseNotFound,
- installErr: errors.New("failed installing chart"),
desiredRel: &release.Release{
Info: &release.Info{Status: release.StatusDeployed},
Manifest: validManifest,
},
}
- mockPf := &mockPreflight{installErr: errors.New("failed during install pre-flight check")}
helmApplier := applier.Helm{
- ActionClientGetter: mockAcg,
- Preflights: []applier.Preflight{mockPf},
- PreAuthorizer: &mockPreAuthorizer{
- fn: func(ctx context.Context, user user.Info, reader io.Reader, additionalRequiredPerms ...authorization.UserAuthorizerAttributesFactory) ([]authorization.ScopedPolicyRules, error) {
- return nil, nil
- },
- },
+ ActionClientGetter: mockAcg,
HelmChartProvider: DummyHelmChartProvider,
HelmReleaseToObjectsConverter: mockHelmReleaseToObjectsConverter{},
}
installSucceeded, installStatus, err := helmApplier.Apply(context.TODO(), validFS, testCE, testObjectLabels, testStorageLabels)
require.Error(t, err)
- require.ErrorContains(t, err, "install pre-flight check")
- require.False(t, installSucceeded)
- require.Empty(t, installStatus)
- })
-
- t.Run("fails during installation because of pre-authorization failure", func(t *testing.T) {
- mockAcg := &mockActionGetter{
- getClientErr: driver.ErrReleaseNotFound,
- desiredRel: &release.Release{
- Info: &release.Info{Status: release.StatusDeployed},
- Manifest: validManifest,
- },
- }
- helmApplier := applier.Helm{
- ActionClientGetter: mockAcg,
- PreAuthorizer: &mockPreAuthorizer{
- fn: func(ctx context.Context, user user.Info, reader io.Reader, additionalRequiredPerms ...authorization.UserAuthorizerAttributesFactory) ([]authorization.ScopedPolicyRules, error) {
- return nil, errPreAuth
- },
- },
- HelmChartProvider: DummyHelmChartProvider,
- }
- // Use a ClusterExtension with valid Spec fields.
- validCE := &ocv1.ClusterExtension{
- Spec: ocv1.ClusterExtensionSpec{
- Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
- },
- }
- installSucceeded, installStatus, err := helmApplier.Apply(context.TODO(), validFS, validCE, testObjectLabels, testStorageLabels)
- require.Error(t, err)
- require.ErrorContains(t, err, "problem running preauthorization")
- require.False(t, installSucceeded)
- require.Empty(t, installStatus)
- })
-
- t.Run("fails during installation due to missing RBAC rules", func(t *testing.T) {
- mockAcg := &mockActionGetter{
- getClientErr: driver.ErrReleaseNotFound,
- desiredRel: &release.Release{
- Info: &release.Info{Status: release.StatusDeployed},
- Manifest: validManifest,
- },
- }
- helmApplier := applier.Helm{
- ActionClientGetter: mockAcg,
- PreAuthorizer: &mockPreAuthorizer{
- fn: func(ctx context.Context, user user.Info, reader io.Reader, additionalRequiredPerms ...authorization.UserAuthorizerAttributesFactory) ([]authorization.ScopedPolicyRules, error) {
- return missingRBAC, nil
- },
- },
- HelmChartProvider: DummyHelmChartProvider,
- }
- // Use a ClusterExtension with valid Spec fields.
- validCE := &ocv1.ClusterExtension{
- Spec: ocv1.ClusterExtensionSpec{
- Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
- },
- }
- installSucceeded, installStatus, err := helmApplier.Apply(context.TODO(), validFS, validCE, testObjectLabels, testStorageLabels)
- require.Error(t, err)
- require.ErrorContains(t, err, errMissingRBAC)
- require.False(t, installSucceeded)
- require.Empty(t, installStatus)
- })
-
- t.Run("successful installation", func(t *testing.T) {
- mockAcg := &mockActionGetter{
- getClientErr: driver.ErrReleaseNotFound,
- desiredRel: &release.Release{
- Info: &release.Info{Status: release.StatusDeployed},
- Manifest: validManifest,
- },
- }
- helmApplier := applier.Helm{
- ActionClientGetter: mockAcg,
- PreAuthorizer: &mockPreAuthorizer{
- fn: func(ctx context.Context, user user.Info, reader io.Reader, additionalRequiredPerms ...authorization.UserAuthorizerAttributesFactory) ([]authorization.ScopedPolicyRules, error) {
- return nil, nil
- },
- },
- HelmChartProvider: DummyHelmChartProvider,
- HelmReleaseToObjectsConverter: mockHelmReleaseToObjectsConverter{},
- Manager: &mockManagedContentCacheManager{
- cache: &mockManagedContentCache{},
- },
- }
-
- // Use a ClusterExtension with valid Spec fields.
- validCE := &ocv1.ClusterExtension{
- Spec: ocv1.ClusterExtensionSpec{
- Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
- },
- }
-
- installSucceeded, installStatus, err := helmApplier.Apply(context.TODO(), validFS, validCE, testObjectLabels, testStorageLabels)
- require.NoError(t, err)
+ require.ErrorContains(t, err, "TrackingCache not initialized")
require.Empty(t, installStatus)
require.True(t, installSucceeded)
})
@@ -660,9 +475,7 @@ func TestApply_Upgrade(t *testing.T) {
ActionClientGetter: mockAcg,
HelmChartProvider: DummyHelmChartProvider,
HelmReleaseToObjectsConverter: mockHelmReleaseToObjectsConverter{},
- Manager: &mockManagedContentCacheManager{
- cache: &mockManagedContentCache{},
- },
+ TrackingCache: &mockTrackingCache{},
}
installSucceeded, installStatus, err := helmApplier.Apply(context.TODO(), validFS, testCE, testObjectLabels, testStorageLabels)
@@ -689,9 +502,7 @@ func TestApply_RegistryV1ToChartConverterIntegration(t *testing.T) {
},
},
HelmReleaseToObjectsConverter: mockHelmReleaseToObjectsConverter{},
- Manager: &mockManagedContentCacheManager{
- cache: &mockManagedContentCache{},
- },
+ TrackingCache: &mockTrackingCache{},
}
_, _, _ = helmApplier.Apply(context.TODO(), validFS, testCE, testObjectLabels, testStorageLabels)
@@ -711,9 +522,7 @@ func TestApply_RegistryV1ToChartConverterIntegration(t *testing.T) {
return nil, errors.New("some error")
},
},
- Manager: &mockManagedContentCacheManager{
- cache: &mockManagedContentCache{},
- },
+ TrackingCache: &mockTrackingCache{},
}
_, _, err := helmApplier.Apply(context.TODO(), validFS, testCE, testObjectLabels, testStorageLabels)
diff --git a/internal/operator-controller/applier/provider_test.go b/internal/operator-controller/applier/provider_test.go
index 4369fccd26..6fb9760417 100644
--- a/internal/operator-controller/applier/provider_test.go
+++ b/internal/operator-controller/applier/provider_test.go
@@ -2,11 +2,11 @@ package applier_test
import (
"errors"
- "io/fs"
"testing"
"testing/fstest"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
corev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -24,6 +24,8 @@ import (
. "github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing"
bundlecsv "github.com/operator-framework/operator-controller/internal/testing/bundle/csv"
bundlefs "github.com/operator-framework/operator-controller/internal/testing/bundle/fs"
+ mockapplier "github.com/operator-framework/operator-controller/internal/testutil/mock/applier"
+ mockrender "github.com/operator-framework/operator-controller/internal/testutil/mock/render"
)
func Test_RegistryV1ManifestProvider_Integration(t *testing.T) {
@@ -234,8 +236,9 @@ func Test_RegistryV1ManifestProvider_WebhookSupport(t *testing.T) {
})
t.Run("accepts bundles with webhook definitions if support is enabled and a certificate provider is defined", func(t *testing.T) {
+ ctrl := gomock.NewController(t)
provider := applier.RegistryV1ManifestProvider{
- CertificateProvider: FakeCertProvider{},
+ CertificateProvider: mockrender.NewMockCertificateProvider(ctrl),
IsWebhookSupportEnabled: true,
}
@@ -729,8 +732,9 @@ func Test_RegistryV1ManifestProvider_DeploymentConfig(t *testing.T) {
func Test_RegistryV1HelmChartProvider_Integration(t *testing.T) {
t.Run("surfaces bundle source errors", func(t *testing.T) {
+ ctrl := gomock.NewController(t)
provider := applier.RegistryV1HelmChartProvider{
- ManifestProvider: DummyManifestProvider,
+ ManifestProvider: newDummyManifestProvider(ctrl),
}
ext := &ocv1.ClusterExtension{
Spec: ocv1.ClusterExtensionSpec{
@@ -743,12 +747,12 @@ func Test_RegistryV1HelmChartProvider_Integration(t *testing.T) {
})
t.Run("surfaces manifest provider failures", func(t *testing.T) {
+ ctrl := gomock.NewController(t)
+ mockMP := mockapplier.NewMockManifestProvider(ctrl)
+ mockMP.EXPECT().Get(gomock.Any(), gomock.Any()).Return(nil, errors.New("some error")).AnyTimes()
+
provider := applier.RegistryV1HelmChartProvider{
- ManifestProvider: &FakeManifestProvider{
- GetFn: func(bundle fs.FS, ext *ocv1.ClusterExtension) ([]client.Object, error) {
- return nil, errors.New("some error")
- },
- },
+ ManifestProvider: mockMP,
}
ext := &ocv1.ClusterExtension{
@@ -803,16 +807,8 @@ func Test_RegistryV1HelmChartProvider_Chart(t *testing.T) {
require.Len(t, chart.Templates, 1)
}
-var DummyManifestProvider = &FakeManifestProvider{
- GetFn: func(bundle fs.FS, ext *ocv1.ClusterExtension) ([]client.Object, error) {
- return []client.Object{}, nil
- },
-}
-
-type FakeManifestProvider struct {
- GetFn func(bundleFS fs.FS, ext *ocv1.ClusterExtension) ([]client.Object, error)
-}
-
-func (f *FakeManifestProvider) Get(bundleFS fs.FS, ext *ocv1.ClusterExtension) ([]client.Object, error) {
- return f.GetFn(bundleFS, ext)
+func newDummyManifestProvider(ctrl *gomock.Controller) *mockapplier.MockManifestProvider {
+ m := mockapplier.NewMockManifestProvider(ctrl)
+ m.EXPECT().Get(gomock.Any(), gomock.Any()).Return([]client.Object{}, nil).AnyTimes()
+ return m
}
diff --git a/internal/operator-controller/authentication/synthetic.go b/internal/operator-controller/authentication/synthetic.go
deleted file mode 100644
index 710f2885e8..0000000000
--- a/internal/operator-controller/authentication/synthetic.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package authentication
-
-import (
- "fmt"
-
- "k8s.io/client-go/transport"
-
- ocv1 "github.com/operator-framework/operator-controller/api/v1"
-)
-
-func syntheticUserName(ext ocv1.ClusterExtension) string {
- return fmt.Sprintf("olm:clusterextension:%s", ext.Name)
-}
-
-func syntheticGroups(_ ocv1.ClusterExtension) []string {
- return []string{
- "olm:clusterextensions",
- }
-}
-
-func SyntheticImpersonationConfig(ext ocv1.ClusterExtension) transport.ImpersonationConfig {
- return transport.ImpersonationConfig{
- UserName: syntheticUserName(ext),
- Groups: syntheticGroups(ext),
- }
-}
diff --git a/internal/operator-controller/authentication/synthetic_test.go b/internal/operator-controller/authentication/synthetic_test.go
deleted file mode 100644
index 2e3f17a07b..0000000000
--- a/internal/operator-controller/authentication/synthetic_test.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package authentication_test
-
-import (
- "testing"
-
- "github.com/stretchr/testify/require"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-
- ocv1 "github.com/operator-framework/operator-controller/api/v1"
- "github.com/operator-framework/operator-controller/internal/operator-controller/authentication"
-)
-
-func TestSyntheticImpersonationConfig(t *testing.T) {
- config := authentication.SyntheticImpersonationConfig(ocv1.ClusterExtension{
- ObjectMeta: metav1.ObjectMeta{
- Name: "my-ext",
- },
- })
- require.Equal(t, "olm:clusterextension:my-ext", config.UserName)
- require.Equal(t, []string{
- "olm:clusterextensions",
- }, config.Groups)
- require.Empty(t, config.UID)
- require.Empty(t, config.Extra)
-}
diff --git a/internal/operator-controller/authentication/tokengetter.go b/internal/operator-controller/authentication/tokengetter.go
deleted file mode 100644
index 7870dc8e83..0000000000
--- a/internal/operator-controller/authentication/tokengetter.go
+++ /dev/null
@@ -1,128 +0,0 @@
-package authentication
-
-import (
- "context"
- "fmt"
- "sync"
- "time"
-
- authenticationv1 "k8s.io/api/authentication/v1"
- "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/types"
- corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
- "k8s.io/utils/ptr"
-)
-
-type TokenGetter struct {
- client corev1.ServiceAccountsGetter
- expirationDuration time.Duration
- tokens map[types.NamespacedName]*authenticationv1.TokenRequestStatus
- mu sync.RWMutex
-}
-
-type ServiceAccountNotFoundError struct {
- ServiceAccountName string
- ServiceAccountNamespace string
- Err error
-}
-
-func (e *ServiceAccountNotFoundError) Unwrap() error {
- return e.Err
-}
-
-// Error implements the error interface for ServiceAccountNotFoundError.
-func (e *ServiceAccountNotFoundError) Error() string {
- return fmt.Sprintf("service account \"%s\" not found in namespace \"%s\": unable to authenticate with the Kubernetes cluster.", e.ServiceAccountName, e.ServiceAccountNamespace)
-}
-
-type TokenGetterOption func(*TokenGetter)
-
-const (
- rotationThresholdFraction = 0.1
- DefaultExpirationDuration = 5 * time.Minute
-)
-
-// Returns a token getter that can fetch tokens given a service account.
-// The token getter also caches tokens which helps reduce the number of requests to the API Server.
-// In case a cached token is expiring a fresh token is created.
-func NewTokenGetter(client corev1.ServiceAccountsGetter, options ...TokenGetterOption) *TokenGetter {
- tokenGetter := &TokenGetter{
- client: client,
- expirationDuration: DefaultExpirationDuration,
- tokens: map[types.NamespacedName]*authenticationv1.TokenRequestStatus{},
- }
-
- for _, opt := range options {
- opt(tokenGetter)
- }
-
- return tokenGetter
-}
-
-func WithExpirationDuration(expirationDuration time.Duration) TokenGetterOption {
- return func(tg *TokenGetter) {
- tg.expirationDuration = expirationDuration
- }
-}
-
-// Get returns a token from the cache if available and not expiring, otherwise creates a new token
-func (t *TokenGetter) Get(ctx context.Context, key types.NamespacedName) (string, error) {
- t.mu.RLock()
- token, ok := t.tokens[key]
- t.mu.RUnlock()
-
- expireTime := time.Time{}
- if ok {
- expireTime = token.ExpirationTimestamp.Time
- }
-
- // Create a new token if the cached token expires within rotationThresholdFraction of expirationDuration from now
- rotationThresholdAfterNow := metav1.Now().Add(time.Duration(float64(t.expirationDuration) * (rotationThresholdFraction)))
- if expireTime.Before(rotationThresholdAfterNow) {
- var err error
- token, err = t.getToken(ctx, key)
- if err != nil {
- return "", err
- }
- t.mu.Lock()
- t.tokens[key] = token
- t.mu.Unlock()
- }
-
- // Delete tokens that have expired
- t.reapExpiredTokens()
-
- return token.Token, nil
-}
-
-func (t *TokenGetter) getToken(ctx context.Context, key types.NamespacedName) (*authenticationv1.TokenRequestStatus, error) {
- req, err := t.client.ServiceAccounts(key.Namespace).CreateToken(ctx,
- key.Name,
- &authenticationv1.TokenRequest{
- Spec: authenticationv1.TokenRequestSpec{ExpirationSeconds: ptr.To(int64(t.expirationDuration / time.Second))},
- }, metav1.CreateOptions{})
- if err != nil {
- if errors.IsNotFound(err) {
- return nil, &ServiceAccountNotFoundError{ServiceAccountName: key.Name, ServiceAccountNamespace: key.Namespace}
- }
- return nil, err
- }
- return &req.Status, nil
-}
-
-func (t *TokenGetter) reapExpiredTokens() {
- t.mu.Lock()
- defer t.mu.Unlock()
- for key, token := range t.tokens {
- if metav1.Now().Sub(token.ExpirationTimestamp.Time) > 0 {
- delete(t.tokens, key)
- }
- }
-}
-
-func (t *TokenGetter) Delete(key types.NamespacedName) {
- t.mu.Lock()
- defer t.mu.Unlock()
- delete(t.tokens, key)
-}
diff --git a/internal/operator-controller/authentication/tokengetter_test.go b/internal/operator-controller/authentication/tokengetter_test.go
deleted file mode 100644
index 6aebfcc636..0000000000
--- a/internal/operator-controller/authentication/tokengetter_test.go
+++ /dev/null
@@ -1,89 +0,0 @@
-package authentication
-
-import (
- "context"
- "fmt"
- "testing"
- "time"
-
- "github.com/stretchr/testify/assert"
- authenticationv1 "k8s.io/api/authentication/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/types"
- "k8s.io/client-go/kubernetes/fake"
- ctest "k8s.io/client-go/testing"
-)
-
-func TestTokenGetterGet(t *testing.T) {
- fakeClient := fake.NewClientset()
- fakeClient.PrependReactor("create", "serviceaccounts/token",
- func(action ctest.Action) (bool, runtime.Object, error) {
- act, ok := action.(ctest.CreateActionImpl)
- if !ok {
- return false, nil, nil
- }
- tokenRequest := act.GetObject().(*authenticationv1.TokenRequest)
- var err error
- if act.Name == "test-service-account-1" {
- tokenRequest.Status = authenticationv1.TokenRequestStatus{
- Token: "test-token-1",
- ExpirationTimestamp: metav1.NewTime(metav1.Now().Add(DefaultExpirationDuration)),
- }
- }
- if act.Name == "test-service-account-2" {
- tokenRequest.Status = authenticationv1.TokenRequestStatus{
- Token: "test-token-2",
- ExpirationTimestamp: metav1.NewTime(metav1.Now().Add(1 * time.Second)),
- }
- }
- if act.Name == "test-service-account-3" {
- tokenRequest.Status = authenticationv1.TokenRequestStatus{
- Token: "test-token-3",
- ExpirationTimestamp: metav1.NewTime(metav1.Now().Add(-10 * time.Second)),
- }
- }
- if act.Name == "test-service-account-4" {
- tokenRequest = nil
- err = fmt.Errorf("error when fetching token")
- }
- return true, tokenRequest, err
- })
-
- tg := NewTokenGetter(fakeClient.CoreV1(),
- WithExpirationDuration(DefaultExpirationDuration))
-
- tests := []struct {
- testName string
- serviceAccountName string
- namespace string
- want string
- errorMsg string
- }{
- {"Testing getting token with fake client", "test-service-account-1",
- "test-namespace-1", "test-token-1", "failed to get token"},
- {"Testing getting token from cache", "test-service-account-1",
- "test-namespace-1", "test-token-1", "failed to get token"},
- {"Testing getting short lived token from fake client", "test-service-account-2",
- "test-namespace-2", "test-token-2", "failed to get token"},
- {"Testing getting nearly expired token from cache", "test-service-account-2",
- "test-namespace-2", "test-token-2", "failed to refresh token"},
- {"Testing token that expired 10 seconds ago", "test-service-account-3",
- "test-namespace-3", "test-token-3", "failed to get token"},
- {"Testing error when getting token from fake client", "test-service-account-4",
- "test-namespace-4", "error when fetching token", "error when fetching token"},
- {"Testing service account not found", "missing-sa",
- "test-namespace-5", "", "service account \"missing-sa\" not found in namespace \"test-namespace-5\": unable to authenticate with the Kubernetes cluster."},
- }
-
- for _, tc := range tests {
- got, err := tg.Get(context.Background(), types.NamespacedName{Namespace: tc.namespace, Name: tc.serviceAccountName})
- if err != nil {
- t.Logf("%s: expected: %v, got: %v", tc.testName, tc.want, err)
- assert.EqualError(t, err, tc.errorMsg, "Error message should match expected output")
- } else {
- t.Logf("%s: expected: %v, got: %v", tc.testName, tc.want, got)
- assert.Equal(t, tc.want, got, tc.errorMsg)
- }
- }
-}
diff --git a/internal/operator-controller/authentication/tripper.go b/internal/operator-controller/authentication/tripper.go
deleted file mode 100644
index 77bc1175c0..0000000000
--- a/internal/operator-controller/authentication/tripper.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package authentication
-
-import (
- "fmt"
- "net/http"
-
- "k8s.io/apimachinery/pkg/types"
- utilnet "k8s.io/apimachinery/pkg/util/net"
-)
-
-var _ http.RoundTripper = (*TokenInjectingRoundTripper)(nil)
-
-type TokenInjectingRoundTripper struct {
- Tripper http.RoundTripper
- TokenGetter *TokenGetter
- Key types.NamespacedName
-}
-
-func (tt *TokenInjectingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
- resp, err := tt.do(req)
- if resp != nil && resp.StatusCode == http.StatusUnauthorized {
- tt.TokenGetter.Delete(tt.Key)
- resp, err = tt.do(req)
- }
- return resp, err
-}
-
-func (tt *TokenInjectingRoundTripper) do(req *http.Request) (*http.Response, error) {
- reqClone := utilnet.CloneRequest(req)
- token, err := tt.TokenGetter.Get(reqClone.Context(), tt.Key)
- if err != nil {
- return nil, err
- }
-
- // Always set the Authorization header to our retrieved token
- reqClone.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))
- return tt.Tripper.RoundTrip(reqClone)
-}
diff --git a/internal/operator-controller/authorization/rbac.go b/internal/operator-controller/authorization/rbac.go
deleted file mode 100644
index 6a85fd276b..0000000000
--- a/internal/operator-controller/authorization/rbac.go
+++ /dev/null
@@ -1,692 +0,0 @@
-package authorization
-
-import (
- "context"
- "errors"
- "fmt"
- "io"
- "maps"
- "regexp"
- "slices"
- "sort"
- "strings"
-
- corev1 "k8s.io/api/core/v1"
- rbacv1 "k8s.io/api/rbac/v1"
- apierrors "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/types"
- "k8s.io/apimachinery/pkg/util/sets"
- apimachyaml "k8s.io/apimachinery/pkg/util/yaml"
- "k8s.io/apiserver/pkg/authentication/user"
- "k8s.io/apiserver/pkg/authorization/authorizer"
- "k8s.io/apiserver/pkg/endpoints/request"
- rbacinternal "k8s.io/kubernetes/pkg/apis/rbac"
- rbacv1helpers "k8s.io/kubernetes/pkg/apis/rbac/v1"
- rbacregistry "k8s.io/kubernetes/pkg/registry/rbac"
- "k8s.io/kubernetes/pkg/registry/rbac/validation"
- "k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac"
- "sigs.k8s.io/controller-runtime/pkg/client"
-)
-
-// UserAuthorizerAttributesFactory is a function that produces a slice of AttributesRecord for user
-type UserAuthorizerAttributesFactory func(user user.Info) []authorizer.AttributesRecord
-
-type PreAuthorizer interface {
- // PreAuthorize validates whether the user satisfies the necessary permissions
- // as defined by the RBAC policy. It examines the user’s roles, resource identifiers, and
- // the intended action to determine if the operation is allowed. Optional additional required permissions are also evaluated
- // against user.
- //
- // Return Value:
- // - nil: indicates that the authorization check passed and the operation is permitted.
- // - non-nil error: indicates that an error occurred during the permission evaluation process
- // (for example, a failure decoding the manifest or other internal issues). If the evaluation
- // completes successfully but identifies missing rules, then a nil error is returned along with
- // the list (or slice) of missing rules. Note that in some cases the error may encapsulate multiple
- // evaluation failures
- PreAuthorize(ctx context.Context, user user.Info, manifestReader io.Reader, additionalRequiredPerms ...UserAuthorizerAttributesFactory) ([]ScopedPolicyRules, error)
-}
-
-type ScopedPolicyRules struct {
- Namespace string
- MissingRules []rbacv1.PolicyRule
-}
-
-// objectVerbs are the verbs checked for each specific resource (by name) in the manifest.
-// These verbs operate on existing resource instances and can be restricted by resourceNames in RBAC rules.
-var objectVerbs = []string{"get", "patch", "update", "delete"}
-
-// namespacedCollectionVerbs are the verbs checked once per unique namespace across all resources in a GVR.
-// These verbs operate at the resource type level (collection) and cannot be restricted by resourceNames.
-// The "create" verb is included here because it operates on the collection level - you can't specify
-// resourceNames for create operations since the resource doesn't exist yet.
-var namespacedCollectionVerbs = []string{"create"}
-
-type RBACPreAuthorizerOption func(*rbacPreAuthorizer)
-
-// WithClusterCollectionVerbs configures cluster-scoped collection verbs (e.g. list, watch)
-// that are checked in addition to object and namespaced collection verbs.
-func WithClusterCollectionVerbs(verbs ...string) RBACPreAuthorizerOption {
- return func(a *rbacPreAuthorizer) {
- a.clusterCollectionVerbs = slices.Clone(verbs)
- }
-}
-
-type rbacPreAuthorizer struct {
- authorizer authorizer.Authorizer
- ruleResolver validation.AuthorizationRuleResolver
- restMapper meta.RESTMapper
- clusterCollectionVerbs []string
-}
-
-func NewRBACPreAuthorizer(cl client.Client, opts ...RBACPreAuthorizerOption) PreAuthorizer {
- a := &rbacPreAuthorizer{
- authorizer: newRBACAuthorizer(cl),
- ruleResolver: newRBACRulesResolver(cl),
- restMapper: cl.RESTMapper(),
- }
- for _, opt := range opts {
- opt(a)
- }
- return a
-}
-
-func (a *rbacPreAuthorizer) PreAuthorize(ctx context.Context, user user.Info, manifestReader io.Reader, additionalRequiredPerms ...UserAuthorizerAttributesFactory) ([]ScopedPolicyRules, error) {
- dm, err := a.decodeManifest(manifestReader)
- if err != nil {
- return nil, err
- }
-
- // derive manifest related attributes records
- attributesRecords := dm.asAuthorizationAttributesRecordsForUser(user, a.clusterCollectionVerbs, namespacedCollectionVerbs)
-
- // append additional required perms
- for _, fn := range additionalRequiredPerms {
- attributesRecords = append(attributesRecords, fn(user)...)
- }
-
- var preAuthEvaluationErrors []error
- missingRules, err := a.authorizeAttributesRecords(ctx, attributesRecords)
- if err != nil {
- preAuthEvaluationErrors = append(preAuthEvaluationErrors, err)
- }
-
- ec := a.escalationCheckerFor(dm)
-
- var parseErrors []error
- for _, obj := range dm.rbacObjects() {
- if err := ec.checkEscalation(ctx, user, obj); err != nil {
- result, err := parseEscalationErrorForMissingRules(err)
- missingRules[obj.GetNamespace()] = append(missingRules[obj.GetNamespace()], result.MissingRules...)
- preAuthEvaluationErrors = append(preAuthEvaluationErrors, result.ResolutionErrors)
- parseErrors = append(parseErrors, err)
- }
- }
- allMissingPolicyRules := make([]ScopedPolicyRules, 0, len(missingRules))
-
- for ns, nsMissingRules := range missingRules {
- // NOTE: Although CompactRules is defined to return an error, its current implementation
- // never produces a non-nil error. This is because all operations within the function are
- // designed to succeed under current conditions. In the future, if more complex rule validations
- // are introduced, this behavior may change and proper error handling will be required.
- if compactMissingRules, err := validation.CompactRules(nsMissingRules); err == nil {
- missingRules[ns] = compactMissingRules
- }
-
- missingRulesWithDeduplicatedVerbs := make([]rbacv1.PolicyRule, 0, len(missingRules[ns]))
- for _, rule := range missingRules[ns] {
- verbSet := sets.New[string](rule.Verbs...)
- if verbSet.Has("*") {
- rule.Verbs = []string{"*"}
- } else {
- rule.Verbs = sets.List(verbSet)
- }
- missingRulesWithDeduplicatedVerbs = append(missingRulesWithDeduplicatedVerbs, rule)
- }
-
- sortableRules := rbacv1helpers.SortableRuleSlice(missingRulesWithDeduplicatedVerbs)
-
- sort.Sort(sortableRules)
- allMissingPolicyRules = append(allMissingPolicyRules, ScopedPolicyRules{Namespace: ns, MissingRules: sortableRules})
- }
-
- // sort allMissingPolicyRules alphabetically by namespace
- slices.SortFunc(allMissingPolicyRules, func(a, b ScopedPolicyRules) int {
- return strings.Compare(a.Namespace, b.Namespace)
- })
-
- var errs []error
- if parseErr := errors.Join(parseErrors...); parseErr != nil {
- errs = append(errs, fmt.Errorf("failed to parse escalation check error strings: %v", parseErr))
- }
- if preAuthEvaluationErrors := errors.Join(preAuthEvaluationErrors...); preAuthEvaluationErrors != nil {
- errs = append(errs, fmt.Errorf("failed to resolve or evaluate permissions: %v", preAuthEvaluationErrors))
- }
- if len(errs) > 0 {
- return allMissingPolicyRules, fmt.Errorf("missing rules may be incomplete: %w", errors.Join(errs...))
- }
- return allMissingPolicyRules, nil
-}
-
-func (a *rbacPreAuthorizer) escalationCheckerFor(dm *decodedManifest) escalationChecker {
- ec := escalationChecker{
- authorizer: a.authorizer,
- ruleResolver: a.ruleResolver,
- extraClusterRoles: dm.clusterRoles,
- extraRoles: dm.roles,
- }
- return ec
-}
-
-func (a *rbacPreAuthorizer) decodeManifest(manifestReader io.Reader) (*decodedManifest, error) {
- dm := &decodedManifest{
- gvrs: map[schema.GroupVersionResource][]types.NamespacedName{},
- clusterRoles: map[client.ObjectKey]rbacv1.ClusterRole{},
- roles: map[client.ObjectKey]rbacv1.Role{},
- clusterRoleBindings: map[client.ObjectKey]rbacv1.ClusterRoleBinding{},
- roleBindings: map[client.ObjectKey]rbacv1.RoleBinding{},
- }
- var (
- i int
- errs []error
- decoder = apimachyaml.NewYAMLOrJSONDecoder(manifestReader, 1024)
- )
- for {
- var uObj unstructured.Unstructured
- err := decoder.Decode(&uObj)
- if errors.Is(err, io.EOF) {
- break
- }
- if err != nil {
- errs = append(errs, fmt.Errorf("could not decode object %d in manifest: %w", i, err))
- continue
- }
- gvk := uObj.GroupVersionKind()
- restMapping, err := a.restMapper.RESTMapping(gvk.GroupKind(), gvk.Version)
- if err != nil {
- var objName string
- if name := uObj.GetName(); name != "" {
- objName = fmt.Sprintf(" (name: %s)", name)
- }
-
- errs = append(
- errs,
- fmt.Errorf("could not get REST mapping for object %d in manifest with GVK %s%s: %w", i, gvk, objName, err),
- )
- continue
- }
-
- gvr := restMapping.Resource
- dm.gvrs[gvr] = append(dm.gvrs[gvr], client.ObjectKeyFromObject(&uObj))
-
- switch restMapping.Resource.GroupResource() {
- case schema.GroupResource{Group: rbacv1.GroupName, Resource: "clusterroles"}:
- obj := &rbacv1.ClusterRole{}
- if err := runtime.DefaultUnstructuredConverter.FromUnstructured(uObj.UnstructuredContent(), obj); err != nil {
- errs = append(errs, fmt.Errorf("could not decode object %d in manifest as ClusterRole: %w", i, err))
- continue
- }
- dm.clusterRoles[client.ObjectKeyFromObject(obj)] = *obj
- case schema.GroupResource{Group: rbacv1.GroupName, Resource: "clusterrolebindings"}:
- obj := &rbacv1.ClusterRoleBinding{}
- if err := runtime.DefaultUnstructuredConverter.FromUnstructured(uObj.UnstructuredContent(), obj); err != nil {
- errs = append(errs, fmt.Errorf("could not decode object %d in manifest as ClusterRoleBinding: %w", i, err))
- continue
- }
- dm.clusterRoleBindings[client.ObjectKeyFromObject(obj)] = *obj
- case schema.GroupResource{Group: rbacv1.GroupName, Resource: "roles"}:
- obj := &rbacv1.Role{}
- if err := runtime.DefaultUnstructuredConverter.FromUnstructured(uObj.UnstructuredContent(), obj); err != nil {
- errs = append(errs, fmt.Errorf("could not decode object %d in manifest as Role: %w", i, err))
- continue
- }
- dm.roles[client.ObjectKeyFromObject(obj)] = *obj
- case schema.GroupResource{Group: rbacv1.GroupName, Resource: "rolebindings"}:
- obj := &rbacv1.RoleBinding{}
- if err := runtime.DefaultUnstructuredConverter.FromUnstructured(uObj.UnstructuredContent(), obj); err != nil {
- errs = append(errs, fmt.Errorf("could not decode object %d in manifest as RoleBinding: %w", i, err))
- continue
- }
- dm.roleBindings[client.ObjectKeyFromObject(obj)] = *obj
- }
- }
- if len(errs) > 0 {
- return nil, errors.Join(errs...)
- }
- return dm, nil
-}
-
-func (a *rbacPreAuthorizer) authorizeAttributesRecords(ctx context.Context, attributesRecords []authorizer.AttributesRecord) (map[string][]rbacv1.PolicyRule, error) {
- var (
- missingRules = map[string][]rbacv1.PolicyRule{}
- errs []error
- )
- for _, ar := range attributesRecords {
- allow, err := a.attributesAllowed(ctx, ar)
- if err != nil {
- errs = append(errs, err)
- continue
- }
- if !allow {
- missingRules[ar.Namespace] = append(missingRules[ar.Namespace], policyRuleFromAttributesRecord(ar))
- }
- }
- return missingRules, errors.Join(errs...)
-}
-
-func (a *rbacPreAuthorizer) attributesAllowed(ctx context.Context, attributesRecord authorizer.AttributesRecord) (bool, error) {
- decision, reason, err := a.authorizer.Authorize(ctx, attributesRecord)
- if err != nil {
- if reason != "" {
- return false, fmt.Errorf("%s: %w", reason, err)
- }
- return false, err
- }
- return decision == authorizer.DecisionAllow, nil
-}
-
-func policyRuleFromAttributesRecord(attributesRecord authorizer.AttributesRecord) rbacv1.PolicyRule {
- pr := rbacv1.PolicyRule{}
- if attributesRecord.Verb != "" {
- pr.Verbs = []string{attributesRecord.Verb}
- }
- if !attributesRecord.ResourceRequest {
- pr.NonResourceURLs = []string{attributesRecord.Path}
- return pr
- }
-
- pr.APIGroups = []string{attributesRecord.APIGroup}
- if attributesRecord.Name != "" {
- pr.ResourceNames = []string{attributesRecord.Name}
- }
-
- r := attributesRecord.Resource
- if attributesRecord.Subresource != "" {
- r += "/" + attributesRecord.Subresource
- }
- pr.Resources = []string{r}
-
- return pr
-}
-
-type decodedManifest struct {
- gvrs map[schema.GroupVersionResource][]types.NamespacedName
- clusterRoles map[client.ObjectKey]rbacv1.ClusterRole
- roles map[client.ObjectKey]rbacv1.Role
- clusterRoleBindings map[client.ObjectKey]rbacv1.ClusterRoleBinding
- roleBindings map[client.ObjectKey]rbacv1.RoleBinding
-}
-
-func (dm *decodedManifest) rbacObjects() []client.Object {
- objects := make([]client.Object, 0, len(dm.clusterRoles)+len(dm.roles)+len(dm.clusterRoleBindings)+len(dm.roleBindings))
- for obj := range maps.Values(dm.clusterRoles) {
- objects = append(objects, &obj)
- }
- for obj := range maps.Values(dm.roles) {
- objects = append(objects, &obj)
- }
- for obj := range maps.Values(dm.clusterRoleBindings) {
- objects = append(objects, &obj)
- }
- for obj := range maps.Values(dm.roleBindings) {
- objects = append(objects, &obj)
- }
- return objects
-}
-
-func (dm *decodedManifest) asAuthorizationAttributesRecordsForUser(manifestManager user.Info, clusterCollectionVerbs, namespacedCollectionVerbs []string) []authorizer.AttributesRecord {
- // Calculate initial capacity as an upper-bound estimate:
- // - For each key: len(objectVerbs) records (4)
- // - For unique namespaces: len(namespacedCollectionVerbs) records (1 per unique namespace across all keys in a GVR)
- // We use totalKeys as upper bound (worst case: each key in different namespace)
- // - For each GVR: len(clusterCollectionVerbs) records (2)
- totalKeys := 0
- for _, keys := range dm.gvrs {
- totalKeys += len(keys)
- }
- estimatedCapacity := totalKeys*len(objectVerbs) + totalKeys*len(namespacedCollectionVerbs) + len(dm.gvrs)*len(clusterCollectionVerbs)
- attributeRecords := make([]authorizer.AttributesRecord, 0, estimatedCapacity)
-
- for gvr, keys := range dm.gvrs {
- namespaces := sets.New[string]()
- for _, k := range keys {
- namespaces.Insert(k.Namespace)
- // generate records for object-specific verbs (get, update, patch, delete) in their respective namespaces
- for _, v := range objectVerbs {
- attributeRecords = append(attributeRecords, authorizer.AttributesRecord{
- User: manifestManager,
- Namespace: k.Namespace,
- Name: k.Name,
- APIGroup: gvr.Group,
- APIVersion: gvr.Version,
- Resource: gvr.Resource,
- ResourceRequest: true,
- Verb: v,
- })
- }
- }
- // generate records for namespaced collection verbs (create) for each relevant namespace
- for _, ns := range sets.List(namespaces) {
- for _, v := range namespacedCollectionVerbs {
- attributeRecords = append(attributeRecords, authorizer.AttributesRecord{
- User: manifestManager,
- Namespace: ns,
- APIGroup: gvr.Group,
- APIVersion: gvr.Version,
- Resource: gvr.Resource,
- ResourceRequest: true,
- Verb: v,
- })
- }
- }
- // generate records for cluster-scoped collection verbs (e.g. list, watch)
- for _, v := range clusterCollectionVerbs {
- attributeRecords = append(attributeRecords, authorizer.AttributesRecord{
- User: manifestManager,
- Namespace: corev1.NamespaceAll, // check cluster scope
- APIGroup: gvr.Group,
- APIVersion: gvr.Version,
- Resource: gvr.Resource,
- ResourceRequest: true,
- Verb: v,
- })
- }
- }
- return attributeRecords
-}
-
-func newRBACAuthorizer(cl client.Client) authorizer.Authorizer {
- rg := &rbacGetter{cl: cl}
- return rbac.New(rg, rg, rg, rg)
-}
-
-type rbacGetter struct {
- cl client.Client
-}
-
-func (r rbacGetter) ListClusterRoleBindings(ctx context.Context) ([]*rbacv1.ClusterRoleBinding, error) {
- var clusterRoleBindingsList rbacv1.ClusterRoleBindingList
- if err := r.cl.List(ctx, &clusterRoleBindingsList); err != nil {
- return nil, err
- }
- return toPtrSlice(clusterRoleBindingsList.Items), nil
-}
-
-func (r rbacGetter) GetClusterRole(ctx context.Context, name string) (*rbacv1.ClusterRole, error) {
- var clusterRole rbacv1.ClusterRole
- if err := r.cl.Get(ctx, client.ObjectKey{Name: name}, &clusterRole); err != nil {
- return nil, err
- }
- return &clusterRole, nil
-}
-
-func (r rbacGetter) ListRoleBindings(ctx context.Context, namespace string) ([]*rbacv1.RoleBinding, error) {
- var roleBindingsList rbacv1.RoleBindingList
- if err := r.cl.List(ctx, &roleBindingsList, client.InNamespace(namespace)); err != nil {
- return nil, err
- }
- return toPtrSlice(roleBindingsList.Items), nil
-}
-
-func (r rbacGetter) GetRole(ctx context.Context, namespace, name string) (*rbacv1.Role, error) {
- var role rbacv1.Role
- if err := r.cl.Get(ctx, client.ObjectKey{Name: name, Namespace: namespace}, &role); err != nil {
- return nil, err
- }
- return &role, nil
-}
-
-func newRBACRulesResolver(cl client.Client) validation.AuthorizationRuleResolver {
- rg := &rbacGetter{cl: cl}
- return validation.NewDefaultRuleResolver(rg, rg, rg, rg)
-}
-
-type escalationChecker struct {
- authorizer authorizer.Authorizer
- ruleResolver validation.AuthorizationRuleResolver
- extraRoles map[types.NamespacedName]rbacv1.Role
- extraClusterRoles map[types.NamespacedName]rbacv1.ClusterRole
-}
-
-func (ec *escalationChecker) checkEscalation(ctx context.Context, manifestManager user.Info, obj client.Object) error {
- ctx = request.WithUser(request.WithNamespace(ctx, obj.GetNamespace()), manifestManager)
- switch v := obj.(type) {
- case *rbacv1.Role:
- ctx = request.WithRequestInfo(ctx, &request.RequestInfo{APIGroup: rbacv1.GroupName, Resource: "roles", IsResourceRequest: true})
- return ec.checkRoleEscalation(ctx, v)
- case *rbacv1.RoleBinding:
- ctx = request.WithRequestInfo(ctx, &request.RequestInfo{APIGroup: rbacv1.GroupName, Resource: "rolebindings", IsResourceRequest: true})
- return ec.checkRoleBindingEscalation(ctx, v)
- case *rbacv1.ClusterRole:
- ctx = request.WithRequestInfo(ctx, &request.RequestInfo{APIGroup: rbacv1.GroupName, Resource: "clusterroles", IsResourceRequest: true})
- return ec.checkClusterRoleEscalation(ctx, v)
- case *rbacv1.ClusterRoleBinding:
- ctx = request.WithRequestInfo(ctx, &request.RequestInfo{APIGroup: rbacv1.GroupName, Resource: "clusterrolebindings", IsResourceRequest: true})
- return ec.checkClusterRoleBindingEscalation(ctx, v)
- default:
- return fmt.Errorf("unknown object type %T", v)
- }
-}
-
-func (ec *escalationChecker) checkClusterRoleEscalation(ctx context.Context, clusterRole *rbacv1.ClusterRole) error {
- if rbacregistry.EscalationAllowed(ctx) || rbacregistry.RoleEscalationAuthorized(ctx, ec.authorizer) {
- return nil
- }
-
- // to set the aggregation rule, since it can gather anything, requires * on *.*
- if hasAggregationRule(clusterRole) {
- if err := validation.ConfirmNoEscalation(ctx, ec.ruleResolver, fullAuthority); err != nil {
- return fmt.Errorf("must have cluster-admin privileges to use an aggregationRule: %w", err)
- }
- }
-
- if err := validation.ConfirmNoEscalation(ctx, ec.ruleResolver, clusterRole.Rules); err != nil {
- return err
- }
- return nil
-}
-
-func (ec *escalationChecker) checkClusterRoleBindingEscalation(ctx context.Context, clusterRoleBinding *rbacv1.ClusterRoleBinding) error {
- if rbacregistry.EscalationAllowed(ctx) {
- return nil
- }
-
- roleRef := rbacinternal.RoleRef{}
- err := rbacv1helpers.Convert_v1_RoleRef_To_rbac_RoleRef(&clusterRoleBinding.RoleRef, &roleRef, nil)
- if err != nil {
- return err
- }
-
- if rbacregistry.BindingAuthorized(ctx, roleRef, metav1.NamespaceNone, ec.authorizer) {
- return nil
- }
-
- rules, err := ec.ruleResolver.GetRoleReferenceRules(ctx, clusterRoleBinding.RoleRef, metav1.NamespaceNone)
- if err != nil && !apierrors.IsNotFound(err) {
- return err
- }
-
- if clusterRoleBinding.RoleRef.Kind == "ClusterRole" {
- if manifestClusterRole, ok := ec.extraClusterRoles[types.NamespacedName{Name: clusterRoleBinding.RoleRef.Name}]; ok {
- rules = append(rules, manifestClusterRole.Rules...)
- }
- }
-
- if err := validation.ConfirmNoEscalation(ctx, ec.ruleResolver, rules); err != nil {
- return err
- }
- return nil
-}
-
-func (ec *escalationChecker) checkRoleEscalation(ctx context.Context, role *rbacv1.Role) error {
- if rbacregistry.EscalationAllowed(ctx) || rbacregistry.RoleEscalationAuthorized(ctx, ec.authorizer) {
- return nil
- }
-
- rules := role.Rules
- if err := validation.ConfirmNoEscalation(ctx, ec.ruleResolver, rules); err != nil {
- return err
- }
- return nil
-}
-
-func (ec *escalationChecker) checkRoleBindingEscalation(ctx context.Context, roleBinding *rbacv1.RoleBinding) error {
- if rbacregistry.EscalationAllowed(ctx) {
- return nil
- }
-
- roleRef := rbacinternal.RoleRef{}
- err := rbacv1helpers.Convert_v1_RoleRef_To_rbac_RoleRef(&roleBinding.RoleRef, &roleRef, nil)
- if err != nil {
- return err
- }
- if rbacregistry.BindingAuthorized(ctx, roleRef, roleBinding.Namespace, ec.authorizer) {
- return nil
- }
-
- rules, err := ec.ruleResolver.GetRoleReferenceRules(ctx, roleBinding.RoleRef, roleBinding.Namespace)
- if err != nil && !apierrors.IsNotFound(err) {
- return err
- }
-
- switch roleRef.Kind {
- case "ClusterRole":
- if manifestClusterRole, ok := ec.extraClusterRoles[types.NamespacedName{Name: roleBinding.RoleRef.Name}]; ok {
- rules = append(rules, manifestClusterRole.Rules...)
- }
- case "Role":
- if manifestRole, ok := ec.extraRoles[types.NamespacedName{Namespace: roleBinding.Namespace, Name: roleBinding.RoleRef.Name}]; ok {
- rules = append(rules, manifestRole.Rules...)
- }
- }
-
- if err := validation.ConfirmNoEscalation(ctx, ec.ruleResolver, rules); err != nil {
- return err
- }
- return nil
-}
-
-var fullAuthority = []rbacv1.PolicyRule{
- {Verbs: []string{"*"}, APIGroups: []string{"*"}, Resources: []string{"*"}},
- {Verbs: []string{"*"}, NonResourceURLs: []string{"*"}},
-}
-
-var (
- errRegex = regexp.MustCompile(`(?s)^user ".*" \(groups=.*\) is attempting to grant RBAC permissions not currently held:\n([^;]+)(?:; resolution errors: (.*))?$`)
- ruleRegex = regexp.MustCompile(`{([^}]*)}`)
- itemRegex = regexp.MustCompile(`"[^"]*"`)
-)
-
-type parseResult struct {
- MissingRules []rbacv1.PolicyRule
- ResolutionErrors error
-}
-
-// TODO: Investigate replacing this regex parsing with structured error handling once there are
-//
-// structured RBAC errors introduced by https://github.com/kubernetes/kubernetes/pull/130955.
-//
-// parseEscalationErrorForMissingRules attempts to extract specific RBAC permissions
-// that were denied due to escalation prevention from a given error's text.
-// It returns the list of extracted PolicyRules and an error detailing the escalation attempt
-// and any resolution errors found.
-// Note: If parsing is successful, the returned error is derived from the *input* error's
-// message, not an error encountered during the parsing process itself. If parsing fails due to an unexpected
-// error format, a distinct parsing error is returned.
-func parseEscalationErrorForMissingRules(ecError error) (*parseResult, error) {
- var (
- result = &parseResult{}
- parseErrors []error
- )
-
- // errRegex captures the missing permissions and optionally resolution errors from an escalation error message
- // Group 1: The list of missing permissions
- // Group 2: Optional resolution errors
- errString := ecError.Error()
- errMatches := errRegex.FindStringSubmatch(errString) // Use FindStringSubmatch for single match expected
-
- // Check if the main error message pattern was matched and captured the required groups
- // We expect at least 3 elements: full match, missing permissions, resolution errors (can be empty)
- if len(errMatches) != 3 {
- // The error format doesn't match the expected pattern for escalation errors
- return &parseResult{}, fmt.Errorf("unexpected format of escalation check error string: %q", errString)
- }
- missingPermissionsStr := errMatches[1]
- if resolutionErrorsStr := errMatches[2]; resolutionErrorsStr != "" {
- result.ResolutionErrors = errors.New(resolutionErrorsStr)
- }
-
- // Extract permissions using permRegex from the captured permissions string (Group 1)
- for _, rule := range ruleRegex.FindAllString(missingPermissionsStr, -1) {
- pr, err := parseCompactRuleString(rule)
- if err != nil {
- parseErrors = append(parseErrors, err)
- continue
- }
- result.MissingRules = append(result.MissingRules, *pr)
- }
- // Return the extracted permissions and the constructed error message
- return result, errors.Join(parseErrors...)
-}
-
-func parseCompactRuleString(rule string) (*rbacv1.PolicyRule, error) {
- var fields []string
- if ruleText := rule[1 : len(rule)-1]; ruleText != "" {
- fields = mapSlice(strings.Split(ruleText, ","), func(in string) string {
- return strings.TrimSpace(in)
- })
- }
- var pr rbacv1.PolicyRule
- for _, item := range fields {
- field, valuesStr, ok := strings.Cut(item, ":")
- if !ok {
- return nil, fmt.Errorf("unexpected item %q: expected :[...]", item)
- }
- values := mapSlice(itemRegex.FindAllString(valuesStr, -1), func(in string) string {
- return strings.Trim(in, `"`)
- })
- switch field {
- case "APIGroups":
- pr.APIGroups = values
- case "Resources":
- pr.Resources = values
- case "ResourceNames":
- pr.ResourceNames = values
- case "NonResourceURLs":
- pr.NonResourceURLs = values
- case "Verbs":
- pr.Verbs = values
- default:
- return nil, fmt.Errorf("unexpected item %q: unknown field: %q", item, field)
- }
- }
- return &pr, nil
-}
-
-func hasAggregationRule(clusterRole *rbacv1.ClusterRole) bool {
- // Currently, an aggregation rule is considered present only if it has one or more selectors.
- // An empty slice of ClusterRoleSelectors means no selectors were provided,
- // which does NOT imply "match all."
- return clusterRole.AggregationRule != nil && len(clusterRole.AggregationRule.ClusterRoleSelectors) > 0
-}
-
-func mapSlice[I, O any](in []I, f func(I) O) []O {
- out := make([]O, len(in))
- for i := range in {
- out[i] = f(in[i])
- }
- return out
-}
-
-func toPtrSlice[V any](in []V) []*V {
- out := make([]*V, len(in))
- for i := range in {
- out[i] = &in[i]
- }
- return out
-}
diff --git a/internal/operator-controller/authorization/rbac_test.go b/internal/operator-controller/authorization/rbac_test.go
deleted file mode 100644
index fffcba64a0..0000000000
--- a/internal/operator-controller/authorization/rbac_test.go
+++ /dev/null
@@ -1,882 +0,0 @@
-package authorization
-
-import (
- "context"
- "errors"
- "fmt"
- "strings"
- "testing"
-
- "github.com/stretchr/testify/require"
- corev1 "k8s.io/api/core/v1"
- rbacv1 "k8s.io/api/rbac/v1"
- "k8s.io/apimachinery/pkg/api/meta/testrestmapper"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apiserver/pkg/authentication/user"
- "k8s.io/apiserver/pkg/authorization/authorizer"
- "k8s.io/apiserver/pkg/endpoints/request"
- "k8s.io/kubernetes/pkg/registry/rbac/validation"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/client/fake"
-)
-
-var (
- testManifest = `apiVersion: v1
-kind: Service
-metadata:
- name: test-service
- namespace: test-namespace
-spec:
- clusterIP: None
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: Role
-metadata:
- name: test-extension-role
- namespace: test-namespace
-rules:
-- apiGroups: ["*"]
- resources: [serviceaccounts]
- verbs: [watch]
-- apiGroups: ["*"]
- resources: [certificates]
- verbs: [create]
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: RoleBinding
-metadata:
- name: test-extension-binding
- namespace: test-namespace
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: test-extension-role
-subjects:
-- kind: ServiceAccount
- name: test-serviceaccount
- namespace: test-namespace
- `
-
- testManifestMultiNamespace = `apiVersion: v1
-kind: Service
-metadata:
- name: test-service
- namespace: test-namespace
-spec:
- clusterIP: None
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: Role
-metadata:
- name: test-extension-role
- namespace: test-namespace
-rules:
-- apiGroups: ["*"]
- resources: [serviceaccounts]
- verbs: [watch]
-- apiGroups: ["*"]
- resources: [certificates]
- verbs: [create]
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: RoleBinding
-metadata:
- name: test-extension-binding
- namespace: test-namespace
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: test-extension-role
-subjects:
-- kind: ServiceAccount
- name: test-serviceaccount
- namespace: test-namespace
----
-kind: Service
-metadata:
- name: test-service
- namespace: a-test-namespace
-spec:
- clusterIP: None
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: Role
-metadata:
- name: test-extension-role
- namespace: a-test-namespace
-rules:
-- apiGroups: ["*"]
- resources: [serviceaccounts]
- verbs: [watch]
-- apiGroups: ["*"]
- resources: [certificates]
- verbs: [create]
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: RoleBinding
-metadata:
- name: test-extension-binding
- namespace: a-test-namespace
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: test-extension-role
-subjects:
-- kind: ServiceAccount
- name: test-serviceaccount
- namespace: a-test-namespace
- `
-
- saName = "test-serviceaccount"
- ns = "test-namespace"
- testUser = &user.DefaultInfo{Name: fmt.Sprintf("system:serviceaccount:%s:%s", ns, saName)}
-
- objects = []client.Object{
- &corev1.Namespace{
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-namespace",
- },
- },
- &rbacv1.ClusterRoleBinding{
- ObjectMeta: metav1.ObjectMeta{
- Name: "admin-clusterrole-binding",
- },
- Subjects: []rbacv1.Subject{
- {
- Kind: "ServiceAccount",
- Name: saName,
- Namespace: ns,
- },
- },
- RoleRef: rbacv1.RoleRef{
- Name: "admin-clusterrole",
- Kind: "ClusterRole",
- },
- },
- &corev1.ServiceAccount{
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-serviceaccount",
- Namespace: "test-namespace",
- },
- },
- }
-
- privilegedClusterRole = &rbacv1.ClusterRole{
- ObjectMeta: metav1.ObjectMeta{
- Name: "admin-clusterrole",
- },
- Rules: []rbacv1.PolicyRule{
- {
- APIGroups: []string{"*"},
- Resources: []string{"*"},
- Verbs: []string{"*"},
- },
- },
- }
-
- limitedClusterRole = &rbacv1.ClusterRole{
- ObjectMeta: metav1.ObjectMeta{
- Name: "admin-clusterrole",
- },
- Rules: []rbacv1.PolicyRule{
- {
- APIGroups: []string{""},
- Resources: []string{""},
- Verbs: []string{""},
- },
- },
- }
-
- escalatingClusterRole = &rbacv1.ClusterRole{
- ObjectMeta: metav1.ObjectMeta{
- Name: "admin-clusterrole",
- },
- Rules: []rbacv1.PolicyRule{
- {
- APIGroups: []string{"*"},
- Resources: []string{"serviceaccounts", "services"},
- Verbs: []string{"*"},
- },
- {
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"roles", "clusterroles", "rolebindings", "clusterrolebindings"},
- Verbs: []string{"get", "patch", "watch", "list", "create", "update", "delete", "escalate", "bind"},
- },
- },
- }
-
- expectedSingleNamespaceMissingRules = []ScopedPolicyRules{
- {
- Namespace: "",
- MissingRules: []rbacv1.PolicyRule{
- {
- Verbs: []string{"list", "watch"},
- APIGroups: []string{""},
- Resources: []string{"services"},
- ResourceNames: []string(nil),
- NonResourceURLs: []string(nil)},
- {
- Verbs: []string{"list", "watch"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"rolebindings"},
- ResourceNames: []string(nil),
- NonResourceURLs: []string(nil)},
- {
- Verbs: []string{"list", "watch"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"roles"},
- ResourceNames: []string(nil),
- NonResourceURLs: []string(nil),
- },
- },
- },
- {
- Namespace: "test-namespace",
- MissingRules: []rbacv1.PolicyRule{
- {
- Verbs: []string{"create"},
- APIGroups: []string{"*"},
- Resources: []string{"certificates"}},
- {
- Verbs: []string{"create"},
- APIGroups: []string{""},
- Resources: []string{"services"}},
- {
- Verbs: []string{"create"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"rolebindings"}},
- {
- Verbs: []string{"create"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"roles"}},
- {
- Verbs: []string{"delete", "get", "patch", "update"},
- APIGroups: []string{""},
- Resources: []string{"services"},
- ResourceNames: []string{"test-service"}},
- {
- Verbs: []string{"delete", "get", "patch", "update"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"rolebindings"},
- ResourceNames: []string{"test-extension-binding"}},
- {
- Verbs: []string{"delete", "get", "patch", "update"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"roles"},
- ResourceNames: []string{"test-extension-role"}},
- {
- Verbs: []string{"watch"},
- APIGroups: []string{"*"},
- Resources: []string{"serviceaccounts"},
- },
- },
- },
- }
-
- expectedMultiNamespaceMissingRules = []ScopedPolicyRules{
- {
- Namespace: "",
- MissingRules: []rbacv1.PolicyRule{
- {
- Verbs: []string{"list", "watch"},
- APIGroups: []string{""},
- Resources: []string{"services"},
- ResourceNames: []string(nil),
- NonResourceURLs: []string(nil)},
- {
- Verbs: []string{"list", "watch"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"rolebindings"},
- ResourceNames: []string(nil),
- NonResourceURLs: []string(nil)},
- {
- Verbs: []string{"list", "watch"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"roles"},
- ResourceNames: []string(nil),
- NonResourceURLs: []string(nil),
- },
- },
- },
- {
- Namespace: "a-test-namespace",
- MissingRules: []rbacv1.PolicyRule{
- {
- Verbs: []string{"create"},
- APIGroups: []string{"*"},
- Resources: []string{"certificates"}},
- {
- Verbs: []string{"create"},
- APIGroups: []string{""},
- Resources: []string{"services"}},
- {
- Verbs: []string{"create"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"rolebindings"}},
- {
- Verbs: []string{"create"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"roles"}},
- {
- Verbs: []string{"delete", "get", "patch", "update"},
- APIGroups: []string{""},
- Resources: []string{"services"},
- ResourceNames: []string{"test-service"}},
- {
- Verbs: []string{"delete", "get", "patch", "update"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"rolebindings"},
- ResourceNames: []string{"test-extension-binding"}},
- {
- Verbs: []string{"delete", "get", "patch", "update"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"roles"},
- ResourceNames: []string{"test-extension-role"}},
- {
- Verbs: []string{"watch"},
- APIGroups: []string{"*"},
- Resources: []string{"serviceaccounts"},
- },
- },
- },
- {
- Namespace: "test-namespace",
- MissingRules: []rbacv1.PolicyRule{
- {
- Verbs: []string{"create"},
- APIGroups: []string{"*"},
- Resources: []string{"certificates"}},
- {
- Verbs: []string{"create"},
- APIGroups: []string{""},
- Resources: []string{"services"}},
- {
- Verbs: []string{"create"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"rolebindings"}},
- {
- Verbs: []string{"create"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"roles"}},
- {
- Verbs: []string{"delete", "get", "patch", "update"},
- APIGroups: []string{""},
- Resources: []string{"services"},
- ResourceNames: []string{"test-service"}},
- {
- Verbs: []string{"delete", "get", "patch", "update"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"rolebindings"},
- ResourceNames: []string{"test-extension-binding"}},
- {
- Verbs: []string{"delete", "get", "patch", "update"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"roles"},
- ResourceNames: []string{"test-extension-role"}},
- {
- Verbs: []string{"watch"},
- APIGroups: []string{"*"},
- Resources: []string{"serviceaccounts"},
- },
- },
- },
- }
-)
-
-func setupFakeClient(role client.Object) client.Client {
- s := runtime.NewScheme()
- _ = corev1.AddToScheme(s)
- _ = rbacv1.AddToScheme(s)
- restMapper := testrestmapper.TestOnlyStaticRESTMapper(s)
- fakeClientBuilder := fake.NewClientBuilder().WithObjects(append(objects, role)...).WithRESTMapper(restMapper)
- return fakeClientBuilder.Build()
-}
-
-func TestPreAuthorize_Success(t *testing.T) {
- t.Run("preauthorize succeeds with no missing rbac rules", func(t *testing.T) {
- fakeClient := setupFakeClient(privilegedClusterRole)
- preAuth := NewRBACPreAuthorizer(fakeClient, WithClusterCollectionVerbs("list", "watch"))
- missingRules, err := preAuth.PreAuthorize(context.TODO(), testUser, strings.NewReader(testManifest))
- require.NoError(t, err)
- require.Equal(t, []ScopedPolicyRules{}, missingRules)
- })
-}
-
-func TestPreAuthorize_MissingRBAC(t *testing.T) {
- t.Run("preauthorize fails and finds missing rbac rules", func(t *testing.T) {
- fakeClient := setupFakeClient(limitedClusterRole)
- preAuth := NewRBACPreAuthorizer(fakeClient, WithClusterCollectionVerbs("list", "watch"))
- missingRules, err := preAuth.PreAuthorize(context.TODO(), testUser, strings.NewReader(testManifest))
- require.NoError(t, err)
- require.Equal(t, expectedSingleNamespaceMissingRules, missingRules)
- })
-}
-
-func TestPreAuthorizeMultiNamespace_MissingRBAC(t *testing.T) {
- t.Run("preauthorize fails and finds missing rbac rules in multiple namespaces", func(t *testing.T) {
- fakeClient := setupFakeClient(limitedClusterRole)
- preAuth := NewRBACPreAuthorizer(fakeClient, WithClusterCollectionVerbs("list", "watch"))
- missingRules, err := preAuth.PreAuthorize(context.TODO(), testUser, strings.NewReader(testManifestMultiNamespace))
- require.NoError(t, err)
- require.Equal(t, expectedMultiNamespaceMissingRules, missingRules)
- })
-}
-
-func TestPreAuthorize_CheckEscalation(t *testing.T) {
- t.Run("preauthorize succeeds with no missing rbac rules", func(t *testing.T) {
- fakeClient := setupFakeClient(escalatingClusterRole)
- preAuth := NewRBACPreAuthorizer(fakeClient, WithClusterCollectionVerbs("list", "watch"))
- missingRules, err := preAuth.PreAuthorize(context.TODO(), testUser, strings.NewReader(testManifest))
- require.NoError(t, err)
- require.Equal(t, []ScopedPolicyRules{}, missingRules)
- })
-}
-
-func TestPreAuthorize_AdditionalRequiredPerms_MissingRBAC(t *testing.T) {
- t.Run("preauthorize fails and finds missing rbac rules coming from the additional required permissions", func(t *testing.T) {
- fakeClient := setupFakeClient(escalatingClusterRole)
- preAuth := NewRBACPreAuthorizer(fakeClient, WithClusterCollectionVerbs("list", "watch"))
- missingRules, err := preAuth.PreAuthorize(context.TODO(), testUser, strings.NewReader(testManifest), func(user user.Info) []authorizer.AttributesRecord {
- return []authorizer.AttributesRecord{
- {
- User: user,
- Verb: "create",
- APIGroup: corev1.SchemeGroupVersion.Group,
- APIVersion: corev1.SchemeGroupVersion.Version,
- Resource: "pods",
- ResourceRequest: true,
- },
- }
- })
- require.NoError(t, err)
- require.Equal(t, []ScopedPolicyRules{
- {
- Namespace: "",
- MissingRules: []rbacv1.PolicyRule{
- {
- Verbs: []string{"create"},
- APIGroups: []string{""},
- Resources: []string{"pods"},
- },
- },
- },
- }, missingRules)
- })
-}
-
-func TestPreAuthorize_WithClusterCollectionVerbs(t *testing.T) {
- // expectedNamespacedMissingRules are the missing rules expected in the "test-namespace"
- // namespace regardless of cluster collection verb configuration. These come from object
- // verbs (get, patch, update, delete), namespaced collection verbs (create), and the
- // escalation check for the role/rolebinding in the manifest.
- expectedNamespacedMissingRules := ScopedPolicyRules{
- Namespace: "test-namespace",
- MissingRules: []rbacv1.PolicyRule{
- {
- Verbs: []string{"create"},
- APIGroups: []string{"*"},
- Resources: []string{"certificates"}},
- {
- Verbs: []string{"create"},
- APIGroups: []string{""},
- Resources: []string{"services"}},
- {
- Verbs: []string{"create"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"rolebindings"}},
- {
- Verbs: []string{"create"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"roles"}},
- {
- Verbs: []string{"delete", "get", "patch", "update"},
- APIGroups: []string{""},
- Resources: []string{"services"},
- ResourceNames: []string{"test-service"}},
- {
- Verbs: []string{"delete", "get", "patch", "update"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"rolebindings"},
- ResourceNames: []string{"test-extension-binding"}},
- {
- Verbs: []string{"delete", "get", "patch", "update"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"roles"},
- ResourceNames: []string{"test-extension-role"}},
- {
- Verbs: []string{"watch"},
- APIGroups: []string{"*"},
- Resources: []string{"serviceaccounts"},
- },
- },
- }
-
- t.Run("no cluster collection verbs option omits cluster-scoped collection rules", func(t *testing.T) {
- fakeClient := setupFakeClient(limitedClusterRole)
- preAuth := NewRBACPreAuthorizer(fakeClient)
- missingRules, err := preAuth.PreAuthorize(context.TODO(), testUser, strings.NewReader(testManifest))
- require.NoError(t, err)
- // With no cluster collection verbs, there should be no cluster-scoped (namespace="") missing rules
- require.Equal(t, []ScopedPolicyRules{expectedNamespacedMissingRules}, missingRules)
- })
-
- t.Run("cluster verbs option only checks those verbs at cluster scope", func(t *testing.T) {
- fakeClient := setupFakeClient(limitedClusterRole)
- preAuth := NewRBACPreAuthorizer(fakeClient, WithClusterCollectionVerbs("get", "patch", "update"))
- missingRules, err := preAuth.PreAuthorize(context.TODO(), testUser, strings.NewReader(testManifest))
- require.NoError(t, err)
- require.Equal(t, []ScopedPolicyRules{
- {
- Namespace: "",
- MissingRules: []rbacv1.PolicyRule{
- {
- Verbs: []string{"get", "patch", "update"},
- APIGroups: []string{""},
- Resources: []string{"services"},
- ResourceNames: []string(nil),
- NonResourceURLs: []string(nil)},
- {
- Verbs: []string{"get", "patch", "update"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"rolebindings"},
- ResourceNames: []string(nil),
- NonResourceURLs: []string(nil)},
- {
- Verbs: []string{"get", "patch", "update"},
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"roles"},
- ResourceNames: []string(nil),
- NonResourceURLs: []string(nil),
- },
- },
- },
- expectedNamespacedMissingRules,
- }, missingRules)
- })
-
- t.Run("privileged user with no cluster collection verbs succeeds", func(t *testing.T) {
- fakeClient := setupFakeClient(privilegedClusterRole)
- preAuth := NewRBACPreAuthorizer(fakeClient)
- missingRules, err := preAuth.PreAuthorize(context.TODO(), testUser, strings.NewReader(testManifest))
- require.NoError(t, err)
- require.Equal(t, []ScopedPolicyRules{}, missingRules)
- })
-}
-
-func TestPreAuthorize_NamespacedCollectionVerbs(t *testing.T) {
- // With namespacedCollectionVerbs now being a fixed variable (containing "create"),
- // this test verifies that "create" permissions are always checked at the namespace level.
-
- t.Run("create verb is always checked as namespaced collection verb", func(t *testing.T) {
- fakeClient := setupFakeClient(limitedClusterRole)
- preAuth := NewRBACPreAuthorizer(fakeClient, WithClusterCollectionVerbs("list", "watch"))
- missingRules, err := preAuth.PreAuthorize(context.TODO(), testUser, strings.NewReader(testManifest))
- require.NoError(t, err)
- // The "create" verb should always appear in missing rules because it's part of the
- // namespacedCollectionVerbs. This test verifies expectedSingleNamespaceMissingRules
- // which includes "create" verbs for namespace-scoped resources.
- require.Equal(t, expectedSingleNamespaceMissingRules, missingRules)
- })
-
- t.Run("privileged user with namespaced collection verbs succeeds", func(t *testing.T) {
- fakeClient := setupFakeClient(privilegedClusterRole)
- preAuth := NewRBACPreAuthorizer(fakeClient)
- missingRules, err := preAuth.PreAuthorize(context.TODO(), testUser, strings.NewReader(testManifest))
- require.NoError(t, err)
- require.Equal(t, []ScopedPolicyRules{}, missingRules)
- })
-}
-
-// TestParseEscalationErrorForMissingRules Are tests with respect to https://github.com/kubernetes/api/blob/e8d4d542f6a9a16a694bfc8e3b8cd1557eecfc9d/rbac/v1/types.go#L49-L74
-// Goal is: prove the regex works as planned AND that if the error messages ever change we'll learn about it with these tests
-func TestParseEscalationErrorForMissingRules_ParsingLogic(t *testing.T) {
- testCases := []struct {
- name string
- inputError error
- expectedResult *parseResult
- expectError require.ErrorAssertionFunc
- }{
- {
- name: "One Missing Resource Rule",
- inputError: errors.New(`user "test-user" (groups=["test"]) is attempting to grant RBAC permissions not currently held:
-{APIGroups:["apps"], Resources:["deployments"], Verbs:["get"]}`),
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{
- {APIGroups: []string{"apps"}, Resources: []string{"deployments"}, Verbs: []string{"get"}},
- },
- },
- expectError: require.NoError,
- },
- {
- name: "Multiple Missing Rules (Resource + NonResource)",
- inputError: errors.New(`user "sa" (groups=["system:authenticated"]) is attempting to grant RBAC permissions not currently held:
-{APIGroups:[""], Resources:["pods"], Verbs:["list" "watch"]}
-{NonResourceURLs:["/healthz"], Verbs:["get"]}`),
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{
- {APIGroups: []string{""}, Resources: []string{"pods"}, Verbs: []string{"list", "watch"}},
- {NonResourceURLs: []string{"/healthz"}, Verbs: []string{"get"}},
- },
- },
- expectError: require.NoError,
- },
- {
- name: "One Missing Rule with Resolution Errors",
- inputError: errors.New(`user "test-admin" (groups=["system:masters"]) is attempting to grant RBAC permissions not currently held:
-{APIGroups:["batch"], Resources:["jobs"], Verbs:["create"]}; resolution errors: [role "missing-role" not found]`),
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{
- {APIGroups: []string{"batch"}, Resources: []string{"jobs"}, Verbs: []string{"create"}},
- },
- ResolutionErrors: errors.New(`[role "missing-role" not found]`),
- },
- expectError: require.NoError,
- },
- {
- name: "Multiple Missing Rules with Resolution Errors",
- inputError: errors.New(`user "another-user" (groups=[]) is attempting to grant RBAC permissions not currently held:
-{APIGroups:[""], Resources:["secrets"], Verbs:["get"]}
-{APIGroups:[""], Resources:["configmaps"], Verbs:["list"]}; resolution errors: [clusterrole "missing-clusterrole" not found, role "other-missing" not found]`),
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{
- {APIGroups: []string{""}, Resources: []string{"secrets"}, Verbs: []string{"get"}},
- {APIGroups: []string{""}, Resources: []string{"configmaps"}, Verbs: []string{"list"}},
- },
- ResolutionErrors: errors.New(`[clusterrole "missing-clusterrole" not found, role "other-missing" not found]`),
- },
- expectError: require.NoError,
- },
- {
- name: "Missing Rule (All Resource Fields)",
- inputError: errors.New(`user "resource-name-user" (groups=["test"]) is attempting to grant RBAC permissions not currently held:
-{APIGroups:["extensions"], Resources:["ingresses"], ResourceNames:["my-ingress"], Verbs:["update" "patch"]}`),
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{
- {APIGroups: []string{"extensions"}, Resources: []string{"ingresses"}, ResourceNames: []string{"my-ingress"}, Verbs: []string{"update", "patch"}},
- },
- },
- expectError: require.NoError,
- },
- {
- name: "Missing Rule (No ResourceNames)",
- inputError: errors.New(`user "no-res-name-user" (groups=["test"]) is attempting to grant RBAC permissions not currently held:
-{APIGroups:["networking.k8s.io"], Resources:["networkpolicies"], Verbs:["watch"]}`),
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{
- {APIGroups: []string{"networking.k8s.io"}, Resources: []string{"networkpolicies"}, Verbs: []string{"watch"}},
- },
- },
- expectError: require.NoError,
- },
- {
- name: "Missing Rule (NonResourceURLs only)",
- inputError: errors.New(`user "url-user" (groups=["test"]) is attempting to grant RBAC permissions not currently held:
-{NonResourceURLs:["/version" "/apis"], Verbs:["get"]}`),
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{
- {NonResourceURLs: []string{"/version", "/apis"}, Verbs: []string{"get"}},
- },
- },
- expectError: require.NoError,
- },
- {
- name: "Unexpected Format",
- inputError: errors.New("some completely different error message that doesn't match"),
- expectedResult: &parseResult{},
- expectError: func(t require.TestingT, err error, i ...interface{}) {
- require.ErrorContains(t, err, "unexpected format of escalation check error string")
- },
- },
- {
- name: "Empty Permissions String",
- inputError: errors.New(`user "empty-perms" (groups=["test"]) is attempting to grant RBAC permissions not currently held:
-`),
- expectedResult: &parseResult{},
- expectError: func(t require.TestingT, err error, i ...interface{}) {
- require.ErrorContains(t, err, "unexpected format of escalation check error string")
- },
- },
- {
- name: "Rule with Empty Strings in lists",
- inputError: errors.New(`user "empty-strings" (groups=["test"]) is attempting to grant RBAC permissions not currently held:
-{APIGroups:["" "apps"], Resources:["" "deployments"], Verbs:["get" ""]}`),
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{
- {APIGroups: []string{"", "apps"}, Resources: []string{"", "deployments"}, Verbs: []string{"get", ""}},
- },
- },
- expectError: require.NoError,
- },
- {
- name: "Rule with Only Empty Verb",
- inputError: errors.New(`user "empty-verb" (groups=["test"]) is attempting to grant RBAC permissions not currently held:
-{APIGroups:[""], Resources:["pods"], Verbs:[""]}`),
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{
- {APIGroups: []string{""}, Resources: []string{"pods"}, Verbs: []string{""}},
- },
- },
- expectError: require.NoError,
- },
- {
- name: "Rule with no fields",
- inputError: errors.New(`user "empty-verb" (groups=["test"]) is attempting to grant RBAC permissions not currently held:
-{}`),
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{{}},
- },
- expectError: require.NoError,
- },
- {
- name: "Rule with no colon separator",
- inputError: errors.New(`user "empty-verb" (groups=["test"]) is attempting to grant RBAC permissions not currently held:
-{APIGroups:[""], Resources, Verbs:["get"]}
-`),
- expectedResult: &parseResult{},
- expectError: func(t require.TestingT, err error, i ...interface{}) {
- require.ErrorContains(t, err, `unexpected item "Resources": expected :[...]`)
- },
- },
- {
- name: "Rule with unknown field",
- inputError: errors.New(`user "empty-verb" (groups=["test"]) is attempting to grant RBAC permissions not currently held:
-{FooBar:["baz"]}
-{APIGroups:[""], Resources:["secrets"], Verbs:["get"]}
-`),
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{
- {APIGroups: []string{""}, Resources: []string{"secrets"}, Verbs: []string{"get"}},
- },
- },
- expectError: func(t require.TestingT, err error, i ...interface{}) {
- require.ErrorContains(t, err, `unknown field: "FooBar"`)
- },
- },
- }
-
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- rules, err := parseEscalationErrorForMissingRules(tc.inputError)
- tc.expectError(t, err)
- require.Equal(t, tc.expectedResult, rules)
- })
- }
-}
-
-func TestParseEscalationErrorForMissingRules_KubernetesCompatibility(t *testing.T) {
- testCases := []struct {
- name string
- ruleResolver validation.AuthorizationRuleResolver
- wantRules []rbacv1.PolicyRule
- expectedErrorString string
- expectedResult *parseResult
- }{
- {
- name: "missing rules",
- ruleResolver: mockRulesResolver{
- rules: []rbacv1.PolicyRule{},
- err: nil,
- },
- wantRules: []rbacv1.PolicyRule{
- {APIGroups: []string{""}, Resources: []string{"secrets"}, Verbs: []string{"get"}, ResourceNames: []string{"test-secret"}},
- {APIGroups: []string{""}, Resources: []string{"configmaps"}, Verbs: []string{"get", "list", "watch"}},
- {APIGroups: []string{"apps"}, Resources: []string{"deployments", "replicasets"}, Verbs: []string{"create", "update", "patch", "delete"}},
- {NonResourceURLs: []string{"/healthz", "/livez"}, Verbs: []string{"get", "post"}},
- },
- expectedErrorString: `user "user" (groups=["a" "b"]) is attempting to grant RBAC permissions not currently held:
-{APIGroups:[""], Resources:["configmaps"], Verbs:["get" "list" "watch"]}
-{APIGroups:[""], Resources:["secrets"], ResourceNames:["test-secret"], Verbs:["get"]}
-{APIGroups:["apps"], Resources:["deployments"], Verbs:["create" "update" "patch" "delete"]}
-{APIGroups:["apps"], Resources:["replicasets"], Verbs:["create" "update" "patch" "delete"]}
-{NonResourceURLs:["/healthz"], Verbs:["get"]}
-{NonResourceURLs:["/healthz"], Verbs:["post"]}
-{NonResourceURLs:["/livez"], Verbs:["get"]}
-{NonResourceURLs:["/livez"], Verbs:["post"]}`,
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{
- {APIGroups: []string{""}, Resources: []string{"configmaps"}, Verbs: []string{"get", "list", "watch"}},
- {APIGroups: []string{""}, Resources: []string{"secrets"}, Verbs: []string{"get"}, ResourceNames: []string{"test-secret"}},
- {APIGroups: []string{"apps"}, Resources: []string{"deployments"}, Verbs: []string{"create", "update", "patch", "delete"}},
- {APIGroups: []string{"apps"}, Resources: []string{"replicasets"}, Verbs: []string{"create", "update", "patch", "delete"}},
- {NonResourceURLs: []string{"/healthz"}, Verbs: []string{"get"}},
- {NonResourceURLs: []string{"/healthz"}, Verbs: []string{"post"}},
- {NonResourceURLs: []string{"/livez"}, Verbs: []string{"get"}},
- {NonResourceURLs: []string{"/livez"}, Verbs: []string{"post"}},
- },
- },
- },
- {
- name: "resolution failure",
- ruleResolver: mockRulesResolver{
- rules: []rbacv1.PolicyRule{},
- err: errors.New("resolution error"),
- },
- wantRules: []rbacv1.PolicyRule{
- {APIGroups: []string{""}, Resources: []string{"secrets"}, Verbs: []string{"get"}, ResourceNames: []string{"test-secret"}},
- {APIGroups: []string{""}, Resources: []string{"configmaps"}, Verbs: []string{"get", "list", "watch"}},
- {APIGroups: []string{"apps"}, Resources: []string{"deployments", "replicasets"}, Verbs: []string{"create", "update", "patch", "delete"}},
- {NonResourceURLs: []string{"/healthz", "/livez"}, Verbs: []string{"get", "post"}},
- },
- expectedErrorString: `user "user" (groups=["a" "b"]) is attempting to grant RBAC permissions not currently held:
-{APIGroups:[""], Resources:["configmaps"], Verbs:["get" "list" "watch"]}
-{APIGroups:[""], Resources:["secrets"], ResourceNames:["test-secret"], Verbs:["get"]}
-{APIGroups:["apps"], Resources:["deployments"], Verbs:["create" "update" "patch" "delete"]}
-{APIGroups:["apps"], Resources:["replicasets"], Verbs:["create" "update" "patch" "delete"]}
-{NonResourceURLs:["/healthz"], Verbs:["get"]}
-{NonResourceURLs:["/healthz"], Verbs:["post"]}
-{NonResourceURLs:["/livez"], Verbs:["get"]}
-{NonResourceURLs:["/livez"], Verbs:["post"]}; resolution errors: [resolution error]`,
- expectedResult: &parseResult{
- MissingRules: []rbacv1.PolicyRule{
- {APIGroups: []string{""}, Resources: []string{"configmaps"}, Verbs: []string{"get", "list", "watch"}},
- {APIGroups: []string{""}, Resources: []string{"secrets"}, Verbs: []string{"get"}, ResourceNames: []string{"test-secret"}},
- {APIGroups: []string{"apps"}, Resources: []string{"deployments"}, Verbs: []string{"create", "update", "patch", "delete"}},
- {APIGroups: []string{"apps"}, Resources: []string{"replicasets"}, Verbs: []string{"create", "update", "patch", "delete"}},
- {NonResourceURLs: []string{"/healthz"}, Verbs: []string{"get"}},
- {NonResourceURLs: []string{"/healthz"}, Verbs: []string{"post"}},
- {NonResourceURLs: []string{"/livez"}, Verbs: []string{"get"}},
- {NonResourceURLs: []string{"/livez"}, Verbs: []string{"post"}},
- },
- ResolutionErrors: errors.New("[resolution error]"),
- },
- },
- }
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- ctx := request.WithUser(request.WithNamespace(context.Background(), "namespace"), &user.DefaultInfo{
- Name: "user",
- Groups: []string{"a", "b"},
- })
-
- // Let's actually call the upstream function that generates and returns the
- // error message that we are attempting to parse correctly. The hope is that
- // these tests will start failing if we bump to a new version of kubernetes
- // that causes our parsing logic to be incorrect.
- err := validation.ConfirmNoEscalation(ctx, tc.ruleResolver, tc.wantRules)
- require.Error(t, err)
- require.Equal(t, tc.expectedErrorString, err.Error())
-
- res, err := parseEscalationErrorForMissingRules(err)
- require.NoError(t, err)
- require.Equal(t, tc.expectedResult, res)
- })
- }
-}
-
-type mockRulesResolver struct {
- rules []rbacv1.PolicyRule
- err error
-}
-
-func (m mockRulesResolver) GetRoleReferenceRules(ctx context.Context, roleRef rbacv1.RoleRef, namespace string) ([]rbacv1.PolicyRule, error) {
- panic("unimplemented")
-}
-
-func (m mockRulesResolver) RulesFor(ctx context.Context, user user.Info, namespace string) ([]rbacv1.PolicyRule, error) {
- return m.rules, m.err
-}
-
-func (m mockRulesResolver) VisitRulesFor(ctx context.Context, user user.Info, namespace string, visitor func(source fmt.Stringer, rule *rbacv1.PolicyRule, err error) bool) {
- panic("unimplemented")
-}
diff --git a/internal/operator-controller/catalogmetadata/client/client_test.go b/internal/operator-controller/catalogmetadata/client/client_test.go
index 66817c504b..7ddb7e386b 100644
--- a/internal/operator-controller/catalogmetadata/client/client_test.go
+++ b/internal/operator-controller/catalogmetadata/client/client_test.go
@@ -12,12 +12,15 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/operator-framework/operator-registry/alpha/declcfg"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
catalogClient "github.com/operator-framework/operator-controller/internal/operator-controller/catalogmetadata/client"
+ mockcatalogclient "github.com/operator-framework/operator-controller/internal/testutil/mock/catalogclient"
+ mockhttputil "github.com/operator-framework/operator-controller/internal/testutil/mock/httputil"
)
func defaultCatalog() *ocv1.ClusterCatalog {
@@ -41,11 +44,11 @@ func TestClientGetPackage(t *testing.T) {
}
type testCase struct {
- name string
- catalog func() *ocv1.ClusterCatalog
- pkgName string
- cache catalogClient.Cache
- assert func(*testing.T, *declcfg.DeclarativeConfig, error)
+ name string
+ catalog func() *ocv1.ClusterCatalog
+ pkgName string
+ setupCache func(ctrl *gomock.Controller) catalogClient.Cache
+ assert func(*testing.T, *declcfg.DeclarativeConfig, error)
}
for _, tc := range []testCase{
{
@@ -60,7 +63,11 @@ func TestClientGetPackage(t *testing.T) {
{
name: "served, cache returns error",
catalog: defaultCatalog,
- cache: &fakeCache{getErr: errors.New("fetch error")},
+ setupCache: func(ctrl *gomock.Controller) catalogClient.Cache {
+ cache := mockcatalogclient.NewMockCache(ctrl)
+ cache.EXPECT().Get(gomock.Any(), gomock.Any()).Return(nil, errors.New("fetch error"))
+ return cache
+ },
assert: func(t *testing.T, dc *declcfg.DeclarativeConfig, err error) {
assert.ErrorContains(t, err, `error retrieving cache for catalog "catalog-1"`)
},
@@ -68,7 +75,11 @@ func TestClientGetPackage(t *testing.T) {
{
name: "served, invalid package path",
catalog: defaultCatalog,
- cache: &fakeCache{getFS: testFS},
+ setupCache: func(ctrl *gomock.Controller) catalogClient.Cache {
+ cache := mockcatalogclient.NewMockCache(ctrl)
+ cache.EXPECT().Get(gomock.Any(), gomock.Any()).Return(testFS, nil)
+ return cache
+ },
pkgName: "/",
assert: func(t *testing.T, dc *declcfg.DeclarativeConfig, err error) {
assert.ErrorContains(t, err, `error getting package "/"`)
@@ -78,7 +89,11 @@ func TestClientGetPackage(t *testing.T) {
name: "served, package missing",
catalog: defaultCatalog,
pkgName: "pkg-missing",
- cache: &fakeCache{getFS: testFS},
+ setupCache: func(ctrl *gomock.Controller) catalogClient.Cache {
+ cache := mockcatalogclient.NewMockCache(ctrl)
+ cache.EXPECT().Get(gomock.Any(), gomock.Any()).Return(testFS, nil)
+ return cache
+ },
assert: func(t *testing.T, fbc *declcfg.DeclarativeConfig, err error) {
require.NoError(t, err)
assert.Equal(t, &declcfg.DeclarativeConfig{}, fbc)
@@ -88,9 +103,13 @@ func TestClientGetPackage(t *testing.T) {
name: "served, invalid package present",
catalog: defaultCatalog,
pkgName: "invalid-pkg-present",
- cache: &fakeCache{getFS: fstest.MapFS{
- "invalid-pkg-present/olm.package/invalid-pkg-present.json": &fstest.MapFile{Data: []byte(`{"schema": "olm.package","name": 12345}`)},
- }},
+ setupCache: func(ctrl *gomock.Controller) catalogClient.Cache {
+ cache := mockcatalogclient.NewMockCache(ctrl)
+ cache.EXPECT().Get(gomock.Any(), gomock.Any()).Return(fstest.MapFS{
+ "invalid-pkg-present/olm.package/invalid-pkg-present.json": &fstest.MapFile{Data: []byte(`{"schema": "olm.package","name": 12345}`)},
+ }, nil)
+ return cache
+ },
assert: func(t *testing.T, fbc *declcfg.DeclarativeConfig, err error) {
require.ErrorContains(t, err, `error loading package "invalid-pkg-present"`)
assert.Nil(t, fbc)
@@ -100,7 +119,11 @@ func TestClientGetPackage(t *testing.T) {
name: "served, package present",
catalog: defaultCatalog,
pkgName: "pkg-present",
- cache: &fakeCache{getFS: testFS},
+ setupCache: func(ctrl *gomock.Controller) catalogClient.Cache {
+ cache := mockcatalogclient.NewMockCache(ctrl)
+ cache.EXPECT().Get(gomock.Any(), gomock.Any()).Return(testFS, nil)
+ return cache
+ },
assert: func(t *testing.T, fbc *declcfg.DeclarativeConfig, err error) {
require.NoError(t, err)
assert.Equal(t, &declcfg.DeclarativeConfig{Packages: []declcfg.Package{{Schema: declcfg.SchemaPackage, Name: "pkg-present"}}}, fbc)
@@ -110,9 +133,11 @@ func TestClientGetPackage(t *testing.T) {
name: "cache unpopulated",
catalog: defaultCatalog,
pkgName: "pkg-present",
- cache: &fakeCache{putFunc: func(source string, errToCache error) (fs.FS, error) {
- return testFS, nil
- }},
+ setupCache: func(ctrl *gomock.Controller) catalogClient.Cache {
+ cache := mockcatalogclient.NewMockCache(ctrl)
+ cache.EXPECT().Get(gomock.Any(), gomock.Any()).Return(nil, nil)
+ return cache
+ },
assert: func(t *testing.T, fbc *declcfg.DeclarativeConfig, err error) {
assert.ErrorContains(t, err, `cache for catalog "catalog-1" not found`)
},
@@ -120,14 +145,18 @@ func TestClientGetPackage(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
ctx := context.Background()
+ ctrl := gomock.NewController(t)
+
+ var cache catalogClient.Cache
+ if tc.setupCache != nil {
+ cache = tc.setupCache(ctrl)
+ }
- c := catalogClient.New(tc.cache, func() (*http.Client, error) {
+ mockTripper := mockhttputil.NewMockRoundTripper(ctrl)
+ c := catalogClient.New(cache, func() (*http.Client, error) {
return &http.Client{
// This is to prevent actual network calls
- Transport: &fakeTripper{resp: &http.Response{
- StatusCode: http.StatusOK,
- Body: http.NoBody,
- }},
+ Transport: mockTripper,
}, nil
})
fbc, err := c.GetPackage(ctx, tc.catalog(), tc.pkgName)
@@ -142,42 +171,54 @@ func TestClientPopulateCache(t *testing.T) {
}
type testCase struct {
- name string
- catalog func() *ocv1.ClusterCatalog
- httpClient func() (*http.Client, error)
- putFuncConstructor func(t *testing.T) func(source string, errToCache error) (fs.FS, error)
- assert func(t *testing.T, fs fs.FS, err error)
+ name string
+ catalog func() *ocv1.ClusterCatalog
+ setupMocks func(t *testing.T, ctrl *gomock.Controller) (catalogClient.Cache, func() (*http.Client, error))
+ assert func(t *testing.T, fs fs.FS, err error)
}
for _, tt := range []testCase{
{
name: "cache unpopulated, successful http request",
catalog: defaultCatalog,
- httpClient: func() (*http.Client, error) {
- return &http.Client{
- // This is to prevent actual network calls
- Transport: &fakeTripper{resp: &http.Response{
- StatusCode: http.StatusOK,
- Body: io.NopCloser(strings.NewReader("fake-success-response-body")),
- }},
- }, nil
+ setupMocks: func(t *testing.T, ctrl *gomock.Controller) (catalogClient.Cache, func() (*http.Client, error)) {
+ cache := mockcatalogclient.NewMockCache(ctrl)
+ cache.EXPECT().Put(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(catalogName, resolvedRef string, source io.Reader, errToCache error) (fs.FS, error) {
+ buf := new(strings.Builder)
+ if source != nil {
+ _, _ = io.Copy(buf, source)
+ }
+ assert.Equal(t, "fake-success-response-body", buf.String())
+ assert.NoError(t, errToCache)
+ return testFS, errToCache
+ },
+ )
+
+ mockTripper := mockhttputil.NewMockRoundTripper(ctrl)
+ mockTripper.EXPECT().RoundTrip(gomock.Any()).Return(&http.Response{
+ StatusCode: http.StatusOK,
+ Body: io.NopCloser(strings.NewReader("fake-success-response-body")),
+ }, nil)
+
+ httpClient := func() (*http.Client, error) {
+ return &http.Client{Transport: mockTripper}, nil
+ }
+ return cache, httpClient
},
assert: func(t *testing.T, fs fs.FS, err error) {
require.NoError(t, err)
assert.Equal(t, testFS, fs)
},
- putFuncConstructor: func(t *testing.T) func(source string, errToCache error) (fs.FS, error) {
- return func(source string, errToCache error) (fs.FS, error) {
- assert.Equal(t, "fake-success-response-body", source)
- assert.NoError(t, errToCache)
- return testFS, errToCache
- }
- },
},
{
name: "not served",
catalog: func() *ocv1.ClusterCatalog {
return &ocv1.ClusterCatalog{ObjectMeta: metav1.ObjectMeta{Name: "catalog-1"}}
},
+ setupMocks: func(t *testing.T, ctrl *gomock.Controller) (catalogClient.Cache, func() (*http.Client, error)) {
+ cache := mockcatalogclient.NewMockCache(ctrl)
+ return cache, nil
+ },
assert: func(t *testing.T, fs fs.FS, err error) {
assert.Nil(t, fs)
assert.ErrorContains(t, err, `catalog "catalog-1" is not being served`)
@@ -186,15 +227,20 @@ func TestClientPopulateCache(t *testing.T) {
{
name: "cache unpopulated, error on getting a http client",
catalog: defaultCatalog,
- httpClient: func() (*http.Client, error) {
- return nil, errors.New("fake error getting a http client")
- },
- putFuncConstructor: func(t *testing.T) func(source string, errToCache error) (fs.FS, error) {
- return func(source string, errToCache error) (fs.FS, error) {
- assert.Empty(t, source)
- assert.Error(t, errToCache)
- return nil, errToCache
+ setupMocks: func(t *testing.T, ctrl *gomock.Controller) (catalogClient.Cache, func() (*http.Client, error)) {
+ cache := mockcatalogclient.NewMockCache(ctrl)
+ cache.EXPECT().Put(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(catalogName, resolvedRef string, source io.Reader, errToCache error) (fs.FS, error) {
+ assert.Nil(t, source)
+ assert.Error(t, errToCache)
+ return nil, errToCache
+ },
+ )
+
+ httpClient := func() (*http.Client, error) {
+ return nil, errors.New("fake error getting a http client")
}
+ return cache, httpClient
},
assert: func(t *testing.T, fs fs.FS, err error) {
assert.Nil(t, fs)
@@ -204,18 +250,23 @@ func TestClientPopulateCache(t *testing.T) {
{
name: "cache unpopulated, error on http request",
catalog: defaultCatalog,
- httpClient: func() (*http.Client, error) {
- return &http.Client{
- // This is to prevent actual network calls
- Transport: &fakeTripper{err: errors.New("fake error on a http request")},
- }, nil
- },
- putFuncConstructor: func(t *testing.T) func(source string, errToCache error) (fs.FS, error) {
- return func(source string, errToCache error) (fs.FS, error) {
- assert.Empty(t, source)
- assert.Error(t, errToCache)
- return nil, errToCache
+ setupMocks: func(t *testing.T, ctrl *gomock.Controller) (catalogClient.Cache, func() (*http.Client, error)) {
+ cache := mockcatalogclient.NewMockCache(ctrl)
+ cache.EXPECT().Put(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(catalogName, resolvedRef string, source io.Reader, errToCache error) (fs.FS, error) {
+ assert.Nil(t, source)
+ assert.Error(t, errToCache)
+ return nil, errToCache
+ },
+ )
+
+ mockTripper := mockhttputil.NewMockRoundTripper(ctrl)
+ mockTripper.EXPECT().RoundTrip(gomock.Any()).Return(nil, errors.New("fake error on a http request"))
+
+ httpClient := func() (*http.Client, error) {
+ return &http.Client{Transport: mockTripper}, nil
}
+ return cache, httpClient
},
assert: func(t *testing.T, fs fs.FS, err error) {
assert.Nil(t, fs)
@@ -225,14 +276,19 @@ func TestClientPopulateCache(t *testing.T) {
{
name: "cache unpopulated, unexpected http status",
catalog: defaultCatalog,
- httpClient: func() (*http.Client, error) {
- return &http.Client{
- // This is to prevent actual network calls
- Transport: &fakeTripper{resp: &http.Response{
- StatusCode: http.StatusInternalServerError,
- Body: io.NopCloser(strings.NewReader("fake-unexpected-code-response-body")),
- }},
- }, nil
+ setupMocks: func(t *testing.T, ctrl *gomock.Controller) (catalogClient.Cache, func() (*http.Client, error)) {
+ cache := mockcatalogclient.NewMockCache(ctrl)
+
+ mockTripper := mockhttputil.NewMockRoundTripper(ctrl)
+ mockTripper.EXPECT().RoundTrip(gomock.Any()).Return(&http.Response{
+ StatusCode: http.StatusInternalServerError,
+ Body: io.NopCloser(strings.NewReader("fake-unexpected-code-response-body")),
+ }, nil)
+
+ httpClient := func() (*http.Client, error) {
+ return &http.Client{Transport: mockTripper}, nil
+ }
+ return cache, httpClient
},
assert: func(t *testing.T, fs fs.FS, err error) {
assert.Nil(t, fs)
@@ -242,47 +298,12 @@ func TestClientPopulateCache(t *testing.T) {
} {
t.Run(tt.name, func(t *testing.T) {
ctx := context.Background()
+ ctrl := gomock.NewController(t)
- cache := &fakeCache{}
- if tt.putFuncConstructor != nil {
- cache.putFunc = tt.putFuncConstructor(t)
- }
-
- c := catalogClient.New(cache, tt.httpClient)
+ cache, httpClient := tt.setupMocks(t, ctrl)
+ c := catalogClient.New(cache, httpClient)
fs, err := c.PopulateCache(ctx, tt.catalog())
tt.assert(t, fs, err)
})
}
}
-
-type fakeCache struct {
- getFS fs.FS
- getErr error
-
- putFunc func(source string, errToCache error) (fs.FS, error)
-}
-
-func (c *fakeCache) Get(catalogName, resolvedRef string) (fs.FS, error) {
- return c.getFS, c.getErr
-}
-
-func (c *fakeCache) Put(catalogName, resolvedRef string, source io.Reader, errToCache error) (fs.FS, error) {
- if c.putFunc != nil {
- buf := new(strings.Builder)
- if source != nil {
- io.Copy(buf, source) // nolint:errcheck
- }
- return c.putFunc(buf.String(), errToCache)
- }
-
- return nil, errors.New("unexpected error")
-}
-
-type fakeTripper struct {
- resp *http.Response
- err error
-}
-
-func (ft *fakeTripper) RoundTrip(*http.Request) (*http.Response, error) {
- return ft.resp, ft.err
-}
diff --git a/internal/operator-controller/config/config_test.go b/internal/operator-controller/config/config_test.go
index 2f38ad6d35..461480b285 100644
--- a/internal/operator-controller/config/config_test.go
+++ b/internal/operator-controller/config/config_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/utils/ptr"
@@ -14,6 +15,7 @@ import (
"github.com/operator-framework/operator-controller/internal/operator-controller/config"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/bundle"
"github.com/operator-framework/operator-controller/internal/testing/bundle/csv"
+ mockconfig "github.com/operator-framework/operator-controller/internal/testutil/mock/config"
)
func Test_UnmarshalConfig(t *testing.T) {
@@ -353,8 +355,10 @@ func Test_UnmarshalConfig_EmptySchema(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
- noSchemaBundle := &mockNoSchemaBundle{}
- schema, err := noSchemaBundle.GetConfigSchema()
+ ctrl := gomock.NewController(t)
+ mockProvider := mockconfig.NewMockSchemaProvider(ctrl)
+ mockProvider.EXPECT().GetConfigSchema().Return(nil, nil)
+ schema, err := mockProvider.GetConfigSchema()
require.NoError(t, err)
config, err := config.UnmarshalConfig(tc.rawConfig, schema, "my-namespace")
@@ -535,9 +539,17 @@ func Test_UnmarshalConfig_HelmLike(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
- // Create a mock Helm package (real Helm would read values.schema.json)
- helmBundle := &mockHelmBundle{schema: tc.helmSchema}
- schema, err := helmBundle.GetConfigSchema()
+ ctrl := gomock.NewController(t)
+ mockProvider := mockconfig.NewMockSchemaProvider(ctrl)
+
+ // Pre-unmarshal the schema string, mimicking what a real Helm bundle would do
+ var schemaMap map[string]any
+ if tc.helmSchema != "" {
+ require.NoError(t, json.Unmarshal([]byte(tc.helmSchema), &schemaMap))
+ }
+ mockProvider.EXPECT().GetConfigSchema().Return(schemaMap, nil)
+
+ schema, err := mockProvider.GetConfigSchema()
require.NoError(t, err)
// Same validation function works for Helm, registry+v1, registry+v2, etc.
@@ -559,42 +571,8 @@ func Test_UnmarshalConfig_HelmLike(t *testing.T) {
}
}
-// mockHelmBundle shows how Helm would plug into the validation system.
-//
-// Real implementation would:
-// 1. Read values.schema.json from the Helm chart package
-// 2. Parse it into a map[string]any
-// 3. Return it (just like registry+v1 returns its generated schema)
-// 4. Let the shared validation logic handle the rest
-type mockHelmBundle struct {
- schema string
-}
-
-// GetConfigSchema returns the schema (in real Helm, read from values.schema.json).
-func (h *mockHelmBundle) GetConfigSchema() (map[string]any, error) {
- if h.schema == "" {
- return nil, nil
- }
- var schemaMap map[string]any
- if err := json.Unmarshal([]byte(h.schema), &schemaMap); err != nil {
- return nil, err
- }
- return schemaMap, nil
-}
-
-// mockNoSchemaBundle represents a bundle that doesn't provide a configuration schema.
-type mockNoSchemaBundle struct{}
-
-func (e *mockNoSchemaBundle) GetConfigSchema() (map[string]any, error) {
- // Return nil to indicate "no schema" (skip validation)
- return nil, nil
-}
-
// Test_GetDeploymentConfig tests the GetDeploymentConfig accessor method.
func Test_GetDeploymentConfig(t *testing.T) {
- // Create a bundle that returns nil schema (no validation)
- bundle := &mockNoSchemaBundle{}
-
tests := []struct {
name string
rawConfig []byte
@@ -646,7 +624,10 @@ func Test_GetDeploymentConfig(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- schema, err := bundle.GetConfigSchema()
+ ctrl := gomock.NewController(t)
+ mockProvider := mockconfig.NewMockSchemaProvider(ctrl)
+ mockProvider.EXPECT().GetConfigSchema().Return(nil, nil)
+ schema, err := mockProvider.GetConfigSchema()
require.NoError(t, err)
cfg, err := config.UnmarshalConfig(tt.rawConfig, schema, "")
@@ -681,7 +662,10 @@ func Test_GetDeploymentConfig(t *testing.T) {
}
}`)
- schema, err := bundle.GetConfigSchema()
+ ctrl := gomock.NewController(t)
+ mockProvider := mockconfig.NewMockSchemaProvider(ctrl)
+ mockProvider.EXPECT().GetConfigSchema().Return(nil, nil)
+ schema, err := mockProvider.GetConfigSchema()
require.NoError(t, err)
cfg, err := config.UnmarshalConfig(rawConfig, schema, "")
diff --git a/internal/operator-controller/contentmanager/cache/cache.go b/internal/operator-controller/contentmanager/cache/cache.go
deleted file mode 100644
index f56cfd575d..0000000000
--- a/internal/operator-controller/contentmanager/cache/cache.go
+++ /dev/null
@@ -1,264 +0,0 @@
-package cache
-
-import (
- "context"
- "errors"
- "fmt"
- "io"
- "slices"
- "strings"
- "sync"
- "time"
-
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/sets"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/log"
- "sigs.k8s.io/controller-runtime/pkg/source"
-)
-
-type Watcher interface {
- Watch(source.Source) error
-}
-
-// Cache is a storage mechanism for keeping track of
-// managed content sources
-type Cache interface {
- io.Closer
- // Watch establishes watches for all provided client.Objects.
- // Subsequent calls to Watch will result in no longer necessary
- // watches being stopped and removed and new watches being
- // created
- Watch(context.Context, Watcher, ...client.Object) error
-}
-
-// CloserSyncingSource is a wrapper of the controller-runtime
-// source.SyncingSource that includes methods for:
-// - Closing the source, stopping it's interaction with the Kubernetes API server and reaction to events
-type CloserSyncingSource interface {
- source.SyncingSource
- io.Closer
-}
-
-type sourcerer interface {
- // Source returns a CloserSyncingSource for the provided
- // GroupVersionKind. If the CloserSyncingSource encounters an
- // error after having initially synced, it should requeue the
- // provided client.Object and call the provided callback function
- Source(schema.GroupVersionKind, client.Object, func(context.Context)) (CloserSyncingSource, error)
-}
-
-type cache struct {
- sources map[schema.GroupVersionKind]CloserSyncingSource
- sourcerer sourcerer
- owner client.Object
- syncTimeout time.Duration
- mu sync.Mutex
-}
-
-func NewCache(sourcerer sourcerer, owner client.Object, syncTimeout time.Duration) Cache {
- return &cache{
- sources: make(map[schema.GroupVersionKind]CloserSyncingSource),
- sourcerer: sourcerer,
- owner: owner,
- syncTimeout: syncTimeout,
- }
-}
-
-var _ Cache = (*cache)(nil)
-
-func (c *cache) Watch(ctx context.Context, watcher Watcher, objs ...client.Object) error {
- c.mu.Lock()
- defer c.mu.Unlock()
- gvkSet, err := gvksForObjects(objs...)
- if err != nil {
- return fmt.Errorf("getting set of GVKs for managed objects: %w", err)
- }
-
- if err := c.removeStaleSources(gvkSet); err != nil {
- return fmt.Errorf("removing stale sources: %w", err)
- }
- return c.startNewSources(ctx, gvkSet, watcher)
-}
-
-func (c *cache) Close() error {
- c.mu.Lock()
- defer c.mu.Unlock()
-
- errs := []error{}
- for _, source := range c.sources {
- if err := source.Close(); err != nil {
- errs = append(errs, err)
- }
- }
-
- slices.SortFunc(errs, func(a, b error) int {
- return strings.Compare(a.Error(), b.Error())
- })
-
- return errors.Join(errs...)
-}
-
-func (c *cache) startNewSources(ctx context.Context, gvks sets.Set[schema.GroupVersionKind], watcher Watcher) error {
- cacheGvks := c.getCacheGVKs()
- gvksToCreate := gvks.Difference(cacheGvks)
-
- type startResult struct {
- source CloserSyncingSource
- gvk schema.GroupVersionKind
- err error
- }
- startResults := make(chan startResult)
- wg := sync.WaitGroup{}
- for _, gvk := range gvksToCreate.UnsortedList() {
- wg.Add(1)
- go func() {
- defer wg.Done()
- source, err := c.startNewSource(ctx, gvk, watcher)
- startResults <- startResult{
- source: source,
- gvk: gvk,
- err: err,
- }
- }()
- }
- go func() {
- wg.Wait()
- close(startResults)
- }()
-
- sourcesErrors := []error{}
- for result := range startResults {
- if result.err != nil {
- sourcesErrors = append(sourcesErrors, result.err)
- continue
- }
-
- err := c.addSource(result.gvk, result.source)
- if err != nil {
- // If we made it here then there is a logic error in
- // calculating the diffs between what is currently being
- // watched by the cache
- panic(err)
- }
- }
-
- slices.SortFunc(sourcesErrors, func(a, b error) int {
- return strings.Compare(a.Error(), b.Error())
- })
-
- return errors.Join(sourcesErrors...)
-}
-
-func (c *cache) startNewSource(ctx context.Context, gvk schema.GroupVersionKind, watcher Watcher) (CloserSyncingSource, error) {
- s, err := c.sourcerer.Source(gvk, c.owner, func(ctx context.Context) {
- // this callback function ensures that we remove the source from the
- // cache if it encounters an error after it initially synced successfully
- c.mu.Lock()
- defer c.mu.Unlock()
- err := c.removeSource(gvk)
- if err != nil {
- logr := log.FromContext(ctx)
- logr.Error(err, "managed content cache postSyncError removing source failed", "gvk", gvk)
- }
- })
- if err != nil {
- return nil, fmt.Errorf("getting source: %w", err)
- }
-
- err = watcher.Watch(s)
- if err != nil {
- return nil, fmt.Errorf("establishing watch for GVK %q: %w", gvk, err)
- }
-
- syncCtx, syncCancel := context.WithTimeout(ctx, c.syncTimeout)
- defer syncCancel()
- err = s.WaitForSync(syncCtx)
- if err != nil {
- return nil, fmt.Errorf("waiting for sync: %w", err)
- }
-
- return s, nil
-}
-
-func (c *cache) addSource(gvk schema.GroupVersionKind, source CloserSyncingSource) error {
- if _, ok := c.sources[gvk]; !ok {
- c.sources[gvk] = source
- return nil
- }
- return errors.New("source already exists")
-}
-
-func (c *cache) removeStaleSources(gvks sets.Set[schema.GroupVersionKind]) error {
- cacheGvks := c.getCacheGVKs()
- removeErrs := []error{}
- gvksToRemove := cacheGvks.Difference(gvks)
- for _, gvk := range gvksToRemove.UnsortedList() {
- err := c.removeSource(gvk)
- if err != nil {
- removeErrs = append(removeErrs, err)
- }
- }
-
- slices.SortFunc(removeErrs, func(a, b error) int {
- return strings.Compare(a.Error(), b.Error())
- })
-
- return errors.Join(removeErrs...)
-}
-
-func (c *cache) removeSource(gvk schema.GroupVersionKind) error {
- if source, ok := c.sources[gvk]; ok {
- err := source.Close()
- if err != nil {
- return fmt.Errorf("closing source for GVK %q: %w", gvk, err)
- }
- }
- delete(c.sources, gvk)
- return nil
-}
-
-func (c *cache) getCacheGVKs() sets.Set[schema.GroupVersionKind] {
- cacheGvks := sets.New[schema.GroupVersionKind]()
- for gvk := range c.sources {
- cacheGvks.Insert(gvk)
- }
- return cacheGvks
-}
-
-// gvksForObjects builds a sets.Set of GroupVersionKinds for
-// the provided client.Objects. It returns an error if:
-// - There is no Kind set on the client.Object
-// - There is no Version set on the client.Object
-//
-// An empty Group is assumed to be the "core" Kubernetes
-// API group.
-func gvksForObjects(objs ...client.Object) (sets.Set[schema.GroupVersionKind], error) {
- gvkSet := sets.New[schema.GroupVersionKind]()
- for _, obj := range objs {
- gvk := obj.GetObjectKind().GroupVersionKind()
-
- // If the Kind or Version is not set in an object's GroupVersionKind
- // attempting to add it to the runtime.Scheme will result in a panic.
- // To avoid panics, we are doing the validation and returning early
- // with an error if any objects are provided with a missing Kind or Version
- // field
- if gvk.Kind == "" {
- return nil, fmt.Errorf(
- "adding %s to set; object Kind is not defined",
- obj.GetName(),
- )
- }
-
- if gvk.Version == "" {
- return nil, fmt.Errorf(
- "adding %s to set; object Version is not defined",
- obj.GetName(),
- )
- }
-
- gvkSet.Insert(gvk)
- }
-
- return gvkSet, nil
-}
diff --git a/internal/operator-controller/contentmanager/cache/cache_test.go b/internal/operator-controller/contentmanager/cache/cache_test.go
deleted file mode 100644
index da44551681..0000000000
--- a/internal/operator-controller/contentmanager/cache/cache_test.go
+++ /dev/null
@@ -1,202 +0,0 @@
-package cache
-
-import (
- "context"
- "errors"
- "testing"
- "time"
-
- "github.com/stretchr/testify/require"
- corev1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/util/workqueue"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/reconcile"
- "sigs.k8s.io/controller-runtime/pkg/source"
-
- ocv1 "github.com/operator-framework/operator-controller/api/v1"
-)
-
-type mockWatcher struct {
- err error
-}
-
-var _ Watcher = (*mockWatcher)(nil)
-
-func (mw *mockWatcher) Watch(source.Source) error {
- return mw.err
-}
-
-type mockSourcerer struct {
- err error
- source CloserSyncingSource
-}
-
-var _ sourcerer = (*mockSourcerer)(nil)
-
-func (ms *mockSourcerer) Source(_ schema.GroupVersionKind, _ client.Object, _ func(context.Context)) (CloserSyncingSource, error) {
- if ms.err != nil {
- return nil, ms.err
- }
- return ms.source, nil
-}
-
-type mockSource struct {
- err error
-}
-
-var _ CloserSyncingSource = (*mockSource)(nil)
-
-func (ms *mockSource) Start(_ context.Context, _ workqueue.TypedRateLimitingInterface[reconcile.Request]) error {
- return ms.err
-}
-
-func (ms *mockSource) WaitForSync(ctx context.Context) error {
- return ms.err
-}
-
-func (ms *mockSource) Close() error {
- return ms.err
-}
-
-func TestCacheWatch(t *testing.T) {
- c := NewCache(
- &mockSourcerer{
- source: &mockSource{},
- },
- &ocv1.ClusterExtension{},
- time.Second,
- )
-
- pod := &corev1.Pod{}
- podGvk := corev1.SchemeGroupVersion.WithKind("Pod")
- pod.SetGroupVersionKind(podGvk)
-
- require.NoError(t, c.Watch(context.Background(), &mockWatcher{}, pod))
- require.Contains(t, c.(*cache).sources, podGvk, "sources", c.(*cache).sources)
-}
-
-func TestCacheWatchInvalidGVK(t *testing.T) {
- c := NewCache(
- &mockSourcerer{
- source: &mockSource{},
- },
- &ocv1.ClusterExtension{},
- time.Second,
- )
-
- pod := &corev1.Pod{}
- require.Error(t, c.Watch(context.Background(), &mockWatcher{}, pod), "should fail on invalid GVK")
-}
-
-func TestCacheWatchSourcererError(t *testing.T) {
- c := NewCache(
- &mockSourcerer{
- err: errors.New("error"),
- },
- &ocv1.ClusterExtension{},
- time.Second,
- )
-
- pod := &corev1.Pod{}
- podGvk := corev1.SchemeGroupVersion.WithKind("Pod")
- pod.SetGroupVersionKind(podGvk)
- require.Error(t, c.Watch(context.Background(), &mockWatcher{}, pod), "should fail when sourcerer returns an error")
-}
-
-func TestCacheWatchWatcherError(t *testing.T) {
- c := NewCache(
- &mockSourcerer{
- source: &mockSource{},
- },
- &ocv1.ClusterExtension{},
- time.Second,
- )
-
- pod := &corev1.Pod{}
- podGvk := corev1.SchemeGroupVersion.WithKind("Pod")
- pod.SetGroupVersionKind(podGvk)
- require.Error(t, c.Watch(context.Background(), &mockWatcher{err: errors.New("error")}, pod), "should fail when watcher returns an error")
-}
-
-func TestCacheWatchSourceWaitForSyncError(t *testing.T) {
- c := NewCache(
- &mockSourcerer{
- source: &mockSource{
- err: errors.New("error"),
- },
- },
- &ocv1.ClusterExtension{},
- time.Second,
- )
-
- pod := &corev1.Pod{}
- podGvk := corev1.SchemeGroupVersion.WithKind("Pod")
- pod.SetGroupVersionKind(podGvk)
- require.Error(t, c.Watch(context.Background(), &mockWatcher{}, pod), "should fail when source fails to sync")
- require.NotContains(t, c.(*cache).sources, podGvk, "should not contain source entry in mapping")
-}
-
-func TestCacheWatchExistingSourceNotPanic(t *testing.T) {
- c := NewCache(
- &mockSourcerer{
- source: &mockSource{},
- },
- &ocv1.ClusterExtension{},
- time.Second,
- )
-
- pod := &corev1.Pod{}
- podGvk := corev1.SchemeGroupVersion.WithKind("Pod")
- pod.SetGroupVersionKind(podGvk)
- require.NoError(t, c.(*cache).addSource(podGvk, &mockSource{}))
-
- // In this case, a panic means there is a logic error somewhere in the
- // cache.Watch() method. It should never hit the condition where it panics
- // as it should never attempt to create a new source for one that already exists.
- require.NotPanics(t, func() { _ = c.Watch(context.Background(), &mockWatcher{}, pod) }, "should never panic")
-}
-
-func TestCacheWatchRemovesStaleSources(t *testing.T) {
- c := NewCache(
- &mockSourcerer{
- source: &mockSource{},
- },
- &ocv1.ClusterExtension{},
- time.Second,
- )
-
- pod := &corev1.Pod{}
- podGvk := corev1.SchemeGroupVersion.WithKind("Pod")
- pod.SetGroupVersionKind(podGvk)
-
- require.NoError(t, c.Watch(context.Background(), &mockWatcher{}, pod))
- require.Contains(t, c.(*cache).sources, podGvk)
-
- secret := &corev1.Secret{}
- secretGvk := corev1.SchemeGroupVersion.WithKind("Secret")
- secret.SetGroupVersionKind(secretGvk)
- require.NoError(t, c.Watch(context.Background(), &mockWatcher{}, secret))
- require.Contains(t, c.(*cache).sources, secretGvk)
- require.NotContains(t, c.(*cache).sources, podGvk)
-}
-
-func TestCacheWatchRemovingStaleSourcesError(t *testing.T) {
- c := NewCache(
- &mockSourcerer{
- source: &mockSource{},
- },
- &ocv1.ClusterExtension{},
- time.Second,
- )
-
- podGvk := corev1.SchemeGroupVersion.WithKind("Pod")
- require.NoError(t, c.(*cache).addSource(podGvk, &mockSource{
- err: errors.New("error"),
- }))
-
- secret := &corev1.Secret{}
- secretGvk := corev1.SchemeGroupVersion.WithKind("Secret")
- secret.SetGroupVersionKind(secretGvk)
- require.Error(t, c.Watch(context.Background(), &mockWatcher{}, secret))
-}
diff --git a/internal/operator-controller/contentmanager/contentmanager.go b/internal/operator-controller/contentmanager/contentmanager.go
deleted file mode 100644
index d488bdb535..0000000000
--- a/internal/operator-controller/contentmanager/contentmanager.go
+++ /dev/null
@@ -1,147 +0,0 @@
-package contentmanager
-
-import (
- "context"
- "fmt"
- "sync"
- "time"
-
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/dynamic"
- "k8s.io/client-go/dynamic/dynamicinformer"
- "k8s.io/client-go/rest"
- "sigs.k8s.io/controller-runtime/pkg/client"
-
- ocv1 "github.com/operator-framework/operator-controller/api/v1"
- cmcache "github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager/cache"
- oclabels "github.com/operator-framework/operator-controller/internal/operator-controller/labels"
-)
-
-// Manager is a utility to manage content caches belonging
-// to ClusterExtensions
-type Manager interface {
- // Get returns a managed content cache for the provided
- // ClusterExtension if one exists. If one does not exist,
- // a new Cache is created and returned
- Get(context.Context, *ocv1.ClusterExtension) (cmcache.Cache, error)
- // Delete will stop and remove a managed content cache
- // for the provided ClusterExtension if one exists.
- Delete(*ocv1.ClusterExtension) error
-}
-
-type RestConfigMapper func(context.Context, client.Object, *rest.Config) (*rest.Config, error)
-
-// managerImpl is an implementation of the Manager interface
-type managerImpl struct {
- rcm RestConfigMapper
- baseCfg *rest.Config
- caches map[string]cmcache.Cache
- mapper meta.RESTMapper
- mu *sync.Mutex
- syncTimeout time.Duration
- resyncPeriod time.Duration
-}
-
-type ManagerOption func(*managerImpl)
-
-// WithSyncTimeout configures the time spent waiting
-// for a managed content source to sync
-func WithSyncTimeout(t time.Duration) ManagerOption {
- return func(m *managerImpl) {
- m.syncTimeout = t
- }
-}
-
-// WithResyncPeriod configures the frequency
-// a managed content source attempts to resync
-func WithResyncPeriod(t time.Duration) ManagerOption {
- return func(m *managerImpl) {
- m.resyncPeriod = t
- }
-}
-
-// NewManager creates a new Manager
-func NewManager(rcm RestConfigMapper, cfg *rest.Config, mapper meta.RESTMapper, opts ...ManagerOption) Manager {
- m := &managerImpl{
- rcm: rcm,
- baseCfg: cfg,
- caches: make(map[string]cmcache.Cache),
- mapper: mapper,
- mu: &sync.Mutex{},
- syncTimeout: time.Second * 10,
- resyncPeriod: time.Hour * 10,
- }
-
- for _, opt := range opts {
- opt(m)
- }
-
- return m
-}
-
-// Get returns a Cache for the provided ClusterExtension.
-// If a cache does not already exist, a new one will be created.
-// If a nil ClusterExtension is provided this function will panic.
-func (i *managerImpl) Get(ctx context.Context, ce *ocv1.ClusterExtension) (cmcache.Cache, error) {
- if ce == nil {
- panic("nil ClusterExtension provided")
- }
-
- i.mu.Lock()
- defer i.mu.Unlock()
- cache, ok := i.caches[ce.Name]
- if ok {
- return cache, nil
- }
-
- cfg, err := i.rcm(ctx, ce, i.baseCfg)
- if err != nil {
- return nil, fmt.Errorf("getting rest.Config: %w", err)
- }
-
- dynamicClient, err := dynamic.NewForConfig(cfg)
- if err != nil {
- return nil, fmt.Errorf("getting dynamic client: %w", err)
- }
-
- tgtLabels := labels.Set{
- oclabels.OwnerKindKey: ocv1.ClusterExtensionKind,
- oclabels.OwnerNameKey: ce.GetName(),
- }
-
- dynamicSourcerer := &dynamicSourcerer{
- // Due to the limitation outlined in the dynamic informer source,
- // related to reusing an informer factory, we return a new informer
- // factory every time to ensure we are not attempting to configure or
- // start an already started informer
- informerFactoryCreateFunc: func() dynamicinformer.DynamicSharedInformerFactory {
- return dynamicinformer.NewFilteredDynamicSharedInformerFactory(dynamicClient, time.Hour*10, metav1.NamespaceAll, func(lo *metav1.ListOptions) {
- lo.LabelSelector = tgtLabels.AsSelector().String()
- })
- },
- mapper: i.mapper,
- }
- cache = cmcache.NewCache(dynamicSourcerer, ce, i.syncTimeout)
- i.caches[ce.Name] = cache
- return cache, nil
-}
-
-// Delete stops and removes the Cache for the provided ClusterExtension
-func (i *managerImpl) Delete(ce *ocv1.ClusterExtension) error {
- if ce == nil {
- panic("nil ClusterExtension provided")
- }
-
- i.mu.Lock()
- defer i.mu.Unlock()
- if cache, ok := i.caches[ce.Name]; ok {
- err := cache.Close()
- if err != nil {
- return fmt.Errorf("closing cache: %w", err)
- }
- delete(i.caches, ce.Name)
- }
- return nil
-}
diff --git a/internal/operator-controller/contentmanager/source/dynamicsource.go b/internal/operator-controller/contentmanager/source/dynamicsource.go
deleted file mode 100644
index 9a4e6910db..0000000000
--- a/internal/operator-controller/contentmanager/source/dynamicsource.go
+++ /dev/null
@@ -1,195 +0,0 @@
-package source
-
-import (
- "context"
- "errors"
- "fmt"
- "sync"
- "time"
-
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/types"
- "k8s.io/apimachinery/pkg/util/wait"
- "k8s.io/client-go/dynamic/dynamicinformer"
- cgocache "k8s.io/client-go/tools/cache"
- "k8s.io/client-go/util/workqueue"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/handler"
- "sigs.k8s.io/controller-runtime/pkg/predicate"
- "sigs.k8s.io/controller-runtime/pkg/reconcile"
-
- source "github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager/source/internal"
-)
-
-type DynamicSourceConfig struct {
- // DynamicInformerFactory is the dynamicinformer.DynamicSharedInformerFactory
- // that is used to generate the informers configured on this sources startup.
- // If you use a dynamicinformer.DynamicSharedInformerFactory that you've
- // used previously, it must not have been used to start a new informer for
- // the same GVR. You can not start or configure an informer that has already
- // been started, even after it has been stopped. Reusing an informer factory
- // may result in attempting to configure and start an informer that has
- // already been started.
- DynamicInformerFactory dynamicinformer.DynamicSharedInformerFactory
- // GVR is the GroupVersionResource that this source is responsible
- // for creating and configuring an informer for
- GVR schema.GroupVersionResource
- // Owner is the client.Object that owns the managed content that this
- // source will be creating an informer to react to events for. This
- // field is used to attempt to requeue the owning client.Object for
- // reconciliation on a watch error after a previously successful sync
- Owner client.Object
- // Handler is the handler.EventHandler that is used to react to events
- // received by the configured source
- Handler handler.EventHandler
- // Predicates are the predicate.Predicate functions used to determine
- // if a triggered event should be reacted to
- Predicates []predicate.Predicate
- // OnPostSyncError is the callback function that is used when the source
- // initially synced successfully and later encountered an error
- OnPostSyncError func(context.Context)
-}
-
-func NewDynamicSource(cfg DynamicSourceConfig) *dynamicInformerSource {
- return &dynamicInformerSource{
- cfg: cfg,
- erroredChan: make(chan struct{}),
- syncedChan: make(chan struct{}),
- startedChan: make(chan struct{}),
- }
-}
-
-// dynamicInformerSource is an implementation of the
-// ReaderCloserSyncingSource interface. It is used
-// to create an informer, using the provided dynamic informer
-// factory, for the configured GroupVersionResource.
-//
-// The informer is configured with a WatchEventErrorHandler that
-// stops the informer, and if it had previously synced successfully
-// it attempts to requeue the provided Owner for reconciliation and
-// calls the provided OnWatchError function.
-type dynamicInformerSource struct {
- cfg DynamicSourceConfig
- informerCancel context.CancelFunc
- informerCtx context.Context
- startedChan chan struct{}
- syncedChan chan struct{}
- erroredChan chan struct{}
- errOnce sync.Once
- err error
-}
-
-func (dis *dynamicInformerSource) String() string {
- return fmt.Sprintf("contentmanager.DynamicInformerSource - GVR: %s, Owner Type: %T, Owner Name: %s", dis.cfg.GVR, dis.cfg.Owner, dis.cfg.Owner.GetName())
-}
-
-func (dis *dynamicInformerSource) Start(ctx context.Context, q workqueue.TypedRateLimitingInterface[reconcile.Request]) error {
- // Close the startedChan to signal that this
- // source has been started. Subsequent calls
- // to Start will attempt to close a closed channel
- // and panic.
- close(dis.startedChan)
-
- dis.informerCtx, dis.informerCancel = context.WithCancel(ctx)
- gInf := dis.cfg.DynamicInformerFactory.ForResource(dis.cfg.GVR)
- eventHandler := source.NewEventHandler(dis.informerCtx, q, dis.cfg.Handler, dis.cfg.Predicates)
-
- // If we encounter an error during the watch we will:
- // - Capture the error
- // - cancel the informer
- // requeuing of the ClusterExtension should happen by the
- // WaitForSync function returning an error
- // Only if we have successfully synced in the past should we
- // requeue the ClusterExtension
- sharedIndexInf := gInf.Informer()
- err := sharedIndexInf.SetWatchErrorHandler(func(r *cgocache.Reflector, err error) {
- dis.errOnce.Do(func() {
- dis.err = err
- close(dis.erroredChan)
- })
-
- if dis.hasSynced() {
- // We won't be able to update the ClusterExtension status
- // conditions so instead force a requeue if we
- // have previously synced and then errored
- defer q.Add(reconcile.Request{
- NamespacedName: types.NamespacedName{
- Name: dis.cfg.Owner.GetName(),
- },
- })
- dis.cfg.OnPostSyncError(dis.informerCtx)
- }
- dis.informerCancel()
- cgocache.DefaultWatchErrorHandler(dis.informerCtx, r, err)
- })
- if err != nil {
- return fmt.Errorf("setting WatchErrorHandler: %w", err)
- }
-
- _, err = sharedIndexInf.AddEventHandler(eventHandler.HandlerFuncs())
- if err != nil {
- return fmt.Errorf("adding event handler: %w", err)
- }
-
- go sharedIndexInf.Run(dis.informerCtx.Done())
-
- go func() {
- syncOnce := sync.OnceFunc(func() {
- dis.syncedChan <- struct{}{}
- close(dis.syncedChan)
- })
-
- _ = wait.PollUntilContextCancel(dis.informerCtx, time.Millisecond*100, true, func(_ context.Context) (bool, error) {
- if sharedIndexInf.HasSynced() {
- syncOnce()
- return true, nil
- }
- return false, nil
- })
- }()
-
- return nil
-}
-
-func (dis *dynamicInformerSource) WaitForSync(ctx context.Context) error {
- if !dis.hasStarted() {
- return fmt.Errorf("not yet started")
- }
-
- select {
- case <-ctx.Done():
- return ctx.Err()
- case <-dis.erroredChan:
- return dis.err
- case <-dis.informerCtx.Done():
- return dis.informerCtx.Err()
- case <-dis.syncedChan:
- return nil
- }
-}
-
-func (dis *dynamicInformerSource) Close() error {
- if !dis.hasStarted() {
- return errors.New("source has not yet started")
- }
- dis.informerCancel()
- return nil
-}
-
-func (dis *dynamicInformerSource) hasSynced() bool {
- select {
- case <-dis.syncedChan:
- return true
- default:
- return false
- }
-}
-
-func (dis *dynamicInformerSource) hasStarted() bool {
- select {
- case <-dis.startedChan:
- return true
- default:
- return false
- }
-}
diff --git a/internal/operator-controller/contentmanager/source/dynamicsource_test.go b/internal/operator-controller/contentmanager/source/dynamicsource_test.go
deleted file mode 100644
index 3a89a639e0..0000000000
--- a/internal/operator-controller/contentmanager/source/dynamicsource_test.go
+++ /dev/null
@@ -1,116 +0,0 @@
-package source
-
-import (
- "context"
- "errors"
- "testing"
- "time"
-
- "github.com/stretchr/testify/require"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/dynamic/dynamicinformer"
- dynamicfake "k8s.io/client-go/dynamic/fake"
- "k8s.io/client-go/kubernetes/scheme"
- "sigs.k8s.io/controller-runtime/pkg/handler"
- "sigs.k8s.io/controller-runtime/pkg/predicate"
-
- ocv1 "github.com/operator-framework/operator-controller/api/v1"
-)
-
-func TestDynamicInformerSourceCloseBeforeStartErrors(t *testing.T) {
- dis := NewDynamicSource(DynamicSourceConfig{})
- require.Error(t, dis.Close(), "calling close before start should error")
-}
-
-func TestDynamicInformerSourceWaitForSyncTimeout(t *testing.T) {
- dis := NewDynamicSource(DynamicSourceConfig{})
- close(dis.startedChan)
- dis.informerCtx = context.Background()
- timeout, cancel := context.WithTimeout(context.TODO(), time.Millisecond*10)
- defer cancel()
- require.Error(t, dis.WaitForSync(timeout), "should error on timeout")
-}
-
-func TestDynamicInformerSourceWaitForSyncInformerContextClosed(t *testing.T) {
- dis := NewDynamicSource(DynamicSourceConfig{})
- close(dis.startedChan)
- timeout, cancel := context.WithTimeout(context.TODO(), time.Millisecond*10)
- defer cancel()
- dis.informerCtx = timeout
- require.Error(t, dis.WaitForSync(context.Background()), "should error on informer context closed")
-}
-
-func TestDynamicInformerSourceWaitForSyncErrorChannel(t *testing.T) {
- dis := NewDynamicSource(DynamicSourceConfig{})
- close(dis.startedChan)
- dis.informerCtx = context.Background()
- go func() {
- time.Sleep(time.Millisecond * 10)
- dis.err = errors.New("error")
- close(dis.erroredChan)
- }()
- require.Error(t, dis.WaitForSync(context.Background()), "should error on receiving error from channel")
-}
-
-func TestDynamicInformerSourceWaitForSyncAlreadyErrored(t *testing.T) {
- dis := NewDynamicSource(DynamicSourceConfig{})
- close(dis.startedChan)
- dis.informerCtx = context.Background()
- dis.err = errors.New("error")
- close(dis.erroredChan)
- require.Error(t, dis.WaitForSync(context.Background()), "should error since there is already a sync error")
-}
-
-func TestDynamicInformerSourceWaitForSyncAlreadySynced(t *testing.T) {
- dis := NewDynamicSource(DynamicSourceConfig{})
- close(dis.startedChan)
- close(dis.syncedChan)
- dis.informerCtx = context.Background()
- require.NoError(t, dis.WaitForSync(context.Background()), "should not error if already synced")
-}
-
-func TestDynamicInformerSourceWaitForSyncSyncedChannel(t *testing.T) {
- dis := NewDynamicSource(DynamicSourceConfig{})
- close(dis.startedChan)
- dis.informerCtx = context.Background()
- go func() {
- time.Sleep(time.Millisecond * 10)
- close(dis.syncedChan)
- }()
- require.NoError(t, dis.WaitForSync(context.Background()), "should not error on receiving struct from syncedChannel")
-}
-
-func TestDynamicInformerSourceWaitForSyncNotStarted(t *testing.T) {
- dis := NewDynamicSource(DynamicSourceConfig{})
- require.Error(t, dis.WaitForSync(context.Background()), "should error if not started")
-}
-
-func TestDynamicInformerSourceStartAlreadyStarted(t *testing.T) {
- dis := NewDynamicSource(DynamicSourceConfig{})
- close(dis.startedChan)
- require.Panics(t, func() { _ = dis.Start(context.Background(), nil) }, "should return an error if already started")
-}
-
-func TestDynamicInformerSourceStart(t *testing.T) {
- fakeDynamicClient := dynamicfake.NewSimpleDynamicClient(scheme.Scheme)
- infFact := dynamicinformer.NewDynamicSharedInformerFactory(fakeDynamicClient, time.Minute)
- dis := NewDynamicSource(DynamicSourceConfig{
- DynamicInformerFactory: infFact,
- GVR: schema.GroupVersionResource{
- Group: "",
- Version: "v1",
- Resource: "pods",
- },
- Owner: &ocv1.ClusterExtension{},
- Handler: handler.Funcs{},
- Predicates: []predicate.Predicate{},
- OnPostSyncError: func(ctx context.Context) {},
- })
-
- require.NoError(t, dis.Start(context.Background(), nil))
-
- waitCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
- defer cancel()
- require.NoError(t, dis.WaitForSync(waitCtx))
- require.NoError(t, dis.Close())
-}
diff --git a/internal/operator-controller/contentmanager/source/internal/eventhandler.go b/internal/operator-controller/contentmanager/source/internal/eventhandler.go
deleted file mode 100644
index dde5ed3d28..0000000000
--- a/internal/operator-controller/contentmanager/source/internal/eventhandler.go
+++ /dev/null
@@ -1,214 +0,0 @@
-package source
-
-// NOTE: To reduce the amount of custom code that needs to be written to facilitate
-// the creation of a custom source implementation, the code in this file is copied from
-// https://github.com/kubernetes-sigs/controller-runtime/blob/release-0.18/pkg/internal/source/event_handler.go
-//
-// Any modifications to this code will be noted below:
-// - The "k8s.io/client-go/tools/cache" package was aliased to "cgocache".
-// All references to this package were updated to use the new alias.
-// - The "logf" aliased import was updated from "sigs.k8s.io/controller-runtime/pkg/internal/log"
-// to "sigs.k8s.io/controller-runtime/pkg/log"
-// - The logger for the event handler is now generated with "logf.Log.WithName("source").WithName("EventHandler")"
-// instead of "logf.RuntimeLog.WithName("source").WithName("EventHandler")"
-//
-// All modifications are licensed under the Apache 2.0 license.
-//
-// In the future, we may consider making a contribution to the
-// controller-runtime project that exports this more generic
-// event handler functionality. If that happens, this code will be removed
-// and we will instead import the appropriate logic from the controller-runtime
-// project.
-
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-import (
- "context"
- "errors"
- "fmt"
-
- cgocache "k8s.io/client-go/tools/cache"
- "k8s.io/client-go/util/workqueue"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/event"
- "sigs.k8s.io/controller-runtime/pkg/handler"
- logf "sigs.k8s.io/controller-runtime/pkg/log"
- "sigs.k8s.io/controller-runtime/pkg/predicate"
-)
-
-var log = logf.Log.WithName("source").WithName("EventHandler")
-
-// NewEventHandler creates a new EventHandler.
-func NewEventHandler[object client.Object, request comparable](
- ctx context.Context,
- queue workqueue.TypedRateLimitingInterface[request],
- handler handler.TypedEventHandler[object, request],
- predicates []predicate.TypedPredicate[object]) *EventHandler[object, request] {
- return &EventHandler[object, request]{
- ctx: ctx,
- handler: handler,
- queue: queue,
- predicates: predicates,
- }
-}
-
-// EventHandler adapts a handler.EventHandler interface to a cache.ResourceEventHandler interface.
-type EventHandler[object client.Object, request comparable] struct {
- // ctx stores the context that created the event handler
- // that is used to propagate cancellation signals to each handler function.
- ctx context.Context
-
- handler handler.TypedEventHandler[object, request]
- queue workqueue.TypedRateLimitingInterface[request]
- predicates []predicate.TypedPredicate[object]
-}
-
-// HandlerFuncs converts EventHandler to a ResourceEventHandlerFuncs
-// TODO: switch to ResourceEventHandlerDetailedFuncs with client-go 1.27
-func (e *EventHandler[object, request]) HandlerFuncs() cgocache.ResourceEventHandlerFuncs {
- return cgocache.ResourceEventHandlerFuncs{
- AddFunc: e.OnAdd,
- UpdateFunc: e.OnUpdate,
- DeleteFunc: e.OnDelete,
- }
-}
-
-// OnAdd creates CreateEvent and calls Create on EventHandler.
-func (e *EventHandler[object, request]) OnAdd(obj interface{}) {
- c := event.TypedCreateEvent[object]{}
-
- // Pull Object out of the object
- if o, ok := obj.(object); ok {
- c.Object = o
- } else {
- log.Error(errors.New("failed to cast object"),
- "OnAdd missing Object",
- "expected_type", fmt.Sprintf("%T", c.Object),
- "received_type", fmt.Sprintf("%T", obj),
- "object", obj)
- return
- }
-
- for _, p := range e.predicates {
- if !p.Create(c) {
- return
- }
- }
-
- // Invoke create handler
- ctx, cancel := context.WithCancel(e.ctx)
- defer cancel()
- e.handler.Create(ctx, c, e.queue)
-}
-
-// OnUpdate creates UpdateEvent and calls Update on EventHandler.
-func (e *EventHandler[object, request]) OnUpdate(oldObj, newObj interface{}) {
- u := event.TypedUpdateEvent[object]{}
-
- if o, ok := oldObj.(object); ok {
- u.ObjectOld = o
- } else {
- log.Error(errors.New("failed to cast old object"),
- "OnUpdate missing ObjectOld",
- "object", oldObj,
- "expected_type", fmt.Sprintf("%T", u.ObjectOld),
- "received_type", fmt.Sprintf("%T", oldObj))
- return
- }
-
- // Pull Object out of the object
- if o, ok := newObj.(object); ok {
- u.ObjectNew = o
- } else {
- log.Error(errors.New("failed to cast new object"),
- "OnUpdate missing ObjectNew",
- "object", newObj,
- "expected_type", fmt.Sprintf("%T", u.ObjectNew),
- "received_type", fmt.Sprintf("%T", newObj))
- return
- }
-
- // Run predicates before proceeding
- for _, p := range e.predicates {
- if !p.Update(u) {
- return
- }
- }
-
- // Invoke update handler
- ctx, cancel := context.WithCancel(e.ctx)
- defer cancel()
- e.handler.Update(ctx, u, e.queue)
-}
-
-// OnDelete creates DeleteEvent and calls Delete on EventHandler.
-func (e *EventHandler[object, request]) OnDelete(obj interface{}) {
- d := event.TypedDeleteEvent[object]{}
-
- // Handle tombstone events (cache.DeletedFinalStateUnknown)
- if obj == nil {
- log.Error(errors.New("received nil object"),
- "OnDelete received a nil object, ignoring event")
- return
- }
-
- // Deal with tombstone events by pulling the object out. Tombstone events wrap the object in a
- // DeleteFinalStateUnknown struct, so the object needs to be pulled out.
- // Copied from sample-controller
- // This should never happen if we aren't missing events, which we have concluded that we are not
- // and made decisions off of this belief. Maybe this shouldn't be here?
- if _, ok := obj.(client.Object); !ok {
- // If the object doesn't have Metadata, assume it is a tombstone object of type DeletedFinalStateUnknown
- tombstone, ok := obj.(cgocache.DeletedFinalStateUnknown)
- if !ok {
- log.Error(errors.New("unexpected object type"),
- "Error decoding objects, expected cache.DeletedFinalStateUnknown",
- "received_type", fmt.Sprintf("%T", obj),
- "object", obj)
- return
- }
-
- // Set DeleteStateUnknown to true
- d.DeleteStateUnknown = true
-
- // Set obj to the tombstone obj
- obj = tombstone.Obj
- }
-
- // Pull Object out of the object
- if o, ok := obj.(object); ok {
- d.Object = o
- } else {
- log.Error(errors.New("failed to cast object"),
- "OnDelete missing Object",
- "expected_type", fmt.Sprintf("%T", d.Object),
- "received_type", fmt.Sprintf("%T", obj),
- "object", obj)
- return
- }
-
- for _, p := range e.predicates {
- if !p.Delete(d) {
- return
- }
- }
-
- // Invoke delete handler
- ctx, cancel := context.WithCancel(e.ctx)
- defer cancel()
- e.handler.Delete(ctx, d, e.queue)
-}
diff --git a/internal/operator-controller/contentmanager/sourcerer.go b/internal/operator-controller/contentmanager/sourcerer.go
deleted file mode 100644
index 050de87854..0000000000
--- a/internal/operator-controller/contentmanager/sourcerer.go
+++ /dev/null
@@ -1,99 +0,0 @@
-package contentmanager
-
-import (
- "context"
- "fmt"
-
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/dynamic/dynamicinformer"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/event"
- "sigs.k8s.io/controller-runtime/pkg/handler"
- "sigs.k8s.io/controller-runtime/pkg/predicate"
-
- ocv1 "github.com/operator-framework/operator-controller/api/v1"
- "github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager/cache"
- "github.com/operator-framework/operator-controller/internal/operator-controller/contentmanager/source"
-)
-
-type dynamicSourcerer struct {
- informerFactoryCreateFunc func() dynamicinformer.DynamicSharedInformerFactory
- mapper meta.RESTMapper
-}
-
-func (ds *dynamicSourcerer) Source(gvk schema.GroupVersionKind, owner client.Object, onPostSyncError func(context.Context)) (cache.CloserSyncingSource, error) {
- scheme, err := buildScheme(gvk)
- if err != nil {
- return nil, fmt.Errorf("building scheme: %w", err)
- }
-
- restMapping, err := ds.mapper.RESTMapping(gvk.GroupKind(), gvk.Version)
- if err != nil {
- return nil, fmt.Errorf("getting resource mapping for GVK %q: %w", gvk, err)
- }
-
- s := source.NewDynamicSource(source.DynamicSourceConfig{
- GVR: restMapping.Resource,
- Owner: owner,
- Handler: handler.EnqueueRequestForOwner(scheme, ds.mapper, owner, handler.OnlyControllerOwner()),
- Predicates: []predicate.Predicate{
- predicate.Funcs{
- CreateFunc: func(tce event.TypedCreateEvent[client.Object]) bool { return false },
- UpdateFunc: func(tue event.TypedUpdateEvent[client.Object]) bool { return true },
- DeleteFunc: func(tde event.TypedDeleteEvent[client.Object]) bool { return true },
- GenericFunc: func(tge event.TypedGenericEvent[client.Object]) bool { return true },
- },
- },
- DynamicInformerFactory: ds.informerFactoryCreateFunc(),
- OnPostSyncError: onPostSyncError,
- })
- return s, nil
-}
-
-// buildScheme builds a runtime.Scheme based on the provided GroupVersionKinds,
-// with all GroupVersionKinds mapping to the unstructured.Unstructured type
-// (unstructured.UnstructuredList for list kinds).
-//
-// It is assumed all GroupVersionKinds are valid, which means:
-// - The Kind is set
-// - The Version is set
-//
-// Invalid GroupVersionKinds will result in a panic.
-func buildScheme(gvks ...schema.GroupVersionKind) (*runtime.Scheme, error) {
- scheme := runtime.NewScheme()
- // The ClusterExtension types must be added to the scheme since its
- // going to be used to establish watches that trigger reconciliation
- // of the owning ClusterExtension
- if err := ocv1.AddToScheme(scheme); err != nil {
- return nil, fmt.Errorf("adding operator controller APIs to scheme: %w", err)
- }
-
- for _, gvk := range gvks {
- if !scheme.Recognizes(gvk) {
- // Since we can't have a mapping to every possible Go type in existence
- // based on the GVK we need to use the unstructured types for mapping
- u := &unstructured.Unstructured{}
- u.SetGroupVersionKind(gvk)
- scheme.AddKnownTypeWithName(gvk, u)
-
- // Adding the common meta schemas to the scheme for the GroupVersion
- // is necessary to ensure the scheme is aware of the different operations
- // that can be performed against the resources in this GroupVersion
- metav1.AddToGroupVersion(scheme, gvk.GroupVersion())
- }
-
- listGVK := gvk
- listGVK.Kind = listGVK.Kind + "List"
- if !scheme.Recognizes(listGVK) {
- ul := &unstructured.UnstructuredList{}
- ul.SetGroupVersionKind(listGVK)
- scheme.AddKnownTypeWithName(listGVK, ul)
- }
- }
-
- return scheme, nil
-}
diff --git a/internal/operator-controller/controllers/clustercatalog_controller_test.go b/internal/operator-controller/controllers/clustercatalog_controller_test.go
index aad0bb006b..da16ed54f1 100644
--- a/internal/operator-controller/controllers/clustercatalog_controller_test.go
+++ b/internal/operator-controller/controllers/clustercatalog_controller_test.go
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
ctrl "sigs.k8s.io/controller-runtime"
@@ -17,6 +18,7 @@ import (
ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/operator-controller/controllers"
"github.com/operator-framework/operator-controller/internal/operator-controller/scheme"
+ mockcontrollers "github.com/operator-framework/operator-controller/internal/testutil/mock/controllers"
)
func TestClusterCatalogReconcilerFinalizers(t *testing.T) {
@@ -24,14 +26,10 @@ func TestClusterCatalogReconcilerFinalizers(t *testing.T) {
catalogKey := types.NamespacedName{Name: "test-catalog"}
for _, tt := range []struct {
- name string
- catalog *ocv1.ClusterCatalog
- catalogCache mockCatalogCache
- catalogCachePopulator mockCatalogCachePopulator
- wantGetCacheCalled bool
- wantRemoveCacheCalled bool
- wantPopulateCacheCalled bool
- wantErr string
+ name string
+ catalog *ocv1.ClusterCatalog
+ setupMocks func(*gomock.Controller) (controllers.CatalogCache, controllers.CatalogCachePopulator)
+ wantErr string
}{
{
name: "catalog exists - cache unpopulated",
@@ -47,14 +45,18 @@ func TestClusterCatalogReconcilerFinalizers(t *testing.T) {
},
},
},
- catalogCachePopulator: mockCatalogCachePopulator{
- populateCacheFunc: func(ctx context.Context, catalog *ocv1.ClusterCatalog) (fs.FS, error) {
- assert.Equal(t, catalogKey.Name, catalog.Name)
- return nil, nil
- },
+ setupMocks: func(ctrl *gomock.Controller) (controllers.CatalogCache, controllers.CatalogCachePopulator) {
+ cache := mockcontrollers.NewMockCatalogCache(ctrl)
+ cache.EXPECT().Get(catalogKey.Name, fakeResolvedRef).Return(nil, nil)
+ populator := mockcontrollers.NewMockCatalogCachePopulator(ctrl)
+ populator.EXPECT().PopulateCache(gomock.Any(), gomock.Any()).DoAndReturn(
+ func(ctx context.Context, catalog *ocv1.ClusterCatalog) (fs.FS, error) {
+ assert.Equal(t, catalogKey.Name, catalog.Name)
+ return nil, nil
+ },
+ )
+ return cache, populator
},
- wantGetCacheCalled: true,
- wantPopulateCacheCalled: true,
},
{
name: "catalog exists - cache already populated",
@@ -70,15 +72,19 @@ func TestClusterCatalogReconcilerFinalizers(t *testing.T) {
},
},
},
- catalogCache: mockCatalogCache{
- getFunc: func(catalogName, resolvedRef string) (fs.FS, error) {
- assert.Equal(t, catalogKey.Name, catalogName)
- assert.Equal(t, fakeResolvedRef, resolvedRef)
- // Just any non-nil fs.FS to simulate existence of cache
- return fstest.MapFS{}, nil
- },
+ setupMocks: func(ctrl *gomock.Controller) (controllers.CatalogCache, controllers.CatalogCachePopulator) {
+ cache := mockcontrollers.NewMockCatalogCache(ctrl)
+ cache.EXPECT().Get(catalogKey.Name, fakeResolvedRef).DoAndReturn(
+ func(catalogName, resolvedRef string) (fs.FS, error) {
+ assert.Equal(t, catalogKey.Name, catalogName)
+ assert.Equal(t, fakeResolvedRef, resolvedRef)
+ // Just any non-nil fs.FS to simulate existence of cache
+ return fstest.MapFS{}, nil
+ },
+ )
+ populator := mockcontrollers.NewMockCatalogCachePopulator(ctrl)
+ return cache, populator
},
- wantGetCacheCalled: true,
},
{
name: "catalog exists - catalog not yet resolved",
@@ -87,6 +93,11 @@ func TestClusterCatalogReconcilerFinalizers(t *testing.T) {
Name: catalogKey.Name,
},
},
+ setupMocks: func(ctrl *gomock.Controller) (controllers.CatalogCache, controllers.CatalogCachePopulator) {
+ cache := mockcontrollers.NewMockCatalogCache(ctrl)
+ populator := mockcontrollers.NewMockCatalogCachePopulator(ctrl)
+ return cache, populator
+ },
},
{
name: "catalog exists - error on cache population",
@@ -102,15 +113,19 @@ func TestClusterCatalogReconcilerFinalizers(t *testing.T) {
},
},
},
- catalogCachePopulator: mockCatalogCachePopulator{
- populateCacheFunc: func(ctx context.Context, catalog *ocv1.ClusterCatalog) (fs.FS, error) {
- assert.Equal(t, catalogKey.Name, catalog.Name)
- return nil, errors.New("fake error from populate cache function")
- },
+ setupMocks: func(ctrl *gomock.Controller) (controllers.CatalogCache, controllers.CatalogCachePopulator) {
+ cache := mockcontrollers.NewMockCatalogCache(ctrl)
+ cache.EXPECT().Get(catalogKey.Name, fakeResolvedRef).Return(nil, nil)
+ populator := mockcontrollers.NewMockCatalogCachePopulator(ctrl)
+ populator.EXPECT().PopulateCache(gomock.Any(), gomock.Any()).DoAndReturn(
+ func(ctx context.Context, catalog *ocv1.ClusterCatalog) (fs.FS, error) {
+ assert.Equal(t, catalogKey.Name, catalog.Name)
+ return nil, errors.New("fake error from populate cache function")
+ },
+ )
+ return cache, populator
},
- wantGetCacheCalled: true,
- wantPopulateCacheCalled: true,
- wantErr: "error populating cache for catalog",
+ wantErr: "error populating cache for catalog",
},
{
name: "catalog exists - error on cache get",
@@ -126,41 +141,56 @@ func TestClusterCatalogReconcilerFinalizers(t *testing.T) {
},
},
},
- catalogCache: mockCatalogCache{
- getFunc: func(catalogName, resolvedRef string) (fs.FS, error) {
- assert.Equal(t, catalogKey.Name, catalogName)
- assert.Equal(t, fakeResolvedRef, resolvedRef)
- return nil, errors.New("fake error from cache get function")
- },
+ setupMocks: func(ctrl *gomock.Controller) (controllers.CatalogCache, controllers.CatalogCachePopulator) {
+ cache := mockcontrollers.NewMockCatalogCache(ctrl)
+ cache.EXPECT().Get(catalogKey.Name, fakeResolvedRef).DoAndReturn(
+ func(catalogName, resolvedRef string) (fs.FS, error) {
+ assert.Equal(t, catalogKey.Name, catalogName)
+ assert.Equal(t, fakeResolvedRef, resolvedRef)
+ return nil, errors.New("fake error from cache get function")
+ },
+ )
+ populator := mockcontrollers.NewMockCatalogCachePopulator(ctrl)
+ populator.EXPECT().PopulateCache(gomock.Any(), gomock.Any()).Return(nil, nil)
+ return cache, populator
},
- wantGetCacheCalled: true,
- wantPopulateCacheCalled: true,
},
{
name: "catalog does not exist",
- catalogCache: mockCatalogCache{
- removeFunc: func(catalogName string) error {
- assert.Equal(t, catalogKey.Name, catalogName)
- return nil
- },
+ setupMocks: func(ctrl *gomock.Controller) (controllers.CatalogCache, controllers.CatalogCachePopulator) {
+ cache := mockcontrollers.NewMockCatalogCache(ctrl)
+ cache.EXPECT().Remove(catalogKey.Name).DoAndReturn(
+ func(catalogName string) error {
+ assert.Equal(t, catalogKey.Name, catalogName)
+ return nil
+ },
+ )
+ populator := mockcontrollers.NewMockCatalogCachePopulator(ctrl)
+ return cache, populator
},
- wantRemoveCacheCalled: true,
},
{
name: "catalog does not exist - error on removal",
- catalogCache: mockCatalogCache{
- removeFunc: func(catalogName string) error {
- assert.Equal(t, catalogKey.Name, catalogName)
- return errors.New("fake error from remove")
- },
+ setupMocks: func(ctrl *gomock.Controller) (controllers.CatalogCache, controllers.CatalogCachePopulator) {
+ cache := mockcontrollers.NewMockCatalogCache(ctrl)
+ cache.EXPECT().Remove(catalogKey.Name).DoAndReturn(
+ func(catalogName string) error {
+ assert.Equal(t, catalogKey.Name, catalogName)
+ return errors.New("fake error from remove")
+ },
+ )
+ populator := mockcontrollers.NewMockCatalogCachePopulator(ctrl)
+ return cache, populator
},
- wantRemoveCacheCalled: true,
- wantErr: "error removing cache for catalog",
+ wantErr: "error removing cache for catalog",
},
} {
t.Run(tt.name, func(t *testing.T) {
ctx := context.Background()
+ mockCtrl := gomock.NewController(t)
+ cache, populator := tt.setupMocks(mockCtrl)
+
clientBuilder := fake.NewClientBuilder().WithScheme(scheme.Scheme)
if tt.catalog != nil {
clientBuilder = clientBuilder.WithObjects(tt.catalog)
@@ -169,8 +199,8 @@ func TestClusterCatalogReconcilerFinalizers(t *testing.T) {
reconciler := &controllers.ClusterCatalogReconciler{
Client: cl,
- CatalogCache: controllers.CatalogCache(&tt.catalogCache),
- CatalogCachePopulator: controllers.CatalogCachePopulator(&tt.catalogCachePopulator),
+ CatalogCache: cache,
+ CatalogCachePopulator: populator,
}
result, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: catalogKey})
@@ -180,49 +210,6 @@ func TestClusterCatalogReconcilerFinalizers(t *testing.T) {
require.ErrorContains(t, err, tt.wantErr)
}
require.Equal(t, ctrl.Result{}, result)
-
- assert.Equal(t, tt.wantRemoveCacheCalled, tt.catalogCache.removeFuncCalled)
- assert.Equal(t, tt.wantGetCacheCalled, tt.catalogCache.getFuncCalled)
- assert.Equal(t, tt.wantPopulateCacheCalled, tt.catalogCachePopulator.populateCacheCalled)
})
}
}
-
-type mockCatalogCache struct {
- removeFuncCalled bool
- removeFunc func(catalogName string) error
- getFuncCalled bool
- getFunc func(catalogName, resolvedRef string) (fs.FS, error)
-}
-
-func (m *mockCatalogCache) Remove(catalogName string) error {
- m.removeFuncCalled = true
- if m.removeFunc != nil {
- return m.removeFunc(catalogName)
- }
-
- return nil
-}
-
-func (m *mockCatalogCache) Get(catalogName, resolvedRef string) (fs.FS, error) {
- m.getFuncCalled = true
- if m.getFunc != nil {
- return m.getFunc(catalogName, resolvedRef)
- }
-
- return nil, nil
-}
-
-type mockCatalogCachePopulator struct {
- populateCacheCalled bool
- populateCacheFunc func(ctx context.Context, catalog *ocv1.ClusterCatalog) (fs.FS, error)
-}
-
-func (m *mockCatalogCachePopulator) PopulateCache(ctx context.Context, catalog *ocv1.ClusterCatalog) (fs.FS, error) {
- m.populateCacheCalled = true
- if m.populateCacheFunc != nil {
- return m.populateCacheFunc(ctx, catalog)
- }
-
- return nil, nil
-}
diff --git a/internal/operator-controller/controllers/clusterextension_admission_test.go b/internal/operator-controller/controllers/clusterextension_admission_test.go
index 259bb95059..57d4712326 100644
--- a/internal/operator-controller/controllers/clusterextension_admission_test.go
+++ b/internal/operator-controller/controllers/clusterextension_admission_test.go
@@ -45,9 +45,6 @@ func TestClusterExtensionSourceConfig(t *testing.T) {
},
},
Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
}))
}
if tc.unionField == "" {
@@ -56,9 +53,6 @@ func TestClusterExtensionSourceConfig(t *testing.T) {
SourceType: tc.sourceType,
},
Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
}))
}
@@ -123,9 +117,6 @@ func TestClusterExtensionAdmissionPackageName(t *testing.T) {
},
},
Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
}))
if tc.errMsg == "" {
require.NoError(t, err, "unexpected error for package name %q: %w", tc.pkgName, err)
@@ -221,9 +212,6 @@ func TestClusterExtensionAdmissionVersion(t *testing.T) {
},
},
Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
}))
if tc.errMsg == "" {
require.NoError(t, err, "unexpected error for version %q: %w", tc.version, err)
@@ -245,7 +233,7 @@ func TestClusterExtensionAdmissionChannel(t *testing.T) {
errMsg string
}{
{"no channel name", []string{""}, regexMismatchError},
- {"hypen-separated", []string{"hyphenated-name"}, ""},
+ {"hyphen-separated", []string{"hyphenated-name"}, ""},
{"dot-separated", []string{"dotted.name"}, ""},
{"includes version", []string{"channel-has-version-1.0.1"}, ""},
{"long channel name", []string{strings.Repeat("x", 254)}, tooLongError},
@@ -276,9 +264,6 @@ func TestClusterExtensionAdmissionChannel(t *testing.T) {
},
},
Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
}))
if tc.errMsg == "" {
require.NoError(t, err, "unexpected error for channel %q: %w", tc.channels, err)
@@ -300,7 +285,7 @@ func TestClusterExtensionAdmissionInstallNamespace(t *testing.T) {
errMsg string
}{
{"just alphanumeric", "justalphanumberic1", ""},
- {"hypen-separated", "hyphenated-name", ""},
+ {"hyphen-separated", "hyphenated-name", ""},
{"no install namespace", "", regexMismatchError},
{"dot-separated", "dotted.name", regexMismatchError},
{"longest valid install namespace", strings.Repeat("x", 63), ""},
@@ -329,9 +314,6 @@ func TestClusterExtensionAdmissionInstallNamespace(t *testing.T) {
},
},
Namespace: tc.namespace,
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
}))
if tc.errMsg == "" {
require.NoError(t, err, "unexpected error for namespace %q: %w", tc.namespace, err)
@@ -343,30 +325,35 @@ func TestClusterExtensionAdmissionInstallNamespace(t *testing.T) {
}
}
+// TestClusterExtensionAdmissionServiceAccount validates the deprecated spec.serviceAccount field:
+// - CRD-level validation (format, length) still works
+// - ValidatingAdmissionPolicy emits a deprecation warning for valid non-empty values
func TestClusterExtensionAdmissionServiceAccount(t *testing.T) {
tooLongError := "spec.serviceAccount.name: Too long: may not be more than 253"
regexMismatchError := "name must be a valid DNS1123 subdomain"
+ deprecationWarning := "spec.serviceAccount is deprecated"
testCases := []struct {
name string
serviceAccount string
errMsg string
+ warnMsg string
}{
- {"just alphanumeric", "justalphanumeric1", ""},
- {"hypen-separated", "hyphenated-name", ""},
- {"dot-separated", "dotted.name", ""},
- {"longest valid service account name", strings.Repeat("x", 253), ""},
- {"too long service account name", strings.Repeat("x", 254), tooLongError},
- {"no service account name", "", regexMismatchError},
- {"spaces", "spaces spaces", regexMismatchError},
- {"capitalized", "Capitalized", regexMismatchError},
- {"camel case", "camelCase", regexMismatchError},
- {"invalid characters", "many/invalid$characters+in_name", regexMismatchError},
- {"starts with hyphen", "-start-with-hyphen", regexMismatchError},
- {"ends with hyphen", "end-with-hyphen-", regexMismatchError},
- {"starts with period", ".start-with-period", regexMismatchError},
- {"ends with period", "end-with-period.", regexMismatchError},
- {"multiple sequential separators", "a.-b", regexMismatchError},
+ {"just alphanumeric", "justalphanumeric1", "", deprecationWarning},
+ {"hyphen-separated", "hyphenated-name", "", deprecationWarning},
+ {"dot-separated", "dotted.name", "", deprecationWarning},
+ {"longest valid service account name", strings.Repeat("x", 253), "", deprecationWarning},
+ {"too long service account name", strings.Repeat("x", 254), tooLongError, ""},
+ {"no service account name", "", "", ""},
+ {"spaces", "spaces spaces", regexMismatchError, ""},
+ {"capitalized", "Capitalized", regexMismatchError, ""},
+ {"camel case", "camelCase", regexMismatchError, ""},
+ {"invalid characters", "many/invalid$characters+in_name", regexMismatchError, ""},
+ {"starts with hyphen", "-start-with-hyphen", regexMismatchError, ""},
+ {"ends with hyphen", "end-with-hyphen-", regexMismatchError, ""},
+ {"starts with period", ".start-with-period", regexMismatchError, ""},
+ {"ends with period", "end-with-period.", regexMismatchError, ""},
+ {"multiple sequential separators", "a.-b", regexMismatchError, ""},
}
t.Parallel()
@@ -374,7 +361,7 @@ func TestClusterExtensionAdmissionServiceAccount(t *testing.T) {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
- cl := newClient(t)
+ cl, collector := newWarningCapturingClient(t)
err := cl.Create(context.Background(), buildClusterExtension(ocv1.ClusterExtensionSpec{
Source: ocv1.SourceConfig{
SourceType: "Catalog",
@@ -383,7 +370,7 @@ func TestClusterExtensionAdmissionServiceAccount(t *testing.T) {
},
},
Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
+ ServiceAccount: ocv1.ServiceAccountReference{ //nolint:staticcheck // testing deprecated field
Name: tc.serviceAccount,
},
}))
@@ -393,6 +380,9 @@ func TestClusterExtensionAdmissionServiceAccount(t *testing.T) {
require.Error(t, err)
require.Contains(t, err.Error(), tc.errMsg)
}
+ if tc.warnMsg != "" {
+ require.True(t, collector.hasWarning(tc.warnMsg), "expected deprecation warning containing %q", tc.warnMsg)
+ }
})
}
}
@@ -442,10 +432,7 @@ func TestClusterExtensionAdmissionInstall(t *testing.T) {
},
},
Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
- Install: tc.installConfig,
+ Install: tc.installConfig,
}))
if tc.errMsg == "" {
require.NoError(t, err, "unexpected error for install configuration %v: %w", tc.installConfig, err)
@@ -494,9 +481,6 @@ func Test_ClusterExtensionAdmissionInlineConfig(t *testing.T) {
},
},
Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
Config: &ocv1.ClusterExtensionConfig{
ConfigType: ocv1.ClusterExtensionConfigTypeInline,
Inline: &apiextensionsv1.JSON{
diff --git a/internal/operator-controller/controllers/clusterextension_controller.go b/internal/operator-controller/controllers/clusterextension_controller.go
index 6645d392f3..0fa5fdee2c 100644
--- a/internal/operator-controller/controllers/clusterextension_controller.go
+++ b/internal/operator-controller/controllers/clusterextension_controller.go
@@ -42,6 +42,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
+ "sigs.k8s.io/controller-runtime/pkg/source"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
@@ -425,6 +426,12 @@ func WithOwns(obj client.Object) ControllerBuilderOption {
}
}
+func WithWatchesRawSource(src source.Source) ControllerBuilderOption {
+ return func(b *ctrl.Builder) {
+ b.WatchesRawSource(src)
+ }
+}
+
// SetupWithManager sets up the controller with the Manager.
func (r *ClusterExtensionReconciler) SetupWithManager(mgr ctrl.Manager, opts ...ControllerBuilderOption) (crcontroller.Controller, error) {
ctrlBuilder := ctrl.NewControllerManagedBy(mgr).
diff --git a/internal/operator-controller/controllers/clusterextension_controller_test.go b/internal/operator-controller/controllers/clusterextension_controller_test.go
index 4f524dd9a6..75ed035a97 100644
--- a/internal/operator-controller/controllers/clusterextension_controller_test.go
+++ b/internal/operator-controller/controllers/clusterextension_controller_test.go
@@ -12,24 +12,20 @@ import (
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- "helm.sh/helm/v3/pkg/action"
- "helm.sh/helm/v3/pkg/chart"
+ "go.uber.org/mock/gomock"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/storage/driver"
- corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/equality"
apimeta "k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/rand"
- "k8s.io/client-go/kubernetes/fake"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
crfinalizer "sigs.k8s.io/controller-runtime/pkg/finalizer"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
- helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
"github.com/operator-framework/operator-registry/alpha/declcfg"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
@@ -41,6 +37,8 @@ import (
"github.com/operator-framework/operator-controller/internal/operator-controller/labels"
"github.com/operator-framework/operator-controller/internal/operator-controller/resolve"
imageutil "github.com/operator-framework/operator-controller/internal/shared/util/image"
+ mockcontrollers "github.com/operator-framework/operator-controller/internal/testutil/mock/controllers"
+ mockhelmclient "github.com/operator-framework/operator-controller/internal/testutil/mock/helmclient"
)
// Describe: ClusterExtension Controller Test
@@ -58,9 +56,7 @@ func TestClusterExtensionShortCircuitsReconcileDuringDeletion(t *testing.T) {
installedBundleGetterCalledErr := errors.New("revision states getter called")
cl, reconciler := newClientAndReconciler(t, func(d *deps) {
- d.RevisionStatesGetter = &MockRevisionStatesGetter{
- Err: installedBundleGetterCalledErr,
- }
+ d.RevisionStatesGetter = newMockRevisionStatesGetter(gomock.NewController(t), nil, installedBundleGetterCalledErr)
})
checkInstalledBundleGetterCalled := func(t require.TestingT, err error, args ...interface{}) {
@@ -111,9 +107,6 @@ func TestClusterExtensionShortCircuitsReconcileDuringDeletion(t *testing.T) {
},
},
Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
},
}
require.NoError(t, cl.Create(ctx, clusterExtension))
@@ -152,9 +145,6 @@ func TestClusterExtensionResolutionFails(t *testing.T) {
},
},
Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
},
}
require.NoError(t, cl.Create(ctx, clusterExtension))
@@ -215,8 +205,7 @@ func TestClusterExtensionResolutionFailsWithDeprecationData(t *testing.T) {
SourceType: "Catalog",
Catalog: &ocv1.CatalogFilter{PackageName: pkgName},
},
- Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "default"},
+ Namespace: "default",
},
}
require.NoError(t, cl.Create(ctx, clusterExtension))
@@ -282,20 +271,18 @@ func TestClusterExtensionUpgradeShowsInstalledBundleDeprecation(t *testing.T) {
}},
}, nil
})
- d.RevisionStatesGetter = &MockRevisionStatesGetter{
- RevisionStates: &controllers.RevisionStates{
- Installed: &controllers.RevisionMetadata{
- Package: pkgName,
- BundleMetadata: ocv1.BundleMetadata{
- Name: installedBundleName, // v1.0.0 installed
- Version: "1.0.0",
- },
- Image: fmt.Sprintf("quay.io/example/%s@sha256:installed100", pkgName),
+ d.RevisionStatesGetter = newMockRevisionStatesGetter(gomock.NewController(t), &controllers.RevisionStates{
+ Installed: &controllers.RevisionMetadata{
+ Package: pkgName,
+ BundleMetadata: ocv1.BundleMetadata{
+ Name: installedBundleName, // v1.0.0 installed
+ Version: "1.0.0",
},
+ Image: fmt.Sprintf("quay.io/example/%s@sha256:installed100", pkgName),
},
- }
- d.ImagePuller = &imageutil.MockPuller{ImageFS: fstest.MapFS{}}
- d.Applier = &MockApplier{}
+ }, nil)
+ d.ImagePuller = &imageutil.FakePuller{ImageFS: fstest.MapFS{}}
+ d.Applier = newMockApplier(gomock.NewController(t), false, nil)
})
extKey := types.NamespacedName{Name: fmt.Sprintf("cluster-extension-test-%s", rand.String(8))}
@@ -306,8 +293,7 @@ func TestClusterExtensionUpgradeShowsInstalledBundleDeprecation(t *testing.T) {
SourceType: "Catalog",
Catalog: &ocv1.CatalogFilter{PackageName: pkgName},
},
- Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "default"},
+ Namespace: "default",
},
}
require.NoError(t, cl.Create(ctx, clusterExtension))
@@ -384,20 +370,18 @@ func TestClusterExtensionUpgradeFromDeprecatedBundleClearsDeprecation(t *testing
}},
}, nil
})
- d.RevisionStatesGetter = &MockRevisionStatesGetter{
- RevisionStates: &controllers.RevisionStates{
- Installed: &controllers.RevisionMetadata{
- Package: pkgName,
- BundleMetadata: ocv1.BundleMetadata{
- Name: installedBundleName,
- Version: "1.0.1",
- },
- Image: fmt.Sprintf("quay.io/example/%s@sha256:installed101", pkgName),
+ d.RevisionStatesGetter = newMockRevisionStatesGetter(gomock.NewController(t), &controllers.RevisionStates{
+ Installed: &controllers.RevisionMetadata{
+ Package: pkgName,
+ BundleMetadata: ocv1.BundleMetadata{
+ Name: installedBundleName,
+ Version: "1.0.1",
},
+ Image: fmt.Sprintf("quay.io/example/%s@sha256:installed101", pkgName),
},
- }
- d.ImagePuller = &imageutil.MockPuller{ImageFS: fstest.MapFS{}}
- d.Applier = &MockApplier{installCompleted: true}
+ }, nil)
+ d.ImagePuller = &imageutil.FakePuller{ImageFS: fstest.MapFS{}}
+ d.Applier = newMockApplier(gomock.NewController(t), true, nil)
})
extKey := types.NamespacedName{Name: fmt.Sprintf("cluster-extension-test-%s", rand.String(8))}
@@ -408,8 +392,7 @@ func TestClusterExtensionUpgradeFromDeprecatedBundleClearsDeprecation(t *testing
SourceType: "Catalog",
Catalog: &ocv1.CatalogFilter{PackageName: pkgName},
},
- Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "default"},
+ Namespace: "default",
},
}
require.NoError(t, cl.Create(ctx, clusterExtension))
@@ -469,18 +452,16 @@ func TestClusterExtensionResolutionFailsWithoutCatalogDeprecationData(t *testing
return nil, nil, nil, fmt.Errorf("no bundles found for package %q", pkgName)
})
- d.RevisionStatesGetter = &MockRevisionStatesGetter{
- RevisionStates: &controllers.RevisionStates{
- Installed: &controllers.RevisionMetadata{
- Package: pkgName,
- BundleMetadata: ocv1.BundleMetadata{
- Name: installedBundleName,
- Version: "1.0.0",
- },
- Image: "example.com/installed@sha256:deadbeef",
+ d.RevisionStatesGetter = newMockRevisionStatesGetter(gomock.NewController(t), &controllers.RevisionStates{
+ Installed: &controllers.RevisionMetadata{
+ Package: pkgName,
+ BundleMetadata: ocv1.BundleMetadata{
+ Name: installedBundleName,
+ Version: "1.0.0",
},
+ Image: "example.com/installed@sha256:deadbeef",
},
- }
+ }, nil)
})
// Create a ClusterCatalog so CheckCatalogsExist returns true, causing retry instead of fallback
@@ -505,8 +486,7 @@ func TestClusterExtensionResolutionFailsWithoutCatalogDeprecationData(t *testing
SourceType: "Catalog",
Catalog: &ocv1.CatalogFilter{PackageName: pkgName},
},
- Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "default"},
+ Namespace: "default",
},
}
require.NoError(t, cl.Create(ctx, clusterExtension))
@@ -567,7 +547,6 @@ func TestClusterExtensionResolutionSuccessfulUnpackFails(t *testing.T) {
pkgVer := "1.0.0"
pkgChan := "beta"
namespace := fmt.Sprintf("test-ns-%s", rand.String(8))
- serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8))
clusterExtension := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{Name: extKey.Name},
@@ -581,14 +560,11 @@ func TestClusterExtensionResolutionSuccessfulUnpackFails(t *testing.T) {
},
},
Namespace: namespace,
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: serviceAccount,
- },
},
}
cl, reconciler := newClientAndReconciler(t,
func(d *deps) {
- d.ImagePuller = &imageutil.MockPuller{
+ d.ImagePuller = &imageutil.FakePuller{
Error: tc.pullErr,
}
},
@@ -667,7 +643,7 @@ func TestClusterExtensionResolutionSuccessfulUnpackFails(t *testing.T) {
func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails(t *testing.T) {
cl, reconciler := newClientAndReconciler(t,
func(d *deps) {
- d.ImagePuller = &imageutil.MockPuller{
+ d.ImagePuller = &imageutil.FakePuller{
ImageFS: fstest.MapFS{},
}
d.Resolver = resolve.Func(func(ctx context.Context, ext *ocv1.ClusterExtension, installedBundle *ocv1.BundleMetadata) (*declcfg.Bundle, *bundle.VersionRelease, *declcfg.Deprecation, error) {
@@ -680,9 +656,7 @@ func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails(t *testing.T)
Image: "quay.io/operatorhubio/prometheus@fake1.0.0",
}, &v, nil, nil
})
- d.Applier = &MockApplier{
- err: errors.New("apply failure"),
- }
+ d.Applier = newMockApplier(gomock.NewController(t), false, errors.New("apply failure"))
})
ctx := context.Background()
@@ -694,7 +668,6 @@ func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails(t *testing.T)
pkgVer := "1.0.0"
pkgChan := "beta"
namespace := fmt.Sprintf("test-ns-%s", rand.String(8))
- serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8))
clusterExtension := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{Name: extKey.Name},
@@ -708,9 +681,6 @@ func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails(t *testing.T)
},
},
Namespace: namespace,
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: serviceAccount,
- },
},
}
err := cl.Create(ctx, clusterExtension)
@@ -785,11 +755,9 @@ func TestClusterExtensionBoxcutterApplierFailsDoesNotLeakDeprecationErrors(t *te
cl, reconciler := newClientAndReconciler(t, func(d *deps) {
// Boxcutter keeps a rolling revision when apply fails. We mirror that state so the test uses
// the same inputs the runtime would see.
- d.RevisionStatesGetter = &MockRevisionStatesGetter{
- RevisionStates: &controllers.RevisionStates{
- RollingOut: []*controllers.RevisionMetadata{{}},
- },
- }
+ d.RevisionStatesGetter = newMockRevisionStatesGetter(gomock.NewController(t), &controllers.RevisionStates{
+ RollingOut: []*controllers.RevisionMetadata{{}},
+ }, nil)
d.Resolver = resolve.Func(func(ctx context.Context, ext *ocv1.ClusterExtension, installedBundle *ocv1.BundleMetadata) (*declcfg.Bundle, *bundle.VersionRelease, *declcfg.Deprecation, error) {
v := bundle.VersionRelease{
Version: bsemver.MustParse("1.0.0"),
@@ -800,8 +768,8 @@ func TestClusterExtensionBoxcutterApplierFailsDoesNotLeakDeprecationErrors(t *te
Image: "quay.io/operatorhubio/prometheus@fake1.0.0",
}, &v, nil, nil
})
- d.ImagePuller = &imageutil.MockPuller{ImageFS: fstest.MapFS{}}
- d.Applier = &MockApplier{err: errors.New("boxcutter apply failure")}
+ d.ImagePuller = &imageutil.FakePuller{ImageFS: fstest.MapFS{}}
+ d.Applier = newMockApplier(gomock.NewController(t), false, errors.New("boxcutter apply failure"))
})
ctx := context.Background()
@@ -820,9 +788,6 @@ func TestClusterExtensionBoxcutterApplierFailsDoesNotLeakDeprecationErrors(t *te
},
},
Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "default",
- },
},
}
require.NoError(t, cl.Create(ctx, clusterExtension))
@@ -956,32 +921,6 @@ func TestValidateClusterExtension(t *testing.T) {
expectError: true,
errorMessageIncludes: "validation error 1\nvalidation error 2",
},
- {
- name: "service account not found",
- validators: []controllers.ClusterExtensionValidator{
- // Create a different ServiceAccount to ensure "test-sa" is not found.
- serviceAccountValidatorWithFakeClient(&corev1.ServiceAccount{
- ObjectMeta: metav1.ObjectMeta{
- Name: "not-test-sa",
- Namespace: "test-ns",
- },
- }),
- },
- expectError: true,
- errorMessageIncludes: `service account "test-sa" not found in namespace "test-ns"`,
- },
- {
- name: "service account found",
- validators: []controllers.ClusterExtensionValidator{
- serviceAccountValidatorWithFakeClient(&corev1.ServiceAccount{
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-sa",
- Namespace: "test-ns",
- },
- }),
- },
- expectError: false,
- },
}
for _, tt := range tests {
@@ -989,9 +928,7 @@ func TestValidateClusterExtension(t *testing.T) {
ctx := context.Background()
cl, reconciler := newClientAndReconciler(t, func(d *deps) {
- d.RevisionStatesGetter = &MockRevisionStatesGetter{
- RevisionStates: &controllers.RevisionStates{},
- }
+ d.RevisionStatesGetter = newMockRevisionStatesGetter(gomock.NewController(t), &controllers.RevisionStates{}, nil)
d.Validators = tt.validators
})
@@ -1007,9 +944,6 @@ func TestValidateClusterExtension(t *testing.T) {
},
},
Namespace: "test-ns",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "test-sa",
- },
},
}
@@ -1047,11 +981,15 @@ func TestValidateClusterExtension(t *testing.T) {
}
func TestClusterExtensionApplierFailsWithBundleInstalled(t *testing.T) {
- mockApplier := &MockApplier{
- installCompleted: true,
- }
+ // This test calls Reconcile twice: first with a successful applier,
+ // then with a failing applier. We use gomock.InOrder to sequence the calls.
+ mockCtrl := gomock.NewController(t)
+ applier := mockcontrollers.NewMockApplier(mockCtrl)
+ firstCall := applier.EXPECT().Apply(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(true, "", nil)
+ applier.EXPECT().Apply(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(false, "", errors.New("apply failure")).After(firstCall)
+
cl, reconciler := newClientAndReconciler(t, func(d *deps) {
- d.ImagePuller = &imageutil.MockPuller{
+ d.ImagePuller = &imageutil.FakePuller{
ImageFS: fstest.MapFS{},
}
d.Resolver = resolve.Func(func(ctx context.Context, ext *ocv1.ClusterExtension, installedBundle *ocv1.BundleMetadata) (*declcfg.Bundle, *bundle.VersionRelease, *declcfg.Deprecation, error) {
@@ -1065,15 +1003,13 @@ func TestClusterExtensionApplierFailsWithBundleInstalled(t *testing.T) {
}, &v, nil, nil
})
- d.RevisionStatesGetter = &MockRevisionStatesGetter{
- RevisionStates: &controllers.RevisionStates{
- Installed: &controllers.RevisionMetadata{
- BundleMetadata: ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"},
- Image: "quay.io/operatorhubio/prometheus@fake1.0.0",
- },
+ d.RevisionStatesGetter = newMockRevisionStatesGetter(gomock.NewController(t), &controllers.RevisionStates{
+ Installed: &controllers.RevisionMetadata{
+ BundleMetadata: ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"},
+ Image: "quay.io/operatorhubio/prometheus@fake1.0.0",
},
- }
- d.Applier = mockApplier
+ }, nil)
+ d.Applier = applier
})
ctx := context.Background()
@@ -1085,7 +1021,6 @@ func TestClusterExtensionApplierFailsWithBundleInstalled(t *testing.T) {
pkgVer := "1.0.0"
pkgChan := "beta"
namespace := fmt.Sprintf("test-ns-%s", rand.String(8))
- serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8))
clusterExtension := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{Name: extKey.Name},
@@ -1099,9 +1034,6 @@ func TestClusterExtensionApplierFailsWithBundleInstalled(t *testing.T) {
},
},
Namespace: namespace,
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: serviceAccount,
- },
},
}
err := cl.Create(ctx, clusterExtension)
@@ -1114,9 +1046,6 @@ func TestClusterExtensionApplierFailsWithBundleInstalled(t *testing.T) {
require.Equal(t, ctrl.Result{}, res)
require.NoError(t, err)
- mockApplier.installCompleted = false
- mockApplier.err = errors.New("apply failure")
-
res, err = reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: extKey})
require.Equal(t, ctrl.Result{}, res)
require.Error(t, err)
@@ -1146,7 +1075,7 @@ func TestClusterExtensionApplierFailsWithBundleInstalled(t *testing.T) {
func TestClusterExtensionManagerFailed(t *testing.T) {
cl, reconciler := newClientAndReconciler(t, func(d *deps) {
- d.ImagePuller = &imageutil.MockPuller{
+ d.ImagePuller = &imageutil.FakePuller{
ImageFS: fstest.MapFS{},
}
d.Resolver = resolve.Func(func(ctx context.Context, ext *ocv1.ClusterExtension, installedBundle *ocv1.BundleMetadata) (*declcfg.Bundle, *bundle.VersionRelease, *declcfg.Deprecation, error) {
@@ -1159,10 +1088,7 @@ func TestClusterExtensionManagerFailed(t *testing.T) {
Image: "quay.io/operatorhubio/prometheus@fake1.0.0",
}, &v, nil, nil
})
- d.Applier = &MockApplier{
- installCompleted: true,
- err: errors.New("manager fail"),
- }
+ d.Applier = newMockApplier(gomock.NewController(t), true, errors.New("manager fail"))
})
ctx := context.Background()
@@ -1174,7 +1100,6 @@ func TestClusterExtensionManagerFailed(t *testing.T) {
pkgVer := "1.0.0"
pkgChan := "beta"
namespace := fmt.Sprintf("test-ns-%s", rand.String(8))
- serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8))
clusterExtension := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{Name: extKey.Name},
@@ -1188,9 +1113,6 @@ func TestClusterExtensionManagerFailed(t *testing.T) {
},
},
Namespace: namespace,
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: serviceAccount,
- },
},
}
err := cl.Create(ctx, clusterExtension)
@@ -1225,7 +1147,7 @@ func TestClusterExtensionManagerFailed(t *testing.T) {
func TestClusterExtensionManagedContentCacheWatchFail(t *testing.T) {
cl, reconciler := newClientAndReconciler(t, func(d *deps) {
- d.ImagePuller = &imageutil.MockPuller{
+ d.ImagePuller = &imageutil.FakePuller{
ImageFS: fstest.MapFS{},
}
d.Resolver = resolve.Func(func(ctx context.Context, ext *ocv1.ClusterExtension, installedBundle *ocv1.BundleMetadata) (*declcfg.Bundle, *bundle.VersionRelease, *declcfg.Deprecation, error) {
@@ -1238,10 +1160,7 @@ func TestClusterExtensionManagedContentCacheWatchFail(t *testing.T) {
Image: "quay.io/operatorhubio/prometheus@fake1.0.0",
}, &v, nil, nil
})
- d.Applier = &MockApplier{
- installCompleted: true,
- err: errors.New("watch error"),
- }
+ d.Applier = newMockApplier(gomock.NewController(t), true, errors.New("watch error"))
})
ctx := context.Background()
@@ -1253,7 +1172,6 @@ func TestClusterExtensionManagedContentCacheWatchFail(t *testing.T) {
pkgVer := "1.0.0"
pkgChan := "beta"
installNamespace := fmt.Sprintf("test-ns-%s", rand.String(8))
- serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8))
clusterExtension := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{Name: extKey.Name},
@@ -1268,9 +1186,6 @@ func TestClusterExtensionManagedContentCacheWatchFail(t *testing.T) {
},
},
Namespace: installNamespace,
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: serviceAccount,
- },
},
}
err := cl.Create(ctx, clusterExtension)
@@ -1306,7 +1221,7 @@ func TestClusterExtensionManagedContentCacheWatchFail(t *testing.T) {
func TestClusterExtensionInstallationSucceeds(t *testing.T) {
cl, reconciler := newClientAndReconciler(t, func(d *deps) {
- d.ImagePuller = &imageutil.MockPuller{
+ d.ImagePuller = &imageutil.FakePuller{
ImageFS: fstest.MapFS{},
}
d.Resolver = resolve.Func(func(ctx context.Context, ext *ocv1.ClusterExtension, installedBundle *ocv1.BundleMetadata) (*declcfg.Bundle, *bundle.VersionRelease, *declcfg.Deprecation, error) {
@@ -1319,9 +1234,7 @@ func TestClusterExtensionInstallationSucceeds(t *testing.T) {
Image: "quay.io/operatorhubio/prometheus@fake1.0.0",
}, &v, nil, nil
})
- d.Applier = &MockApplier{
- installCompleted: true,
- }
+ d.Applier = newMockApplier(gomock.NewController(t), true, nil)
})
ctx := context.Background()
@@ -1333,7 +1246,6 @@ func TestClusterExtensionInstallationSucceeds(t *testing.T) {
pkgVer := "1.0.0"
pkgChan := "beta"
namespace := fmt.Sprintf("test-ns-%s", rand.String(8))
- serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8))
clusterExtension := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{Name: extKey.Name},
@@ -1347,9 +1259,6 @@ func TestClusterExtensionInstallationSucceeds(t *testing.T) {
},
},
Namespace: namespace,
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: serviceAccount,
- },
},
}
err := cl.Create(ctx, clusterExtension)
@@ -1387,7 +1296,7 @@ func TestClusterExtensionDeleteFinalizerFails(t *testing.T) {
finalizersMessage := "still have finalizers"
var rfinalizers crfinalizer.Finalizers
cl, reconciler := newClientAndReconciler(t, func(d *deps) {
- d.ImagePuller = &imageutil.MockPuller{
+ d.ImagePuller = &imageutil.FakePuller{
ImageFS: fstest.MapFS{},
}
d.Resolver = resolve.Func(func(ctx context.Context, ext *ocv1.ClusterExtension, installedBundle *ocv1.BundleMetadata) (*declcfg.Bundle, *bundle.VersionRelease, *declcfg.Deprecation, error) {
@@ -1400,17 +1309,13 @@ func TestClusterExtensionDeleteFinalizerFails(t *testing.T) {
Image: "quay.io/operatorhubio/prometheus@fake1.0.0",
}, &v, nil, nil
})
- d.Applier = &MockApplier{
- installCompleted: true,
- }
- d.RevisionStatesGetter = &MockRevisionStatesGetter{
- RevisionStates: &controllers.RevisionStates{
- Installed: &controllers.RevisionMetadata{
- BundleMetadata: ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"},
- Image: "quay.io/operatorhubio/prometheus@fake1.0.0",
- },
+ d.Applier = newMockApplier(gomock.NewController(t), true, nil)
+ d.RevisionStatesGetter = newMockRevisionStatesGetter(gomock.NewController(t), &controllers.RevisionStates{
+ Installed: &controllers.RevisionMetadata{
+ BundleMetadata: ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"},
+ Image: "quay.io/operatorhubio/prometheus@fake1.0.0",
},
- }
+ }, nil)
rfinalizers = d.Finalizers
})
@@ -1423,7 +1328,6 @@ func TestClusterExtensionDeleteFinalizerFails(t *testing.T) {
pkgVer := "1.0.0"
pkgChan := "beta"
namespace := fmt.Sprintf("test-ns-%s", rand.String(8))
- serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8))
clusterExtension := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{Name: extKey.Name},
@@ -1437,9 +1341,6 @@ func TestClusterExtensionDeleteFinalizerFails(t *testing.T) {
},
},
Namespace: namespace,
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: serviceAccount,
- },
},
}
err := cl.Create(ctx, clusterExtension)
@@ -2524,75 +2425,35 @@ func filterDeprecationConditions(conditions []metav1.Condition) []metav1.Conditi
return result
}
-type MockActionGetter struct {
- description string
- rels []*release.Release
- err error
- expectedInstalled *controllers.RevisionMetadata
- expectedError error
-}
-
-func (mag *MockActionGetter) ActionClientFor(ctx context.Context, obj client.Object) (helmclient.ActionInterface, error) {
- return mag, nil
-}
-
-func (mag *MockActionGetter) Get(name string, opts ...helmclient.GetOption) (*release.Release, error) {
- return nil, nil
-}
-
-// This is the function we are really testing
-func (mag *MockActionGetter) History(name string, opts ...helmclient.HistoryOption) ([]*release.Release, error) {
- return mag.rels, mag.err
-}
-
-func (mag *MockActionGetter) Install(name, namespace string, chrt *chart.Chart, vals map[string]interface{}, opts ...helmclient.InstallOption) (*release.Release, error) {
- return nil, nil
-}
-
-func (mag *MockActionGetter) Upgrade(name, namespace string, chrt *chart.Chart, vals map[string]interface{}, opts ...helmclient.UpgradeOption) (*release.Release, error) {
- return nil, nil
-}
-
-func (mag *MockActionGetter) Uninstall(name string, opts ...helmclient.UninstallOption) (*release.UninstallReleaseResponse, error) {
- return nil, nil
-}
-
-func (mag *MockActionGetter) Reconcile(rel *release.Release) error {
- return nil
-}
-
-func (mag *MockActionGetter) Config() *action.Configuration {
- return nil
-}
-
func TestGetInstalledBundleHistory(t *testing.T) {
- getter := controllers.HelmRevisionStatesGetter{}
-
ext := ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{
Name: "test-ext",
},
}
- mag := []MockActionGetter{
+ tests := []struct {
+ description string
+ rels []*release.Release
+ err error
+ expectedInstalled *controllers.RevisionMetadata
+ expectedError error
+ }{
{
- "No return",
- nil, nil,
- nil, nil,
+ description: "No return",
},
{
- "ErrReleaseNotFound (special case)",
- nil, driver.ErrReleaseNotFound,
- nil, nil,
+ description: "ErrReleaseNotFound (special case)",
+ err: driver.ErrReleaseNotFound,
},
{
- "Error from History",
- nil, fmt.Errorf("generic error"),
- nil, fmt.Errorf("generic error"),
+ description: "Error from History",
+ err: fmt.Errorf("generic error"),
+ expectedError: fmt.Errorf("generic error"),
},
{
- "One item in history",
- []*release.Release{
+ description: "One item in history",
+ rels: []*release.Release{
{
Name: "test-ext",
Info: &release.Info{
@@ -2606,19 +2467,18 @@ func TestGetInstalledBundleHistory(t *testing.T) {
},
},
},
- nil,
- &controllers.RevisionMetadata{
+ expectedInstalled: &controllers.RevisionMetadata{
BundleMetadata: ocv1.BundleMetadata{
Name: "test-ext",
Version: "1.0",
Release: ptr.To("2"),
},
Image: "bundle-ref",
- }, nil,
+ },
},
{
- "Two items in history",
- []*release.Release{
+ description: "Two items in history",
+ rels: []*release.Release{
{
Name: "test-ext",
Info: &release.Info{
@@ -2642,29 +2502,36 @@ func TestGetInstalledBundleHistory(t *testing.T) {
},
},
},
- nil,
- &controllers.RevisionMetadata{
+ expectedInstalled: &controllers.RevisionMetadata{
BundleMetadata: ocv1.BundleMetadata{
Name: "test-ext",
Version: "1.0",
},
Image: "bundle-ref-1",
- }, nil,
+ },
},
}
- for _, tst := range mag {
- t.Log(tst.description)
- getter.ActionClientGetter = &tst
- md, err := getter.GetRevisionStates(context.Background(), &ext)
- if tst.expectedError != nil {
- require.Equal(t, tst.expectedError, err)
- require.Nil(t, md)
- } else {
- require.NoError(t, err)
- require.Equal(t, tst.expectedInstalled, md.Installed)
- require.Nil(t, md.RollingOut)
- }
+ for _, tst := range tests {
+ t.Run(tst.description, func(t *testing.T) {
+ ctrl := gomock.NewController(t)
+ m := mockhelmclient.NewMockActionClientGetterAndInterface(ctrl)
+ m.EXPECT().ActionClientFor(gomock.Any(), gomock.Any()).Return(m, nil).AnyTimes()
+ m.EXPECT().History(gomock.Any(), gomock.Any()).Return(tst.rels, tst.err).AnyTimes()
+
+ getter := controllers.HelmRevisionStatesGetter{
+ ActionClientGetter: m,
+ }
+ md, err := getter.GetRevisionStates(context.Background(), &ext)
+ if tst.expectedError != nil {
+ require.Equal(t, tst.expectedError, err)
+ require.Nil(t, md)
+ } else {
+ require.NoError(t, err)
+ require.Equal(t, tst.expectedInstalled, md.Installed)
+ require.Nil(t, md.RollingOut)
+ }
+ })
}
}
@@ -2689,21 +2556,15 @@ func TestResolutionFallbackToInstalledBundle(t *testing.T) {
return nil, nil, nil, fmt.Errorf("catalog unavailable")
})
// Applier succeeds (resources maintained)
- d.Applier = &MockApplier{
- installCompleted: true,
- installStatus: "",
- err: nil,
- }
- d.ImagePuller = &imageutil.MockPuller{ImageFS: fstest.MapFS{}}
- d.RevisionStatesGetter = &MockRevisionStatesGetter{
- RevisionStates: &controllers.RevisionStates{
- Installed: &controllers.RevisionMetadata{
- Package: "test-pkg",
- BundleMetadata: ocv1.BundleMetadata{Name: "test.1.0.0", Version: "1.0.0"},
- Image: "test-image:1.0.0",
- },
+ d.Applier = newMockApplier(gomock.NewController(t), true, nil)
+ d.ImagePuller = &imageutil.FakePuller{ImageFS: fstest.MapFS{}}
+ d.RevisionStatesGetter = newMockRevisionStatesGetter(gomock.NewController(t), &controllers.RevisionStates{
+ Installed: &controllers.RevisionMetadata{
+ Package: "test-pkg",
+ BundleMetadata: ocv1.BundleMetadata{Name: "test.1.0.0", Version: "1.0.0"},
+ Image: "test-image:1.0.0",
},
- }
+ }, nil)
})
ctx := context.Background()
@@ -2720,8 +2581,7 @@ func TestResolutionFallbackToInstalledBundle(t *testing.T) {
// No version - should fall back
},
},
- Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "default"},
+ Namespace: "default",
},
}
require.NoError(t, cl.Create(ctx, ext))
@@ -2781,13 +2641,11 @@ func TestResolutionFallbackToInstalledBundle(t *testing.T) {
d.Resolver = resolve.Func(func(_ context.Context, _ *ocv1.ClusterExtension, _ *ocv1.BundleMetadata) (*declcfg.Bundle, *bundle.VersionRelease, *declcfg.Deprecation, error) {
return nil, nil, nil, fmt.Errorf("catalog unavailable")
})
- d.RevisionStatesGetter = &MockRevisionStatesGetter{
- RevisionStates: &controllers.RevisionStates{
- Installed: &controllers.RevisionMetadata{
- BundleMetadata: ocv1.BundleMetadata{Name: "test.1.0.0", Version: "1.0.0"},
- },
+ d.RevisionStatesGetter = newMockRevisionStatesGetter(gomock.NewController(t), &controllers.RevisionStates{
+ Installed: &controllers.RevisionMetadata{
+ BundleMetadata: ocv1.BundleMetadata{Name: "test.1.0.0", Version: "1.0.0"},
},
- }
+ }, nil)
})
ctx := context.Background()
@@ -2804,8 +2662,7 @@ func TestResolutionFallbackToInstalledBundle(t *testing.T) {
Version: "1.0.1", // Requesting upgrade
},
},
- Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "default"},
+ Namespace: "default",
},
}
require.NoError(t, cl.Create(ctx, ext))
@@ -2852,17 +2709,15 @@ func TestResolutionFallbackToInstalledBundle(t *testing.T) {
Image: "test-image:2.0.0",
}, &v, &declcfg.Deprecation{}, nil
})
- d.RevisionStatesGetter = &MockRevisionStatesGetter{
- RevisionStates: &controllers.RevisionStates{
- Installed: &controllers.RevisionMetadata{
- Package: "test-pkg",
- BundleMetadata: ocv1.BundleMetadata{Name: "test.1.0.0", Version: "1.0.0"},
- Image: "test-image:1.0.0",
- },
+ d.RevisionStatesGetter = newMockRevisionStatesGetter(gomock.NewController(t), &controllers.RevisionStates{
+ Installed: &controllers.RevisionMetadata{
+ Package: "test-pkg",
+ BundleMetadata: ocv1.BundleMetadata{Name: "test.1.0.0", Version: "1.0.0"},
+ Image: "test-image:1.0.0",
},
- }
- d.ImagePuller = &imageutil.MockPuller{ImageFS: fstest.MapFS{}}
- d.Applier = &MockApplier{installCompleted: true}
+ }, nil)
+ d.ImagePuller = &imageutil.FakePuller{ImageFS: fstest.MapFS{}}
+ d.Applier = newMockApplier(gomock.NewController(t), true, nil)
})
ctx := context.Background()
@@ -2878,8 +2733,7 @@ func TestResolutionFallbackToInstalledBundle(t *testing.T) {
// No version - auto-update to latest
},
},
- Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "default"},
+ Namespace: "default",
},
}
require.NoError(t, cl.Create(ctx, ext))
@@ -2939,15 +2793,13 @@ func TestResolutionFallbackToInstalledBundle(t *testing.T) {
d.Resolver = resolve.Func(func(_ context.Context, _ *ocv1.ClusterExtension, _ *ocv1.BundleMetadata) (*declcfg.Bundle, *bundle.VersionRelease, *declcfg.Deprecation, error) {
return nil, nil, nil, fmt.Errorf("transient catalog issue: cache stale")
})
- d.RevisionStatesGetter = &MockRevisionStatesGetter{
- RevisionStates: &controllers.RevisionStates{
- Installed: &controllers.RevisionMetadata{
- Package: "test-pkg",
- BundleMetadata: ocv1.BundleMetadata{Name: "test.1.0.0", Version: "1.0.0"},
- Image: "test-image:1.0.0",
- },
+ d.RevisionStatesGetter = newMockRevisionStatesGetter(gomock.NewController(t), &controllers.RevisionStates{
+ Installed: &controllers.RevisionMetadata{
+ Package: "test-pkg",
+ BundleMetadata: ocv1.BundleMetadata{Name: "test.1.0.0", Version: "1.0.0"},
+ Image: "test-image:1.0.0",
},
- }
+ }, nil)
})
ctx := context.Background()
@@ -2980,8 +2832,7 @@ func TestResolutionFallbackToInstalledBundle(t *testing.T) {
// No version specified
},
},
- Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "default"},
+ Namespace: "default",
},
}
require.NoError(t, cl.Create(ctx, ext))
@@ -3107,10 +2958,3 @@ func TestCheckCatalogsExist(t *testing.T) {
require.False(t, exists)
})
}
-
-func serviceAccountValidatorWithFakeClient(serviceAccount *corev1.ServiceAccount) controllers.ClusterExtensionValidator {
- if serviceAccount == nil {
- return controllers.ServiceAccountValidator(fake.NewClientset().CoreV1())
- }
- return controllers.ServiceAccountValidator(fake.NewClientset(serviceAccount).CoreV1())
-}
diff --git a/internal/operator-controller/controllers/clusterextension_reconcile_steps.go b/internal/operator-controller/controllers/clusterextension_reconcile_steps.go
index 1c6bfcb29c..b07a5072f4 100644
--- a/internal/operator-controller/controllers/clusterextension_reconcile_steps.go
+++ b/internal/operator-controller/controllers/clusterextension_reconcile_steps.go
@@ -21,10 +21,8 @@ import (
"errors"
"fmt"
- apierrors "k8s.io/apimachinery/pkg/api/errors"
apimeta "k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/finalizer"
@@ -98,16 +96,13 @@ func ValidateClusterExtension(validators ...ClusterExtensionValidator) Reconcile
}
}
-// ServiceAccountValidator returns a validator that checks if the specified
-// ServiceAccount exists in the cluster by performing a direct Get call.
-func ServiceAccountValidator(saClient corev1client.ServiceAccountsGetter) ClusterExtensionValidator {
+// ServiceAccountDeprecationWarning returns a validator that checks if the deprecated
+// serviceAccount field is populated and logs a warning if found.
+func ServiceAccountDeprecationWarning() ClusterExtensionValidator {
return func(ctx context.Context, ext *ocv1.ClusterExtension) error {
- _, err := saClient.ServiceAccounts(ext.Spec.Namespace).Get(ctx, ext.Spec.ServiceAccount.Name, metav1.GetOptions{})
- if err != nil {
- if apierrors.IsNotFound(err) {
- return fmt.Errorf("service account %q not found in namespace %q", ext.Spec.ServiceAccount.Name, ext.Spec.Namespace)
- }
- return fmt.Errorf("error getting service account: %w", err)
+ l := log.FromContext(ctx)
+ if len(ext.Spec.ServiceAccount.Name) > 0 { //nolint:staticcheck // intentional read of deprecated field to emit deprecation warning
+ l.Info("spec.serviceAccount is deprecated, ignored, and will be removed in a future release - operator-controller's cluster-admin service account is used for all cluster interactions")
}
return nil
}
diff --git a/internal/operator-controller/controllers/clusterobjectset_controller.go b/internal/operator-controller/controllers/clusterobjectset_controller.go
index bc081b6765..eb0bbc1222 100644
--- a/internal/operator-controller/controllers/clusterobjectset_controller.go
+++ b/internal/operator-controller/controllers/clusterobjectset_controller.go
@@ -58,6 +58,7 @@ type ClusterObjectSetReconciler struct {
Clock clock.Clock
}
+//go:generate mockgen -source clusterobjectset_controller.go -destination mock_trackingcache_gen_test.go -package controllers -mock_names trackingCache=MockTrackingCache -exclude_interfaces Sourcoser
type trackingCache interface {
client.Reader
Source(handler handler.EventHandler, predicates ...predicate.Predicate) source.Source
diff --git a/internal/operator-controller/controllers/clusterobjectset_controller_internal_test.go b/internal/operator-controller/controllers/clusterobjectset_controller_internal_test.go
index 654de33883..7a3861faa9 100644
--- a/internal/operator-controller/controllers/clusterobjectset_controller_internal_test.go
+++ b/internal/operator-controller/controllers/clusterobjectset_controller_internal_test.go
@@ -10,21 +10,17 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
- "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/client/interceptor"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
- "sigs.k8s.io/controller-runtime/pkg/handler"
- "sigs.k8s.io/controller-runtime/pkg/predicate"
- "sigs.k8s.io/controller-runtime/pkg/source"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/operator-controller/labels"
@@ -143,6 +139,7 @@ func Test_ClusterObjectSetReconciler_listPreviousRevisions(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
testClient := fake.NewClientBuilder().
WithScheme(testScheme).
WithObjects(tc.existingObjs()...).
@@ -150,7 +147,7 @@ func Test_ClusterObjectSetReconciler_listPreviousRevisions(t *testing.T) {
reconciler := &ClusterObjectSetReconciler{
Client: testClient,
- TrackingCache: &mockTrackingCacheInternal{client: testClient},
+ TrackingCache: newMockTrackingCacheInternal(mockCtrl, testClient),
}
currentRev := &ocv1.ClusterObjectSet{}
@@ -178,9 +175,6 @@ func newTestClusterExtensionInternal() *ocv1.ClusterExtension {
},
Spec: ocv1.ClusterExtensionSpec{
Namespace: "some-namespace",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "some-sa",
- },
Source: ocv1.SourceConfig{
SourceType: "Catalog",
Catalog: &ocv1.CatalogFilter{
@@ -220,28 +214,14 @@ func newTestClusterObjectSetInternal(t *testing.T, name string) *ocv1.ClusterObj
return rev
}
-type mockTrackingCacheInternal struct {
- client client.Client
-}
-
-func (m *mockTrackingCacheInternal) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
- return m.client.Get(ctx, key, obj, opts...)
-}
-
-func (m *mockTrackingCacheInternal) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
- return m.client.List(ctx, list, opts...)
-}
-
-func (m *mockTrackingCacheInternal) Free(ctx context.Context, user client.Object) error {
- return nil
-}
-
-func (m *mockTrackingCacheInternal) Watch(ctx context.Context, user client.Object, gvks sets.Set[schema.GroupVersionKind]) error {
- return nil
-}
-
-func (m *mockTrackingCacheInternal) Source(h handler.EventHandler, predicates ...predicate.Predicate) source.Source {
- return nil
+func newMockTrackingCacheInternal(ctrl *gomock.Controller, cl client.Client) *MockTrackingCache {
+ m := NewMockTrackingCache(ctrl)
+ m.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(cl.Get).AnyTimes()
+ m.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(cl.List).AnyTimes()
+ m.EXPECT().Source(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
+ m.EXPECT().Watch(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
+ m.EXPECT().Free(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
+ return m
}
func TestComputePhaseDigest(t *testing.T) {
diff --git a/internal/operator-controller/controllers/clusterobjectset_controller_test.go b/internal/operator-controller/controllers/clusterobjectset_controller_test.go
index 75e7a2f8e4..1db01a549f 100644
--- a/internal/operator-controller/controllers/clusterobjectset_controller_test.go
+++ b/internal/operator-controller/controllers/clusterobjectset_controller_test.go
@@ -8,6 +8,7 @@ import (
"time"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -15,7 +16,6 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
- "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/utils/clock"
clocktesting "k8s.io/utils/clock/testing"
"pkg.package-operator.run/boxcutter"
@@ -26,19 +26,19 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
- "sigs.k8s.io/controller-runtime/pkg/handler"
- "sigs.k8s.io/controller-runtime/pkg/predicate"
- "sigs.k8s.io/controller-runtime/pkg/source"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/operator-controller/controllers"
"github.com/operator-framework/operator-controller/internal/operator-controller/labels"
+ mockcontrollers "github.com/operator-framework/operator-controller/internal/testutil/mock/controllers"
+ mockmachinery "github.com/operator-framework/operator-controller/internal/testutil/mock/machinery"
)
const clusterObjectSetName = "test-ext-1"
func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing.T) {
testScheme := newScheme(t)
+ mockCtrl := gomock.NewController(t)
for _, tc := range []struct {
name string
@@ -51,7 +51,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
{
name: "sets teardown finalizer",
reconcilingRevisionName: clusterObjectSetName,
- revisionResult: mockRevisionResult{},
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme)
@@ -69,7 +69,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
{
name: "Available condition is not updated on error if its not already set",
reconcilingRevisionName: clusterObjectSetName,
- revisionResult: mockRevisionResult{},
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}),
revisionReconcileErr: errors.New("some error"),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
@@ -89,7 +89,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
{
name: "Available condition is updated to Unknown on error if its been already set",
reconcilingRevisionName: clusterObjectSetName,
- revisionResult: mockRevisionResult{},
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}),
revisionReconcileErr: errors.New("some error"),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
@@ -120,7 +120,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
{
name: "set Available:False:RollingOut status condition during rollout when no probe failures are detected",
reconcilingRevisionName: clusterObjectSetName,
- revisionResult: mockRevisionResult{},
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme)
@@ -143,24 +143,22 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
{
name: "set Available:False:ProbeFailure condition when probe failures are detected and revision is in transition",
reconcilingRevisionName: clusterObjectSetName,
- revisionResult: mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
inTransition: true,
isComplete: false,
phases: []machinery.PhaseResult{
- mockPhaseResult{
+ newMockPhaseResult(mockCtrl, phaseResultConfig{
name: "somephase",
isComplete: false,
objects: []machinery.ObjectResult{
- mockObjectResult{
- success: true,
+ newMockObjectResult(mockCtrl, objectResultConfig{
probes: machinerytypes.ProbeResultContainer{
boxcutter.ProgressProbeType: {
Status: machinerytypes.ProbeStatusTrue,
},
},
- },
- mockObjectResult{
- success: false,
+ }),
+ newMockObjectResult(mockCtrl, objectResultConfig{
object: func() client.Object {
obj := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
@@ -180,15 +178,14 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
},
},
},
- },
+ }),
},
- },
- mockPhaseResult{
+ }),
+ newMockPhaseResult(mockCtrl, phaseResultConfig{
name: "someotherphase",
isComplete: false,
objects: []machinery.ObjectResult{
- mockObjectResult{
- success: false,
+ newMockObjectResult(mockCtrl, objectResultConfig{
object: func() client.Object {
obj := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
@@ -207,11 +204,11 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
},
},
},
- },
+ }),
},
- },
+ }),
},
- },
+ }),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme)
@@ -234,24 +231,22 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
{
name: "set Available:False:ProbeFailure condition when probe failures are detected and revision is not in transition",
reconcilingRevisionName: clusterObjectSetName,
- revisionResult: mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
inTransition: false,
isComplete: false,
phases: []machinery.PhaseResult{
- mockPhaseResult{
+ newMockPhaseResult(mockCtrl, phaseResultConfig{
name: "somephase",
isComplete: false,
objects: []machinery.ObjectResult{
- mockObjectResult{
- success: true,
+ newMockObjectResult(mockCtrl, objectResultConfig{
probes: machinerytypes.ProbeResultContainer{
boxcutter.ProgressProbeType: machinerytypes.ProbeResult{
Status: machinerytypes.ProbeStatusTrue,
},
},
- },
- mockObjectResult{
- success: false,
+ }),
+ newMockObjectResult(mockCtrl, objectResultConfig{
object: func() client.Object {
obj := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
@@ -271,15 +266,14 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
},
},
},
- },
+ }),
},
- },
- mockPhaseResult{
+ }),
+ newMockPhaseResult(mockCtrl, phaseResultConfig{
name: "someotherphase",
isComplete: false,
objects: []machinery.ObjectResult{
- mockObjectResult{
- success: false,
+ newMockObjectResult(mockCtrl, objectResultConfig{
object: func() client.Object {
obj := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
@@ -298,11 +292,11 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
},
},
},
- },
+ }),
},
- },
+ }),
},
- },
+ }),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme)
@@ -347,9 +341,9 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
},
{
name: "set Progressing:True:RollingOut condition while revision is transitioning",
- revisionResult: mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
inTransition: true,
- },
+ }),
reconcilingRevisionName: clusterObjectSetName,
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
@@ -372,10 +366,10 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
},
{
name: "set Progressing:True:Succeeded once transition rollout is finished",
- revisionResult: mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
inTransition: false,
isComplete: true,
- },
+ }),
reconcilingRevisionName: clusterObjectSetName,
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
@@ -405,9 +399,9 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
},
{
name: "set Available:True:ProbesSucceeded and Succeeded:True:Succeeded conditions on successful revision rollout",
- revisionResult: mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
isComplete: true,
- },
+ }),
reconcilingRevisionName: clusterObjectSetName,
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
@@ -444,9 +438,9 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
},
{
name: "archive previous revisions on successful rollout",
- revisionResult: mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
isComplete: true,
- },
+ }),
reconcilingRevisionName: "test-ext-3",
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
@@ -478,6 +472,8 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
},
} {
t.Run(tc.name, func(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
+
// create extension and cluster extension
testClient := fake.NewClientBuilder().
WithScheme(testScheme).
@@ -486,15 +482,15 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing
Build()
// reconcile cluster extension revision
- mockEngine := &mockRevisionEngine{
- reconcile: func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
+ mockEngine := newMockRevisionEngineWithReconcile(mockCtrl,
+ func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
return tc.revisionResult, tc.revisionReconcileErr
- },
- }
+ }, nil,
+ )
result, err := (&controllers.ClusterObjectSetReconciler{
Client: testClient,
- RevisionEngineFactory: &mockRevisionEngineFactory{engine: mockEngine},
- TrackingCache: &mockTrackingCache{client: testClient},
+ RevisionEngineFactory: newMockRevisionEngineFactoryWithEngine(mockCtrl, mockEngine, nil),
+ TrackingCache: newMockTrackingCache(mockCtrl, testClient, nil),
}).Reconcile(t.Context(), ctrl.Request{
NamespacedName: types.NamespacedName{
Name: tc.reconcilingRevisionName,
@@ -522,6 +518,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ValidationError_Retries(t *testin
)
testScheme := newScheme(t)
+ mockCtrl := gomock.NewController(t)
for _, tc := range []struct {
name string
@@ -529,7 +526,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ValidationError_Retries(t *testin
}{
{
name: "retries on revision result validation error",
- revisionResult: mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
validationError: &validation.RevisionValidationError{
RevisionName: "test-ext-1",
RevisionNumber: 1,
@@ -559,13 +556,13 @@ func Test_ClusterObjectSetReconciler_Reconcile_ValidationError_Retries(t *testin
},
},
},
- },
+ }),
},
{
name: "retries on revision result phase validation error",
- revisionResult: mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
phases: []machinery.PhaseResult{
- mockPhaseResult{
+ newMockPhaseResult(mockCtrl, phaseResultConfig{
validationError: &validation.PhaseValidationError{
PhaseName: "everything",
PhaseError: fmt.Errorf("some error"),
@@ -589,12 +586,13 @@ func Test_ClusterObjectSetReconciler_Reconcile_ValidationError_Retries(t *testin
},
},
},
- },
+ }),
},
- },
+ }),
},
} {
t.Run(tc.name, func(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
ext := newTestClusterExtension()
rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme)
@@ -606,15 +604,15 @@ func Test_ClusterObjectSetReconciler_Reconcile_ValidationError_Retries(t *testin
Build()
// reconcile cluster extension revision
- mockEngine := &mockRevisionEngine{
- reconcile: func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
+ mockEngine := newMockRevisionEngineWithReconcile(mockCtrl,
+ func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
return tc.revisionResult, nil
- },
- }
+ }, nil,
+ )
result, err := (&controllers.ClusterObjectSetReconciler{
Client: testClient,
- RevisionEngineFactory: &mockRevisionEngineFactory{engine: mockEngine},
- TrackingCache: &mockTrackingCache{client: testClient},
+ RevisionEngineFactory: newMockRevisionEngineFactoryWithEngine(mockCtrl, mockEngine, nil),
+ TrackingCache: newMockTrackingCache(mockCtrl, testClient, nil),
}).Reconcile(t.Context(), ctrl.Request{
NamespacedName: types.NamespacedName{
Name: clusterObjectSetName,
@@ -637,12 +635,13 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
testScheme := newScheme(t)
require.NoError(t, corev1.AddToScheme(testScheme))
+ mockCtrl := gomock.NewController(t)
for _, tc := range []struct {
name string
existingObjs func() []client.Object
revisionResult machinery.RevisionResult
- revisionEngineTeardownFn func(*testing.T) func(context.Context, machinerytypes.Revision, ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error)
+ revisionEngineTeardownFn func(*gomock.Controller) func(context.Context, machinerytypes.Revision, ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error)
revisionEngineFactoryErr error
validate func(*testing.T, client.Client)
trackingCacheFreeFn func(context.Context, client.Object) error
@@ -651,7 +650,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
}{
{
name: "teardown finalizer is removed",
- revisionResult: mockRevisionResult{},
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme)
@@ -668,13 +667,13 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
require.NoError(t, err)
require.NotContains(t, "olm.operatorframework.io/teardown", rev.Finalizers)
},
- revisionEngineTeardownFn: func(t *testing.T) func(context.Context, machinerytypes.Revision, ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
+ revisionEngineTeardownFn: func(ctrl *gomock.Controller) func(context.Context, machinerytypes.Revision, ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
return nil
},
},
{
name: "set Available:Unknown:Reconciling when tracking cache free fails during deletion",
- revisionResult: mockRevisionResult{},
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme)
@@ -700,13 +699,13 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
require.Equal(t, ocv1.ClusterObjectSetReasonReconciling, cond.Reason)
require.Contains(t, cond.Message, "tracking cache free failed")
},
- revisionEngineTeardownFn: func(t *testing.T) func(context.Context, machinerytypes.Revision, ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
+ revisionEngineTeardownFn: func(ctrl *gomock.Controller) func(context.Context, machinerytypes.Revision, ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
return nil
},
},
{
name: "set Available:Archived:Unknown and Progressing:False:Archived conditions when a revision is archived",
- revisionResult: mockRevisionResult{},
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme)
@@ -716,11 +715,11 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
rev1.Spec.LifecycleState = ocv1.ClusterObjectSetLifecycleStateArchived
return []client.Object{rev1, ext}
},
- revisionEngineTeardownFn: func(t *testing.T) func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
+ revisionEngineTeardownFn: func(ctrl *gomock.Controller) func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
return func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
- return &mockRevisionTeardownResult{
+ return newMockRevisionTeardownResult(mockCtrl, revisionTeardownResultConfig{
isComplete: true,
- }, nil
+ }), nil
}
},
validate: func(t *testing.T, c client.Client) {
@@ -746,7 +745,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
},
{
name: "set Progressing:True:Retrying and requeue when archived revision archival is incomplete",
- revisionResult: mockRevisionResult{},
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme)
@@ -756,11 +755,11 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
rev1.Spec.LifecycleState = ocv1.ClusterObjectSetLifecycleStateArchived
return []client.Object{rev1, ext}
},
- revisionEngineTeardownFn: func(t *testing.T) func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
+ revisionEngineTeardownFn: func(ctrl *gomock.Controller) func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
return func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
- return &mockRevisionTeardownResult{
+ return newMockRevisionTeardownResult(mockCtrl, revisionTeardownResultConfig{
isComplete: false,
- }, nil
+ }), nil
}
},
expectedResult: ctrl.Result{RequeueAfter: 5 * time.Second},
@@ -782,7 +781,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
},
{
name: "return error and set retrying conditions when archived revision teardown fails",
- revisionResult: mockRevisionResult{},
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme)
@@ -792,7 +791,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
rev1.Spec.LifecycleState = ocv1.ClusterObjectSetLifecycleStateArchived
return []client.Object{rev1, ext}
},
- revisionEngineTeardownFn: func(t *testing.T) func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
+ revisionEngineTeardownFn: func(ctrl *gomock.Controller) func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
return func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
return nil, fmt.Errorf("teardown failed: connection refused")
}
@@ -816,7 +815,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
},
{
name: "return error and set retrying conditions when factory fails to create engine during archived teardown",
- revisionResult: mockRevisionResult{},
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme)
@@ -826,7 +825,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
rev1.Spec.LifecycleState = ocv1.ClusterObjectSetLifecycleStateArchived
return []client.Object{rev1, ext}
},
- revisionEngineTeardownFn: func(t *testing.T) func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
+ revisionEngineTeardownFn: func(ctrl *gomock.Controller) func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
return nil
},
revisionEngineFactoryErr: fmt.Errorf("token getter failed"),
@@ -849,7 +848,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
},
{
name: "revision is torn down when in archived state and finalizer is removed",
- revisionResult: mockRevisionResult{},
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}),
existingObjs: func() []client.Object {
ext := newTestClusterExtension()
rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme)
@@ -873,11 +872,11 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
})
return []client.Object{rev1, ext}
},
- revisionEngineTeardownFn: func(t *testing.T) func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
+ revisionEngineTeardownFn: func(ctrl *gomock.Controller) func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
return func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
- return &mockRevisionTeardownResult{
+ return newMockRevisionTeardownResult(mockCtrl, revisionTeardownResultConfig{
isComplete: true,
- }, nil
+ }), nil
}
},
validate: func(t *testing.T, c client.Client) {
@@ -891,6 +890,8 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
},
} {
t.Run(tc.name, func(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
+
// create extension and cluster extension
testClient := fake.NewClientBuilder().
WithScheme(testScheme).
@@ -899,20 +900,17 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T)
Build()
// reconcile cluster extension revision
- mockEngine := &mockRevisionEngine{
- reconcile: func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
+ mockEngine := newMockRevisionEngineWithReconcile(mockCtrl,
+ func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
return tc.revisionResult, nil
},
- teardown: tc.revisionEngineTeardownFn(t),
- }
- factory := &mockRevisionEngineFactory{engine: mockEngine, createErr: tc.revisionEngineFactoryErr}
+ tc.revisionEngineTeardownFn(mockCtrl),
+ )
+ factory := newMockRevisionEngineFactoryWithEngine(mockCtrl, mockEngine, tc.revisionEngineFactoryErr)
result, err := (&controllers.ClusterObjectSetReconciler{
Client: testClient,
RevisionEngineFactory: factory,
- TrackingCache: &mockTrackingCache{
- client: testClient,
- freeFn: tc.trackingCacheFreeFn,
- },
+ TrackingCache: newMockTrackingCache(mockCtrl, testClient, tc.trackingCacheFreeFn),
}).Reconcile(t.Context(), ctrl.Request{
NamespacedName: types.NamespacedName{
Name: clusterObjectSetName,
@@ -940,6 +938,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ProgressDeadline(t *testing.T) {
testScheme := newScheme(t)
require.NoError(t, corev1.AddToScheme(testScheme))
+ mockCtrl := gomock.NewController(t)
for _, tc := range []struct {
name string
@@ -961,9 +960,9 @@ func Test_ClusterObjectSetReconciler_Reconcile_ProgressDeadline(t *testing.T) {
},
// 61sec elapsed since the creation of the revision
clock: clocktesting.NewFakeClock(time.Date(2022, 1, 1, 0, 1, 1, 0, time.UTC)),
- revisionResult: &mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
inTransition: true,
- },
+ }),
validate: func(t *testing.T, c client.Client) {
rev := &ocv1.ClusterObjectSet{}
err := c.Get(t.Context(), client.ObjectKey{
@@ -985,9 +984,9 @@ func Test_ClusterObjectSetReconciler_Reconcile_ProgressDeadline(t *testing.T) {
return []client.Object{rev1, ext}
},
clock: clocktesting.NewFakeClock(time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC)),
- revisionResult: &mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
inTransition: true,
- },
+ }),
reconcileResult: ctrl.Result{RequeueAfter: 60 * time.Second},
validate: func(t *testing.T, c client.Client) {
rev := &ocv1.ClusterObjectSet{}
@@ -1017,9 +1016,9 @@ func Test_ClusterObjectSetReconciler_Reconcile_ProgressDeadline(t *testing.T) {
return []client.Object{rev1, ext}
},
clock: clocktesting.NewFakeClock(time.Date(2022, 1, 1, 0, 5, 0, 0, time.UTC)),
- revisionResult: &mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
isComplete: true,
- },
+ }),
validate: func(t *testing.T, c client.Client) {
rev := &ocv1.ClusterObjectSet{}
err := c.Get(t.Context(), client.ObjectKey{
@@ -1054,9 +1053,9 @@ func Test_ClusterObjectSetReconciler_Reconcile_ProgressDeadline(t *testing.T) {
})
return []client.Object{rev1, ext}
},
- revisionResult: &mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
inTransition: true,
- },
+ }),
validate: func(t *testing.T, c client.Client) {
rev := &ocv1.ClusterObjectSet{}
err := c.Get(t.Context(), client.ObjectKey{
@@ -1070,6 +1069,8 @@ func Test_ClusterObjectSetReconciler_Reconcile_ProgressDeadline(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
+
// create extension and cluster extension
testClient := fake.NewClientBuilder().
WithScheme(testScheme).
@@ -1078,18 +1079,16 @@ func Test_ClusterObjectSetReconciler_Reconcile_ProgressDeadline(t *testing.T) {
Build()
// reconcile cluster extension revision
- mockEngine := &mockRevisionEngine{
- reconcile: func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
+ mockEngine := newMockRevisionEngineWithReconcile(mockCtrl,
+ func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
return tc.revisionResult, nil
- },
- }
+ }, nil,
+ )
result, err := (&controllers.ClusterObjectSetReconciler{
Client: testClient,
- RevisionEngineFactory: &mockRevisionEngineFactory{engine: mockEngine},
- TrackingCache: &mockTrackingCache{
- client: testClient,
- },
- Clock: tc.clock,
+ RevisionEngineFactory: newMockRevisionEngineFactoryWithEngine(mockCtrl, mockEngine, nil),
+ TrackingCache: newMockTrackingCache(mockCtrl, testClient, nil),
+ Clock: tc.clock,
}).Reconcile(t.Context(), ctrl.Request{
NamespacedName: types.NamespacedName{
Name: clusterObjectSetName,
@@ -1111,9 +1110,6 @@ func newTestClusterExtension() *ocv1.ClusterExtension {
},
Spec: ocv1.ClusterExtensionSpec{
Namespace: "some-namespace",
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: "service-account",
- },
Source: ocv1.SourceConfig{
SourceType: ocv1.SourceTypeCatalog,
Catalog: &ocv1.CatalogFilter{
@@ -1136,12 +1132,10 @@ func newTestClusterObjectSet(t *testing.T, revisionName string, ext *ocv1.Cluste
UID: types.UID(revisionName),
Generation: int64(1),
Annotations: map[string]string{
- labels.PackageNameKey: "some-package",
- labels.BundleNameKey: "some-package.v1.0.0",
- labels.BundleReferenceKey: "registry.io/some-repo/some-package:v1.0.0",
- labels.BundleVersionKey: "1.0.0",
- labels.ServiceAccountNameKey: ext.Spec.ServiceAccount.Name,
- labels.ServiceAccountNamespaceKey: ext.Spec.Namespace,
+ labels.PackageNameKey: "some-package",
+ labels.BundleNameKey: "some-package.v1.0.0",
+ labels.BundleReferenceKey: "registry.io/some-repo/some-package:v1.0.0",
+ labels.BundleVersionKey: "1.0.0",
},
Labels: map[string]string{
labels.OwnerNameKey: ext.Name,
@@ -1174,211 +1168,148 @@ func newTestClusterObjectSet(t *testing.T, revisionName string, ext *ocv1.Cluste
return rev
}
-type mockRevisionEngine struct {
- teardown func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error)
- reconcile func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error)
-}
+// Helper constructors for gomock-generated result mocks.
-func (m mockRevisionEngine) Teardown(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
- return m.teardown(ctx, rev)
-}
-
-func (m mockRevisionEngine) Reconcile(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
- return m.reconcile(ctx, rev)
-}
-
-// mockRevisionEngineFactory creates mock RevisionEngines for testing
-type mockRevisionEngineFactory struct {
- engine controllers.RevisionEngine
- createErr error
-}
-
-func (f *mockRevisionEngineFactory) CreateRevisionEngine(ctx context.Context, rev *ocv1.ClusterObjectSet) (controllers.RevisionEngine, error) {
- if f.createErr != nil {
- return nil, f.createErr
- }
- return f.engine, nil
-}
-
-type mockRevisionResult struct {
+type revisionResultConfig struct {
validationError *validation.RevisionValidationError
phases []machinery.PhaseResult
inTransition bool
isComplete bool
hasProgressed bool
- string string
-}
-
-func (m mockRevisionResult) GetValidationError() *validation.RevisionValidationError {
- return m.validationError
-}
-
-func (m mockRevisionResult) GetPhases() []machinery.PhaseResult {
- return m.phases
+ str string
}
-func (m mockRevisionResult) InTransition() bool {
- return m.inTransition
+func newMockRevisionResult(ctrl *gomock.Controller, cfg revisionResultConfig) *mockmachinery.MockRevisionResult {
+ m := mockmachinery.NewMockRevisionResult(ctrl)
+ m.EXPECT().GetValidationError().Return(cfg.validationError).AnyTimes()
+ m.EXPECT().GetPhases().Return(cfg.phases).AnyTimes()
+ m.EXPECT().InTransition().Return(cfg.inTransition).AnyTimes()
+ m.EXPECT().IsComplete().Return(cfg.isComplete).AnyTimes()
+ m.EXPECT().HasProgressed().Return(cfg.hasProgressed).AnyTimes()
+ m.EXPECT().String().Return(cfg.str).AnyTimes()
+ return m
}
-func (m mockRevisionResult) IsComplete() bool {
- return m.isComplete
-}
-
-func (m mockRevisionResult) HasProgressed() bool {
- return m.hasProgressed
-}
-
-func (m mockRevisionResult) String() string {
- return m.string
-}
-
-var _ machinery.PhaseResult = &mockPhaseResult{}
-
-type mockPhaseResult struct {
+type phaseResultConfig struct {
name string
validationError *validation.PhaseValidationError
objects []machinery.ObjectResult
inTransition bool
isComplete bool
hasProgressed bool
- string string
+ str string
}
-func (m mockPhaseResult) GetName() string {
- return m.name
+func newMockPhaseResult(ctrl *gomock.Controller, cfg phaseResultConfig) *mockmachinery.MockPhaseResult {
+ m := mockmachinery.NewMockPhaseResult(ctrl)
+ m.EXPECT().GetName().Return(cfg.name).AnyTimes()
+ m.EXPECT().GetValidationError().Return(cfg.validationError).AnyTimes()
+ m.EXPECT().GetObjects().Return(cfg.objects).AnyTimes()
+ m.EXPECT().InTransition().Return(cfg.inTransition).AnyTimes()
+ m.EXPECT().IsComplete().Return(cfg.isComplete).AnyTimes()
+ m.EXPECT().HasProgressed().Return(cfg.hasProgressed).AnyTimes()
+ m.EXPECT().String().Return(cfg.str).AnyTimes()
+ return m
}
-func (m mockPhaseResult) GetValidationError() *validation.PhaseValidationError {
- return m.validationError
-}
-
-func (m mockPhaseResult) GetObjects() []machinery.ObjectResult {
- return m.objects
-}
-
-func (m mockPhaseResult) InTransition() bool {
- return m.inTransition
-}
-
-func (m mockPhaseResult) IsComplete() bool {
- return m.isComplete
-}
-
-func (m mockPhaseResult) HasProgressed() bool {
- return m.hasProgressed
-}
-
-func (m mockPhaseResult) String() string {
- return m.string
-}
-
-var _ machinery.ObjectResult = &mockObjectResult{}
-
-type mockObjectResult struct {
+type objectResultConfig struct {
action machinery.Action
object machinery.Object
- success bool
complete bool
paused bool
probes machinerytypes.ProbeResultContainer
- string string
+ str string
}
-func (m mockObjectResult) ProbeResults() machinerytypes.ProbeResultContainer {
- return m.probes
+func newMockObjectResult(ctrl *gomock.Controller, cfg objectResultConfig) *mockmachinery.MockObjectResult {
+ m := mockmachinery.NewMockObjectResult(ctrl)
+ m.EXPECT().ProbeResults().Return(cfg.probes).AnyTimes()
+ m.EXPECT().IsComplete().Return(cfg.complete).AnyTimes()
+ m.EXPECT().IsPaused().Return(cfg.paused).AnyTimes()
+ m.EXPECT().Action().Return(cfg.action).AnyTimes()
+ m.EXPECT().Object().Return(cfg.object).AnyTimes()
+ m.EXPECT().String().Return(cfg.str).AnyTimes()
+ return m
}
-func (m mockObjectResult) IsComplete() bool {
- return m.complete
-}
-
-func (m mockObjectResult) IsPaused() bool {
- return m.paused
-}
-
-func (m mockObjectResult) Action() machinery.Action {
- return m.action
-}
-
-func (m mockObjectResult) Object() machinery.Object {
- return m.object
-}
-
-func (m mockObjectResult) Success() bool {
- return m.success
-}
-
-func (m mockObjectResult) String() string {
- return m.string
-}
-
-var _ machinery.RevisionTeardownResult = mockRevisionTeardownResult{}
-
-type mockRevisionTeardownResult struct {
+type revisionTeardownResultConfig struct {
phases []machinery.PhaseTeardownResult
isComplete bool
waitingPhaseNames []string
activePhaseName string
phaseIsActive bool
gonePhaseNames []string
- string string
-}
-
-func (m mockRevisionTeardownResult) GetPhases() []machinery.PhaseTeardownResult {
- return m.phases
-}
-
-func (m mockRevisionTeardownResult) IsComplete() bool {
- return m.isComplete
-}
-
-func (m mockRevisionTeardownResult) GetWaitingPhaseNames() []string {
- return m.waitingPhaseNames
+ str string
}
-func (m mockRevisionTeardownResult) GetActivePhaseName() (string, bool) {
- return m.activePhaseName, m.phaseIsActive
+func newMockRevisionTeardownResult(ctrl *gomock.Controller, cfg revisionTeardownResultConfig) *mockmachinery.MockRevisionTeardownResult {
+ m := mockmachinery.NewMockRevisionTeardownResult(ctrl)
+ m.EXPECT().GetPhases().Return(cfg.phases).AnyTimes()
+ m.EXPECT().IsComplete().Return(cfg.isComplete).AnyTimes()
+ m.EXPECT().GetWaitingPhaseNames().Return(cfg.waitingPhaseNames).AnyTimes()
+ m.EXPECT().GetActivePhaseName().Return(cfg.activePhaseName, cfg.phaseIsActive).AnyTimes()
+ m.EXPECT().GetGonePhaseNames().Return(cfg.gonePhaseNames).AnyTimes()
+ m.EXPECT().String().Return(cfg.str).AnyTimes()
+ return m
}
-func (m mockRevisionTeardownResult) GetGonePhaseNames() []string {
- return m.gonePhaseNames
-}
-
-func (m mockRevisionTeardownResult) String() string {
- return m.string
-}
-
-type mockTrackingCache struct {
- client client.Client
- freeFn func(context.Context, client.Object) error
-}
-
-func (m *mockTrackingCache) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
- return m.client.Get(ctx, key, obj, opts...)
-}
-
-func (m *mockTrackingCache) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
- return m.client.List(ctx, list, opts...)
+func newMockTrackingCache(ctrl *gomock.Controller, cl client.Client, freeFn func(ctx context.Context, user client.Object) error) *controllers.MockTrackingCache {
+ m := controllers.NewMockTrackingCache(ctrl)
+ m.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(cl.Get).AnyTimes()
+ m.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(cl.List).AnyTimes()
+ m.EXPECT().Source(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
+ m.EXPECT().Watch(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
+ if freeFn != nil {
+ m.EXPECT().Free(gomock.Any(), gomock.Any()).DoAndReturn(freeFn).AnyTimes()
+ } else {
+ m.EXPECT().Free(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
+ }
+ return m
}
-func (m *mockTrackingCache) Source(handler handler.EventHandler, predicates ...predicate.Predicate) source.Source {
- panic("not implemented")
+// newNoopMockRevisionEngine creates a MockRevisionEngine with no expectations set.
+// Useful for tests where the engine is never called (e.g., error paths that fail before reaching the engine).
+func newNoopMockRevisionEngine(ctrl *gomock.Controller) *mockcontrollers.MockRevisionEngine {
+ return mockcontrollers.NewMockRevisionEngine(ctrl)
}
-func (m *mockTrackingCache) Watch(ctx context.Context, user client.Object, gvks sets.Set[schema.GroupVersionKind]) error {
- return nil
+// newMockRevisionEngineWithReconcile creates a MockRevisionEngine with a Reconcile expectation.
+// If teardownFn is non-nil, a Teardown expectation is also configured.
+func newMockRevisionEngineWithReconcile(
+ ctrl *gomock.Controller,
+ reconcileFn func(context.Context, machinerytypes.Revision, ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error),
+ teardownFn func(context.Context, machinerytypes.Revision, ...machinerytypes.RevisionTeardownOption) (machinery.RevisionTeardownResult, error),
+) *mockcontrollers.MockRevisionEngine {
+ m := mockcontrollers.NewMockRevisionEngine(ctrl)
+ m.EXPECT().Reconcile(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(reconcileFn).AnyTimes()
+ if teardownFn != nil {
+ m.EXPECT().Teardown(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(teardownFn).AnyTimes()
+ }
+ return m
}
-func (m *mockTrackingCache) Free(ctx context.Context, user client.Object) error {
- if m.freeFn != nil {
- return m.freeFn(ctx, user)
- }
- return nil
+// newMockRevisionEngineFactoryWithEngine creates a MockRevisionEngineFactory
+// that returns the given engine and error.
+func newMockRevisionEngineFactoryWithEngine(
+ ctrl *gomock.Controller,
+ engine controllers.RevisionEngine,
+ createErr error,
+) *mockcontrollers.MockRevisionEngineFactory {
+ m := mockcontrollers.NewMockRevisionEngineFactory(ctrl)
+ m.EXPECT().CreateRevisionEngine(gomock.Any(), gomock.Any()).DoAndReturn(
+ func(ctx context.Context, rev *ocv1.ClusterObjectSet) (controllers.RevisionEngine, error) {
+ if createErr != nil {
+ return nil, createErr
+ }
+ return engine, nil
+ },
+ ).AnyTimes()
+ return m
}
func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testing.T) {
testScheme := newScheme(t)
+ mockCtrl := gomock.NewController(t)
for _, tc := range []struct {
name string
@@ -1394,8 +1325,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
extA := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{Name: "ext-A", UID: "ext-A-uid"},
Spec: ocv1.ClusterExtensionSpec{
- Namespace: "ns-a",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "sa-a"},
+ Namespace: "ns-a",
Source: ocv1.SourceConfig{
SourceType: ocv1.SourceTypeCatalog,
Catalog: &ocv1.CatalogFilter{PackageName: "pkg"},
@@ -1405,8 +1335,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
extB := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{Name: "ext-B", UID: "ext-B-uid"},
Spec: ocv1.ClusterExtensionSpec{
- Namespace: "ns-b",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "sa-b"},
+ Namespace: "ns-b",
Source: ocv1.SourceConfig{
SourceType: ocv1.SourceTypeCatalog,
Catalog: &ocv1.CatalogFilter{PackageName: "pkg"},
@@ -1417,12 +1346,12 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
cerB1 := newTestClusterObjectSet(t, "ext-B-1", extB, testScheme)
return []client.Object{extA, extB, cerA2, cerB1}
},
- revisionResult: mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
phases: []machinery.PhaseResult{
- mockPhaseResult{
+ newMockPhaseResult(mockCtrl, phaseResultConfig{
name: "everything",
objects: []machinery.ObjectResult{
- mockObjectResult{
+ newMockObjectResult(mockCtrl, objectResultConfig{
action: machinery.ActionCollision,
object: &unstructured.Unstructured{
Object: map[string]interface{}{
@@ -1448,11 +1377,11 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
Status: machinerytypes.ProbeStatusTrue,
},
},
- },
+ }),
},
- },
+ }),
},
- },
+ }),
expectCollision: true,
},
{
@@ -1462,8 +1391,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
extA := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{Name: "ext-A", UID: "ext-A-uid"},
Spec: ocv1.ClusterExtensionSpec{
- Namespace: "ns-a",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "sa-a"},
+ Namespace: "ns-a",
Source: ocv1.SourceConfig{
SourceType: ocv1.SourceTypeCatalog,
Catalog: &ocv1.CatalogFilter{PackageName: "pkg"},
@@ -1474,12 +1402,12 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
cerA2 := newTestClusterObjectSet(t, "ext-A-2", extA, testScheme)
return []client.Object{extA, cerA1, cerA2}
},
- revisionResult: mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
phases: []machinery.PhaseResult{
- mockPhaseResult{
+ newMockPhaseResult(mockCtrl, phaseResultConfig{
name: "everything",
objects: []machinery.ObjectResult{
- mockObjectResult{
+ newMockObjectResult(mockCtrl, objectResultConfig{
action: machinery.ActionProgressed,
object: &unstructured.Unstructured{
Object: map[string]interface{}{
@@ -1505,11 +1433,11 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
Status: machinerytypes.ProbeStatusTrue,
},
},
- },
+ }),
},
- },
+ }),
},
- },
+ }),
expectCollision: false,
},
{
@@ -1519,8 +1447,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
extB := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{Name: "ext-B", UID: "ext-B-uid"},
Spec: ocv1.ClusterExtensionSpec{
- Namespace: "ns-b",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "sa-b"},
+ Namespace: "ns-b",
Source: ocv1.SourceConfig{
SourceType: ocv1.SourceTypeCatalog,
Catalog: &ocv1.CatalogFilter{PackageName: "pkg"},
@@ -1530,12 +1457,12 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
cerB1 := newTestClusterObjectSet(t, "ext-B-1", extB, testScheme)
return []client.Object{extB, cerB1}
},
- revisionResult: mockRevisionResult{
+ revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{
phases: []machinery.PhaseResult{
- mockPhaseResult{
+ newMockPhaseResult(mockCtrl, phaseResultConfig{
name: "everything",
objects: []machinery.ObjectResult{
- mockObjectResult{
+ newMockObjectResult(mockCtrl, objectResultConfig{
action: machinery.ActionProgressed,
object: &unstructured.Unstructured{
Object: map[string]interface{}{
@@ -1562,30 +1489,31 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
Status: machinerytypes.ProbeStatusTrue,
},
},
- },
+ }),
},
- },
+ }),
},
- },
+ }),
expectCollision: false,
},
} {
t.Run(tc.name, func(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
testClient := fake.NewClientBuilder().
WithScheme(testScheme).
WithStatusSubresource(&ocv1.ClusterObjectSet{}).
WithObjects(tc.existingObjs()...).
Build()
- mockEngine := &mockRevisionEngine{
- reconcile: func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
+ mockEngine := newMockRevisionEngineWithReconcile(mockCtrl,
+ func(ctx context.Context, rev machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
return tc.revisionResult, nil
- },
- }
+ }, nil,
+ )
result, err := (&controllers.ClusterObjectSetReconciler{
Client: testClient,
- RevisionEngineFactory: &mockRevisionEngineFactory{engine: mockEngine},
- TrackingCache: &mockTrackingCache{client: testClient},
+ RevisionEngineFactory: newMockRevisionEngineFactoryWithEngine(mockCtrl, mockEngine, nil),
+ TrackingCache: newMockTrackingCache(mockCtrl, testClient, nil),
}).Reconcile(t.Context(), ctrl.Request{
NamespacedName: types.NamespacedName{
Name: tc.reconcilingRevisionName,
@@ -1668,89 +1596,8 @@ func Test_effectiveCollisionProtection(t *testing.T) {
func Test_ClusterObjectSetReconciler_getScopedClient_Errors(t *testing.T) {
testScheme := newScheme(t)
- t.Run("works with serviceAccount annotation and without owner label", func(t *testing.T) {
- rev := &ocv1.ClusterObjectSet{
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-rev-1",
- UID: types.UID("test-rev-1"),
- Labels: map[string]string{},
- Annotations: map[string]string{
- labels.ServiceAccountNameKey: "test-sa",
- labels.ServiceAccountNamespaceKey: "test-ns",
- labels.BundleVersionKey: "1.0.0",
- },
- },
- Spec: ocv1.ClusterObjectSetSpec{
- LifecycleState: ocv1.ClusterObjectSetLifecycleStateActive,
- Revision: 1,
- Phases: []ocv1.ClusterObjectSetPhase{},
- },
- }
-
- testClient := fake.NewClientBuilder().
- WithScheme(testScheme).
- WithStatusSubresource(&ocv1.ClusterObjectSet{}).
- WithObjects(rev).
- Build()
-
- mockEngine := &mockRevisionEngine{
- reconcile: func(ctx context.Context, r machinerytypes.Revision, opts ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
- return &mockRevisionResult{}, nil
- },
- }
-
- reconciler := &controllers.ClusterObjectSetReconciler{
- Client: testClient,
- RevisionEngineFactory: &mockRevisionEngineFactory{engine: mockEngine},
- TrackingCache: &mockTrackingCache{client: testClient},
- }
-
- _, err := reconciler.Reconcile(t.Context(), ctrl.Request{
- NamespacedName: types.NamespacedName{Name: "test-rev-1"},
- })
-
- require.NoError(t, err)
- })
-
- t.Run("missing serviceAccount annotation", func(t *testing.T) {
- rev := &ocv1.ClusterObjectSet{
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-rev-1",
- Annotations: map[string]string{
- labels.BundleVersionKey: "1.0.0",
- },
- },
- Spec: ocv1.ClusterObjectSetSpec{
- LifecycleState: ocv1.ClusterObjectSetLifecycleStateActive,
- Revision: 1,
- Phases: []ocv1.ClusterObjectSetPhase{},
- },
- }
-
- testClient := fake.NewClientBuilder().
- WithScheme(testScheme).
- WithObjects(rev).
- Build()
-
- failingFactory := &mockRevisionEngineFactory{
- createErr: errors.New("missing serviceAccount name annotation"),
- }
-
- reconciler := &controllers.ClusterObjectSetReconciler{
- Client: testClient,
- RevisionEngineFactory: failingFactory,
- TrackingCache: &mockTrackingCache{client: testClient},
- }
-
- _, err := reconciler.Reconcile(t.Context(), ctrl.Request{
- NamespacedName: types.NamespacedName{Name: "test-rev-1"},
- })
-
- require.Error(t, err)
- require.Contains(t, err.Error(), "serviceAccount")
- })
-
t.Run("factory fails to create engine", func(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
ext := newTestClusterExtension()
rev := newTestClusterObjectSet(t, "test-rev", ext, testScheme)
@@ -1759,14 +1606,12 @@ func Test_ClusterObjectSetReconciler_getScopedClient_Errors(t *testing.T) {
WithObjects(ext, rev).
Build()
- failingFactory := &mockRevisionEngineFactory{
- createErr: errors.New("token getter failed"),
- }
+ failingFactory := newMockRevisionEngineFactoryWithEngine(mockCtrl, nil, errors.New("token getter failed"))
reconciler := &controllers.ClusterObjectSetReconciler{
Client: testClient,
RevisionEngineFactory: failingFactory,
- TrackingCache: &mockTrackingCache{client: testClient},
+ TrackingCache: newMockTrackingCache(mockCtrl, testClient, nil),
}
_, err := reconciler.Reconcile(t.Context(), ctrl.Request{
diff --git a/internal/operator-controller/controllers/mock_trackingcache_gen_test.go b/internal/operator-controller/controllers/mock_trackingcache_gen_test.go
new file mode 100644
index 0000000000..c15fa9cd0e
--- /dev/null
+++ b/internal/operator-controller/controllers/mock_trackingcache_gen_test.go
@@ -0,0 +1,132 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: clusterobjectset_controller.go
+//
+// Generated by this command:
+//
+// mockgen -source clusterobjectset_controller.go -destination mock_trackingcache_gen_test.go -package controllers -mock_names trackingCache=MockTrackingCache -exclude_interfaces Sourcoser
+//
+
+// Package controllers is a generated GoMock package.
+package controllers
+
+import (
+ context "context"
+ reflect "reflect"
+
+ gomock "go.uber.org/mock/gomock"
+ schema "k8s.io/apimachinery/pkg/runtime/schema"
+ sets "k8s.io/apimachinery/pkg/util/sets"
+ client "sigs.k8s.io/controller-runtime/pkg/client"
+ handler "sigs.k8s.io/controller-runtime/pkg/handler"
+ predicate "sigs.k8s.io/controller-runtime/pkg/predicate"
+ source "sigs.k8s.io/controller-runtime/pkg/source"
+)
+
+// MockTrackingCache is a mock of trackingCache interface.
+type MockTrackingCache struct {
+ ctrl *gomock.Controller
+ recorder *MockTrackingCacheMockRecorder
+ isgomock struct{}
+}
+
+// MockTrackingCacheMockRecorder is the mock recorder for MockTrackingCache.
+type MockTrackingCacheMockRecorder struct {
+ mock *MockTrackingCache
+}
+
+// NewMockTrackingCache creates a new mock instance.
+func NewMockTrackingCache(ctrl *gomock.Controller) *MockTrackingCache {
+ mock := &MockTrackingCache{ctrl: ctrl}
+ mock.recorder = &MockTrackingCacheMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockTrackingCache) EXPECT() *MockTrackingCacheMockRecorder {
+ return m.recorder
+}
+
+// Free mocks base method.
+func (m *MockTrackingCache) Free(ctx context.Context, user client.Object) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Free", ctx, user)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Free indicates an expected call of Free.
+func (mr *MockTrackingCacheMockRecorder) Free(ctx, user any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Free", reflect.TypeOf((*MockTrackingCache)(nil).Free), ctx, user)
+}
+
+// Get mocks base method.
+func (m *MockTrackingCache) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, key, obj}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Get", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Get indicates an expected call of Get.
+func (mr *MockTrackingCacheMockRecorder) Get(ctx, key, obj any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, key, obj}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockTrackingCache)(nil).Get), varargs...)
+}
+
+// List mocks base method.
+func (m *MockTrackingCache) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, list}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "List", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// List indicates an expected call of List.
+func (mr *MockTrackingCacheMockRecorder) List(ctx, list any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, list}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockTrackingCache)(nil).List), varargs...)
+}
+
+// Source mocks base method.
+func (m *MockTrackingCache) Source(arg0 handler.EventHandler, predicates ...predicate.Predicate) source.Source {
+ m.ctrl.T.Helper()
+ varargs := []any{arg0}
+ for _, a := range predicates {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Source", varargs...)
+ ret0, _ := ret[0].(source.Source)
+ return ret0
+}
+
+// Source indicates an expected call of Source.
+func (mr *MockTrackingCacheMockRecorder) Source(arg0 any, predicates ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{arg0}, predicates...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Source", reflect.TypeOf((*MockTrackingCache)(nil).Source), varargs...)
+}
+
+// Watch mocks base method.
+func (m *MockTrackingCache) Watch(ctx context.Context, user client.Object, gvks sets.Set[schema.GroupVersionKind]) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Watch", ctx, user, gvks)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Watch indicates an expected call of Watch.
+func (mr *MockTrackingCacheMockRecorder) Watch(ctx, user, gvks any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Watch", reflect.TypeOf((*MockTrackingCache)(nil).Watch), ctx, user, gvks)
+}
diff --git a/internal/operator-controller/controllers/resolve_ref_test.go b/internal/operator-controller/controllers/resolve_ref_test.go
index 53e0df2c93..8a9a102743 100644
--- a/internal/operator-controller/controllers/resolve_ref_test.go
+++ b/internal/operator-controller/controllers/resolve_ref_test.go
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apimachineryruntime "k8s.io/apimachinery/pkg/runtime"
@@ -34,6 +35,7 @@ func newSchemeWithCoreV1(t *testing.T) *apimachineryruntime.Scheme {
}
func TestResolveObjectRef_PlainJSON(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
testScheme := newSchemeWithCoreV1(t)
cmObj := map[string]interface{}{
@@ -70,15 +72,15 @@ func TestResolveObjectRef_PlainJSON(t *testing.T) {
WithStatusSubresource(&ocv1.ClusterObjectSet{}).
Build()
- mockEngine := &mockRevisionEngine{
- reconcile: func(_ context.Context, _ machinerytypes.Revision, _ ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
- return mockRevisionResult{}, nil
- },
- }
+ mockEngine := newMockRevisionEngineWithReconcile(mockCtrl,
+ func(_ context.Context, _ machinerytypes.Revision, _ ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
+ return newMockRevisionResult(mockCtrl, revisionResultConfig{}), nil
+ }, nil,
+ )
reconciler := &controllers.ClusterObjectSetReconciler{
Client: fakeClient,
- RevisionEngineFactory: &mockRevisionEngineFactory{engine: mockEngine},
- TrackingCache: &mockTrackingCache{client: fakeClient},
+ RevisionEngineFactory: newMockRevisionEngineFactoryWithEngine(mockCtrl, mockEngine, nil),
+ TrackingCache: newMockTrackingCache(mockCtrl, fakeClient, nil),
Clock: clocktesting.NewFakeClock(metav1.Now().Time),
}
@@ -89,6 +91,7 @@ func TestResolveObjectRef_PlainJSON(t *testing.T) {
}
func TestResolveObjectRef_GzipCompressed(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
testScheme := newSchemeWithCoreV1(t)
cmObj := map[string]interface{}{
@@ -132,15 +135,15 @@ func TestResolveObjectRef_GzipCompressed(t *testing.T) {
WithStatusSubresource(&ocv1.ClusterObjectSet{}).
Build()
- mockEngine := &mockRevisionEngine{
- reconcile: func(_ context.Context, _ machinerytypes.Revision, _ ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
- return mockRevisionResult{}, nil
- },
- }
+ mockEngine := newMockRevisionEngineWithReconcile(mockCtrl,
+ func(_ context.Context, _ machinerytypes.Revision, _ ...machinerytypes.RevisionReconcileOption) (machinery.RevisionResult, error) {
+ return newMockRevisionResult(mockCtrl, revisionResultConfig{}), nil
+ }, nil,
+ )
reconciler := &controllers.ClusterObjectSetReconciler{
Client: fakeClient,
- RevisionEngineFactory: &mockRevisionEngineFactory{engine: mockEngine},
- TrackingCache: &mockTrackingCache{client: fakeClient},
+ RevisionEngineFactory: newMockRevisionEngineFactoryWithEngine(mockCtrl, mockEngine, nil),
+ TrackingCache: newMockTrackingCache(mockCtrl, fakeClient, nil),
Clock: clocktesting.NewFakeClock(metav1.Now().Time),
}
@@ -151,6 +154,7 @@ func TestResolveObjectRef_GzipCompressed(t *testing.T) {
}
func TestResolveObjectRef_SecretNotFound(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
testScheme := newSchemeWithCoreV1(t)
cos := newRefTestCOS("ref-notfound-1", ocv1.ObjectSourceRef{
@@ -167,8 +171,8 @@ func TestResolveObjectRef_SecretNotFound(t *testing.T) {
reconciler := &controllers.ClusterObjectSetReconciler{
Client: fakeClient,
- RevisionEngineFactory: &mockRevisionEngineFactory{engine: &mockRevisionEngine{}},
- TrackingCache: &mockTrackingCache{client: fakeClient},
+ RevisionEngineFactory: newMockRevisionEngineFactoryWithEngine(mockCtrl, newNoopMockRevisionEngine(mockCtrl), nil),
+ TrackingCache: newMockTrackingCache(mockCtrl, fakeClient, nil),
Clock: clocktesting.NewFakeClock(metav1.Now().Time),
}
@@ -180,6 +184,7 @@ func TestResolveObjectRef_SecretNotFound(t *testing.T) {
}
func TestResolveObjectRef_KeyNotFound(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
testScheme := newSchemeWithCoreV1(t)
secret := &corev1.Secret{
@@ -207,8 +212,8 @@ func TestResolveObjectRef_KeyNotFound(t *testing.T) {
reconciler := &controllers.ClusterObjectSetReconciler{
Client: fakeClient,
- RevisionEngineFactory: &mockRevisionEngineFactory{engine: &mockRevisionEngine{}},
- TrackingCache: &mockTrackingCache{client: fakeClient},
+ RevisionEngineFactory: newMockRevisionEngineFactoryWithEngine(mockCtrl, newNoopMockRevisionEngine(mockCtrl), nil),
+ TrackingCache: newMockTrackingCache(mockCtrl, fakeClient, nil),
Clock: clocktesting.NewFakeClock(metav1.Now().Time),
}
@@ -220,6 +225,7 @@ func TestResolveObjectRef_KeyNotFound(t *testing.T) {
}
func TestResolveObjectRef_InvalidJSON(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
testScheme := newSchemeWithCoreV1(t)
secret := &corev1.Secret{
@@ -247,8 +253,8 @@ func TestResolveObjectRef_InvalidJSON(t *testing.T) {
reconciler := &controllers.ClusterObjectSetReconciler{
Client: fakeClient,
- RevisionEngineFactory: &mockRevisionEngineFactory{engine: &mockRevisionEngine{}},
- TrackingCache: &mockTrackingCache{client: fakeClient},
+ RevisionEngineFactory: newMockRevisionEngineFactoryWithEngine(mockCtrl, newNoopMockRevisionEngine(mockCtrl), nil),
+ TrackingCache: newMockTrackingCache(mockCtrl, fakeClient, nil),
Clock: clocktesting.NewFakeClock(metav1.Now().Time),
}
diff --git a/internal/operator-controller/controllers/revision_engine_factory.go b/internal/operator-controller/controllers/revision_engine_factory.go
index 9311e8641f..a68896a3f2 100644
--- a/internal/operator-controller/controllers/revision_engine_factory.go
+++ b/internal/operator-controller/controllers/revision_engine_factory.go
@@ -10,12 +10,9 @@ package controllers
import (
"context"
"fmt"
- "net/http"
- "strings"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/discovery"
"k8s.io/client-go/rest"
"pkg.package-operator.run/boxcutter/machinery"
@@ -25,8 +22,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
ocv1 "github.com/operator-framework/operator-controller/api/v1"
- "github.com/operator-framework/operator-controller/internal/operator-controller/authentication"
- "github.com/operator-framework/operator-controller/internal/operator-controller/labels"
)
// RevisionEngine defines the interface for reconciling and tearing down revisions.
@@ -40,7 +35,7 @@ type RevisionEngineFactory interface {
CreateRevisionEngine(ctx context.Context, rev *ocv1.ClusterObjectSet) (RevisionEngine, error)
}
-// defaultRevisionEngineFactory creates boxcutter RevisionEngines with serviceAccount-scoped clients.
+// defaultRevisionEngineFactory creates boxcutter RevisionEngines.
type defaultRevisionEngineFactory struct {
Scheme *runtime.Scheme
TrackingCache managedcache.TrackingCache
@@ -48,77 +43,30 @@ type defaultRevisionEngineFactory struct {
RESTMapper meta.RESTMapper
FieldOwnerPrefix string
BaseConfig *rest.Config
- TokenGetter *authentication.TokenGetter
}
// CreateRevisionEngine constructs a boxcutter RevisionEngine for the given ClusterObjectSet.
-// It reads the ServiceAccount from annotations and creates a scoped client.
func (f *defaultRevisionEngineFactory) CreateRevisionEngine(_ context.Context, rev *ocv1.ClusterObjectSet) (RevisionEngine, error) {
- saNamespace, saName, err := f.getServiceAccount(rev)
- if err != nil {
- return nil, err
- }
-
- scopedClient, err := f.createScopedClient(saNamespace, saName)
+ c, err := client.New(f.BaseConfig, client.Options{
+ Scheme: f.Scheme,
+ })
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("failed to create client: %w", err)
}
return machinery.NewRevisionEngine(
machinery.NewPhaseEngine(
machinery.NewObjectEngine(
- f.Scheme, f.TrackingCache, scopedClient,
+ f.Scheme, f.TrackingCache, c,
machinery.NewComparator(f.DiscoveryClient, f.Scheme, f.FieldOwnerPrefix),
- f.FieldOwnerPrefix, f.FieldOwnerPrefix, scopedClient,
+ f.FieldOwnerPrefix, f.FieldOwnerPrefix, c,
),
- validation.NewClusterPhaseValidator(f.RESTMapper, scopedClient),
+ validation.NewClusterPhaseValidator(f.RESTMapper, c),
),
- validation.NewRevisionValidator(), scopedClient,
+ validation.NewRevisionValidator(), c,
), nil
}
-func (f *defaultRevisionEngineFactory) getServiceAccount(rev *ocv1.ClusterObjectSet) (string, string, error) {
- annotations := rev.GetAnnotations()
- if annotations == nil {
- return "", "", fmt.Errorf("revision %q is missing required annotations", rev.Name)
- }
-
- saName := strings.TrimSpace(annotations[labels.ServiceAccountNameKey])
- saNamespace := strings.TrimSpace(annotations[labels.ServiceAccountNamespaceKey])
-
- if len(saName) == 0 {
- return "", "", fmt.Errorf("revision %q is missing ServiceAccount name annotation", rev.Name)
- }
- if len(saNamespace) == 0 {
- return "", "", fmt.Errorf("revision %q is missing ServiceAccount namespace annotation", rev.Name)
- }
-
- return saNamespace, saName, nil
-}
-
-func (f *defaultRevisionEngineFactory) createScopedClient(namespace, serviceAccountName string) (client.Client, error) {
- saConfig := rest.AnonymousClientConfig(f.BaseConfig)
- saConfig.Wrap(func(rt http.RoundTripper) http.RoundTripper {
- return &authentication.TokenInjectingRoundTripper{
- Tripper: rt,
- TokenGetter: f.TokenGetter,
- Key: types.NamespacedName{
- Name: serviceAccountName,
- Namespace: namespace,
- },
- }
- })
-
- scopedClient, err := client.New(saConfig, client.Options{
- Scheme: f.Scheme,
- })
- if err != nil {
- return nil, fmt.Errorf("failed to create client for ServiceAccount %s/%s: %w", namespace, serviceAccountName, err)
- }
-
- return scopedClient, nil
-}
-
// NewDefaultRevisionEngineFactory creates a new defaultRevisionEngineFactory.
func NewDefaultRevisionEngineFactory(
scheme *runtime.Scheme,
@@ -127,14 +75,10 @@ func NewDefaultRevisionEngineFactory(
restMapper meta.RESTMapper,
fieldOwnerPrefix string,
baseConfig *rest.Config,
- tokenGetter *authentication.TokenGetter,
) (RevisionEngineFactory, error) {
if baseConfig == nil {
return nil, fmt.Errorf("baseConfig is required but not provided")
}
- if tokenGetter == nil {
- return nil, fmt.Errorf("tokenGetter is required but not provided")
- }
return &defaultRevisionEngineFactory{
Scheme: scheme,
TrackingCache: trackingCache,
@@ -142,6 +86,5 @@ func NewDefaultRevisionEngineFactory(
RESTMapper: restMapper,
FieldOwnerPrefix: fieldOwnerPrefix,
BaseConfig: baseConfig,
- TokenGetter: tokenGetter,
}, nil
}
diff --git a/internal/operator-controller/controllers/suite_test.go b/internal/operator-controller/controllers/suite_test.go
index 109f0b66cb..19376b3449 100644
--- a/internal/operator-controller/controllers/suite_test.go
+++ b/internal/operator-controller/controllers/suite_test.go
@@ -18,13 +18,17 @@ package controllers_test
import (
"context"
- "io/fs"
"log"
"os"
+ "strings"
+ "sync"
"testing"
"time"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
+ admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apimachineryruntime "k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/rest"
@@ -35,6 +39,7 @@ import (
"github.com/operator-framework/operator-controller/internal/operator-controller/controllers"
"github.com/operator-framework/operator-controller/internal/operator-controller/resolve"
"github.com/operator-framework/operator-controller/internal/shared/util/image"
+ mockcontrollers "github.com/operator-framework/operator-controller/internal/testutil/mock/controllers"
"github.com/operator-framework/operator-controller/test"
)
@@ -53,30 +58,51 @@ func newClient(t *testing.T) client.Client {
return cl
}
-var _ controllers.RevisionStatesGetter = (*MockRevisionStatesGetter)(nil)
+type warningCollector struct {
+ mu sync.Mutex
+ items []string
+}
-type MockRevisionStatesGetter struct {
- *controllers.RevisionStates
- Err error
+func (w *warningCollector) HandleWarningHeader(code int, agent string, text string) {
+ w.mu.Lock()
+ defer w.mu.Unlock()
+ w.items = append(w.items, text)
}
-func (m *MockRevisionStatesGetter) GetRevisionStates(ctx context.Context, ext *ocv1.ClusterExtension) (*controllers.RevisionStates, error) {
- if m.Err != nil {
- return nil, m.Err
+func (w *warningCollector) hasWarning(substr string) bool {
+ w.mu.Lock()
+ defer w.mu.Unlock()
+ for _, item := range w.items {
+ if strings.Contains(item, substr) {
+ return true
+ }
}
- return m.RevisionStates, nil
+ return false
}
-var _ controllers.Applier = (*MockApplier)(nil)
+func newWarningCapturingClient(t *testing.T) (client.Client, *warningCollector) {
+ collector := &warningCollector{}
+ cfg := rest.CopyConfig(config)
+ cfg.WarningHandler = collector
+ cl, err := client.New(cfg, client.Options{Scheme: newScheme(t)})
+ require.NoError(t, err)
+ return cl, collector
+}
-type MockApplier struct {
- installCompleted bool
- installStatus string
- err error
+// newMockRevisionStatesGetter creates a gomock-based RevisionStatesGetter
+// that returns fixed values, replacing the hand-written MockRevisionStatesGetter.
+func newMockRevisionStatesGetter(ctrl *gomock.Controller, revisionStates *controllers.RevisionStates, err error) *mockcontrollers.MockRevisionStatesGetter {
+ m := mockcontrollers.NewMockRevisionStatesGetter(ctrl)
+ m.EXPECT().GetRevisionStates(gomock.Any(), gomock.Any()).Return(revisionStates, err).AnyTimes()
+ return m
}
-func (m *MockApplier) Apply(_ context.Context, _ fs.FS, _ *ocv1.ClusterExtension, _ map[string]string, _ map[string]string) (bool, string, error) {
- return m.installCompleted, m.installStatus, m.err
+// newMockApplier creates a gomock-based Applier that returns fixed values,
+// replacing the hand-written MockApplier.
+func newMockApplier(ctrl *gomock.Controller, installCompleted bool, err error) *mockcontrollers.MockApplier {
+ m := mockcontrollers.NewMockApplier(ctrl)
+ m.EXPECT().Apply(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(installCompleted, "", err).AnyTimes()
+ return m
}
type reconcilerOption func(*deps)
@@ -94,11 +120,13 @@ type deps struct {
func newClientAndReconciler(t *testing.T, opts ...reconcilerOption) (client.Client, *controllers.ClusterExtensionReconciler) {
cl := newClient(t)
+ mockCtrl := gomock.NewController(t)
+ defaultRevisionStatesGetter := mockcontrollers.NewMockRevisionStatesGetter(mockCtrl)
+ defaultRevisionStatesGetter.EXPECT().GetRevisionStates(gomock.Any(), gomock.Any()).Return(&controllers.RevisionStates{}, nil).AnyTimes()
+
d := &deps{
- RevisionStatesGetter: &MockRevisionStatesGetter{
- RevisionStates: &controllers.RevisionStates{},
- },
- Finalizers: crfinalizer.NewFinalizers(),
+ RevisionStatesGetter: defaultRevisionStatesGetter,
+ Finalizers: crfinalizer.NewFinalizers(),
}
reconciler := &controllers.ClusterExtensionReconciler{
Client: cl,
@@ -136,6 +164,38 @@ func TestMain(m *testing.M) {
log.Panic("expected cfg to not be nil")
}
+ cl, err := client.New(config, client.Options{})
+ utilruntime.Must(err)
+ ctx := context.Background()
+ utilruntime.Must(cl.Create(ctx, &admissionregistrationv1.ValidatingAdmissionPolicy{
+ ObjectMeta: metav1.ObjectMeta{Name: "clusterextension-serviceaccount-deprecated"},
+ Spec: admissionregistrationv1.ValidatingAdmissionPolicySpec{
+ MatchConstraints: &admissionregistrationv1.MatchResources{
+ ResourceRules: []admissionregistrationv1.NamedRuleWithOperations{{
+ RuleWithOperations: admissionregistrationv1.RuleWithOperations{
+ Operations: []admissionregistrationv1.OperationType{admissionregistrationv1.Create, admissionregistrationv1.Update},
+ Rule: admissionregistrationv1.Rule{
+ APIGroups: []string{"olm.operatorframework.io"},
+ APIVersions: []string{"v1"},
+ Resources: []string{"clusterextensions"},
+ },
+ },
+ }},
+ },
+ Validations: []admissionregistrationv1.Validation{{
+ Expression: `!has(object.spec.serviceAccount) || !has(object.spec.serviceAccount.name) || object.spec.serviceAccount.name == ''`,
+ Message: "spec.serviceAccount is deprecated, ignored, and will be removed in a future release. The operator-controller's cluster-admin service account is used for all cluster interactions.",
+ }},
+ },
+ }))
+ utilruntime.Must(cl.Create(ctx, &admissionregistrationv1.ValidatingAdmissionPolicyBinding{
+ ObjectMeta: metav1.ObjectMeta{Name: "clusterextension-serviceaccount-deprecated"},
+ Spec: admissionregistrationv1.ValidatingAdmissionPolicyBindingSpec{
+ PolicyName: "clusterextension-serviceaccount-deprecated",
+ ValidationActions: []admissionregistrationv1.ValidationAction{admissionregistrationv1.Warn},
+ },
+ }))
+
code := m.Run()
// Use Eventually wrapper for graceful test environment teardown
// controller-runtime v0.23.0+ requires this to prevent timing-related errors
diff --git a/internal/operator-controller/features/features.go b/internal/operator-controller/features/features.go
index 01e4fe4486..95720bb296 100644
--- a/internal/operator-controller/features/features.go
+++ b/internal/operator-controller/features/features.go
@@ -11,9 +11,7 @@ import (
const (
// Add new feature gates constants (strings)
// Ex: SomeFeature featuregate.Feature = "SomeFeature"
- PreflightPermissions featuregate.Feature = "PreflightPermissions"
SingleOwnNamespaceInstallSupport featuregate.Feature = "SingleOwnNamespaceInstallSupport"
- SyntheticPermissions featuregate.Feature = "SyntheticPermissions"
WebhookProviderCertManager featuregate.Feature = "WebhookProviderCertManager"
WebhookProviderOpenshiftServiceCA featuregate.Feature = "WebhookProviderOpenshiftServiceCA"
HelmChartSupport featuregate.Feature = "HelmChartSupport"
@@ -25,12 +23,6 @@ const (
var operatorControllerFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
// Add new feature gate definitions
// Ex: SomeFeature: {...}
- PreflightPermissions: {
- Default: false,
- PreRelease: featuregate.Alpha,
- LockToDefault: false,
- },
-
// SingleOwnNamespaceInstallSupport enables support for installing
// registry+v1 cluster extensions with single or own namespaces modes
// i.e. with a single watch namespace.
@@ -40,14 +32,6 @@ var operatorControllerFeatureGates = map[featuregate.Feature]featuregate.Feature
LockToDefault: false,
},
- // SyntheticPermissions enables support for a synthetic user permission
- // model to manage operator permission boundaries
- SyntheticPermissions: {
- Default: false,
- PreRelease: featuregate.Alpha,
- LockToDefault: false,
- },
-
// WebhookProviderCertManager enables support for installing
// registry+v1 cluster extensions that include validating,
// mutating, and/or conversion webhooks with CertManager
diff --git a/internal/operator-controller/labels/labels.go b/internal/operator-controller/labels/labels.go
index 02234dce49..3a0cdaf46a 100644
--- a/internal/operator-controller/labels/labels.go
+++ b/internal/operator-controller/labels/labels.go
@@ -41,20 +41,6 @@ const (
// ClusterObjectSet.
BundleReferenceKey = "olm.operatorframework.io/bundle-reference"
- // ServiceAccountNameKey is the annotation key used to record the name of
- // the ServiceAccount configured on the owning ClusterExtension. It is
- // applied as an annotation on ClusterObjectSet resources to
- // capture which ServiceAccount was used for their lifecycle operations.
- ServiceAccountNameKey = "olm.operatorframework.io/service-account-name"
-
- // ServiceAccountNamespaceKey is the annotation key used to record the
- // namespace of the ServiceAccount configured on the owning
- // ClusterExtension. It is applied as an annotation on
- // ClusterObjectSet resources together with ServiceAccountNameKey
- // so that the effective ServiceAccount identity used for
- // ClusterObjectSet operations is preserved.
- ServiceAccountNamespaceKey = "olm.operatorframework.io/service-account-namespace"
-
// RevisionNameKey is the label key used to record the name of the
// ClusterObjectSet that owns or references a resource (e.g. a
// ref Secret). It enables efficient listing of all resources associated
diff --git a/internal/operator-controller/resolve/catalog_test.go b/internal/operator-controller/resolve/catalog_test.go
index 27f158dd53..9f70c537ee 100644
--- a/internal/operator-controller/resolve/catalog_test.go
+++ b/internal/operator-controller/resolve/catalog_test.go
@@ -586,8 +586,7 @@ func buildFooClusterExtension(pkg string, channels []string, version string, upg
Name: pkg,
},
Spec: ocv1.ClusterExtensionSpec{
- Namespace: "default",
- ServiceAccount: ocv1.ServiceAccountReference{Name: "default"},
+ Namespace: "default",
Source: ocv1.SourceConfig{
SourceType: "Catalog",
Catalog: &ocv1.CatalogFilter{
diff --git a/internal/operator-controller/rukpak/preflights/crdupgradesafety/crdupgradesafety_test.go b/internal/operator-controller/rukpak/preflights/crdupgradesafety/crdupgradesafety_test.go
index 82fa203c64..0f32cf7090 100644
--- a/internal/operator-controller/rukpak/preflights/crdupgradesafety/crdupgradesafety_test.go
+++ b/internal/operator-controller/rukpak/preflights/crdupgradesafety/crdupgradesafety_test.go
@@ -8,11 +8,10 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
"helm.sh/helm/v3/pkg/release"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
- apiextensionsv1client "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
crdifyconfig "sigs.k8s.io/crdify/pkg/config"
@@ -20,24 +19,14 @@ import (
"github.com/operator-framework/operator-controller/internal/operator-controller/applier"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/preflights/crdupgradesafety"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util"
+ mockcrdclient "github.com/operator-framework/operator-controller/internal/testutil/mock/crdclient"
)
-type MockCRDGetter struct {
- oldCrd *apiextensionsv1.CustomResourceDefinition
- getErr error
- apiextensionsv1client.CustomResourceDefinitionInterface
-}
-
-func (c *MockCRDGetter) Get(ctx context.Context, name string, options metav1.GetOptions) (*apiextensionsv1.CustomResourceDefinition, error) {
- return c.oldCrd, c.getErr
-}
-
-func newMockPreflight(crd *apiextensionsv1.CustomResourceDefinition, err error) *crdupgradesafety.Preflight {
+func newMockPreflight(ctrl *gomock.Controller, crd *apiextensionsv1.CustomResourceDefinition, err error) *crdupgradesafety.Preflight {
+ m := mockcrdclient.NewMockCustomResourceDefinitionInterface(ctrl)
+ m.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(crd, err).AnyTimes()
var preflightOpts []crdupgradesafety.Option
- return crdupgradesafety.NewPreflight(&MockCRDGetter{
- oldCrd: crd,
- getErr: err,
- }, preflightOpts...)
+ return crdupgradesafety.NewPreflight(m, preflightOpts...)
}
const crdFolder string = "testdata/manifests"
@@ -203,7 +192,8 @@ func TestInstall(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
- preflight := newMockPreflight(getCrdFromManifestFile(t, tc.oldCrdPath), tc.wantCrdGetErr)
+ mockCtrl := gomock.NewController(t)
+ preflight := newMockPreflight(mockCtrl, getCrdFromManifestFile(t, tc.oldCrdPath), tc.wantCrdGetErr)
objs, err := applier.HelmReleaseToObjectsConverter{}.GetObjectsFromRelease(tc.release)
if err == nil {
err = preflight.Install(context.Background(), objs)
@@ -408,7 +398,8 @@ func TestUpgrade(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
- preflight := newMockPreflight(getCrdFromManifestFile(t, tc.oldCrdPath), tc.wantCrdGetErr)
+ mockCtrl := gomock.NewController(t)
+ preflight := newMockPreflight(mockCtrl, getCrdFromManifestFile(t, tc.oldCrdPath), tc.wantCrdGetErr)
objs, err := applier.HelmReleaseToObjectsConverter{}.GetObjectsFromRelease(tc.release)
if err == nil {
err = preflight.Upgrade(context.Background(), objs)
@@ -424,7 +415,8 @@ func TestUpgrade(t *testing.T) {
func TestUpgrade_OneOfRemoved(t *testing.T) {
t.Run("removing oneOf subschemas should fail", func(t *testing.T) {
- preflight := newMockPreflight(getCrdFromManifestFile(t, "crd-oneof-removed-old.json"), nil)
+ mockCtrl := gomock.NewController(t)
+ preflight := newMockPreflight(mockCtrl, getCrdFromManifestFile(t, "crd-oneof-removed-old.json"), nil)
rel := &release.Release{
Name: "test-release",
Manifest: getManifestString(t, "crd-oneof-removed-new.json"),
@@ -439,7 +431,8 @@ func TestUpgrade_OneOfRemoved(t *testing.T) {
func TestUpgrade_OneOfAdded(t *testing.T) {
t.Run("adding oneOf required constraints to existing property should report oneOf error", func(t *testing.T) {
- preflight := newMockPreflight(getCrdFromManifestFile(t, "crd-oneof-safe-addition-old.json"), nil)
+ mockCtrl := gomock.NewController(t)
+ preflight := newMockPreflight(mockCtrl, getCrdFromManifestFile(t, "crd-oneof-safe-addition-old.json"), nil)
rel := &release.Release{
Name: "test-release",
Manifest: getManifestString(t, "crd-oneof-safe-addition-new.json"),
@@ -456,7 +449,8 @@ func TestUpgrade_OneOfAdded(t *testing.T) {
func TestUpgrade_UnhandledChanges_InSpec_DefaultPolicy(t *testing.T) {
t.Run("unhandled spec changes cause error by default", func(t *testing.T) {
- preflight := newMockPreflight(getCrdFromManifestFile(t, "crd-unhandled-old.json"), nil)
+ mockCtrl := gomock.NewController(t)
+ preflight := newMockPreflight(mockCtrl, getCrdFromManifestFile(t, "crd-unhandled-old.json"), nil)
rel := &release.Release{
Name: "test-release",
Manifest: getManifestString(t, "crd-unhandled-new.json"),
@@ -474,7 +468,10 @@ func TestUpgrade_UnhandledChanges_InSpec_DefaultPolicy(t *testing.T) {
func TestUpgrade_UnhandledChanges_PolicyError(t *testing.T) {
t.Run("unhandled changes error when policy is Error", func(t *testing.T) {
oldCrd := getCrdFromManifestFile(t, "crd-unhandled-old.json")
- preflight := crdupgradesafety.NewPreflight(&MockCRDGetter{oldCrd: oldCrd}, crdupgradesafety.WithConfig(&crdifyconfig.Config{
+ ctrl := gomock.NewController(t)
+ mockCRD := mockcrdclient.NewMockCustomResourceDefinitionInterface(ctrl)
+ mockCRD.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(oldCrd, nil).AnyTimes()
+ preflight := crdupgradesafety.NewPreflight(mockCRD, crdupgradesafety.WithConfig(&crdifyconfig.Config{
Conversion: crdifyconfig.ConversionPolicyIgnore,
UnhandledEnforcement: crdifyconfig.EnforcementPolicyError,
}))
diff --git a/internal/operator-controller/rukpak/render/certprovider_test.go b/internal/operator-controller/rukpak/render/certprovider_test.go
index a245a4173a..514702ee06 100644
--- a/internal/operator-controller/rukpak/render/certprovider_test.go
+++ b/internal/operator-controller/rukpak/render/certprovider_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -12,6 +13,7 @@ import (
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render"
. "github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing"
+ mockrender "github.com/operator-framework/operator-controller/internal/testutil/mock/render"
)
func Test_CertificateProvisioner_WithoutCertProvider(t *testing.T) {
@@ -31,29 +33,35 @@ func Test_CertificateProvisioner_WithoutCertProvider(t *testing.T) {
}
func Test_CertificateProvisioner_WithCertProvider(t *testing.T) {
- fakeProvider := &FakeCertProvider{
- InjectCABundleFn: func(obj client.Object, cfg render.CertificateProvisionerConfig) error {
+ ctrl := gomock.NewController(t)
+ mockCert := mockrender.NewMockCertificateProvider(ctrl)
+ mockCert.EXPECT().InjectCABundle(gomock.Any(), gomock.Any()).DoAndReturn(
+ func(obj client.Object, cfg render.CertificateProvisionerConfig) error {
obj.SetName("some-name")
return nil
},
- AdditionalObjectsFn: func(cfg render.CertificateProvisionerConfig) ([]unstructured.Unstructured, error) {
+ )
+ mockCert.EXPECT().AdditionalObjects(gomock.Any()).DoAndReturn(
+ func(cfg render.CertificateProvisionerConfig) ([]unstructured.Unstructured, error) {
return []unstructured.Unstructured{*ToUnstructuredT(t, &corev1.Secret{
TypeMeta: metav1.TypeMeta{Kind: "Secret", APIVersion: corev1.SchemeGroupVersion.String()},
})}, nil
},
- GetCertSecretInfoFn: func(cfg render.CertificateProvisionerConfig) render.CertSecretInfo {
+ )
+ mockCert.EXPECT().GetCertSecretInfo(gomock.Any()).DoAndReturn(
+ func(cfg render.CertificateProvisionerConfig) render.CertSecretInfo {
return render.CertSecretInfo{
SecretName: "some-secret",
PrivateKeyKey: "some-key",
CertificateKey: "another-key",
}
},
- }
+ )
provisioner := &render.CertificateProvisioner{
ServiceName: "webhook",
CertName: "cert",
Namespace: "namespace",
- CertProvider: fakeProvider,
+ CertProvider: mockCert,
}
svc := &corev1.Service{}
@@ -74,19 +82,23 @@ func Test_CertificateProvisioner_WithCertProvider(t *testing.T) {
}
func Test_CertificateProvisioner_Errors(t *testing.T) {
- fakeProvider := &FakeCertProvider{
- InjectCABundleFn: func(obj client.Object, cfg render.CertificateProvisionerConfig) error {
+ ctrl := gomock.NewController(t)
+ mockCert := mockrender.NewMockCertificateProvider(ctrl)
+ mockCert.EXPECT().InjectCABundle(gomock.Any(), gomock.Any()).DoAndReturn(
+ func(obj client.Object, cfg render.CertificateProvisionerConfig) error {
return fmt.Errorf("some error")
},
- AdditionalObjectsFn: func(cfg render.CertificateProvisionerConfig) ([]unstructured.Unstructured, error) {
+ )
+ mockCert.EXPECT().AdditionalObjects(gomock.Any()).DoAndReturn(
+ func(cfg render.CertificateProvisionerConfig) ([]unstructured.Unstructured, error) {
return nil, fmt.Errorf("some other error")
},
- }
+ )
provisioner := &render.CertificateProvisioner{
ServiceName: "webhook",
CertName: "cert",
Namespace: "namespace",
- CertProvider: fakeProvider,
+ CertProvider: mockCert,
}
err := provisioner.InjectCABundle(&corev1.Service{})
@@ -100,13 +112,14 @@ func Test_CertificateProvisioner_Errors(t *testing.T) {
}
func Test_CertProvisionerFor(t *testing.T) {
- fakeProvider := &FakeCertProvider{}
+ ctrl := gomock.NewController(t)
+ mockCert := mockrender.NewMockCertificateProvider(ctrl)
prov := render.CertProvisionerFor("my.deployment.thing", render.Options{
InstallNamespace: "my-namespace",
- CertificateProvider: fakeProvider,
+ CertificateProvider: mockCert,
})
- require.Equal(t, prov.CertProvider, fakeProvider)
+ require.Equal(t, prov.CertProvider, mockCert)
require.Equal(t, "my-deployment-thing-service", prov.ServiceName)
require.Equal(t, "my-deployment-thing-service-cert", prov.CertName)
require.Equal(t, "my-namespace", prov.Namespace)
diff --git a/internal/operator-controller/rukpak/render/fake.go b/internal/operator-controller/rukpak/render/fake.go
deleted file mode 100644
index c8213d78a8..0000000000
--- a/internal/operator-controller/rukpak/render/fake.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package render
-
-import (
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "sigs.k8s.io/controller-runtime/pkg/client"
-)
-
-type FakeCertProvider struct {
- InjectCABundleFn func(obj client.Object, cfg CertificateProvisionerConfig) error
- AdditionalObjectsFn func(cfg CertificateProvisionerConfig) ([]unstructured.Unstructured, error)
- GetCertSecretInfoFn func(cfg CertificateProvisionerConfig) CertSecretInfo
-}
-
-func (f FakeCertProvider) InjectCABundle(obj client.Object, cfg CertificateProvisionerConfig) error {
- return f.InjectCABundleFn(obj, cfg)
-}
-
-func (f FakeCertProvider) AdditionalObjects(cfg CertificateProvisionerConfig) ([]unstructured.Unstructured, error) {
- return f.AdditionalObjectsFn(cfg)
-}
-
-func (f FakeCertProvider) GetCertSecretInfo(cfg CertificateProvisionerConfig) CertSecretInfo {
- return f.GetCertSecretInfoFn(cfg)
-}
diff --git a/internal/operator-controller/rukpak/render/registryv1/generators/generators_test.go b/internal/operator-controller/rukpak/render/registryv1/generators/generators_test.go
index 3caf006c39..26c3f4b70d 100644
--- a/internal/operator-controller/rukpak/render/registryv1/generators/generators_test.go
+++ b/internal/operator-controller/rukpak/render/registryv1/generators/generators_test.go
@@ -7,6 +7,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
@@ -27,6 +28,7 @@ import (
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render/registryv1/generators"
. "github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing"
"github.com/operator-framework/operator-controller/internal/testing/bundle/csv"
+ mockrender "github.com/operator-framework/operator-controller/internal/testutil/mock/render"
)
func Test_ResourceGenerators(t *testing.T) {
@@ -165,15 +167,13 @@ func Test_BundleCSVDeploymentGenerator_Succeeds(t *testing.T) {
}
func Test_BundleCSVDeploymentGenerator_WithCertWithCertProvider_Succeeds(t *testing.T) {
- fakeProvider := FakeCertProvider{
- GetCertSecretInfoFn: func(cfg render.CertificateProvisionerConfig) render.CertSecretInfo {
- return render.CertSecretInfo{
- SecretName: "some-secret",
- CertificateKey: "some-cert-key",
- PrivateKeyKey: "some-private-key-key",
- }
- },
- }
+ ctrl := gomock.NewController(t)
+ fakeProvider := mockrender.NewMockCertificateProvider(ctrl)
+ fakeProvider.EXPECT().GetCertSecretInfo(gomock.Any()).Return(render.CertSecretInfo{
+ SecretName: "some-secret",
+ CertificateKey: "some-cert-key",
+ PrivateKeyKey: "some-private-key-key",
+ }).AnyTimes()
b := &bundle.RegistryV1{
CSV: csv.Builder().
@@ -1393,14 +1393,14 @@ func Test_BundleCRDGenerator_WithConversionWebhook_Fails(t *testing.T) {
}
func Test_BundleCRDGenerator_WithCertProvider_Succeeds(t *testing.T) {
- fakeProvider := FakeCertProvider{
- InjectCABundleFn: func(obj client.Object, cfg render.CertificateProvisionerConfig) error {
- obj.SetAnnotations(map[string]string{
- "cert-provider": "annotation",
- })
- return nil
- },
- }
+ ctrl := gomock.NewController(t)
+ fakeProvider := mockrender.NewMockCertificateProvider(ctrl)
+ fakeProvider.EXPECT().InjectCABundle(gomock.Any(), gomock.Any()).DoAndReturn(func(obj client.Object, _ render.CertificateProvisionerConfig) error {
+ obj.SetAnnotations(map[string]string{
+ "cert-provider": "annotation",
+ })
+ return nil
+ }).AnyTimes()
opts := render.Options{
InstallNamespace: "install-namespace",
@@ -1485,14 +1485,14 @@ func Test_BundleAdditionalResourcesGenerator_FailsOnNil(t *testing.T) {
}
func Test_BundleValidatingWebhookResourceGenerator_Succeeds(t *testing.T) {
- fakeProvider := FakeCertProvider{
- InjectCABundleFn: func(obj client.Object, cfg render.CertificateProvisionerConfig) error {
- obj.SetAnnotations(map[string]string{
- "cert-provider": "annotation",
- })
- return nil
- },
- }
+ ctrl := gomock.NewController(t)
+ fakeProvider := mockrender.NewMockCertificateProvider(ctrl)
+ fakeProvider.EXPECT().InjectCABundle(gomock.Any(), gomock.Any()).DoAndReturn(func(obj client.Object, _ render.CertificateProvisionerConfig) error {
+ obj.SetAnnotations(map[string]string{
+ "cert-provider": "annotation",
+ })
+ return nil
+ }).AnyTimes()
for _, tc := range []struct {
name string
bundle *bundle.RegistryV1
@@ -1765,14 +1765,14 @@ func Test_BundleValidatingWebhookResourceGenerator_FailsOnNil(t *testing.T) {
}
func Test_BundleMutatingWebhookResourceGenerator_Succeeds(t *testing.T) {
- fakeProvider := FakeCertProvider{
- InjectCABundleFn: func(obj client.Object, cfg render.CertificateProvisionerConfig) error {
- obj.SetAnnotations(map[string]string{
- "cert-provider": "annotation",
- })
- return nil
- },
- }
+ ctrl := gomock.NewController(t)
+ fakeProvider := mockrender.NewMockCertificateProvider(ctrl)
+ fakeProvider.EXPECT().InjectCABundle(gomock.Any(), gomock.Any()).DoAndReturn(func(obj client.Object, _ render.CertificateProvisionerConfig) error {
+ obj.SetAnnotations(map[string]string{
+ "cert-provider": "annotation",
+ })
+ return nil
+ }).AnyTimes()
for _, tc := range []struct {
name string
bundle *bundle.RegistryV1
@@ -2049,14 +2049,14 @@ func Test_BundleMutatingWebhookResourceGenerator_FailsOnNil(t *testing.T) {
}
func Test_BundleDeploymentServiceResourceGenerator_Succeeds(t *testing.T) {
- fakeProvider := FakeCertProvider{
- InjectCABundleFn: func(obj client.Object, cfg render.CertificateProvisionerConfig) error {
- obj.SetAnnotations(map[string]string{
- "cert-provider": "annotation",
- })
- return nil
- },
- }
+ ctrl := gomock.NewController(t)
+ fakeProvider := mockrender.NewMockCertificateProvider(ctrl)
+ fakeProvider.EXPECT().InjectCABundle(gomock.Any(), gomock.Any()).DoAndReturn(func(obj client.Object, _ render.CertificateProvisionerConfig) error {
+ obj.SetAnnotations(map[string]string{
+ "cert-provider": "annotation",
+ })
+ return nil
+ }).AnyTimes()
for _, tc := range []struct {
name string
bundle *bundle.RegistryV1
@@ -2470,16 +2470,16 @@ func Test_BundleDeploymentServiceResourceGenerator_FailsOnNil(t *testing.T) {
}
func Test_CertProviderResourceGenerator_Succeeds(t *testing.T) {
- fakeProvider := FakeCertProvider{
- AdditionalObjectsFn: func(cfg render.CertificateProvisionerConfig) ([]unstructured.Unstructured, error) {
- return []unstructured.Unstructured{*ToUnstructuredT(t, &corev1.Secret{
- TypeMeta: metav1.TypeMeta{Kind: "Secret", APIVersion: corev1.SchemeGroupVersion.String()},
- ObjectMeta: metav1.ObjectMeta{
- Name: cfg.CertName,
- },
- })}, nil
- },
- }
+ ctrl := gomock.NewController(t)
+ fakeProvider := mockrender.NewMockCertificateProvider(ctrl)
+ fakeProvider.EXPECT().AdditionalObjects(gomock.Any()).DoAndReturn(func(cfg render.CertificateProvisionerConfig) ([]unstructured.Unstructured, error) {
+ return []unstructured.Unstructured{*ToUnstructuredT(t, &corev1.Secret{
+ TypeMeta: metav1.TypeMeta{Kind: "Secret", APIVersion: corev1.SchemeGroupVersion.String()},
+ ObjectMeta: metav1.ObjectMeta{
+ Name: cfg.CertName,
+ },
+ })}, nil
+ }).AnyTimes()
objs, err := generators.CertProviderResourceGenerator(&bundle.RegistryV1{
CSV: csv.Builder().
diff --git a/internal/operator-controller/rukpak/render/render_test.go b/internal/operator-controller/rukpak/render/render_test.go
index 4af451f317..fb24b7d3b1 100644
--- a/internal/operator-controller/rukpak/render/render_test.go
+++ b/internal/operator-controller/rukpak/render/render_test.go
@@ -7,6 +7,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -16,8 +17,8 @@ import (
"github.com/operator-framework/operator-controller/internal/operator-controller/config"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/bundle"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render"
- . "github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing"
"github.com/operator-framework/operator-controller/internal/testing/bundle/csv"
+ mockrender "github.com/operator-framework/operator-controller/internal/testutil/mock/render"
)
func Test_BundleRenderer_NoConfig(t *testing.T) {
@@ -323,8 +324,9 @@ func Test_WithUniqueNameGenerator(t *testing.T) {
}
func Test_WithCertificateProvide(t *testing.T) {
+ ctrl := gomock.NewController(t)
opts := &render.Options{}
- expectedCertProvider := FakeCertProvider{}
+ expectedCertProvider := mockrender.NewMockCertificateProvider(ctrl)
render.WithCertificateProvider(expectedCertProvider)(opts)
require.Equal(t, expectedCertProvider, opts.CertificateProvider)
}
diff --git a/internal/operator-controller/rukpak/util/testing/testing.go b/internal/operator-controller/rukpak/util/testing/testing.go
index 2670091a19..5d7a449775 100644
--- a/internal/operator-controller/rukpak/util/testing/testing.go
+++ b/internal/operator-controller/rukpak/util/testing/testing.go
@@ -8,28 +8,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/bundle"
- "github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util"
)
-type FakeCertProvider struct {
- InjectCABundleFn func(obj client.Object, cfg render.CertificateProvisionerConfig) error
- AdditionalObjectsFn func(cfg render.CertificateProvisionerConfig) ([]unstructured.Unstructured, error)
- GetCertSecretInfoFn func(cfg render.CertificateProvisionerConfig) render.CertSecretInfo
-}
-
-func (f FakeCertProvider) InjectCABundle(obj client.Object, cfg render.CertificateProvisionerConfig) error {
- return f.InjectCABundleFn(obj, cfg)
-}
-
-func (f FakeCertProvider) AdditionalObjects(cfg render.CertificateProvisionerConfig) ([]unstructured.Unstructured, error) {
- return f.AdditionalObjectsFn(cfg)
-}
-
-func (f FakeCertProvider) GetCertSecretInfo(cfg render.CertificateProvisionerConfig) render.CertSecretInfo {
- return f.GetCertSecretInfoFn(cfg)
-}
-
type FakeBundleSource func() (bundle.RegistryV1, error)
func (f FakeBundleSource) GetBundle() (bundle.RegistryV1, error) {
diff --git a/internal/shared/util/featuregates/logging_test.go b/internal/shared/util/featuregates/logging_test.go
index 1d4b163e3a..9077af4fed 100644
--- a/internal/shared/util/featuregates/logging_test.go
+++ b/internal/shared/util/featuregates/logging_test.go
@@ -5,40 +5,13 @@ import (
"github.com/go-logr/logr"
"github.com/stretchr/testify/require"
+ "go.uber.org/mock/gomock"
"k8s.io/component-base/featuregate"
"github.com/operator-framework/operator-controller/internal/shared/util/featuregates"
+ mocklogrsink "github.com/operator-framework/operator-controller/internal/testutil/mock/logrsink"
)
-// fakeSink implements logr.LogSink, capturing Info calls for testing
-type fakeSink struct {
- level int
- msg string
- keysAndValues []interface{}
-}
-
-// Init is part of logr.LogSink
-func (f *fakeSink) Init(info logr.RuntimeInfo) {}
-
-// Enabled is part of logr.LogSink
-func (f *fakeSink) Enabled(level int) bool { return true }
-
-// Info captures the log level, message, and key/value pairs
-func (f *fakeSink) Info(level int, msg string, keysAndValues ...interface{}) {
- f.level = level
- f.msg = msg
- f.keysAndValues = append([]interface{}{}, keysAndValues...)
-}
-
-// Error is part of logr.LogSink; not used in this test
-func (f *fakeSink) Error(err error, msg string, keysAndValues ...interface{}) {}
-
-// WithValues returns a sink with additional values; for testing, return self
-func (f *fakeSink) WithValues(keysAndValues ...interface{}) logr.LogSink { return f }
-
-// WithName returns a sink with a new name; for testing, return self
-func (f *fakeSink) WithName(name string) logr.LogSink { return f }
-
// TestLogFeatureGateStates verifies that LogFeatureGateStates logs features
// sorted alphabetically with their enabled state
func TestLogFeatureGateStates(t *testing.T) {
@@ -58,15 +31,31 @@ func TestLogFeatureGateStates(t *testing.T) {
"CFeature": true,
}))
- // prepare a fake sink and logger
- sink := &fakeSink{}
+ // prepare a mock sink and logger, capturing Info calls
+ ctrl := gomock.NewController(t)
+ sink := mocklogrsink.NewMockLogSink(ctrl)
+
+ var capturedMsg string
+ var capturedKV []interface{}
+
+ sink.EXPECT().Init(gomock.Any()).AnyTimes()
+ sink.EXPECT().Enabled(gomock.Any()).Return(true).AnyTimes()
+ sink.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
+ func(level int, msg string, kv ...interface{}) {
+ capturedMsg = msg
+ capturedKV = append([]interface{}{}, kv...)
+ }).AnyTimes()
+ sink.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
+ sink.EXPECT().WithValues(gomock.Any()).Return(sink).AnyTimes()
+ sink.EXPECT().WithName(gomock.Any()).Return(sink).AnyTimes()
+
logger := logr.New(sink)
// log the feature states
featuregates.LogFeatureGateStates(logger, "feature states", gate, defs)
// verify the message
- require.Equal(t, "feature states", sink.msg)
+ require.Equal(t, "feature states", capturedMsg)
// Expect keys sorted: AFeature, BFeature, CFeature
want := []interface{}{
@@ -74,5 +63,5 @@ func TestLogFeatureGateStates(t *testing.T) {
featuregate.Feature("BFeature"), true,
featuregate.Feature("CFeature"), true,
}
- require.Equal(t, want, sink.keysAndValues)
+ require.Equal(t, want, capturedKV)
}
diff --git a/internal/shared/util/image/mocks.go b/internal/shared/util/image/fakes.go
similarity index 63%
rename from internal/shared/util/image/mocks.go
rename to internal/shared/util/image/fakes.go
index 82e8226e26..b995ae9b53 100644
--- a/internal/shared/util/image/mocks.go
+++ b/internal/shared/util/image/fakes.go
@@ -10,17 +10,17 @@ import (
"go.podman.io/image/v5/docker/reference"
)
-var _ Puller = (*MockPuller)(nil)
+var _ Puller = (*FakePuller)(nil)
-// MockPuller is a utility for mocking out a Puller interface
-type MockPuller struct {
+// FakePuller is a test fake that returns preconfigured values for the Puller interface
+type FakePuller struct {
ImageFS fs.FS
Ref reference.Canonical
ModTime time.Time
Error error
}
-func (ms *MockPuller) Pull(_ context.Context, _, _ string, _ Cache) (fs.FS, reference.Canonical, time.Time, error) {
+func (ms *FakePuller) Pull(_ context.Context, _, _ string, _ Cache) (fs.FS, reference.Canonical, time.Time, error) {
if ms.Error != nil {
return nil, nil, time.Time{}, ms.Error
}
@@ -28,9 +28,9 @@ func (ms *MockPuller) Pull(_ context.Context, _, _ string, _ Cache) (fs.FS, refe
return ms.ImageFS, ms.Ref, ms.ModTime, nil
}
-var _ Cache = (*MockCache)(nil)
+var _ Cache = (*FakeCache)(nil)
-type MockCache struct {
+type FakeCache struct {
FetchFS fs.FS
FetchModTime time.Time
FetchError error
@@ -44,18 +44,18 @@ type MockCache struct {
GarbageCollectError error
}
-func (m MockCache) Fetch(_ context.Context, _ string, _ reference.Canonical) (fs.FS, time.Time, error) {
+func (m FakeCache) Fetch(_ context.Context, _ string, _ reference.Canonical) (fs.FS, time.Time, error) {
return m.FetchFS, m.FetchModTime, m.FetchError
}
-func (m MockCache) Store(_ context.Context, _ string, _ reference.Named, _ reference.Canonical, _ ocispecv1.Image, _ iter.Seq[LayerData]) (fs.FS, time.Time, error) {
+func (m FakeCache) Store(_ context.Context, _ string, _ reference.Named, _ reference.Canonical, _ ocispecv1.Image, _ iter.Seq[LayerData]) (fs.FS, time.Time, error) {
return m.StoreFS, m.StoreModTime, m.StoreError
}
-func (m MockCache) Delete(_ context.Context, _ string) error {
+func (m FakeCache) Delete(_ context.Context, _ string) error {
return m.DeleteErr
}
-func (m MockCache) GarbageCollect(_ context.Context, _ string, _ reference.Canonical) error {
+func (m FakeCache) GarbageCollect(_ context.Context, _ string, _ reference.Canonical) error {
return m.GarbageCollectError
}
diff --git a/internal/shared/util/image/pull_test.go b/internal/shared/util/image/pull_test.go
index 2b11718a9b..ac59ae509b 100644
--- a/internal/shared/util/image/pull_test.go
+++ b/internal/shared/util/image/pull_test.go
@@ -122,7 +122,7 @@ func TestContainersImagePuller_Pull(t *testing.T) {
name: "return error if cache fetch fails",
ownerID: myOwner,
srcRef: myCanonicalRef.String(),
- cache: MockCache{FetchError: errors.New("fetch error")},
+ cache: FakeCache{FetchError: errors.New("fetch error")},
contextFunc: defaultContextFunc,
expect: func(t *testing.T, fsys fs.FS, canonical reference.Canonical, modTime time.Time, err error) {
require.ErrorContains(t, err, "fetch error")
@@ -132,7 +132,7 @@ func TestContainersImagePuller_Pull(t *testing.T) {
name: "return canonical ref's data from cache, if present",
ownerID: myOwner,
srcRef: myCanonicalRef.String(),
- cache: MockCache{
+ cache: FakeCache{
FetchFS: fstest.MapFS{
testFileName: &fstest.MapFile{Data: []byte(testFileContents)},
},
@@ -153,7 +153,7 @@ func TestContainersImagePuller_Pull(t *testing.T) {
name: "return tag ref's data from cache, if present",
ownerID: myOwner,
srcRef: myTagRef.String(),
- cache: MockCache{
+ cache: FakeCache{
FetchFS: fstest.MapFS{
testFileName: &fstest.MapFile{Data: []byte(testFileContents)},
},
@@ -174,7 +174,7 @@ func TestContainersImagePuller_Pull(t *testing.T) {
name: "returns error if failure storing content in cache",
ownerID: myOwner,
srcRef: myCanonicalRef.String(),
- cache: MockCache{
+ cache: FakeCache{
StoreError: errors.New("store error"),
},
contextFunc: buildSourceContextFunc(t, myCanonicalRef),
@@ -186,7 +186,7 @@ func TestContainersImagePuller_Pull(t *testing.T) {
name: "returns stored data upon pull success",
ownerID: myOwner,
srcRef: myTagRef.String(),
- cache: MockCache{
+ cache: FakeCache{
StoreFS: fstest.MapFS{
testFileName: &fstest.MapFile{Data: []byte(testFileContents)},
},
@@ -208,7 +208,7 @@ func TestContainersImagePuller_Pull(t *testing.T) {
name: "returns error if cache garbage collection fails",
ownerID: myOwner,
srcRef: myTagRef.String(),
- cache: MockCache{
+ cache: FakeCache{
StoreFS: fstest.MapFS{
testFileName: &fstest.MapFile{Data: []byte(testFileContents)},
},
diff --git a/internal/testutil/mock/applier/mock_applier.go b/internal/testutil/mock/applier/mock_applier.go
new file mode 100644
index 0000000000..5ff9b4e08c
--- /dev/null
+++ b/internal/testutil/mock/applier/mock_applier.go
@@ -0,0 +1,246 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: github.com/operator-framework/operator-controller/internal/operator-controller/applier (interfaces: Preflight,HelmReleaseToObjectsConverterInterface,HelmChartProvider,ClusterObjectSetGenerator,ManifestProvider)
+//
+// Generated by this command:
+//
+// mockgen -destination=applier/mock_applier.go -package=applier github.com/operator-framework/operator-controller/internal/operator-controller/applier Preflight,HelmReleaseToObjectsConverterInterface,HelmChartProvider,ClusterObjectSetGenerator,ManifestProvider
+//
+
+// Package applier is a generated GoMock package.
+package applier
+
+import (
+ context "context"
+ fs "io/fs"
+ reflect "reflect"
+
+ v1 "github.com/operator-framework/operator-controller/api/v1"
+ v10 "github.com/operator-framework/operator-controller/applyconfigurations/api/v1"
+ gomock "go.uber.org/mock/gomock"
+ chart "helm.sh/helm/v3/pkg/chart"
+ release "helm.sh/helm/v3/pkg/release"
+ client "sigs.k8s.io/controller-runtime/pkg/client"
+)
+
+// MockPreflight is a mock of Preflight interface.
+type MockPreflight struct {
+ ctrl *gomock.Controller
+ recorder *MockPreflightMockRecorder
+ isgomock struct{}
+}
+
+// MockPreflightMockRecorder is the mock recorder for MockPreflight.
+type MockPreflightMockRecorder struct {
+ mock *MockPreflight
+}
+
+// NewMockPreflight creates a new mock instance.
+func NewMockPreflight(ctrl *gomock.Controller) *MockPreflight {
+ mock := &MockPreflight{ctrl: ctrl}
+ mock.recorder = &MockPreflightMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockPreflight) EXPECT() *MockPreflightMockRecorder {
+ return m.recorder
+}
+
+// Install mocks base method.
+func (m *MockPreflight) Install(arg0 context.Context, arg1 []client.Object) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Install", arg0, arg1)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Install indicates an expected call of Install.
+func (mr *MockPreflightMockRecorder) Install(arg0, arg1 any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Install", reflect.TypeOf((*MockPreflight)(nil).Install), arg0, arg1)
+}
+
+// Upgrade mocks base method.
+func (m *MockPreflight) Upgrade(arg0 context.Context, arg1 []client.Object) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Upgrade", arg0, arg1)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Upgrade indicates an expected call of Upgrade.
+func (mr *MockPreflightMockRecorder) Upgrade(arg0, arg1 any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Upgrade", reflect.TypeOf((*MockPreflight)(nil).Upgrade), arg0, arg1)
+}
+
+// MockHelmReleaseToObjectsConverterInterface is a mock of HelmReleaseToObjectsConverterInterface interface.
+type MockHelmReleaseToObjectsConverterInterface struct {
+ ctrl *gomock.Controller
+ recorder *MockHelmReleaseToObjectsConverterInterfaceMockRecorder
+ isgomock struct{}
+}
+
+// MockHelmReleaseToObjectsConverterInterfaceMockRecorder is the mock recorder for MockHelmReleaseToObjectsConverterInterface.
+type MockHelmReleaseToObjectsConverterInterfaceMockRecorder struct {
+ mock *MockHelmReleaseToObjectsConverterInterface
+}
+
+// NewMockHelmReleaseToObjectsConverterInterface creates a new mock instance.
+func NewMockHelmReleaseToObjectsConverterInterface(ctrl *gomock.Controller) *MockHelmReleaseToObjectsConverterInterface {
+ mock := &MockHelmReleaseToObjectsConverterInterface{ctrl: ctrl}
+ mock.recorder = &MockHelmReleaseToObjectsConverterInterfaceMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockHelmReleaseToObjectsConverterInterface) EXPECT() *MockHelmReleaseToObjectsConverterInterfaceMockRecorder {
+ return m.recorder
+}
+
+// GetObjectsFromRelease mocks base method.
+func (m *MockHelmReleaseToObjectsConverterInterface) GetObjectsFromRelease(rel *release.Release) ([]client.Object, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetObjectsFromRelease", rel)
+ ret0, _ := ret[0].([]client.Object)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GetObjectsFromRelease indicates an expected call of GetObjectsFromRelease.
+func (mr *MockHelmReleaseToObjectsConverterInterfaceMockRecorder) GetObjectsFromRelease(rel any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObjectsFromRelease", reflect.TypeOf((*MockHelmReleaseToObjectsConverterInterface)(nil).GetObjectsFromRelease), rel)
+}
+
+// MockHelmChartProvider is a mock of HelmChartProvider interface.
+type MockHelmChartProvider struct {
+ ctrl *gomock.Controller
+ recorder *MockHelmChartProviderMockRecorder
+ isgomock struct{}
+}
+
+// MockHelmChartProviderMockRecorder is the mock recorder for MockHelmChartProvider.
+type MockHelmChartProviderMockRecorder struct {
+ mock *MockHelmChartProvider
+}
+
+// NewMockHelmChartProvider creates a new mock instance.
+func NewMockHelmChartProvider(ctrl *gomock.Controller) *MockHelmChartProvider {
+ mock := &MockHelmChartProvider{ctrl: ctrl}
+ mock.recorder = &MockHelmChartProviderMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockHelmChartProvider) EXPECT() *MockHelmChartProviderMockRecorder {
+ return m.recorder
+}
+
+// Get mocks base method.
+func (m *MockHelmChartProvider) Get(bundle fs.FS, clusterExtension *v1.ClusterExtension) (*chart.Chart, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Get", bundle, clusterExtension)
+ ret0, _ := ret[0].(*chart.Chart)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Get indicates an expected call of Get.
+func (mr *MockHelmChartProviderMockRecorder) Get(bundle, clusterExtension any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockHelmChartProvider)(nil).Get), bundle, clusterExtension)
+}
+
+// MockClusterObjectSetGenerator is a mock of ClusterObjectSetGenerator interface.
+type MockClusterObjectSetGenerator struct {
+ ctrl *gomock.Controller
+ recorder *MockClusterObjectSetGeneratorMockRecorder
+ isgomock struct{}
+}
+
+// MockClusterObjectSetGeneratorMockRecorder is the mock recorder for MockClusterObjectSetGenerator.
+type MockClusterObjectSetGeneratorMockRecorder struct {
+ mock *MockClusterObjectSetGenerator
+}
+
+// NewMockClusterObjectSetGenerator creates a new mock instance.
+func NewMockClusterObjectSetGenerator(ctrl *gomock.Controller) *MockClusterObjectSetGenerator {
+ mock := &MockClusterObjectSetGenerator{ctrl: ctrl}
+ mock.recorder = &MockClusterObjectSetGeneratorMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockClusterObjectSetGenerator) EXPECT() *MockClusterObjectSetGeneratorMockRecorder {
+ return m.recorder
+}
+
+// GenerateRevision mocks base method.
+func (m *MockClusterObjectSetGenerator) GenerateRevision(ctx context.Context, bundleFS fs.FS, ext *v1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*v10.ClusterObjectSetApplyConfiguration, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GenerateRevision", ctx, bundleFS, ext, objectLabels, revisionAnnotations)
+ ret0, _ := ret[0].(*v10.ClusterObjectSetApplyConfiguration)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GenerateRevision indicates an expected call of GenerateRevision.
+func (mr *MockClusterObjectSetGeneratorMockRecorder) GenerateRevision(ctx, bundleFS, ext, objectLabels, revisionAnnotations any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateRevision", reflect.TypeOf((*MockClusterObjectSetGenerator)(nil).GenerateRevision), ctx, bundleFS, ext, objectLabels, revisionAnnotations)
+}
+
+// GenerateRevisionFromHelmRelease mocks base method.
+func (m *MockClusterObjectSetGenerator) GenerateRevisionFromHelmRelease(ctx context.Context, helmRelease *release.Release, ext *v1.ClusterExtension, objectLabels map[string]string) (*v10.ClusterObjectSetApplyConfiguration, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GenerateRevisionFromHelmRelease", ctx, helmRelease, ext, objectLabels)
+ ret0, _ := ret[0].(*v10.ClusterObjectSetApplyConfiguration)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GenerateRevisionFromHelmRelease indicates an expected call of GenerateRevisionFromHelmRelease.
+func (mr *MockClusterObjectSetGeneratorMockRecorder) GenerateRevisionFromHelmRelease(ctx, helmRelease, ext, objectLabels any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateRevisionFromHelmRelease", reflect.TypeOf((*MockClusterObjectSetGenerator)(nil).GenerateRevisionFromHelmRelease), ctx, helmRelease, ext, objectLabels)
+}
+
+// MockManifestProvider is a mock of ManifestProvider interface.
+type MockManifestProvider struct {
+ ctrl *gomock.Controller
+ recorder *MockManifestProviderMockRecorder
+ isgomock struct{}
+}
+
+// MockManifestProviderMockRecorder is the mock recorder for MockManifestProvider.
+type MockManifestProviderMockRecorder struct {
+ mock *MockManifestProvider
+}
+
+// NewMockManifestProvider creates a new mock instance.
+func NewMockManifestProvider(ctrl *gomock.Controller) *MockManifestProvider {
+ mock := &MockManifestProvider{ctrl: ctrl}
+ mock.recorder = &MockManifestProviderMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockManifestProvider) EXPECT() *MockManifestProviderMockRecorder {
+ return m.recorder
+}
+
+// Get mocks base method.
+func (m *MockManifestProvider) Get(bundle fs.FS, ext *v1.ClusterExtension) ([]client.Object, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Get", bundle, ext)
+ ret0, _ := ret[0].([]client.Object)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Get indicates an expected call of Get.
+func (mr *MockManifestProviderMockRecorder) Get(bundle, ext any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockManifestProvider)(nil).Get), bundle, ext)
+}
diff --git a/internal/testutil/mock/catalogclient/mock_cache.go b/internal/testutil/mock/catalogclient/mock_cache.go
new file mode 100644
index 0000000000..5b7805158a
--- /dev/null
+++ b/internal/testutil/mock/catalogclient/mock_cache.go
@@ -0,0 +1,72 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: github.com/operator-framework/operator-controller/internal/operator-controller/catalogmetadata/client (interfaces: Cache)
+//
+// Generated by this command:
+//
+// mockgen -destination=catalogclient/mock_cache.go -package=catalogclient github.com/operator-framework/operator-controller/internal/operator-controller/catalogmetadata/client Cache
+//
+
+// Package catalogclient is a generated GoMock package.
+package catalogclient
+
+import (
+ io "io"
+ fs "io/fs"
+ reflect "reflect"
+
+ gomock "go.uber.org/mock/gomock"
+)
+
+// MockCache is a mock of Cache interface.
+type MockCache struct {
+ ctrl *gomock.Controller
+ recorder *MockCacheMockRecorder
+ isgomock struct{}
+}
+
+// MockCacheMockRecorder is the mock recorder for MockCache.
+type MockCacheMockRecorder struct {
+ mock *MockCache
+}
+
+// NewMockCache creates a new mock instance.
+func NewMockCache(ctrl *gomock.Controller) *MockCache {
+ mock := &MockCache{ctrl: ctrl}
+ mock.recorder = &MockCacheMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockCache) EXPECT() *MockCacheMockRecorder {
+ return m.recorder
+}
+
+// Get mocks base method.
+func (m *MockCache) Get(catalogName, resolvedRef string) (fs.FS, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Get", catalogName, resolvedRef)
+ ret0, _ := ret[0].(fs.FS)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Get indicates an expected call of Get.
+func (mr *MockCacheMockRecorder) Get(catalogName, resolvedRef any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockCache)(nil).Get), catalogName, resolvedRef)
+}
+
+// Put mocks base method.
+func (m *MockCache) Put(catalogName, resolvedRef string, source io.Reader, errToCache error) (fs.FS, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Put", catalogName, resolvedRef, source, errToCache)
+ ret0, _ := ret[0].(fs.FS)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Put indicates an expected call of Put.
+func (mr *MockCacheMockRecorder) Put(catalogName, resolvedRef, source, errToCache any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockCache)(nil).Put), catalogName, resolvedRef, source, errToCache)
+}
diff --git a/internal/testutil/mock/catalogdserver/mock_catalogstore.go b/internal/testutil/mock/catalogdserver/mock_catalogstore.go
new file mode 100644
index 0000000000..38318f6cee
--- /dev/null
+++ b/internal/testutil/mock/catalogdserver/mock_catalogstore.go
@@ -0,0 +1,89 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: github.com/operator-framework/operator-controller/internal/catalogd/server (interfaces: CatalogStore)
+//
+// Generated by this command:
+//
+// mockgen -destination=catalogdserver/mock_catalogstore.go -package=catalogdserver github.com/operator-framework/operator-controller/internal/catalogd/server CatalogStore
+//
+
+// Package catalogdserver is a generated GoMock package.
+package catalogdserver
+
+import (
+ fs "io/fs"
+ os "os"
+ reflect "reflect"
+
+ server "github.com/operator-framework/operator-controller/internal/catalogd/server"
+ gomock "go.uber.org/mock/gomock"
+)
+
+// MockCatalogStore is a mock of CatalogStore interface.
+type MockCatalogStore struct {
+ ctrl *gomock.Controller
+ recorder *MockCatalogStoreMockRecorder
+ isgomock struct{}
+}
+
+// MockCatalogStoreMockRecorder is the mock recorder for MockCatalogStore.
+type MockCatalogStoreMockRecorder struct {
+ mock *MockCatalogStore
+}
+
+// NewMockCatalogStore creates a new mock instance.
+func NewMockCatalogStore(ctrl *gomock.Controller) *MockCatalogStore {
+ mock := &MockCatalogStore{ctrl: ctrl}
+ mock.recorder = &MockCatalogStoreMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockCatalogStore) EXPECT() *MockCatalogStoreMockRecorder {
+ return m.recorder
+}
+
+// GetCatalogData mocks base method.
+func (m *MockCatalogStore) GetCatalogData(catalog string) (*os.File, os.FileInfo, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetCatalogData", catalog)
+ ret0, _ := ret[0].(*os.File)
+ ret1, _ := ret[1].(os.FileInfo)
+ ret2, _ := ret[2].(error)
+ return ret0, ret1, ret2
+}
+
+// GetCatalogData indicates an expected call of GetCatalogData.
+func (mr *MockCatalogStoreMockRecorder) GetCatalogData(catalog any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCatalogData", reflect.TypeOf((*MockCatalogStore)(nil).GetCatalogData), catalog)
+}
+
+// GetCatalogFS mocks base method.
+func (m *MockCatalogStore) GetCatalogFS(catalog string) (fs.FS, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetCatalogFS", catalog)
+ ret0, _ := ret[0].(fs.FS)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GetCatalogFS indicates an expected call of GetCatalogFS.
+func (mr *MockCatalogStoreMockRecorder) GetCatalogFS(catalog any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCatalogFS", reflect.TypeOf((*MockCatalogStore)(nil).GetCatalogFS), catalog)
+}
+
+// GetIndex mocks base method.
+func (m *MockCatalogStore) GetIndex(catalog string) (server.Index, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetIndex", catalog)
+ ret0, _ := ret[0].(server.Index)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GetIndex indicates an expected call of GetIndex.
+func (mr *MockCatalogStoreMockRecorder) GetIndex(catalog any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetIndex", reflect.TypeOf((*MockCatalogStore)(nil).GetIndex), catalog)
+}
diff --git a/internal/testutil/mock/catalogdservice/mock_graphqlservice.go b/internal/testutil/mock/catalogdservice/mock_graphqlservice.go
new file mode 100644
index 0000000000..ee40372a59
--- /dev/null
+++ b/internal/testutil/mock/catalogdservice/mock_graphqlservice.go
@@ -0,0 +1,85 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: github.com/operator-framework/operator-controller/internal/catalogd/service (interfaces: GraphQLService)
+//
+// Generated by this command:
+//
+// mockgen -destination=catalogdservice/mock_graphqlservice.go -package=catalogdservice github.com/operator-framework/operator-controller/internal/catalogd/service GraphQLService
+//
+
+// Package catalogdservice is a generated GoMock package.
+package catalogdservice
+
+import (
+ fs "io/fs"
+ reflect "reflect"
+
+ graphql "github.com/graphql-go/graphql"
+ graphql0 "github.com/operator-framework/operator-controller/internal/catalogd/graphql"
+ gomock "go.uber.org/mock/gomock"
+)
+
+// MockGraphQLService is a mock of GraphQLService interface.
+type MockGraphQLService struct {
+ ctrl *gomock.Controller
+ recorder *MockGraphQLServiceMockRecorder
+ isgomock struct{}
+}
+
+// MockGraphQLServiceMockRecorder is the mock recorder for MockGraphQLService.
+type MockGraphQLServiceMockRecorder struct {
+ mock *MockGraphQLService
+}
+
+// NewMockGraphQLService creates a new mock instance.
+func NewMockGraphQLService(ctrl *gomock.Controller) *MockGraphQLService {
+ mock := &MockGraphQLService{ctrl: ctrl}
+ mock.recorder = &MockGraphQLServiceMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockGraphQLService) EXPECT() *MockGraphQLServiceMockRecorder {
+ return m.recorder
+}
+
+// ExecuteQuery mocks base method.
+func (m *MockGraphQLService) ExecuteQuery(catalog string, catalogFS fs.FS, query string) (*graphql.Result, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "ExecuteQuery", catalog, catalogFS, query)
+ ret0, _ := ret[0].(*graphql.Result)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// ExecuteQuery indicates an expected call of ExecuteQuery.
+func (mr *MockGraphQLServiceMockRecorder) ExecuteQuery(catalog, catalogFS, query any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecuteQuery", reflect.TypeOf((*MockGraphQLService)(nil).ExecuteQuery), catalog, catalogFS, query)
+}
+
+// GetSchema mocks base method.
+func (m *MockGraphQLService) GetSchema(catalog string, catalogFS fs.FS) (*graphql0.DynamicSchema, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetSchema", catalog, catalogFS)
+ ret0, _ := ret[0].(*graphql0.DynamicSchema)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GetSchema indicates an expected call of GetSchema.
+func (mr *MockGraphQLServiceMockRecorder) GetSchema(catalog, catalogFS any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSchema", reflect.TypeOf((*MockGraphQLService)(nil).GetSchema), catalog, catalogFS)
+}
+
+// InvalidateCache mocks base method.
+func (m *MockGraphQLService) InvalidateCache(catalog string) {
+ m.ctrl.T.Helper()
+ m.ctrl.Call(m, "InvalidateCache", catalog)
+}
+
+// InvalidateCache indicates an expected call of InvalidateCache.
+func (mr *MockGraphQLServiceMockRecorder) InvalidateCache(catalog any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InvalidateCache", reflect.TypeOf((*MockGraphQLService)(nil).InvalidateCache), catalog)
+}
diff --git a/internal/testutil/mock/config/mock_schemaprovider.go b/internal/testutil/mock/config/mock_schemaprovider.go
new file mode 100644
index 0000000000..5d5fef774f
--- /dev/null
+++ b/internal/testutil/mock/config/mock_schemaprovider.go
@@ -0,0 +1,55 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: github.com/operator-framework/operator-controller/internal/operator-controller/config (interfaces: SchemaProvider)
+//
+// Generated by this command:
+//
+// mockgen -destination=config/mock_schemaprovider.go -package=config github.com/operator-framework/operator-controller/internal/operator-controller/config SchemaProvider
+//
+
+// Package config is a generated GoMock package.
+package config
+
+import (
+ reflect "reflect"
+
+ gomock "go.uber.org/mock/gomock"
+)
+
+// MockSchemaProvider is a mock of SchemaProvider interface.
+type MockSchemaProvider struct {
+ ctrl *gomock.Controller
+ recorder *MockSchemaProviderMockRecorder
+ isgomock struct{}
+}
+
+// MockSchemaProviderMockRecorder is the mock recorder for MockSchemaProvider.
+type MockSchemaProviderMockRecorder struct {
+ mock *MockSchemaProvider
+}
+
+// NewMockSchemaProvider creates a new mock instance.
+func NewMockSchemaProvider(ctrl *gomock.Controller) *MockSchemaProvider {
+ mock := &MockSchemaProvider{ctrl: ctrl}
+ mock.recorder = &MockSchemaProviderMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockSchemaProvider) EXPECT() *MockSchemaProviderMockRecorder {
+ return m.recorder
+}
+
+// GetConfigSchema mocks base method.
+func (m *MockSchemaProvider) GetConfigSchema() (map[string]any, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetConfigSchema")
+ ret0, _ := ret[0].(map[string]any)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GetConfigSchema indicates an expected call of GetConfigSchema.
+func (mr *MockSchemaProviderMockRecorder) GetConfigSchema() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetConfigSchema", reflect.TypeOf((*MockSchemaProvider)(nil).GetConfigSchema))
+}
diff --git a/internal/testutil/mock/controllers/mock_controllers.go b/internal/testutil/mock/controllers/mock_controllers.go
new file mode 100644
index 0000000000..4e75dd5aa0
--- /dev/null
+++ b/internal/testutil/mock/controllers/mock_controllers.go
@@ -0,0 +1,296 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: github.com/operator-framework/operator-controller/internal/operator-controller/controllers (interfaces: CatalogCache,CatalogCachePopulator,RevisionStatesGetter,Applier,RevisionEngine,RevisionEngineFactory)
+//
+// Generated by this command:
+//
+// mockgen -destination=controllers/mock_controllers.go -package=controllers github.com/operator-framework/operator-controller/internal/operator-controller/controllers CatalogCache,CatalogCachePopulator,RevisionStatesGetter,Applier,RevisionEngine,RevisionEngineFactory
+//
+
+// Package controllers is a generated GoMock package.
+package controllers
+
+import (
+ context "context"
+ fs "io/fs"
+ reflect "reflect"
+
+ v1 "github.com/operator-framework/operator-controller/api/v1"
+ controllers "github.com/operator-framework/operator-controller/internal/operator-controller/controllers"
+ gomock "go.uber.org/mock/gomock"
+ machinery "pkg.package-operator.run/boxcutter/machinery"
+ types "pkg.package-operator.run/boxcutter/machinery/types"
+)
+
+// MockCatalogCache is a mock of CatalogCache interface.
+type MockCatalogCache struct {
+ ctrl *gomock.Controller
+ recorder *MockCatalogCacheMockRecorder
+ isgomock struct{}
+}
+
+// MockCatalogCacheMockRecorder is the mock recorder for MockCatalogCache.
+type MockCatalogCacheMockRecorder struct {
+ mock *MockCatalogCache
+}
+
+// NewMockCatalogCache creates a new mock instance.
+func NewMockCatalogCache(ctrl *gomock.Controller) *MockCatalogCache {
+ mock := &MockCatalogCache{ctrl: ctrl}
+ mock.recorder = &MockCatalogCacheMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockCatalogCache) EXPECT() *MockCatalogCacheMockRecorder {
+ return m.recorder
+}
+
+// Get mocks base method.
+func (m *MockCatalogCache) Get(catalogName, resolvedRef string) (fs.FS, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Get", catalogName, resolvedRef)
+ ret0, _ := ret[0].(fs.FS)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Get indicates an expected call of Get.
+func (mr *MockCatalogCacheMockRecorder) Get(catalogName, resolvedRef any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockCatalogCache)(nil).Get), catalogName, resolvedRef)
+}
+
+// Remove mocks base method.
+func (m *MockCatalogCache) Remove(catalogName string) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Remove", catalogName)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Remove indicates an expected call of Remove.
+func (mr *MockCatalogCacheMockRecorder) Remove(catalogName any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remove", reflect.TypeOf((*MockCatalogCache)(nil).Remove), catalogName)
+}
+
+// MockCatalogCachePopulator is a mock of CatalogCachePopulator interface.
+type MockCatalogCachePopulator struct {
+ ctrl *gomock.Controller
+ recorder *MockCatalogCachePopulatorMockRecorder
+ isgomock struct{}
+}
+
+// MockCatalogCachePopulatorMockRecorder is the mock recorder for MockCatalogCachePopulator.
+type MockCatalogCachePopulatorMockRecorder struct {
+ mock *MockCatalogCachePopulator
+}
+
+// NewMockCatalogCachePopulator creates a new mock instance.
+func NewMockCatalogCachePopulator(ctrl *gomock.Controller) *MockCatalogCachePopulator {
+ mock := &MockCatalogCachePopulator{ctrl: ctrl}
+ mock.recorder = &MockCatalogCachePopulatorMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockCatalogCachePopulator) EXPECT() *MockCatalogCachePopulatorMockRecorder {
+ return m.recorder
+}
+
+// PopulateCache mocks base method.
+func (m *MockCatalogCachePopulator) PopulateCache(ctx context.Context, catalog *v1.ClusterCatalog) (fs.FS, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "PopulateCache", ctx, catalog)
+ ret0, _ := ret[0].(fs.FS)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// PopulateCache indicates an expected call of PopulateCache.
+func (mr *MockCatalogCachePopulatorMockRecorder) PopulateCache(ctx, catalog any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PopulateCache", reflect.TypeOf((*MockCatalogCachePopulator)(nil).PopulateCache), ctx, catalog)
+}
+
+// MockRevisionStatesGetter is a mock of RevisionStatesGetter interface.
+type MockRevisionStatesGetter struct {
+ ctrl *gomock.Controller
+ recorder *MockRevisionStatesGetterMockRecorder
+ isgomock struct{}
+}
+
+// MockRevisionStatesGetterMockRecorder is the mock recorder for MockRevisionStatesGetter.
+type MockRevisionStatesGetterMockRecorder struct {
+ mock *MockRevisionStatesGetter
+}
+
+// NewMockRevisionStatesGetter creates a new mock instance.
+func NewMockRevisionStatesGetter(ctrl *gomock.Controller) *MockRevisionStatesGetter {
+ mock := &MockRevisionStatesGetter{ctrl: ctrl}
+ mock.recorder = &MockRevisionStatesGetterMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockRevisionStatesGetter) EXPECT() *MockRevisionStatesGetterMockRecorder {
+ return m.recorder
+}
+
+// GetRevisionStates mocks base method.
+func (m *MockRevisionStatesGetter) GetRevisionStates(ctx context.Context, ext *v1.ClusterExtension) (*controllers.RevisionStates, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetRevisionStates", ctx, ext)
+ ret0, _ := ret[0].(*controllers.RevisionStates)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GetRevisionStates indicates an expected call of GetRevisionStates.
+func (mr *MockRevisionStatesGetterMockRecorder) GetRevisionStates(ctx, ext any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRevisionStates", reflect.TypeOf((*MockRevisionStatesGetter)(nil).GetRevisionStates), ctx, ext)
+}
+
+// MockApplier is a mock of Applier interface.
+type MockApplier struct {
+ ctrl *gomock.Controller
+ recorder *MockApplierMockRecorder
+ isgomock struct{}
+}
+
+// MockApplierMockRecorder is the mock recorder for MockApplier.
+type MockApplierMockRecorder struct {
+ mock *MockApplier
+}
+
+// NewMockApplier creates a new mock instance.
+func NewMockApplier(ctrl *gomock.Controller) *MockApplier {
+ mock := &MockApplier{ctrl: ctrl}
+ mock.recorder = &MockApplierMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockApplier) EXPECT() *MockApplierMockRecorder {
+ return m.recorder
+}
+
+// Apply mocks base method.
+func (m *MockApplier) Apply(arg0 context.Context, arg1 fs.FS, arg2 *v1.ClusterExtension, arg3, arg4 map[string]string) (bool, string, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Apply", arg0, arg1, arg2, arg3, arg4)
+ ret0, _ := ret[0].(bool)
+ ret1, _ := ret[1].(string)
+ ret2, _ := ret[2].(error)
+ return ret0, ret1, ret2
+}
+
+// Apply indicates an expected call of Apply.
+func (mr *MockApplierMockRecorder) Apply(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Apply", reflect.TypeOf((*MockApplier)(nil).Apply), arg0, arg1, arg2, arg3, arg4)
+}
+
+// MockRevisionEngine is a mock of RevisionEngine interface.
+type MockRevisionEngine struct {
+ ctrl *gomock.Controller
+ recorder *MockRevisionEngineMockRecorder
+ isgomock struct{}
+}
+
+// MockRevisionEngineMockRecorder is the mock recorder for MockRevisionEngine.
+type MockRevisionEngineMockRecorder struct {
+ mock *MockRevisionEngine
+}
+
+// NewMockRevisionEngine creates a new mock instance.
+func NewMockRevisionEngine(ctrl *gomock.Controller) *MockRevisionEngine {
+ mock := &MockRevisionEngine{ctrl: ctrl}
+ mock.recorder = &MockRevisionEngineMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockRevisionEngine) EXPECT() *MockRevisionEngineMockRecorder {
+ return m.recorder
+}
+
+// Reconcile mocks base method.
+func (m *MockRevisionEngine) Reconcile(ctx context.Context, rev types.Revision, opts ...types.RevisionReconcileOption) (machinery.RevisionResult, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, rev}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Reconcile", varargs...)
+ ret0, _ := ret[0].(machinery.RevisionResult)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Reconcile indicates an expected call of Reconcile.
+func (mr *MockRevisionEngineMockRecorder) Reconcile(ctx, rev any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, rev}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reconcile", reflect.TypeOf((*MockRevisionEngine)(nil).Reconcile), varargs...)
+}
+
+// Teardown mocks base method.
+func (m *MockRevisionEngine) Teardown(ctx context.Context, rev types.Revision, opts ...types.RevisionTeardownOption) (machinery.RevisionTeardownResult, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, rev}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Teardown", varargs...)
+ ret0, _ := ret[0].(machinery.RevisionTeardownResult)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Teardown indicates an expected call of Teardown.
+func (mr *MockRevisionEngineMockRecorder) Teardown(ctx, rev any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, rev}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Teardown", reflect.TypeOf((*MockRevisionEngine)(nil).Teardown), varargs...)
+}
+
+// MockRevisionEngineFactory is a mock of RevisionEngineFactory interface.
+type MockRevisionEngineFactory struct {
+ ctrl *gomock.Controller
+ recorder *MockRevisionEngineFactoryMockRecorder
+ isgomock struct{}
+}
+
+// MockRevisionEngineFactoryMockRecorder is the mock recorder for MockRevisionEngineFactory.
+type MockRevisionEngineFactoryMockRecorder struct {
+ mock *MockRevisionEngineFactory
+}
+
+// NewMockRevisionEngineFactory creates a new mock instance.
+func NewMockRevisionEngineFactory(ctrl *gomock.Controller) *MockRevisionEngineFactory {
+ mock := &MockRevisionEngineFactory{ctrl: ctrl}
+ mock.recorder = &MockRevisionEngineFactoryMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockRevisionEngineFactory) EXPECT() *MockRevisionEngineFactoryMockRecorder {
+ return m.recorder
+}
+
+// CreateRevisionEngine mocks base method.
+func (m *MockRevisionEngineFactory) CreateRevisionEngine(ctx context.Context, rev *v1.ClusterObjectSet) (controllers.RevisionEngine, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "CreateRevisionEngine", ctx, rev)
+ ret0, _ := ret[0].(controllers.RevisionEngine)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// CreateRevisionEngine indicates an expected call of CreateRevisionEngine.
+func (mr *MockRevisionEngineFactoryMockRecorder) CreateRevisionEngine(ctx, rev any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRevisionEngine", reflect.TypeOf((*MockRevisionEngineFactory)(nil).CreateRevisionEngine), ctx, rev)
+}
diff --git a/internal/testutil/mock/crdclient/mock_crdinterface.go b/internal/testutil/mock/crdclient/mock_crdinterface.go
new file mode 100644
index 0000000000..a17696916e
--- /dev/null
+++ b/internal/testutil/mock/crdclient/mock_crdinterface.go
@@ -0,0 +1,214 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1 (interfaces: CustomResourceDefinitionInterface)
+//
+// Generated by this command:
+//
+// mockgen -destination=crdclient/mock_crdinterface.go -package=crdclient k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1 CustomResourceDefinitionInterface
+//
+
+// Package crdclient is a generated GoMock package.
+package crdclient
+
+import (
+ context "context"
+ reflect "reflect"
+
+ gomock "go.uber.org/mock/gomock"
+ v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+ v10 "k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1"
+ v11 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+)
+
+// MockCustomResourceDefinitionInterface is a mock of CustomResourceDefinitionInterface interface.
+type MockCustomResourceDefinitionInterface struct {
+ ctrl *gomock.Controller
+ recorder *MockCustomResourceDefinitionInterfaceMockRecorder
+ isgomock struct{}
+}
+
+// MockCustomResourceDefinitionInterfaceMockRecorder is the mock recorder for MockCustomResourceDefinitionInterface.
+type MockCustomResourceDefinitionInterfaceMockRecorder struct {
+ mock *MockCustomResourceDefinitionInterface
+}
+
+// NewMockCustomResourceDefinitionInterface creates a new mock instance.
+func NewMockCustomResourceDefinitionInterface(ctrl *gomock.Controller) *MockCustomResourceDefinitionInterface {
+ mock := &MockCustomResourceDefinitionInterface{ctrl: ctrl}
+ mock.recorder = &MockCustomResourceDefinitionInterfaceMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockCustomResourceDefinitionInterface) EXPECT() *MockCustomResourceDefinitionInterfaceMockRecorder {
+ return m.recorder
+}
+
+// Apply mocks base method.
+func (m *MockCustomResourceDefinitionInterface) Apply(ctx context.Context, customResourceDefinition *v10.CustomResourceDefinitionApplyConfiguration, opts v11.ApplyOptions) (*v1.CustomResourceDefinition, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Apply", ctx, customResourceDefinition, opts)
+ ret0, _ := ret[0].(*v1.CustomResourceDefinition)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Apply indicates an expected call of Apply.
+func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Apply(ctx, customResourceDefinition, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Apply", reflect.TypeOf((*MockCustomResourceDefinitionInterface)(nil).Apply), ctx, customResourceDefinition, opts)
+}
+
+// ApplyStatus mocks base method.
+func (m *MockCustomResourceDefinitionInterface) ApplyStatus(ctx context.Context, customResourceDefinition *v10.CustomResourceDefinitionApplyConfiguration, opts v11.ApplyOptions) (*v1.CustomResourceDefinition, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "ApplyStatus", ctx, customResourceDefinition, opts)
+ ret0, _ := ret[0].(*v1.CustomResourceDefinition)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// ApplyStatus indicates an expected call of ApplyStatus.
+func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) ApplyStatus(ctx, customResourceDefinition, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ApplyStatus", reflect.TypeOf((*MockCustomResourceDefinitionInterface)(nil).ApplyStatus), ctx, customResourceDefinition, opts)
+}
+
+// Create mocks base method.
+func (m *MockCustomResourceDefinitionInterface) Create(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts v11.CreateOptions) (*v1.CustomResourceDefinition, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Create", ctx, customResourceDefinition, opts)
+ ret0, _ := ret[0].(*v1.CustomResourceDefinition)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Create indicates an expected call of Create.
+func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Create(ctx, customResourceDefinition, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockCustomResourceDefinitionInterface)(nil).Create), ctx, customResourceDefinition, opts)
+}
+
+// Delete mocks base method.
+func (m *MockCustomResourceDefinitionInterface) Delete(ctx context.Context, name string, opts v11.DeleteOptions) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Delete", ctx, name, opts)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Delete indicates an expected call of Delete.
+func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Delete(ctx, name, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockCustomResourceDefinitionInterface)(nil).Delete), ctx, name, opts)
+}
+
+// DeleteCollection mocks base method.
+func (m *MockCustomResourceDefinitionInterface) DeleteCollection(ctx context.Context, opts v11.DeleteOptions, listOpts v11.ListOptions) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "DeleteCollection", ctx, opts, listOpts)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// DeleteCollection indicates an expected call of DeleteCollection.
+func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) DeleteCollection(ctx, opts, listOpts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteCollection", reflect.TypeOf((*MockCustomResourceDefinitionInterface)(nil).DeleteCollection), ctx, opts, listOpts)
+}
+
+// Get mocks base method.
+func (m *MockCustomResourceDefinitionInterface) Get(ctx context.Context, name string, opts v11.GetOptions) (*v1.CustomResourceDefinition, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Get", ctx, name, opts)
+ ret0, _ := ret[0].(*v1.CustomResourceDefinition)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Get indicates an expected call of Get.
+func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Get(ctx, name, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockCustomResourceDefinitionInterface)(nil).Get), ctx, name, opts)
+}
+
+// List mocks base method.
+func (m *MockCustomResourceDefinitionInterface) List(ctx context.Context, opts v11.ListOptions) (*v1.CustomResourceDefinitionList, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "List", ctx, opts)
+ ret0, _ := ret[0].(*v1.CustomResourceDefinitionList)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// List indicates an expected call of List.
+func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) List(ctx, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockCustomResourceDefinitionInterface)(nil).List), ctx, opts)
+}
+
+// Patch mocks base method.
+func (m *MockCustomResourceDefinitionInterface) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v11.PatchOptions, subresources ...string) (*v1.CustomResourceDefinition, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, name, pt, data, opts}
+ for _, a := range subresources {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Patch", varargs...)
+ ret0, _ := ret[0].(*v1.CustomResourceDefinition)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Patch indicates an expected call of Patch.
+func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Patch(ctx, name, pt, data, opts any, subresources ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, name, pt, data, opts}, subresources...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Patch", reflect.TypeOf((*MockCustomResourceDefinitionInterface)(nil).Patch), varargs...)
+}
+
+// Update mocks base method.
+func (m *MockCustomResourceDefinitionInterface) Update(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts v11.UpdateOptions) (*v1.CustomResourceDefinition, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Update", ctx, customResourceDefinition, opts)
+ ret0, _ := ret[0].(*v1.CustomResourceDefinition)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Update indicates an expected call of Update.
+func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Update(ctx, customResourceDefinition, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockCustomResourceDefinitionInterface)(nil).Update), ctx, customResourceDefinition, opts)
+}
+
+// UpdateStatus mocks base method.
+func (m *MockCustomResourceDefinitionInterface) UpdateStatus(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts v11.UpdateOptions) (*v1.CustomResourceDefinition, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "UpdateStatus", ctx, customResourceDefinition, opts)
+ ret0, _ := ret[0].(*v1.CustomResourceDefinition)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// UpdateStatus indicates an expected call of UpdateStatus.
+func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) UpdateStatus(ctx, customResourceDefinition, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateStatus", reflect.TypeOf((*MockCustomResourceDefinitionInterface)(nil).UpdateStatus), ctx, customResourceDefinition, opts)
+}
+
+// Watch mocks base method.
+func (m *MockCustomResourceDefinitionInterface) Watch(ctx context.Context, opts v11.ListOptions) (watch.Interface, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Watch", ctx, opts)
+ ret0, _ := ret[0].(watch.Interface)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Watch indicates an expected call of Watch.
+func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Watch(ctx, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Watch", reflect.TypeOf((*MockCustomResourceDefinitionInterface)(nil).Watch), ctx, opts)
+}
diff --git a/internal/testutil/mock/ctrlclient/mock_client.go b/internal/testutil/mock/ctrlclient/mock_client.go
new file mode 100644
index 0000000000..5833af1a5a
--- /dev/null
+++ b/internal/testutil/mock/ctrlclient/mock_client.go
@@ -0,0 +1,483 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: sigs.k8s.io/controller-runtime/pkg/client (interfaces: Client,StatusWriter,SubResourceWriter)
+//
+// Generated by this command:
+//
+// mockgen -destination=ctrlclient/mock_client.go -package=ctrlclient sigs.k8s.io/controller-runtime/pkg/client Client,StatusWriter,SubResourceWriter
+//
+
+// Package ctrlclient is a generated GoMock package.
+package ctrlclient
+
+import (
+ context "context"
+ reflect "reflect"
+
+ gomock "go.uber.org/mock/gomock"
+ meta "k8s.io/apimachinery/pkg/api/meta"
+ runtime "k8s.io/apimachinery/pkg/runtime"
+ schema "k8s.io/apimachinery/pkg/runtime/schema"
+ client "sigs.k8s.io/controller-runtime/pkg/client"
+)
+
+// MockClient is a mock of Client interface.
+type MockClient struct {
+ ctrl *gomock.Controller
+ recorder *MockClientMockRecorder
+ isgomock struct{}
+}
+
+// MockClientMockRecorder is the mock recorder for MockClient.
+type MockClientMockRecorder struct {
+ mock *MockClient
+}
+
+// NewMockClient creates a new mock instance.
+func NewMockClient(ctrl *gomock.Controller) *MockClient {
+ mock := &MockClient{ctrl: ctrl}
+ mock.recorder = &MockClientMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockClient) EXPECT() *MockClientMockRecorder {
+ return m.recorder
+}
+
+// Apply mocks base method.
+func (m *MockClient) Apply(ctx context.Context, obj runtime.ApplyConfiguration, opts ...client.ApplyOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Apply", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Apply indicates an expected call of Apply.
+func (mr *MockClientMockRecorder) Apply(ctx, obj any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Apply", reflect.TypeOf((*MockClient)(nil).Apply), varargs...)
+}
+
+// Create mocks base method.
+func (m *MockClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Create", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Create indicates an expected call of Create.
+func (mr *MockClientMockRecorder) Create(ctx, obj any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockClient)(nil).Create), varargs...)
+}
+
+// Delete mocks base method.
+func (m *MockClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Delete", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Delete indicates an expected call of Delete.
+func (mr *MockClientMockRecorder) Delete(ctx, obj any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockClient)(nil).Delete), varargs...)
+}
+
+// DeleteAllOf mocks base method.
+func (m *MockClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "DeleteAllOf", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// DeleteAllOf indicates an expected call of DeleteAllOf.
+func (mr *MockClientMockRecorder) DeleteAllOf(ctx, obj any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAllOf", reflect.TypeOf((*MockClient)(nil).DeleteAllOf), varargs...)
+}
+
+// Get mocks base method.
+func (m *MockClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, key, obj}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Get", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Get indicates an expected call of Get.
+func (mr *MockClientMockRecorder) Get(ctx, key, obj any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, key, obj}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockClient)(nil).Get), varargs...)
+}
+
+// GroupVersionKindFor mocks base method.
+func (m *MockClient) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GroupVersionKindFor", obj)
+ ret0, _ := ret[0].(schema.GroupVersionKind)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GroupVersionKindFor indicates an expected call of GroupVersionKindFor.
+func (mr *MockClientMockRecorder) GroupVersionKindFor(obj any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GroupVersionKindFor", reflect.TypeOf((*MockClient)(nil).GroupVersionKindFor), obj)
+}
+
+// IsObjectNamespaced mocks base method.
+func (m *MockClient) IsObjectNamespaced(obj runtime.Object) (bool, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "IsObjectNamespaced", obj)
+ ret0, _ := ret[0].(bool)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// IsObjectNamespaced indicates an expected call of IsObjectNamespaced.
+func (mr *MockClientMockRecorder) IsObjectNamespaced(obj any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsObjectNamespaced", reflect.TypeOf((*MockClient)(nil).IsObjectNamespaced), obj)
+}
+
+// List mocks base method.
+func (m *MockClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, list}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "List", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// List indicates an expected call of List.
+func (mr *MockClientMockRecorder) List(ctx, list any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, list}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockClient)(nil).List), varargs...)
+}
+
+// Patch mocks base method.
+func (m *MockClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj, patch}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Patch", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Patch indicates an expected call of Patch.
+func (mr *MockClientMockRecorder) Patch(ctx, obj, patch any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj, patch}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Patch", reflect.TypeOf((*MockClient)(nil).Patch), varargs...)
+}
+
+// RESTMapper mocks base method.
+func (m *MockClient) RESTMapper() meta.RESTMapper {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "RESTMapper")
+ ret0, _ := ret[0].(meta.RESTMapper)
+ return ret0
+}
+
+// RESTMapper indicates an expected call of RESTMapper.
+func (mr *MockClientMockRecorder) RESTMapper() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RESTMapper", reflect.TypeOf((*MockClient)(nil).RESTMapper))
+}
+
+// Scheme mocks base method.
+func (m *MockClient) Scheme() *runtime.Scheme {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Scheme")
+ ret0, _ := ret[0].(*runtime.Scheme)
+ return ret0
+}
+
+// Scheme indicates an expected call of Scheme.
+func (mr *MockClientMockRecorder) Scheme() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Scheme", reflect.TypeOf((*MockClient)(nil).Scheme))
+}
+
+// Status mocks base method.
+func (m *MockClient) Status() client.SubResourceWriter {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Status")
+ ret0, _ := ret[0].(client.SubResourceWriter)
+ return ret0
+}
+
+// Status indicates an expected call of Status.
+func (mr *MockClientMockRecorder) Status() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Status", reflect.TypeOf((*MockClient)(nil).Status))
+}
+
+// SubResource mocks base method.
+func (m *MockClient) SubResource(subResource string) client.SubResourceClient {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "SubResource", subResource)
+ ret0, _ := ret[0].(client.SubResourceClient)
+ return ret0
+}
+
+// SubResource indicates an expected call of SubResource.
+func (mr *MockClientMockRecorder) SubResource(subResource any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubResource", reflect.TypeOf((*MockClient)(nil).SubResource), subResource)
+}
+
+// Update mocks base method.
+func (m *MockClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Update", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Update indicates an expected call of Update.
+func (mr *MockClientMockRecorder) Update(ctx, obj any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockClient)(nil).Update), varargs...)
+}
+
+// MockStatusWriter is a mock of StatusWriter interface.
+type MockStatusWriter struct {
+ ctrl *gomock.Controller
+ recorder *MockStatusWriterMockRecorder
+ isgomock struct{}
+}
+
+// MockStatusWriterMockRecorder is the mock recorder for MockStatusWriter.
+type MockStatusWriterMockRecorder struct {
+ mock *MockStatusWriter
+}
+
+// NewMockStatusWriter creates a new mock instance.
+func NewMockStatusWriter(ctrl *gomock.Controller) *MockStatusWriter {
+ mock := &MockStatusWriter{ctrl: ctrl}
+ mock.recorder = &MockStatusWriterMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockStatusWriter) EXPECT() *MockStatusWriterMockRecorder {
+ return m.recorder
+}
+
+// Apply mocks base method.
+func (m *MockStatusWriter) Apply(ctx context.Context, obj runtime.ApplyConfiguration, opts ...client.SubResourceApplyOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Apply", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Apply indicates an expected call of Apply.
+func (mr *MockStatusWriterMockRecorder) Apply(ctx, obj any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Apply", reflect.TypeOf((*MockStatusWriter)(nil).Apply), varargs...)
+}
+
+// Create mocks base method.
+func (m *MockStatusWriter) Create(ctx context.Context, obj, subResource client.Object, opts ...client.SubResourceCreateOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj, subResource}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Create", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Create indicates an expected call of Create.
+func (mr *MockStatusWriterMockRecorder) Create(ctx, obj, subResource any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj, subResource}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockStatusWriter)(nil).Create), varargs...)
+}
+
+// Patch mocks base method.
+func (m *MockStatusWriter) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.SubResourcePatchOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj, patch}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Patch", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Patch indicates an expected call of Patch.
+func (mr *MockStatusWriterMockRecorder) Patch(ctx, obj, patch any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj, patch}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Patch", reflect.TypeOf((*MockStatusWriter)(nil).Patch), varargs...)
+}
+
+// Update mocks base method.
+func (m *MockStatusWriter) Update(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Update", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Update indicates an expected call of Update.
+func (mr *MockStatusWriterMockRecorder) Update(ctx, obj any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockStatusWriter)(nil).Update), varargs...)
+}
+
+// MockSubResourceWriter is a mock of SubResourceWriter interface.
+type MockSubResourceWriter struct {
+ ctrl *gomock.Controller
+ recorder *MockSubResourceWriterMockRecorder
+ isgomock struct{}
+}
+
+// MockSubResourceWriterMockRecorder is the mock recorder for MockSubResourceWriter.
+type MockSubResourceWriterMockRecorder struct {
+ mock *MockSubResourceWriter
+}
+
+// NewMockSubResourceWriter creates a new mock instance.
+func NewMockSubResourceWriter(ctrl *gomock.Controller) *MockSubResourceWriter {
+ mock := &MockSubResourceWriter{ctrl: ctrl}
+ mock.recorder = &MockSubResourceWriterMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockSubResourceWriter) EXPECT() *MockSubResourceWriterMockRecorder {
+ return m.recorder
+}
+
+// Apply mocks base method.
+func (m *MockSubResourceWriter) Apply(ctx context.Context, obj runtime.ApplyConfiguration, opts ...client.SubResourceApplyOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Apply", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Apply indicates an expected call of Apply.
+func (mr *MockSubResourceWriterMockRecorder) Apply(ctx, obj any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Apply", reflect.TypeOf((*MockSubResourceWriter)(nil).Apply), varargs...)
+}
+
+// Create mocks base method.
+func (m *MockSubResourceWriter) Create(ctx context.Context, obj, subResource client.Object, opts ...client.SubResourceCreateOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj, subResource}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Create", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Create indicates an expected call of Create.
+func (mr *MockSubResourceWriterMockRecorder) Create(ctx, obj, subResource any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj, subResource}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockSubResourceWriter)(nil).Create), varargs...)
+}
+
+// Patch mocks base method.
+func (m *MockSubResourceWriter) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.SubResourcePatchOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj, patch}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Patch", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Patch indicates an expected call of Patch.
+func (mr *MockSubResourceWriterMockRecorder) Patch(ctx, obj, patch any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj, patch}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Patch", reflect.TypeOf((*MockSubResourceWriter)(nil).Patch), varargs...)
+}
+
+// Update mocks base method.
+func (m *MockSubResourceWriter) Update(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error {
+ m.ctrl.T.Helper()
+ varargs := []any{ctx, obj}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Update", varargs...)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Update indicates an expected call of Update.
+func (mr *MockSubResourceWriterMockRecorder) Update(ctx, obj any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{ctx, obj}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockSubResourceWriter)(nil).Update), varargs...)
+}
diff --git a/internal/testutil/mock/generate.go b/internal/testutil/mock/generate.go
new file mode 100644
index 0000000000..8b07554eb7
--- /dev/null
+++ b/internal/testutil/mock/generate.go
@@ -0,0 +1,46 @@
+/*
+Copyright 2022.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package mock
+
+// External interfaces
+//go:generate mockgen -destination=helmclient/mock_actionclient.go -package=helmclient github.com/operator-framework/helm-operator-plugins/pkg/client ActionInterface,ActionClientGetter
+//go:generate mockgen -destination=helmclient/mock_composite.go -package=helmclient github.com/operator-framework/operator-controller/internal/testutil/mock/helmclient ActionClientGetterAndInterface
+//go:generate mockgen -destination=ctrlclient/mock_client.go -package=ctrlclient sigs.k8s.io/controller-runtime/pkg/client Client,StatusWriter,SubResourceWriter
+//go:generate mockgen -destination=crdclient/mock_crdinterface.go -package=crdclient k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1 CustomResourceDefinitionInterface
+//go:generate mockgen -destination=logrsink/mock_logsink.go -package=logrsink github.com/go-logr/logr LogSink
+//go:generate mockgen -destination=machinery/mock_results.go -package=machinery pkg.package-operator.run/boxcutter/machinery RevisionResult,PhaseResult,ObjectResult,RevisionTeardownResult
+//go:generate mockgen -destination=httputil/mock_roundtripper.go -package=httputil net/http RoundTripper
+
+// Internal interfaces — catalogd
+//go:generate mockgen -destination=storage/mock_instance.go -package=storage github.com/operator-framework/operator-controller/internal/catalogd/storage Instance
+//go:generate mockgen -destination=catalogdserver/mock_catalogstore.go -package=catalogdserver github.com/operator-framework/operator-controller/internal/catalogd/server CatalogStore
+//go:generate mockgen -destination=catalogdservice/mock_graphqlservice.go -package=catalogdservice github.com/operator-framework/operator-controller/internal/catalogd/service GraphQLService
+
+// Internal interfaces — operator-controller applier
+//go:generate mockgen -destination=applier/mock_applier.go -package=applier github.com/operator-framework/operator-controller/internal/operator-controller/applier Preflight,HelmReleaseToObjectsConverterInterface,HelmChartProvider,ClusterObjectSetGenerator,ManifestProvider
+
+// Internal interfaces — operator-controller catalogmetadata
+//go:generate mockgen -destination=catalogclient/mock_cache.go -package=catalogclient github.com/operator-framework/operator-controller/internal/operator-controller/catalogmetadata/client Cache
+
+// Internal interfaces — operator-controller config
+//go:generate mockgen -destination=config/mock_schemaprovider.go -package=config github.com/operator-framework/operator-controller/internal/operator-controller/config SchemaProvider
+
+// Internal interfaces — operator-controller controllers
+//go:generate mockgen -destination=controllers/mock_controllers.go -package=controllers github.com/operator-framework/operator-controller/internal/operator-controller/controllers CatalogCache,CatalogCachePopulator,RevisionStatesGetter,Applier,RevisionEngine,RevisionEngineFactory
+
+// Internal interfaces — rukpak render
+//go:generate mockgen -destination=render/mock_certprovider.go -package=render github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render CertificateProvider
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_service_expansion.go b/internal/testutil/mock/helmclient/interfaces.go
similarity index 59%
rename from vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_service_expansion.go
rename to internal/testutil/mock/helmclient/interfaces.go
index ebd39c4607..30142ce494 100644
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_service_expansion.go
+++ b/internal/testutil/mock/helmclient/interfaces.go
@@ -1,5 +1,5 @@
/*
-Copyright 2014 The Kubernetes Authors.
+Copyright 2022.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,13 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-package fake
+package helmclient
import (
- restclient "k8s.io/client-go/rest"
- core "k8s.io/client-go/testing"
+ helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
)
-func (c *fakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
- return c.Fake.InvokesProxy(core.NewProxyGetAction(c.Resource(), c.Namespace(), scheme, name, port, path, params))
+// ActionClientGetterAndInterface is a composite interface for tests that need
+// a single object implementing both ActionClientGetter and ActionInterface.
+type ActionClientGetterAndInterface interface {
+ helmclient.ActionClientGetter
+ helmclient.ActionInterface
}
diff --git a/internal/testutil/mock/helmclient/mock_actionclient.go b/internal/testutil/mock/helmclient/mock_actionclient.go
new file mode 100644
index 0000000000..108f2bca91
--- /dev/null
+++ b/internal/testutil/mock/helmclient/mock_actionclient.go
@@ -0,0 +1,213 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: github.com/operator-framework/helm-operator-plugins/pkg/client (interfaces: ActionInterface,ActionClientGetter)
+//
+// Generated by this command:
+//
+// mockgen -destination=helmclient/mock_actionclient.go -package=helmclient github.com/operator-framework/helm-operator-plugins/pkg/client ActionInterface,ActionClientGetter
+//
+
+// Package helmclient is a generated GoMock package.
+package helmclient
+
+import (
+ context "context"
+ reflect "reflect"
+
+ client "github.com/operator-framework/helm-operator-plugins/pkg/client"
+ gomock "go.uber.org/mock/gomock"
+ action "helm.sh/helm/v3/pkg/action"
+ chart "helm.sh/helm/v3/pkg/chart"
+ release "helm.sh/helm/v3/pkg/release"
+ client0 "sigs.k8s.io/controller-runtime/pkg/client"
+)
+
+// MockActionInterface is a mock of ActionInterface interface.
+type MockActionInterface struct {
+ ctrl *gomock.Controller
+ recorder *MockActionInterfaceMockRecorder
+ isgomock struct{}
+}
+
+// MockActionInterfaceMockRecorder is the mock recorder for MockActionInterface.
+type MockActionInterfaceMockRecorder struct {
+ mock *MockActionInterface
+}
+
+// NewMockActionInterface creates a new mock instance.
+func NewMockActionInterface(ctrl *gomock.Controller) *MockActionInterface {
+ mock := &MockActionInterface{ctrl: ctrl}
+ mock.recorder = &MockActionInterfaceMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockActionInterface) EXPECT() *MockActionInterfaceMockRecorder {
+ return m.recorder
+}
+
+// Config mocks base method.
+func (m *MockActionInterface) Config() *action.Configuration {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Config")
+ ret0, _ := ret[0].(*action.Configuration)
+ return ret0
+}
+
+// Config indicates an expected call of Config.
+func (mr *MockActionInterfaceMockRecorder) Config() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Config", reflect.TypeOf((*MockActionInterface)(nil).Config))
+}
+
+// Get mocks base method.
+func (m *MockActionInterface) Get(name string, opts ...client.GetOption) (*release.Release, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{name}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Get", varargs...)
+ ret0, _ := ret[0].(*release.Release)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Get indicates an expected call of Get.
+func (mr *MockActionInterfaceMockRecorder) Get(name any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{name}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockActionInterface)(nil).Get), varargs...)
+}
+
+// History mocks base method.
+func (m *MockActionInterface) History(name string, opts ...client.HistoryOption) ([]*release.Release, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{name}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "History", varargs...)
+ ret0, _ := ret[0].([]*release.Release)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// History indicates an expected call of History.
+func (mr *MockActionInterfaceMockRecorder) History(name any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{name}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "History", reflect.TypeOf((*MockActionInterface)(nil).History), varargs...)
+}
+
+// Install mocks base method.
+func (m *MockActionInterface) Install(name, namespace string, chrt *chart.Chart, vals map[string]any, opts ...client.InstallOption) (*release.Release, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{name, namespace, chrt, vals}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Install", varargs...)
+ ret0, _ := ret[0].(*release.Release)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Install indicates an expected call of Install.
+func (mr *MockActionInterfaceMockRecorder) Install(name, namespace, chrt, vals any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{name, namespace, chrt, vals}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Install", reflect.TypeOf((*MockActionInterface)(nil).Install), varargs...)
+}
+
+// Reconcile mocks base method.
+func (m *MockActionInterface) Reconcile(rel *release.Release) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Reconcile", rel)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Reconcile indicates an expected call of Reconcile.
+func (mr *MockActionInterfaceMockRecorder) Reconcile(rel any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reconcile", reflect.TypeOf((*MockActionInterface)(nil).Reconcile), rel)
+}
+
+// Uninstall mocks base method.
+func (m *MockActionInterface) Uninstall(name string, opts ...client.UninstallOption) (*release.UninstallReleaseResponse, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{name}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Uninstall", varargs...)
+ ret0, _ := ret[0].(*release.UninstallReleaseResponse)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Uninstall indicates an expected call of Uninstall.
+func (mr *MockActionInterfaceMockRecorder) Uninstall(name any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{name}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Uninstall", reflect.TypeOf((*MockActionInterface)(nil).Uninstall), varargs...)
+}
+
+// Upgrade mocks base method.
+func (m *MockActionInterface) Upgrade(name, namespace string, chrt *chart.Chart, vals map[string]any, opts ...client.UpgradeOption) (*release.Release, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{name, namespace, chrt, vals}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Upgrade", varargs...)
+ ret0, _ := ret[0].(*release.Release)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Upgrade indicates an expected call of Upgrade.
+func (mr *MockActionInterfaceMockRecorder) Upgrade(name, namespace, chrt, vals any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{name, namespace, chrt, vals}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Upgrade", reflect.TypeOf((*MockActionInterface)(nil).Upgrade), varargs...)
+}
+
+// MockActionClientGetter is a mock of ActionClientGetter interface.
+type MockActionClientGetter struct {
+ ctrl *gomock.Controller
+ recorder *MockActionClientGetterMockRecorder
+ isgomock struct{}
+}
+
+// MockActionClientGetterMockRecorder is the mock recorder for MockActionClientGetter.
+type MockActionClientGetterMockRecorder struct {
+ mock *MockActionClientGetter
+}
+
+// NewMockActionClientGetter creates a new mock instance.
+func NewMockActionClientGetter(ctrl *gomock.Controller) *MockActionClientGetter {
+ mock := &MockActionClientGetter{ctrl: ctrl}
+ mock.recorder = &MockActionClientGetterMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockActionClientGetter) EXPECT() *MockActionClientGetterMockRecorder {
+ return m.recorder
+}
+
+// ActionClientFor mocks base method.
+func (m *MockActionClientGetter) ActionClientFor(ctx context.Context, obj client0.Object) (client.ActionInterface, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "ActionClientFor", ctx, obj)
+ ret0, _ := ret[0].(client.ActionInterface)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// ActionClientFor indicates an expected call of ActionClientFor.
+func (mr *MockActionClientGetterMockRecorder) ActionClientFor(ctx, obj any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ActionClientFor", reflect.TypeOf((*MockActionClientGetter)(nil).ActionClientFor), ctx, obj)
+}
diff --git a/internal/testutil/mock/helmclient/mock_composite.go b/internal/testutil/mock/helmclient/mock_composite.go
new file mode 100644
index 0000000000..b46c40fc88
--- /dev/null
+++ b/internal/testutil/mock/helmclient/mock_composite.go
@@ -0,0 +1,189 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: github.com/operator-framework/operator-controller/internal/testutil/mock/helmclient (interfaces: ActionClientGetterAndInterface)
+//
+// Generated by this command:
+//
+// mockgen -destination=helmclient/mock_composite.go -package=helmclient github.com/operator-framework/operator-controller/internal/testutil/mock/helmclient ActionClientGetterAndInterface
+//
+
+// Package helmclient is a generated GoMock package.
+package helmclient
+
+import (
+ context "context"
+ reflect "reflect"
+
+ client "github.com/operator-framework/helm-operator-plugins/pkg/client"
+ gomock "go.uber.org/mock/gomock"
+ action "helm.sh/helm/v3/pkg/action"
+ chart "helm.sh/helm/v3/pkg/chart"
+ release "helm.sh/helm/v3/pkg/release"
+ client0 "sigs.k8s.io/controller-runtime/pkg/client"
+)
+
+// MockActionClientGetterAndInterface is a mock of ActionClientGetterAndInterface interface.
+type MockActionClientGetterAndInterface struct {
+ ctrl *gomock.Controller
+ recorder *MockActionClientGetterAndInterfaceMockRecorder
+ isgomock struct{}
+}
+
+// MockActionClientGetterAndInterfaceMockRecorder is the mock recorder for MockActionClientGetterAndInterface.
+type MockActionClientGetterAndInterfaceMockRecorder struct {
+ mock *MockActionClientGetterAndInterface
+}
+
+// NewMockActionClientGetterAndInterface creates a new mock instance.
+func NewMockActionClientGetterAndInterface(ctrl *gomock.Controller) *MockActionClientGetterAndInterface {
+ mock := &MockActionClientGetterAndInterface{ctrl: ctrl}
+ mock.recorder = &MockActionClientGetterAndInterfaceMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockActionClientGetterAndInterface) EXPECT() *MockActionClientGetterAndInterfaceMockRecorder {
+ return m.recorder
+}
+
+// ActionClientFor mocks base method.
+func (m *MockActionClientGetterAndInterface) ActionClientFor(ctx context.Context, obj client0.Object) (client.ActionInterface, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "ActionClientFor", ctx, obj)
+ ret0, _ := ret[0].(client.ActionInterface)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// ActionClientFor indicates an expected call of ActionClientFor.
+func (mr *MockActionClientGetterAndInterfaceMockRecorder) ActionClientFor(ctx, obj any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ActionClientFor", reflect.TypeOf((*MockActionClientGetterAndInterface)(nil).ActionClientFor), ctx, obj)
+}
+
+// Config mocks base method.
+func (m *MockActionClientGetterAndInterface) Config() *action.Configuration {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Config")
+ ret0, _ := ret[0].(*action.Configuration)
+ return ret0
+}
+
+// Config indicates an expected call of Config.
+func (mr *MockActionClientGetterAndInterfaceMockRecorder) Config() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Config", reflect.TypeOf((*MockActionClientGetterAndInterface)(nil).Config))
+}
+
+// Get mocks base method.
+func (m *MockActionClientGetterAndInterface) Get(name string, opts ...client.GetOption) (*release.Release, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{name}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Get", varargs...)
+ ret0, _ := ret[0].(*release.Release)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Get indicates an expected call of Get.
+func (mr *MockActionClientGetterAndInterfaceMockRecorder) Get(name any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{name}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockActionClientGetterAndInterface)(nil).Get), varargs...)
+}
+
+// History mocks base method.
+func (m *MockActionClientGetterAndInterface) History(name string, opts ...client.HistoryOption) ([]*release.Release, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{name}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "History", varargs...)
+ ret0, _ := ret[0].([]*release.Release)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// History indicates an expected call of History.
+func (mr *MockActionClientGetterAndInterfaceMockRecorder) History(name any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{name}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "History", reflect.TypeOf((*MockActionClientGetterAndInterface)(nil).History), varargs...)
+}
+
+// Install mocks base method.
+func (m *MockActionClientGetterAndInterface) Install(name, namespace string, chrt *chart.Chart, vals map[string]any, opts ...client.InstallOption) (*release.Release, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{name, namespace, chrt, vals}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Install", varargs...)
+ ret0, _ := ret[0].(*release.Release)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Install indicates an expected call of Install.
+func (mr *MockActionClientGetterAndInterfaceMockRecorder) Install(name, namespace, chrt, vals any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{name, namespace, chrt, vals}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Install", reflect.TypeOf((*MockActionClientGetterAndInterface)(nil).Install), varargs...)
+}
+
+// Reconcile mocks base method.
+func (m *MockActionClientGetterAndInterface) Reconcile(rel *release.Release) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Reconcile", rel)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Reconcile indicates an expected call of Reconcile.
+func (mr *MockActionClientGetterAndInterfaceMockRecorder) Reconcile(rel any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reconcile", reflect.TypeOf((*MockActionClientGetterAndInterface)(nil).Reconcile), rel)
+}
+
+// Uninstall mocks base method.
+func (m *MockActionClientGetterAndInterface) Uninstall(name string, opts ...client.UninstallOption) (*release.UninstallReleaseResponse, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{name}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Uninstall", varargs...)
+ ret0, _ := ret[0].(*release.UninstallReleaseResponse)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Uninstall indicates an expected call of Uninstall.
+func (mr *MockActionClientGetterAndInterfaceMockRecorder) Uninstall(name any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{name}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Uninstall", reflect.TypeOf((*MockActionClientGetterAndInterface)(nil).Uninstall), varargs...)
+}
+
+// Upgrade mocks base method.
+func (m *MockActionClientGetterAndInterface) Upgrade(name, namespace string, chrt *chart.Chart, vals map[string]any, opts ...client.UpgradeOption) (*release.Release, error) {
+ m.ctrl.T.Helper()
+ varargs := []any{name, namespace, chrt, vals}
+ for _, a := range opts {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "Upgrade", varargs...)
+ ret0, _ := ret[0].(*release.Release)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// Upgrade indicates an expected call of Upgrade.
+func (mr *MockActionClientGetterAndInterfaceMockRecorder) Upgrade(name, namespace, chrt, vals any, opts ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{name, namespace, chrt, vals}, opts...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Upgrade", reflect.TypeOf((*MockActionClientGetterAndInterface)(nil).Upgrade), varargs...)
+}
diff --git a/internal/testutil/mock/httputil/mock_roundtripper.go b/internal/testutil/mock/httputil/mock_roundtripper.go
new file mode 100644
index 0000000000..80974859c9
--- /dev/null
+++ b/internal/testutil/mock/httputil/mock_roundtripper.go
@@ -0,0 +1,56 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: net/http (interfaces: RoundTripper)
+//
+// Generated by this command:
+//
+// mockgen -destination=httputil/mock_roundtripper.go -package=httputil net/http RoundTripper
+//
+
+// Package httputil is a generated GoMock package.
+package httputil
+
+import (
+ http "net/http"
+ reflect "reflect"
+
+ gomock "go.uber.org/mock/gomock"
+)
+
+// MockRoundTripper is a mock of RoundTripper interface.
+type MockRoundTripper struct {
+ ctrl *gomock.Controller
+ recorder *MockRoundTripperMockRecorder
+ isgomock struct{}
+}
+
+// MockRoundTripperMockRecorder is the mock recorder for MockRoundTripper.
+type MockRoundTripperMockRecorder struct {
+ mock *MockRoundTripper
+}
+
+// NewMockRoundTripper creates a new mock instance.
+func NewMockRoundTripper(ctrl *gomock.Controller) *MockRoundTripper {
+ mock := &MockRoundTripper{ctrl: ctrl}
+ mock.recorder = &MockRoundTripperMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockRoundTripper) EXPECT() *MockRoundTripperMockRecorder {
+ return m.recorder
+}
+
+// RoundTrip mocks base method.
+func (m *MockRoundTripper) RoundTrip(arg0 *http.Request) (*http.Response, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "RoundTrip", arg0)
+ ret0, _ := ret[0].(*http.Response)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// RoundTrip indicates an expected call of RoundTrip.
+func (mr *MockRoundTripperMockRecorder) RoundTrip(arg0 any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RoundTrip", reflect.TypeOf((*MockRoundTripper)(nil).RoundTrip), arg0)
+}
diff --git a/internal/testutil/mock/logrsink/mock_logsink.go b/internal/testutil/mock/logrsink/mock_logsink.go
new file mode 100644
index 0000000000..d23a8e4b68
--- /dev/null
+++ b/internal/testutil/mock/logrsink/mock_logsink.go
@@ -0,0 +1,133 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: github.com/go-logr/logr (interfaces: LogSink)
+//
+// Generated by this command:
+//
+// mockgen -destination=logrsink/mock_logsink.go -package=logrsink github.com/go-logr/logr LogSink
+//
+
+// Package logrsink is a generated GoMock package.
+package logrsink
+
+import (
+ reflect "reflect"
+
+ logr "github.com/go-logr/logr"
+ gomock "go.uber.org/mock/gomock"
+)
+
+// MockLogSink is a mock of LogSink interface.
+type MockLogSink struct {
+ ctrl *gomock.Controller
+ recorder *MockLogSinkMockRecorder
+ isgomock struct{}
+}
+
+// MockLogSinkMockRecorder is the mock recorder for MockLogSink.
+type MockLogSinkMockRecorder struct {
+ mock *MockLogSink
+}
+
+// NewMockLogSink creates a new mock instance.
+func NewMockLogSink(ctrl *gomock.Controller) *MockLogSink {
+ mock := &MockLogSink{ctrl: ctrl}
+ mock.recorder = &MockLogSinkMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockLogSink) EXPECT() *MockLogSinkMockRecorder {
+ return m.recorder
+}
+
+// Enabled mocks base method.
+func (m *MockLogSink) Enabled(level int) bool {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Enabled", level)
+ ret0, _ := ret[0].(bool)
+ return ret0
+}
+
+// Enabled indicates an expected call of Enabled.
+func (mr *MockLogSinkMockRecorder) Enabled(level any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Enabled", reflect.TypeOf((*MockLogSink)(nil).Enabled), level)
+}
+
+// Error mocks base method.
+func (m *MockLogSink) Error(err error, msg string, keysAndValues ...any) {
+ m.ctrl.T.Helper()
+ varargs := []any{err, msg}
+ for _, a := range keysAndValues {
+ varargs = append(varargs, a)
+ }
+ m.ctrl.Call(m, "Error", varargs...)
+}
+
+// Error indicates an expected call of Error.
+func (mr *MockLogSinkMockRecorder) Error(err, msg any, keysAndValues ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{err, msg}, keysAndValues...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Error", reflect.TypeOf((*MockLogSink)(nil).Error), varargs...)
+}
+
+// Info mocks base method.
+func (m *MockLogSink) Info(level int, msg string, keysAndValues ...any) {
+ m.ctrl.T.Helper()
+ varargs := []any{level, msg}
+ for _, a := range keysAndValues {
+ varargs = append(varargs, a)
+ }
+ m.ctrl.Call(m, "Info", varargs...)
+}
+
+// Info indicates an expected call of Info.
+func (mr *MockLogSinkMockRecorder) Info(level, msg any, keysAndValues ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ varargs := append([]any{level, msg}, keysAndValues...)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Info", reflect.TypeOf((*MockLogSink)(nil).Info), varargs...)
+}
+
+// Init mocks base method.
+func (m *MockLogSink) Init(info logr.RuntimeInfo) {
+ m.ctrl.T.Helper()
+ m.ctrl.Call(m, "Init", info)
+}
+
+// Init indicates an expected call of Init.
+func (mr *MockLogSinkMockRecorder) Init(info any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockLogSink)(nil).Init), info)
+}
+
+// WithName mocks base method.
+func (m *MockLogSink) WithName(name string) logr.LogSink {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "WithName", name)
+ ret0, _ := ret[0].(logr.LogSink)
+ return ret0
+}
+
+// WithName indicates an expected call of WithName.
+func (mr *MockLogSinkMockRecorder) WithName(name any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithName", reflect.TypeOf((*MockLogSink)(nil).WithName), name)
+}
+
+// WithValues mocks base method.
+func (m *MockLogSink) WithValues(keysAndValues ...any) logr.LogSink {
+ m.ctrl.T.Helper()
+ varargs := []any{}
+ for _, a := range keysAndValues {
+ varargs = append(varargs, a)
+ }
+ ret := m.ctrl.Call(m, "WithValues", varargs...)
+ ret0, _ := ret[0].(logr.LogSink)
+ return ret0
+}
+
+// WithValues indicates an expected call of WithValues.
+func (mr *MockLogSinkMockRecorder) WithValues(keysAndValues ...any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithValues", reflect.TypeOf((*MockLogSink)(nil).WithValues), keysAndValues...)
+}
diff --git a/internal/testutil/mock/machinery/mock_results.go b/internal/testutil/mock/machinery/mock_results.go
new file mode 100644
index 0000000000..f1cbecb500
--- /dev/null
+++ b/internal/testutil/mock/machinery/mock_results.go
@@ -0,0 +1,466 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: pkg.package-operator.run/boxcutter/machinery (interfaces: RevisionResult,PhaseResult,ObjectResult,RevisionTeardownResult)
+//
+// Generated by this command:
+//
+// mockgen -destination=machinery/mock_results.go -package=machinery pkg.package-operator.run/boxcutter/machinery RevisionResult,PhaseResult,ObjectResult,RevisionTeardownResult
+//
+
+// Package machinery is a generated GoMock package.
+package machinery
+
+import (
+ reflect "reflect"
+
+ gomock "go.uber.org/mock/gomock"
+ machinery "pkg.package-operator.run/boxcutter/machinery"
+ types "pkg.package-operator.run/boxcutter/machinery/types"
+ validation "pkg.package-operator.run/boxcutter/validation"
+)
+
+// MockRevisionResult is a mock of RevisionResult interface.
+type MockRevisionResult struct {
+ ctrl *gomock.Controller
+ recorder *MockRevisionResultMockRecorder
+ isgomock struct{}
+}
+
+// MockRevisionResultMockRecorder is the mock recorder for MockRevisionResult.
+type MockRevisionResultMockRecorder struct {
+ mock *MockRevisionResult
+}
+
+// NewMockRevisionResult creates a new mock instance.
+func NewMockRevisionResult(ctrl *gomock.Controller) *MockRevisionResult {
+ mock := &MockRevisionResult{ctrl: ctrl}
+ mock.recorder = &MockRevisionResultMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockRevisionResult) EXPECT() *MockRevisionResultMockRecorder {
+ return m.recorder
+}
+
+// GetPhases mocks base method.
+func (m *MockRevisionResult) GetPhases() []machinery.PhaseResult {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetPhases")
+ ret0, _ := ret[0].([]machinery.PhaseResult)
+ return ret0
+}
+
+// GetPhases indicates an expected call of GetPhases.
+func (mr *MockRevisionResultMockRecorder) GetPhases() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPhases", reflect.TypeOf((*MockRevisionResult)(nil).GetPhases))
+}
+
+// GetValidationError mocks base method.
+func (m *MockRevisionResult) GetValidationError() *validation.RevisionValidationError {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetValidationError")
+ ret0, _ := ret[0].(*validation.RevisionValidationError)
+ return ret0
+}
+
+// GetValidationError indicates an expected call of GetValidationError.
+func (mr *MockRevisionResultMockRecorder) GetValidationError() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidationError", reflect.TypeOf((*MockRevisionResult)(nil).GetValidationError))
+}
+
+// HasProgressed mocks base method.
+func (m *MockRevisionResult) HasProgressed() bool {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "HasProgressed")
+ ret0, _ := ret[0].(bool)
+ return ret0
+}
+
+// HasProgressed indicates an expected call of HasProgressed.
+func (mr *MockRevisionResultMockRecorder) HasProgressed() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasProgressed", reflect.TypeOf((*MockRevisionResult)(nil).HasProgressed))
+}
+
+// InTransition mocks base method.
+func (m *MockRevisionResult) InTransition() bool {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "InTransition")
+ ret0, _ := ret[0].(bool)
+ return ret0
+}
+
+// InTransition indicates an expected call of InTransition.
+func (mr *MockRevisionResultMockRecorder) InTransition() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InTransition", reflect.TypeOf((*MockRevisionResult)(nil).InTransition))
+}
+
+// IsComplete mocks base method.
+func (m *MockRevisionResult) IsComplete() bool {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "IsComplete")
+ ret0, _ := ret[0].(bool)
+ return ret0
+}
+
+// IsComplete indicates an expected call of IsComplete.
+func (mr *MockRevisionResultMockRecorder) IsComplete() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsComplete", reflect.TypeOf((*MockRevisionResult)(nil).IsComplete))
+}
+
+// String mocks base method.
+func (m *MockRevisionResult) String() string {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "String")
+ ret0, _ := ret[0].(string)
+ return ret0
+}
+
+// String indicates an expected call of String.
+func (mr *MockRevisionResultMockRecorder) String() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "String", reflect.TypeOf((*MockRevisionResult)(nil).String))
+}
+
+// MockPhaseResult is a mock of PhaseResult interface.
+type MockPhaseResult struct {
+ ctrl *gomock.Controller
+ recorder *MockPhaseResultMockRecorder
+ isgomock struct{}
+}
+
+// MockPhaseResultMockRecorder is the mock recorder for MockPhaseResult.
+type MockPhaseResultMockRecorder struct {
+ mock *MockPhaseResult
+}
+
+// NewMockPhaseResult creates a new mock instance.
+func NewMockPhaseResult(ctrl *gomock.Controller) *MockPhaseResult {
+ mock := &MockPhaseResult{ctrl: ctrl}
+ mock.recorder = &MockPhaseResultMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockPhaseResult) EXPECT() *MockPhaseResultMockRecorder {
+ return m.recorder
+}
+
+// GetName mocks base method.
+func (m *MockPhaseResult) GetName() string {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetName")
+ ret0, _ := ret[0].(string)
+ return ret0
+}
+
+// GetName indicates an expected call of GetName.
+func (mr *MockPhaseResultMockRecorder) GetName() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetName", reflect.TypeOf((*MockPhaseResult)(nil).GetName))
+}
+
+// GetObjects mocks base method.
+func (m *MockPhaseResult) GetObjects() []machinery.ObjectResult {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetObjects")
+ ret0, _ := ret[0].([]machinery.ObjectResult)
+ return ret0
+}
+
+// GetObjects indicates an expected call of GetObjects.
+func (mr *MockPhaseResultMockRecorder) GetObjects() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObjects", reflect.TypeOf((*MockPhaseResult)(nil).GetObjects))
+}
+
+// GetValidationError mocks base method.
+func (m *MockPhaseResult) GetValidationError() *validation.PhaseValidationError {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetValidationError")
+ ret0, _ := ret[0].(*validation.PhaseValidationError)
+ return ret0
+}
+
+// GetValidationError indicates an expected call of GetValidationError.
+func (mr *MockPhaseResultMockRecorder) GetValidationError() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidationError", reflect.TypeOf((*MockPhaseResult)(nil).GetValidationError))
+}
+
+// HasProgressed mocks base method.
+func (m *MockPhaseResult) HasProgressed() bool {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "HasProgressed")
+ ret0, _ := ret[0].(bool)
+ return ret0
+}
+
+// HasProgressed indicates an expected call of HasProgressed.
+func (mr *MockPhaseResultMockRecorder) HasProgressed() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasProgressed", reflect.TypeOf((*MockPhaseResult)(nil).HasProgressed))
+}
+
+// InTransition mocks base method.
+func (m *MockPhaseResult) InTransition() bool {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "InTransition")
+ ret0, _ := ret[0].(bool)
+ return ret0
+}
+
+// InTransition indicates an expected call of InTransition.
+func (mr *MockPhaseResultMockRecorder) InTransition() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InTransition", reflect.TypeOf((*MockPhaseResult)(nil).InTransition))
+}
+
+// IsComplete mocks base method.
+func (m *MockPhaseResult) IsComplete() bool {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "IsComplete")
+ ret0, _ := ret[0].(bool)
+ return ret0
+}
+
+// IsComplete indicates an expected call of IsComplete.
+func (mr *MockPhaseResultMockRecorder) IsComplete() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsComplete", reflect.TypeOf((*MockPhaseResult)(nil).IsComplete))
+}
+
+// String mocks base method.
+func (m *MockPhaseResult) String() string {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "String")
+ ret0, _ := ret[0].(string)
+ return ret0
+}
+
+// String indicates an expected call of String.
+func (mr *MockPhaseResultMockRecorder) String() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "String", reflect.TypeOf((*MockPhaseResult)(nil).String))
+}
+
+// MockObjectResult is a mock of ObjectResult interface.
+type MockObjectResult struct {
+ ctrl *gomock.Controller
+ recorder *MockObjectResultMockRecorder
+ isgomock struct{}
+}
+
+// MockObjectResultMockRecorder is the mock recorder for MockObjectResult.
+type MockObjectResultMockRecorder struct {
+ mock *MockObjectResult
+}
+
+// NewMockObjectResult creates a new mock instance.
+func NewMockObjectResult(ctrl *gomock.Controller) *MockObjectResult {
+ mock := &MockObjectResult{ctrl: ctrl}
+ mock.recorder = &MockObjectResultMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockObjectResult) EXPECT() *MockObjectResultMockRecorder {
+ return m.recorder
+}
+
+// Action mocks base method.
+func (m *MockObjectResult) Action() machinery.Action {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Action")
+ ret0, _ := ret[0].(machinery.Action)
+ return ret0
+}
+
+// Action indicates an expected call of Action.
+func (mr *MockObjectResultMockRecorder) Action() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Action", reflect.TypeOf((*MockObjectResult)(nil).Action))
+}
+
+// IsComplete mocks base method.
+func (m *MockObjectResult) IsComplete() bool {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "IsComplete")
+ ret0, _ := ret[0].(bool)
+ return ret0
+}
+
+// IsComplete indicates an expected call of IsComplete.
+func (mr *MockObjectResultMockRecorder) IsComplete() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsComplete", reflect.TypeOf((*MockObjectResult)(nil).IsComplete))
+}
+
+// IsPaused mocks base method.
+func (m *MockObjectResult) IsPaused() bool {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "IsPaused")
+ ret0, _ := ret[0].(bool)
+ return ret0
+}
+
+// IsPaused indicates an expected call of IsPaused.
+func (mr *MockObjectResultMockRecorder) IsPaused() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsPaused", reflect.TypeOf((*MockObjectResult)(nil).IsPaused))
+}
+
+// Object mocks base method.
+func (m *MockObjectResult) Object() machinery.Object {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Object")
+ ret0, _ := ret[0].(machinery.Object)
+ return ret0
+}
+
+// Object indicates an expected call of Object.
+func (mr *MockObjectResultMockRecorder) Object() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Object", reflect.TypeOf((*MockObjectResult)(nil).Object))
+}
+
+// ProbeResults mocks base method.
+func (m *MockObjectResult) ProbeResults() types.ProbeResultContainer {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "ProbeResults")
+ ret0, _ := ret[0].(types.ProbeResultContainer)
+ return ret0
+}
+
+// ProbeResults indicates an expected call of ProbeResults.
+func (mr *MockObjectResultMockRecorder) ProbeResults() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProbeResults", reflect.TypeOf((*MockObjectResult)(nil).ProbeResults))
+}
+
+// String mocks base method.
+func (m *MockObjectResult) String() string {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "String")
+ ret0, _ := ret[0].(string)
+ return ret0
+}
+
+// String indicates an expected call of String.
+func (mr *MockObjectResultMockRecorder) String() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "String", reflect.TypeOf((*MockObjectResult)(nil).String))
+}
+
+// MockRevisionTeardownResult is a mock of RevisionTeardownResult interface.
+type MockRevisionTeardownResult struct {
+ ctrl *gomock.Controller
+ recorder *MockRevisionTeardownResultMockRecorder
+ isgomock struct{}
+}
+
+// MockRevisionTeardownResultMockRecorder is the mock recorder for MockRevisionTeardownResult.
+type MockRevisionTeardownResultMockRecorder struct {
+ mock *MockRevisionTeardownResult
+}
+
+// NewMockRevisionTeardownResult creates a new mock instance.
+func NewMockRevisionTeardownResult(ctrl *gomock.Controller) *MockRevisionTeardownResult {
+ mock := &MockRevisionTeardownResult{ctrl: ctrl}
+ mock.recorder = &MockRevisionTeardownResultMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockRevisionTeardownResult) EXPECT() *MockRevisionTeardownResultMockRecorder {
+ return m.recorder
+}
+
+// GetActivePhaseName mocks base method.
+func (m *MockRevisionTeardownResult) GetActivePhaseName() (string, bool) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetActivePhaseName")
+ ret0, _ := ret[0].(string)
+ ret1, _ := ret[1].(bool)
+ return ret0, ret1
+}
+
+// GetActivePhaseName indicates an expected call of GetActivePhaseName.
+func (mr *MockRevisionTeardownResultMockRecorder) GetActivePhaseName() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetActivePhaseName", reflect.TypeOf((*MockRevisionTeardownResult)(nil).GetActivePhaseName))
+}
+
+// GetGonePhaseNames mocks base method.
+func (m *MockRevisionTeardownResult) GetGonePhaseNames() []string {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetGonePhaseNames")
+ ret0, _ := ret[0].([]string)
+ return ret0
+}
+
+// GetGonePhaseNames indicates an expected call of GetGonePhaseNames.
+func (mr *MockRevisionTeardownResultMockRecorder) GetGonePhaseNames() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGonePhaseNames", reflect.TypeOf((*MockRevisionTeardownResult)(nil).GetGonePhaseNames))
+}
+
+// GetPhases mocks base method.
+func (m *MockRevisionTeardownResult) GetPhases() []machinery.PhaseTeardownResult {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetPhases")
+ ret0, _ := ret[0].([]machinery.PhaseTeardownResult)
+ return ret0
+}
+
+// GetPhases indicates an expected call of GetPhases.
+func (mr *MockRevisionTeardownResultMockRecorder) GetPhases() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPhases", reflect.TypeOf((*MockRevisionTeardownResult)(nil).GetPhases))
+}
+
+// GetWaitingPhaseNames mocks base method.
+func (m *MockRevisionTeardownResult) GetWaitingPhaseNames() []string {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetWaitingPhaseNames")
+ ret0, _ := ret[0].([]string)
+ return ret0
+}
+
+// GetWaitingPhaseNames indicates an expected call of GetWaitingPhaseNames.
+func (mr *MockRevisionTeardownResultMockRecorder) GetWaitingPhaseNames() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWaitingPhaseNames", reflect.TypeOf((*MockRevisionTeardownResult)(nil).GetWaitingPhaseNames))
+}
+
+// IsComplete mocks base method.
+func (m *MockRevisionTeardownResult) IsComplete() bool {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "IsComplete")
+ ret0, _ := ret[0].(bool)
+ return ret0
+}
+
+// IsComplete indicates an expected call of IsComplete.
+func (mr *MockRevisionTeardownResultMockRecorder) IsComplete() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsComplete", reflect.TypeOf((*MockRevisionTeardownResult)(nil).IsComplete))
+}
+
+// String mocks base method.
+func (m *MockRevisionTeardownResult) String() string {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "String")
+ ret0, _ := ret[0].(string)
+ return ret0
+}
+
+// String indicates an expected call of String.
+func (mr *MockRevisionTeardownResultMockRecorder) String() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "String", reflect.TypeOf((*MockRevisionTeardownResult)(nil).String))
+}
diff --git a/internal/testutil/mock/render/mock_certprovider.go b/internal/testutil/mock/render/mock_certprovider.go
new file mode 100644
index 0000000000..696abcd71d
--- /dev/null
+++ b/internal/testutil/mock/render/mock_certprovider.go
@@ -0,0 +1,86 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render (interfaces: CertificateProvider)
+//
+// Generated by this command:
+//
+// mockgen -destination=render/mock_certprovider.go -package=render github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render CertificateProvider
+//
+
+// Package render is a generated GoMock package.
+package render
+
+import (
+ reflect "reflect"
+
+ render "github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render"
+ gomock "go.uber.org/mock/gomock"
+ unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+ client "sigs.k8s.io/controller-runtime/pkg/client"
+)
+
+// MockCertificateProvider is a mock of CertificateProvider interface.
+type MockCertificateProvider struct {
+ ctrl *gomock.Controller
+ recorder *MockCertificateProviderMockRecorder
+ isgomock struct{}
+}
+
+// MockCertificateProviderMockRecorder is the mock recorder for MockCertificateProvider.
+type MockCertificateProviderMockRecorder struct {
+ mock *MockCertificateProvider
+}
+
+// NewMockCertificateProvider creates a new mock instance.
+func NewMockCertificateProvider(ctrl *gomock.Controller) *MockCertificateProvider {
+ mock := &MockCertificateProvider{ctrl: ctrl}
+ mock.recorder = &MockCertificateProviderMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockCertificateProvider) EXPECT() *MockCertificateProviderMockRecorder {
+ return m.recorder
+}
+
+// AdditionalObjects mocks base method.
+func (m *MockCertificateProvider) AdditionalObjects(cfg render.CertificateProvisionerConfig) ([]unstructured.Unstructured, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "AdditionalObjects", cfg)
+ ret0, _ := ret[0].([]unstructured.Unstructured)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// AdditionalObjects indicates an expected call of AdditionalObjects.
+func (mr *MockCertificateProviderMockRecorder) AdditionalObjects(cfg any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AdditionalObjects", reflect.TypeOf((*MockCertificateProvider)(nil).AdditionalObjects), cfg)
+}
+
+// GetCertSecretInfo mocks base method.
+func (m *MockCertificateProvider) GetCertSecretInfo(cfg render.CertificateProvisionerConfig) render.CertSecretInfo {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetCertSecretInfo", cfg)
+ ret0, _ := ret[0].(render.CertSecretInfo)
+ return ret0
+}
+
+// GetCertSecretInfo indicates an expected call of GetCertSecretInfo.
+func (mr *MockCertificateProviderMockRecorder) GetCertSecretInfo(cfg any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCertSecretInfo", reflect.TypeOf((*MockCertificateProvider)(nil).GetCertSecretInfo), cfg)
+}
+
+// InjectCABundle mocks base method.
+func (m *MockCertificateProvider) InjectCABundle(obj client.Object, cfg render.CertificateProvisionerConfig) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "InjectCABundle", obj, cfg)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// InjectCABundle indicates an expected call of InjectCABundle.
+func (mr *MockCertificateProviderMockRecorder) InjectCABundle(obj, cfg any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InjectCABundle", reflect.TypeOf((*MockCertificateProvider)(nil).InjectCABundle), obj, cfg)
+}
diff --git a/internal/testutil/mock/storage/mock_instance.go b/internal/testutil/mock/storage/mock_instance.go
new file mode 100644
index 0000000000..2aa9613e3b
--- /dev/null
+++ b/internal/testutil/mock/storage/mock_instance.go
@@ -0,0 +1,113 @@
+// Code generated by MockGen. DO NOT EDIT.
+// Source: github.com/operator-framework/operator-controller/internal/catalogd/storage (interfaces: Instance)
+//
+// Generated by this command:
+//
+// mockgen -destination=storage/mock_instance.go -package=storage github.com/operator-framework/operator-controller/internal/catalogd/storage Instance
+//
+
+// Package storage is a generated GoMock package.
+package storage
+
+import (
+ context "context"
+ fs "io/fs"
+ http "net/http"
+ reflect "reflect"
+
+ gomock "go.uber.org/mock/gomock"
+)
+
+// MockInstance is a mock of Instance interface.
+type MockInstance struct {
+ ctrl *gomock.Controller
+ recorder *MockInstanceMockRecorder
+ isgomock struct{}
+}
+
+// MockInstanceMockRecorder is the mock recorder for MockInstance.
+type MockInstanceMockRecorder struct {
+ mock *MockInstance
+}
+
+// NewMockInstance creates a new mock instance.
+func NewMockInstance(ctrl *gomock.Controller) *MockInstance {
+ mock := &MockInstance{ctrl: ctrl}
+ mock.recorder = &MockInstanceMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockInstance) EXPECT() *MockInstanceMockRecorder {
+ return m.recorder
+}
+
+// BaseURL mocks base method.
+func (m *MockInstance) BaseURL(catalog string) string {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "BaseURL", catalog)
+ ret0, _ := ret[0].(string)
+ return ret0
+}
+
+// BaseURL indicates an expected call of BaseURL.
+func (mr *MockInstanceMockRecorder) BaseURL(catalog any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BaseURL", reflect.TypeOf((*MockInstance)(nil).BaseURL), catalog)
+}
+
+// ContentExists mocks base method.
+func (m *MockInstance) ContentExists(catalog string) bool {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "ContentExists", catalog)
+ ret0, _ := ret[0].(bool)
+ return ret0
+}
+
+// ContentExists indicates an expected call of ContentExists.
+func (mr *MockInstanceMockRecorder) ContentExists(catalog any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContentExists", reflect.TypeOf((*MockInstance)(nil).ContentExists), catalog)
+}
+
+// Delete mocks base method.
+func (m *MockInstance) Delete(catalog string) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Delete", catalog)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Delete indicates an expected call of Delete.
+func (mr *MockInstanceMockRecorder) Delete(catalog any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInstance)(nil).Delete), catalog)
+}
+
+// StorageServerHandler mocks base method.
+func (m *MockInstance) StorageServerHandler() http.Handler {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "StorageServerHandler")
+ ret0, _ := ret[0].(http.Handler)
+ return ret0
+}
+
+// StorageServerHandler indicates an expected call of StorageServerHandler.
+func (mr *MockInstanceMockRecorder) StorageServerHandler() *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StorageServerHandler", reflect.TypeOf((*MockInstance)(nil).StorageServerHandler))
+}
+
+// Store mocks base method.
+func (m *MockInstance) Store(ctx context.Context, catalog string, fsys fs.FS) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "Store", ctx, catalog, fsys)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// Store indicates an expected call of Store.
+func (mr *MockInstanceMockRecorder) Store(ctx, catalog, fsys any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Store", reflect.TypeOf((*MockInstance)(nil).Store), ctx, catalog, fsys)
+}
diff --git a/manifests/experimental-e2e.yaml b/manifests/experimental-e2e.yaml
index 664484d852..6ab7afde0d 100644
--- a/manifests/experimental-e2e.yaml
+++ b/manifests/experimental-e2e.yaml
@@ -617,7 +617,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
- controller-gen.kubebuilder.io/version: v0.20.1
+ controller-gen.kubebuilder.io/version: v0.21.0
olm.operatorframework.io/generator: experimental
name: clusterextensions.olm.operatorframework.io
spec:
@@ -762,8 +762,7 @@ spec:
namespace:
description: |-
namespace specifies a Kubernetes namespace.
- This is the namespace where the provided ServiceAccount must exist.
- It also designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
+ It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
This namespace must exist.
@@ -791,18 +790,18 @@ spec:
type: integer
serviceAccount:
description: |-
- serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
- that are required to manage the extension.
- The ServiceAccount must be configured with the necessary permissions to perform these interactions.
- The ServiceAccount must exist in the namespace referenced in the spec.
- The serviceAccount field is required.
+ serviceAccount is a deprecated field and is completely ignored.
+ OLMv1 is a single-tenant system where users with ClusterExtension write access are
+ effectively delegated cluster-admin trust. The operator-controller runs with
+ cluster-admin privileges and uses its own service account for all cluster interactions.
+
+ Deprecated: serviceAccount is no longer used and will be removed in a future release.
properties:
name:
description: |-
- name is a required, immutable reference to the name of the ServiceAccount used for installation
- and management of the content for the package specified in the packageName field.
+ name is a deprecated field and is completely ignored.
- This ServiceAccount must exist in the installNamespace.
+ Deprecated: name is no longer used and will be removed in a future release.
The name field follows the DNS subdomain standard as defined in [RFC 1123].
It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
@@ -823,15 +822,13 @@ spec:
maxLength: 253
type: string
x-kubernetes-validations:
- - message: name is immutable
- rule: self == oldSelf
+ - message: name is immutable once set, but may be cleared
+ rule: self == oldSelf || size(self) == 0
- message: name must be a valid DNS1123 subdomain. It must contain
only lowercase alphanumeric characters, hyphens (-) or periods
(.), start and end with an alphanumeric character, and be
no longer than 253 characters
- rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
- required:
- - name
+ rule: size(self) == 0 || self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
type: object
source:
description: |-
@@ -1109,7 +1106,6 @@ spec:
has(self.catalog) : !has(self.catalog)'
required:
- namespace
- - serviceAccount
- source
type: object
status:
@@ -2159,115 +2155,6 @@ rules:
- list
- watch
---
-# Source: olmv1/templates/rbac/clusterrole-operator-controller-manager-role.yml
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: operator-controller-manager-role
- labels:
- app.kubernetes.io/name: operator-controller
- app.kubernetes.io/part-of: olm
- annotations:
- olm.operatorframework.io/feature-set: experimental-e2e
-rules:
- - apiGroups:
- - ""
- resources:
- - serviceaccounts/token
- verbs:
- - create
- - apiGroups:
- - ""
- resources:
- - serviceaccounts
- verbs:
- - get
- - apiGroups:
- - apiextensions.k8s.io
- resources:
- - customresourcedefinitions
- verbs:
- - get
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clustercatalogs
- verbs:
- - get
- - list
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions
- verbs:
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/finalizers
- verbs:
- - update
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/status
- verbs:
- - patch
- - update
- - apiGroups:
- - rbac.authorization.k8s.io
- resources:
- - clusterrolebindings
- - clusterroles
- - rolebindings
- - roles
- verbs:
- - list
- - watch
- - apiGroups:
- - "*"
- resources:
- - "*"
- verbs:
- - list
- - watch
- - apiGroups:
- - ""
- resources:
- - secrets
- verbs:
- - get
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterobjectsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterobjectsets/status
- verbs:
- - patch
- - update
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterobjectsets/finalizers
- verbs:
- - update
----
# Source: olmv1/templates/rbac/clusterrolebinding-catalogd-manager-rolebinding.yml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
@@ -2334,11 +2221,11 @@ metadata:
labels:
app.kubernetes.io/name: operator-controller
app.kubernetes.io/part-of: olm
- name: operator-controller-manager-admin-rolebinding
+ name: operator-controller-cluster-admin-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
- name: operator-controller-manager-role
+ name: cluster-admin
subjects:
- kind: ServiceAccount
name: operator-controller-controller-manager
@@ -2828,10 +2715,8 @@ spec:
- --feature-gates=BundleReleaseSupport=true
- --feature-gates=DeploymentConfig=true
- --feature-gates=HelmChartSupport=true
- - --feature-gates=PreflightPermissions=true
- --feature-gates=SingleOwnNamespaceInstallSupport=true
- --feature-gates=WebhookProviderCertManager=true
- - --feature-gates=SyntheticPermissions=false
- --feature-gates=WebhookProviderOpenshiftServiceCA=false
- --tls-cert=/var/certs/tls.crt
- --tls-key=/var/certs/tls.key
@@ -3092,3 +2977,44 @@ webhooks:
matchConditions:
- name: MissingOrIncorrectMetadataNameLabel
expression: "'name' in object.metadata && (!has(object.metadata.labels) || !('olm.operatorframework.io/metadata.name' in object.metadata.labels) || object.metadata.labels['olm.operatorframework.io/metadata.name'] != object.metadata.name)"
+---
+# Source: olmv1/templates/validatingadmissionpolicy-clusterextension-serviceaccount-deprecated.yml
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicy
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ app.kubernetes.io/part-of: olm
+ annotations:
+ olm.operatorframework.io/feature-set: experimental-e2e
+spec:
+ matchConstraints:
+ resourceRules:
+ - apiGroups:
+ - olm.operatorframework.io
+ apiVersions:
+ - v1
+ operations:
+ - CREATE
+ - UPDATE
+ resources:
+ - clusterextensions
+ validations:
+ - expression: "!has(object.spec.serviceAccount) || !has(object.spec.serviceAccount.name) || object.spec.serviceAccount.name == ''"
+ message: "spec.serviceAccount is deprecated, ignored, and will be removed in a future release. The operator-controller's cluster-admin service account is used for all cluster interactions."
+---
+# Source: olmv1/templates/validatingadmissionpolicybinding-clusterextension-serviceaccount-deprecated.yml
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicyBinding
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ app.kubernetes.io/part-of: olm
+ annotations:
+ olm.operatorframework.io/feature-set: experimental-e2e
+spec:
+ policyName: clusterextension-serviceaccount-deprecated
+ validationActions:
+ - Warn
diff --git a/manifests/experimental.yaml b/manifests/experimental.yaml
index 267570d6fa..5ada852dc1 100644
--- a/manifests/experimental.yaml
+++ b/manifests/experimental.yaml
@@ -578,7 +578,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
- controller-gen.kubebuilder.io/version: v0.20.1
+ controller-gen.kubebuilder.io/version: v0.21.0
olm.operatorframework.io/generator: experimental
name: clusterextensions.olm.operatorframework.io
spec:
@@ -723,8 +723,7 @@ spec:
namespace:
description: |-
namespace specifies a Kubernetes namespace.
- This is the namespace where the provided ServiceAccount must exist.
- It also designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
+ It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
This namespace must exist.
@@ -752,18 +751,18 @@ spec:
type: integer
serviceAccount:
description: |-
- serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
- that are required to manage the extension.
- The ServiceAccount must be configured with the necessary permissions to perform these interactions.
- The ServiceAccount must exist in the namespace referenced in the spec.
- The serviceAccount field is required.
+ serviceAccount is a deprecated field and is completely ignored.
+ OLMv1 is a single-tenant system where users with ClusterExtension write access are
+ effectively delegated cluster-admin trust. The operator-controller runs with
+ cluster-admin privileges and uses its own service account for all cluster interactions.
+
+ Deprecated: serviceAccount is no longer used and will be removed in a future release.
properties:
name:
description: |-
- name is a required, immutable reference to the name of the ServiceAccount used for installation
- and management of the content for the package specified in the packageName field.
+ name is a deprecated field and is completely ignored.
- This ServiceAccount must exist in the installNamespace.
+ Deprecated: name is no longer used and will be removed in a future release.
The name field follows the DNS subdomain standard as defined in [RFC 1123].
It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
@@ -784,15 +783,13 @@ spec:
maxLength: 253
type: string
x-kubernetes-validations:
- - message: name is immutable
- rule: self == oldSelf
+ - message: name is immutable once set, but may be cleared
+ rule: self == oldSelf || size(self) == 0
- message: name must be a valid DNS1123 subdomain. It must contain
only lowercase alphanumeric characters, hyphens (-) or periods
(.), start and end with an alphanumeric character, and be
no longer than 253 characters
- rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
- required:
- - name
+ rule: size(self) == 0 || self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
type: object
source:
description: |-
@@ -1070,7 +1067,6 @@ spec:
has(self.catalog) : !has(self.catalog)'
required:
- namespace
- - serviceAccount
- source
type: object
status:
@@ -2120,115 +2116,6 @@ rules:
- list
- watch
---
-# Source: olmv1/templates/rbac/clusterrole-operator-controller-manager-role.yml
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: operator-controller-manager-role
- labels:
- app.kubernetes.io/name: operator-controller
- app.kubernetes.io/part-of: olm
- annotations:
- olm.operatorframework.io/feature-set: experimental
-rules:
- - apiGroups:
- - ""
- resources:
- - serviceaccounts/token
- verbs:
- - create
- - apiGroups:
- - ""
- resources:
- - serviceaccounts
- verbs:
- - get
- - apiGroups:
- - apiextensions.k8s.io
- resources:
- - customresourcedefinitions
- verbs:
- - get
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clustercatalogs
- verbs:
- - get
- - list
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions
- verbs:
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/finalizers
- verbs:
- - update
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/status
- verbs:
- - patch
- - update
- - apiGroups:
- - rbac.authorization.k8s.io
- resources:
- - clusterrolebindings
- - clusterroles
- - rolebindings
- - roles
- verbs:
- - list
- - watch
- - apiGroups:
- - "*"
- resources:
- - "*"
- verbs:
- - list
- - watch
- - apiGroups:
- - ""
- resources:
- - secrets
- verbs:
- - get
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterobjectsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterobjectsets/status
- verbs:
- - patch
- - update
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterobjectsets/finalizers
- verbs:
- - update
----
# Source: olmv1/templates/rbac/clusterrolebinding-catalogd-manager-rolebinding.yml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
@@ -2295,11 +2182,11 @@ metadata:
labels:
app.kubernetes.io/name: operator-controller
app.kubernetes.io/part-of: olm
- name: operator-controller-manager-admin-rolebinding
+ name: operator-controller-cluster-admin-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
- name: operator-controller-manager-role
+ name: cluster-admin
subjects:
- kind: ServiceAccount
name: operator-controller-controller-manager
@@ -2734,10 +2621,8 @@ spec:
- --feature-gates=BundleReleaseSupport=true
- --feature-gates=DeploymentConfig=true
- --feature-gates=HelmChartSupport=true
- - --feature-gates=PreflightPermissions=true
- --feature-gates=SingleOwnNamespaceInstallSupport=true
- --feature-gates=WebhookProviderCertManager=true
- - --feature-gates=SyntheticPermissions=false
- --feature-gates=WebhookProviderOpenshiftServiceCA=false
- --tls-cert=/var/certs/tls.crt
- --tls-key=/var/certs/tls.key
@@ -2984,3 +2869,44 @@ webhooks:
matchConditions:
- name: MissingOrIncorrectMetadataNameLabel
expression: "'name' in object.metadata && (!has(object.metadata.labels) || !('olm.operatorframework.io/metadata.name' in object.metadata.labels) || object.metadata.labels['olm.operatorframework.io/metadata.name'] != object.metadata.name)"
+---
+# Source: olmv1/templates/validatingadmissionpolicy-clusterextension-serviceaccount-deprecated.yml
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicy
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ app.kubernetes.io/part-of: olm
+ annotations:
+ olm.operatorframework.io/feature-set: experimental
+spec:
+ matchConstraints:
+ resourceRules:
+ - apiGroups:
+ - olm.operatorframework.io
+ apiVersions:
+ - v1
+ operations:
+ - CREATE
+ - UPDATE
+ resources:
+ - clusterextensions
+ validations:
+ - expression: "!has(object.spec.serviceAccount) || !has(object.spec.serviceAccount.name) || object.spec.serviceAccount.name == ''"
+ message: "spec.serviceAccount is deprecated, ignored, and will be removed in a future release. The operator-controller's cluster-admin service account is used for all cluster interactions."
+---
+# Source: olmv1/templates/validatingadmissionpolicybinding-clusterextension-serviceaccount-deprecated.yml
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicyBinding
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ app.kubernetes.io/part-of: olm
+ annotations:
+ olm.operatorframework.io/feature-set: experimental
+spec:
+ policyName: clusterextension-serviceaccount-deprecated
+ validationActions:
+ - Warn
diff --git a/manifests/standard-e2e.yaml b/manifests/standard-e2e.yaml
index 6f55abc173..20e0cf9bec 100644
--- a/manifests/standard-e2e.yaml
+++ b/manifests/standard-e2e.yaml
@@ -617,7 +617,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
- controller-gen.kubebuilder.io/version: v0.20.1
+ controller-gen.kubebuilder.io/version: v0.21.0
olm.operatorframework.io/generator: standard
name: clusterextensions.olm.operatorframework.io
spec:
@@ -724,8 +724,7 @@ spec:
namespace:
description: |-
namespace specifies a Kubernetes namespace.
- This is the namespace where the provided ServiceAccount must exist.
- It also designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
+ It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
This namespace must exist.
@@ -743,18 +742,18 @@ spec:
rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")
serviceAccount:
description: |-
- serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
- that are required to manage the extension.
- The ServiceAccount must be configured with the necessary permissions to perform these interactions.
- The ServiceAccount must exist in the namespace referenced in the spec.
- The serviceAccount field is required.
+ serviceAccount is a deprecated field and is completely ignored.
+ OLMv1 is a single-tenant system where users with ClusterExtension write access are
+ effectively delegated cluster-admin trust. The operator-controller runs with
+ cluster-admin privileges and uses its own service account for all cluster interactions.
+
+ Deprecated: serviceAccount is no longer used and will be removed in a future release.
properties:
name:
description: |-
- name is a required, immutable reference to the name of the ServiceAccount used for installation
- and management of the content for the package specified in the packageName field.
+ name is a deprecated field and is completely ignored.
- This ServiceAccount must exist in the installNamespace.
+ Deprecated: name is no longer used and will be removed in a future release.
The name field follows the DNS subdomain standard as defined in [RFC 1123].
It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
@@ -775,15 +774,13 @@ spec:
maxLength: 253
type: string
x-kubernetes-validations:
- - message: name is immutable
- rule: self == oldSelf
+ - message: name is immutable once set, but may be cleared
+ rule: self == oldSelf || size(self) == 0
- message: name must be a valid DNS1123 subdomain. It must contain
only lowercase alphanumeric characters, hyphens (-) or periods
(.), start and end with an alphanumeric character, and be
no longer than 253 characters
- rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
- required:
- - name
+ rule: size(self) == 0 || self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
type: object
source:
description: |-
@@ -1061,7 +1058,6 @@ spec:
has(self.catalog) : !has(self.catalog)'
required:
- namespace
- - serviceAccount
- source
type: object
status:
@@ -1330,77 +1326,6 @@ rules:
- list
- watch
---
-# Source: olmv1/templates/rbac/clusterrole-operator-controller-manager-role.yml
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: operator-controller-manager-role
- labels:
- app.kubernetes.io/name: operator-controller
- app.kubernetes.io/part-of: olm
- annotations:
- olm.operatorframework.io/feature-set: standard-e2e
-rules:
- - apiGroups:
- - ""
- resources:
- - serviceaccounts/token
- verbs:
- - create
- - apiGroups:
- - ""
- resources:
- - serviceaccounts
- verbs:
- - get
- - apiGroups:
- - apiextensions.k8s.io
- resources:
- - customresourcedefinitions
- verbs:
- - get
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clustercatalogs
- verbs:
- - get
- - list
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions
- verbs:
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/finalizers
- verbs:
- - update
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/status
- verbs:
- - patch
- - update
- - apiGroups:
- - rbac.authorization.k8s.io
- resources:
- - clusterrolebindings
- - clusterroles
- - rolebindings
- - roles
- verbs:
- - list
- - watch
----
# Source: olmv1/templates/rbac/clusterrolebinding-catalogd-manager-rolebinding.yml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
@@ -1467,11 +1392,11 @@ metadata:
labels:
app.kubernetes.io/name: operator-controller
app.kubernetes.io/part-of: olm
- name: operator-controller-manager-rolebinding
+ name: operator-controller-cluster-admin-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
- name: operator-controller-manager-role
+ name: cluster-admin
subjects:
- kind: ServiceAccount
name: operator-controller-controller-manager
@@ -1961,9 +1886,7 @@ spec:
- --feature-gates=BundleReleaseSupport=false
- --feature-gates=DeploymentConfig=false
- --feature-gates=HelmChartSupport=false
- - --feature-gates=PreflightPermissions=false
- --feature-gates=SingleOwnNamespaceInstallSupport=false
- - --feature-gates=SyntheticPermissions=false
- --feature-gates=WebhookProviderOpenshiftServiceCA=false
- --tls-cert=/var/certs/tls.crt
- --tls-key=/var/certs/tls.key
@@ -2224,3 +2147,44 @@ webhooks:
matchConditions:
- name: MissingOrIncorrectMetadataNameLabel
expression: "'name' in object.metadata && (!has(object.metadata.labels) || !('olm.operatorframework.io/metadata.name' in object.metadata.labels) || object.metadata.labels['olm.operatorframework.io/metadata.name'] != object.metadata.name)"
+---
+# Source: olmv1/templates/validatingadmissionpolicy-clusterextension-serviceaccount-deprecated.yml
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicy
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ app.kubernetes.io/part-of: olm
+ annotations:
+ olm.operatorframework.io/feature-set: standard-e2e
+spec:
+ matchConstraints:
+ resourceRules:
+ - apiGroups:
+ - olm.operatorframework.io
+ apiVersions:
+ - v1
+ operations:
+ - CREATE
+ - UPDATE
+ resources:
+ - clusterextensions
+ validations:
+ - expression: "!has(object.spec.serviceAccount) || !has(object.spec.serviceAccount.name) || object.spec.serviceAccount.name == ''"
+ message: "spec.serviceAccount is deprecated, ignored, and will be removed in a future release. The operator-controller's cluster-admin service account is used for all cluster interactions."
+---
+# Source: olmv1/templates/validatingadmissionpolicybinding-clusterextension-serviceaccount-deprecated.yml
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicyBinding
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ app.kubernetes.io/part-of: olm
+ annotations:
+ olm.operatorframework.io/feature-set: standard-e2e
+spec:
+ policyName: clusterextension-serviceaccount-deprecated
+ validationActions:
+ - Warn
diff --git a/manifests/standard.yaml b/manifests/standard.yaml
index 870f10e3fc..dc29688f4e 100644
--- a/manifests/standard.yaml
+++ b/manifests/standard.yaml
@@ -578,7 +578,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
- controller-gen.kubebuilder.io/version: v0.20.1
+ controller-gen.kubebuilder.io/version: v0.21.0
olm.operatorframework.io/generator: standard
name: clusterextensions.olm.operatorframework.io
spec:
@@ -685,8 +685,7 @@ spec:
namespace:
description: |-
namespace specifies a Kubernetes namespace.
- This is the namespace where the provided ServiceAccount must exist.
- It also designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
+ It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
This namespace must exist.
@@ -704,18 +703,18 @@ spec:
rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")
serviceAccount:
description: |-
- serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
- that are required to manage the extension.
- The ServiceAccount must be configured with the necessary permissions to perform these interactions.
- The ServiceAccount must exist in the namespace referenced in the spec.
- The serviceAccount field is required.
+ serviceAccount is a deprecated field and is completely ignored.
+ OLMv1 is a single-tenant system where users with ClusterExtension write access are
+ effectively delegated cluster-admin trust. The operator-controller runs with
+ cluster-admin privileges and uses its own service account for all cluster interactions.
+
+ Deprecated: serviceAccount is no longer used and will be removed in a future release.
properties:
name:
description: |-
- name is a required, immutable reference to the name of the ServiceAccount used for installation
- and management of the content for the package specified in the packageName field.
+ name is a deprecated field and is completely ignored.
- This ServiceAccount must exist in the installNamespace.
+ Deprecated: name is no longer used and will be removed in a future release.
The name field follows the DNS subdomain standard as defined in [RFC 1123].
It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
@@ -736,15 +735,13 @@ spec:
maxLength: 253
type: string
x-kubernetes-validations:
- - message: name is immutable
- rule: self == oldSelf
+ - message: name is immutable once set, but may be cleared
+ rule: self == oldSelf || size(self) == 0
- message: name must be a valid DNS1123 subdomain. It must contain
only lowercase alphanumeric characters, hyphens (-) or periods
(.), start and end with an alphanumeric character, and be
no longer than 253 characters
- rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
- required:
- - name
+ rule: size(self) == 0 || self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
type: object
source:
description: |-
@@ -1022,7 +1019,6 @@ spec:
has(self.catalog) : !has(self.catalog)'
required:
- namespace
- - serviceAccount
- source
type: object
status:
@@ -1291,77 +1287,6 @@ rules:
- list
- watch
---
-# Source: olmv1/templates/rbac/clusterrole-operator-controller-manager-role.yml
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: operator-controller-manager-role
- labels:
- app.kubernetes.io/name: operator-controller
- app.kubernetes.io/part-of: olm
- annotations:
- olm.operatorframework.io/feature-set: standard
-rules:
- - apiGroups:
- - ""
- resources:
- - serviceaccounts/token
- verbs:
- - create
- - apiGroups:
- - ""
- resources:
- - serviceaccounts
- verbs:
- - get
- - apiGroups:
- - apiextensions.k8s.io
- resources:
- - customresourcedefinitions
- verbs:
- - get
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clustercatalogs
- verbs:
- - get
- - list
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions
- verbs:
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/finalizers
- verbs:
- - update
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/status
- verbs:
- - patch
- - update
- - apiGroups:
- - rbac.authorization.k8s.io
- resources:
- - clusterrolebindings
- - clusterroles
- - rolebindings
- - roles
- verbs:
- - list
- - watch
----
# Source: olmv1/templates/rbac/clusterrolebinding-catalogd-manager-rolebinding.yml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
@@ -1428,11 +1353,11 @@ metadata:
labels:
app.kubernetes.io/name: operator-controller
app.kubernetes.io/part-of: olm
- name: operator-controller-manager-rolebinding
+ name: operator-controller-cluster-admin-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
- name: operator-controller-manager-role
+ name: cluster-admin
subjects:
- kind: ServiceAccount
name: operator-controller-controller-manager
@@ -1867,9 +1792,7 @@ spec:
- --feature-gates=BundleReleaseSupport=false
- --feature-gates=DeploymentConfig=false
- --feature-gates=HelmChartSupport=false
- - --feature-gates=PreflightPermissions=false
- --feature-gates=SingleOwnNamespaceInstallSupport=false
- - --feature-gates=SyntheticPermissions=false
- --feature-gates=WebhookProviderOpenshiftServiceCA=false
- --tls-cert=/var/certs/tls.crt
- --tls-key=/var/certs/tls.key
@@ -2116,3 +2039,44 @@ webhooks:
matchConditions:
- name: MissingOrIncorrectMetadataNameLabel
expression: "'name' in object.metadata && (!has(object.metadata.labels) || !('olm.operatorframework.io/metadata.name' in object.metadata.labels) || object.metadata.labels['olm.operatorframework.io/metadata.name'] != object.metadata.name)"
+---
+# Source: olmv1/templates/validatingadmissionpolicy-clusterextension-serviceaccount-deprecated.yml
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicy
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ app.kubernetes.io/part-of: olm
+ annotations:
+ olm.operatorframework.io/feature-set: standard
+spec:
+ matchConstraints:
+ resourceRules:
+ - apiGroups:
+ - olm.operatorframework.io
+ apiVersions:
+ - v1
+ operations:
+ - CREATE
+ - UPDATE
+ resources:
+ - clusterextensions
+ validations:
+ - expression: "!has(object.spec.serviceAccount) || !has(object.spec.serviceAccount.name) || object.spec.serviceAccount.name == ''"
+ message: "spec.serviceAccount is deprecated, ignored, and will be removed in a future release. The operator-controller's cluster-admin service account is used for all cluster interactions."
+---
+# Source: olmv1/templates/validatingadmissionpolicybinding-clusterextension-serviceaccount-deprecated.yml
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicyBinding
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ app.kubernetes.io/part-of: olm
+ annotations:
+ olm.operatorframework.io/feature-set: standard
+spec:
+ policyName: clusterextension-serviceaccount-deprecated
+ validationActions:
+ - Warn
diff --git a/mkdocs.yml b/mkdocs.yml
index e891896222..4d4484687f 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -40,7 +40,6 @@ nav:
- Version Pinning: howto/how-to-pin-version.md
- Version Range Upgrades: howto/how-to-version-range-upgrades.md
- Z-Stream Upgrades: howto/how-to-z-stream-upgrades.md
- - Derive Service Account Permissions: howto/derive-service-account.md
- Grant Access to Your Extension's API: howto/how-to-grant-api-access.md
- Conceptual Guides:
- Single Owner Objects: concepts/single-owner-objects.md
diff --git a/openshift/operator-controller/manifests-experimental.yaml b/openshift/operator-controller/manifests-experimental.yaml
index 91b6150336..29b1d6a165 100644
--- a/openshift/operator-controller/manifests-experimental.yaml
+++ b/openshift/operator-controller/manifests-experimental.yaml
@@ -91,7 +91,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
- controller-gen.kubebuilder.io/version: v0.20.1
+ controller-gen.kubebuilder.io/version: v0.21.0
olm.operatorframework.io/generator: experimental
name: clusterextensions.olm.operatorframework.io
spec:
@@ -231,8 +231,7 @@ spec:
namespace:
description: |-
namespace specifies a Kubernetes namespace.
- This is the namespace where the provided ServiceAccount must exist.
- It also designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
+ It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
This namespace must exist.
@@ -260,18 +259,18 @@ spec:
type: integer
serviceAccount:
description: |-
- serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
- that are required to manage the extension.
- The ServiceAccount must be configured with the necessary permissions to perform these interactions.
- The ServiceAccount must exist in the namespace referenced in the spec.
- The serviceAccount field is required.
+ serviceAccount is a deprecated field and is completely ignored.
+ OLMv1 is a single-tenant system where users with ClusterExtension write access are
+ effectively delegated cluster-admin trust. The operator-controller runs with
+ cluster-admin privileges and uses its own service account for all cluster interactions.
+
+ Deprecated: serviceAccount is no longer used and will be removed in a future release.
properties:
name:
description: |-
- name is a required, immutable reference to the name of the ServiceAccount used for installation
- and management of the content for the package specified in the packageName field.
+ name is a deprecated field and is completely ignored.
- This ServiceAccount must exist in the installNamespace.
+ Deprecated: name is no longer used and will be removed in a future release.
The name field follows the DNS subdomain standard as defined in [RFC 1123].
It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
@@ -292,12 +291,10 @@ spec:
maxLength: 253
type: string
x-kubernetes-validations:
- - message: name is immutable
- rule: self == oldSelf
+ - message: name is immutable once set, but may be cleared
+ rule: self == oldSelf || size(self) == 0
- message: name must be a valid DNS1123 subdomain. It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.), start and end with an alphanumeric character, and be no longer than 253 characters
- rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
- required:
- - name
+ rule: size(self) == 0 || self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
type: object
source:
description: |-
@@ -568,7 +565,6 @@ spec:
rule: 'has(self.sourceType) && self.sourceType == ''Catalog'' ? has(self.catalog) : !has(self.catalog)'
required:
- namespace
- - serviceAccount
- source
type: object
status:
@@ -858,85 +854,6 @@ rules:
- list
- watch
---
-# Source: olmv1/templates/rbac/clusterrole-operator-controller-manager-role.yml
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: operator-controller-manager-role
- labels:
- app.kubernetes.io/name: operator-controller
- app.kubernetes.io/part-of: olm
- annotations:
- olm.operatorframework.io/feature-set: experimental
-rules:
- - apiGroups:
- - ""
- resources:
- - serviceaccounts/token
- verbs:
- - create
- - apiGroups:
- - ""
- resources:
- - serviceaccounts
- verbs:
- - get
- - apiGroups:
- - apiextensions.k8s.io
- resources:
- - customresourcedefinitions
- verbs:
- - get
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clustercatalogs
- verbs:
- - get
- - list
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions
- verbs:
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/finalizers
- verbs:
- - update
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/status
- verbs:
- - patch
- - update
- - apiGroups:
- - rbac.authorization.k8s.io
- resources:
- - clusterrolebindings
- - clusterroles
- - rolebindings
- - roles
- verbs:
- - list
- - watch
- - apiGroups:
- - security.openshift.io
- resources:
- - securitycontextconstraints
- resourceNames:
- - privileged
- verbs:
- - use
----
# Source: olmv1/templates/rbac/clusterrolebinding-common-proxy-rolebinding.yml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
@@ -965,11 +882,11 @@ metadata:
labels:
app.kubernetes.io/name: operator-controller
app.kubernetes.io/part-of: olm
- name: operator-controller-manager-rolebinding
+ name: operator-controller-cluster-admin-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
- name: operator-controller-manager-role
+ name: cluster-admin
subjects:
- kind: ServiceAccount
name: operator-controller-controller-manager
@@ -1412,3 +1329,44 @@ spec:
matchLabels:
app.kubernetes.io/name: operator-controller
serviceDiscoveryRole: EndpointSlice
+---
+# Source: olmv1/templates/validatingadmissionpolicy-clusterextension-serviceaccount-deprecated.yml
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicy
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ app.kubernetes.io/part-of: olm
+ annotations:
+ olm.operatorframework.io/feature-set: experimental
+spec:
+ matchConstraints:
+ resourceRules:
+ - apiGroups:
+ - olm.operatorframework.io
+ apiVersions:
+ - v1
+ operations:
+ - CREATE
+ - UPDATE
+ resources:
+ - clusterextensions
+ validations:
+ - expression: "!has(object.spec.serviceAccount) || !has(object.spec.serviceAccount.name) || object.spec.serviceAccount.name == ''"
+ message: "spec.serviceAccount is deprecated, ignored, and will be removed in a future release. The operator-controller's cluster-admin service account is used for all cluster interactions."
+---
+# Source: olmv1/templates/validatingadmissionpolicybinding-clusterextension-serviceaccount-deprecated.yml
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicyBinding
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ app.kubernetes.io/part-of: olm
+ annotations:
+ olm.operatorframework.io/feature-set: experimental
+spec:
+ policyName: clusterextension-serviceaccount-deprecated
+ validationActions:
+ - Warn
diff --git a/openshift/operator-controller/manifests.yaml b/openshift/operator-controller/manifests.yaml
index 12e01be385..a43ed9bceb 100644
--- a/openshift/operator-controller/manifests.yaml
+++ b/openshift/operator-controller/manifests.yaml
@@ -91,7 +91,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
- controller-gen.kubebuilder.io/version: v0.20.1
+ controller-gen.kubebuilder.io/version: v0.21.0
olm.operatorframework.io/generator: standard
name: clusterextensions.olm.operatorframework.io
spec:
@@ -195,8 +195,7 @@ spec:
namespace:
description: |-
namespace specifies a Kubernetes namespace.
- This is the namespace where the provided ServiceAccount must exist.
- It also designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
+ It designates the default namespace where namespace-scoped resources for the extension are applied to the cluster.
Some extensions may contain namespace-scoped resources to be applied in other namespaces.
This namespace must exist.
@@ -214,18 +213,18 @@ spec:
rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")
serviceAccount:
description: |-
- serviceAccount specifies a ServiceAccount used to perform all interactions with the cluster
- that are required to manage the extension.
- The ServiceAccount must be configured with the necessary permissions to perform these interactions.
- The ServiceAccount must exist in the namespace referenced in the spec.
- The serviceAccount field is required.
+ serviceAccount is a deprecated field and is completely ignored.
+ OLMv1 is a single-tenant system where users with ClusterExtension write access are
+ effectively delegated cluster-admin trust. The operator-controller runs with
+ cluster-admin privileges and uses its own service account for all cluster interactions.
+
+ Deprecated: serviceAccount is no longer used and will be removed in a future release.
properties:
name:
description: |-
- name is a required, immutable reference to the name of the ServiceAccount used for installation
- and management of the content for the package specified in the packageName field.
+ name is a deprecated field and is completely ignored.
- This ServiceAccount must exist in the installNamespace.
+ Deprecated: name is no longer used and will be removed in a future release.
The name field follows the DNS subdomain standard as defined in [RFC 1123].
It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),
@@ -246,12 +245,10 @@ spec:
maxLength: 253
type: string
x-kubernetes-validations:
- - message: name is immutable
- rule: self == oldSelf
+ - message: name is immutable once set, but may be cleared
+ rule: self == oldSelf || size(self) == 0
- message: name must be a valid DNS1123 subdomain. It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.), start and end with an alphanumeric character, and be no longer than 253 characters
- rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
- required:
- - name
+ rule: size(self) == 0 || self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
type: object
source:
description: |-
@@ -522,7 +519,6 @@ spec:
rule: 'has(self.sourceType) && self.sourceType == ''Catalog'' ? has(self.catalog) : !has(self.catalog)'
required:
- namespace
- - serviceAccount
- source
type: object
status:
@@ -707,85 +703,6 @@ rules:
- list
- watch
---
-# Source: olmv1/templates/rbac/clusterrole-operator-controller-manager-role.yml
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: operator-controller-manager-role
- labels:
- app.kubernetes.io/name: operator-controller
- app.kubernetes.io/part-of: olm
- annotations:
- olm.operatorframework.io/feature-set: standard
-rules:
- - apiGroups:
- - ""
- resources:
- - serviceaccounts/token
- verbs:
- - create
- - apiGroups:
- - ""
- resources:
- - serviceaccounts
- verbs:
- - get
- - apiGroups:
- - apiextensions.k8s.io
- resources:
- - customresourcedefinitions
- verbs:
- - get
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clustercatalogs
- verbs:
- - get
- - list
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions
- verbs:
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/finalizers
- verbs:
- - update
- - apiGroups:
- - olm.operatorframework.io
- resources:
- - clusterextensions/status
- verbs:
- - patch
- - update
- - apiGroups:
- - rbac.authorization.k8s.io
- resources:
- - clusterrolebindings
- - clusterroles
- - rolebindings
- - roles
- verbs:
- - list
- - watch
- - apiGroups:
- - security.openshift.io
- resources:
- - securitycontextconstraints
- resourceNames:
- - privileged
- verbs:
- - use
----
# Source: olmv1/templates/rbac/clusterrolebinding-common-proxy-rolebinding.yml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
@@ -814,11 +731,11 @@ metadata:
labels:
app.kubernetes.io/name: operator-controller
app.kubernetes.io/part-of: olm
- name: operator-controller-manager-rolebinding
+ name: operator-controller-cluster-admin-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
- name: operator-controller-manager-role
+ name: cluster-admin
subjects:
- kind: ServiceAccount
name: operator-controller-controller-manager
@@ -1087,9 +1004,7 @@ spec:
- --feature-gates=BundleReleaseSupport=false
- --feature-gates=DeploymentConfig=false
- --feature-gates=HelmChartSupport=false
- - --feature-gates=PreflightPermissions=false
- --feature-gates=SingleOwnNamespaceInstallSupport=false
- - --feature-gates=SyntheticPermissions=false
- --feature-gates=WebhookProviderOpenshiftServiceCA=false
- --tls-cert=/var/certs/tls.crt
- --tls-key=/var/certs/tls.key
@@ -1264,3 +1179,44 @@ spec:
matchLabels:
app.kubernetes.io/name: operator-controller
serviceDiscoveryRole: EndpointSlice
+---
+# Source: olmv1/templates/validatingadmissionpolicy-clusterextension-serviceaccount-deprecated.yml
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicy
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ app.kubernetes.io/part-of: olm
+ annotations:
+ olm.operatorframework.io/feature-set: standard
+spec:
+ matchConstraints:
+ resourceRules:
+ - apiGroups:
+ - olm.operatorframework.io
+ apiVersions:
+ - v1
+ operations:
+ - CREATE
+ - UPDATE
+ resources:
+ - clusterextensions
+ validations:
+ - expression: "!has(object.spec.serviceAccount) || !has(object.spec.serviceAccount.name) || object.spec.serviceAccount.name == ''"
+ message: "spec.serviceAccount is deprecated, ignored, and will be removed in a future release. The operator-controller's cluster-admin service account is used for all cluster interactions."
+---
+# Source: olmv1/templates/validatingadmissionpolicybinding-clusterextension-serviceaccount-deprecated.yml
+apiVersion: admissionregistration.k8s.io/v1
+kind: ValidatingAdmissionPolicyBinding
+metadata:
+ name: clusterextension-serviceaccount-deprecated
+ labels:
+ app.kubernetes.io/name: operator-controller
+ app.kubernetes.io/part-of: olm
+ annotations:
+ olm.operatorframework.io/feature-set: standard
+spec:
+ policyName: clusterextension-serviceaccount-deprecated
+ validationActions:
+ - Warn
diff --git a/openshift/tests-extension/pkg/bindata/qe/bindata.go b/openshift/tests-extension/pkg/bindata/qe/bindata.go
index f57893af57..a7e1d5199a 100644
--- a/openshift/tests-extension/pkg/bindata/qe/bindata.go
+++ b/openshift/tests-extension/pkg/bindata/qe/bindata.go
@@ -2,8 +2,6 @@
// sources:
// test/qe/testdata/olm/basic-bd-plain-image.yaml
// test/qe/testdata/olm/basic-bd-registry-image.yaml
-// test/qe/testdata/olm/binding-prefligth.yaml
-// test/qe/testdata/olm/binding-prefligth_multirole.yaml
// test/qe/testdata/olm/cip.yaml
// test/qe/testdata/olm/clustercatalog-secret-withlabel.yaml
// test/qe/testdata/olm/clustercatalog-secret.yaml
@@ -28,17 +26,6 @@
// test/qe/testdata/olm/crd-nginxolm74923.yaml
// test/qe/testdata/olm/icsp-single-mirror.yaml
// test/qe/testdata/olm/itdms-full-mirror.yaml
-// test/qe/testdata/olm/prefligth-clusterrole.yaml
-// test/qe/testdata/olm/sa-admin.yaml
-// test/qe/testdata/olm/sa-nginx-insufficient-bundle-boxcutter.yaml
-// test/qe/testdata/olm/sa-nginx-insufficient-bundle.yaml
-// test/qe/testdata/olm/sa-nginx-insufficient-operand-clusterrole-boxcutter.yaml
-// test/qe/testdata/olm/sa-nginx-insufficient-operand-clusterrole.yaml
-// test/qe/testdata/olm/sa-nginx-insufficient-operand-rbac-boxcutter.yaml
-// test/qe/testdata/olm/sa-nginx-insufficient-operand-rbac.yaml
-// test/qe/testdata/olm/sa-nginx-limited-boxcutter.yaml
-// test/qe/testdata/olm/sa-nginx-limited.yaml
-// test/qe/testdata/olm/sa.yaml
package testdata
import (
@@ -166,128 +153,6 @@ func testQeTestdataOlmBasicBdRegistryImageYaml() (*asset, error) {
return a, nil
}
-var _testQeTestdataOlmBindingPrefligthYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-binding-preflight-template
-objects:
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${CLUSTERROLESANAME}-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${CLUSTERROLESANAME}"
- subjects:
- - kind: ServiceAccount
- name: "${SANAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${ROLENAME}-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${ROLENAME}"
- namespace: "${NAMESPACE}"
- subjects:
- - kind: ServiceAccount
- name: "${SANAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: SANAME
- - name: ROLENAME
- - name: CLUSTERROLESANAME
- - name: NAMESPACE
-`)
-
-func testQeTestdataOlmBindingPrefligthYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmBindingPrefligthYaml, nil
-}
-
-func testQeTestdataOlmBindingPrefligthYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmBindingPrefligthYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/binding-prefligth.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-var _testQeTestdataOlmBindingPrefligth_multiroleYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-binding-preflight-template
-objects:
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${CLUSTERROLESANAME}-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${CLUSTERROLESANAME}"
- subjects:
- - kind: ServiceAccount
- name: "${SANAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${ROLENAME}-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${ROLENAME}"
- namespace: "${NAMESPACE}"
- subjects:
- - kind: ServiceAccount
- name: "${SANAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${WATCHROLENAME}-binding"
- namespace: "${WATCHNAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${WATCHROLENAME}"
- namespace: "${WATCHNAMESPACE}"
- subjects:
- - kind: ServiceAccount
- name: "${SANAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: SANAME
- - name: ROLENAME
- - name: CLUSTERROLESANAME
- - name: NAMESPACE
- - name: WATCHROLENAME
- - name: WATCHNAMESPACE
-`)
-
-func testQeTestdataOlmBindingPrefligth_multiroleYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmBindingPrefligth_multiroleYaml, nil
-}
-
-func testQeTestdataOlmBindingPrefligth_multiroleYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmBindingPrefligth_multiroleYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/binding-prefligth_multirole.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
var _testQeTestdataOlmCipYaml = []byte(`kind: Template
apiVersion: template.openshift.io/v1
metadata:
@@ -551,8 +416,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
config:
configType: Inline
inline:
@@ -574,7 +437,6 @@ parameters:
- name: PACKAGE
- name: CHANNEL
- name: VERSION
-- name: SANAME
- name: WATCHNS
value: ""
- name: POLICY
@@ -613,8 +475,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -630,7 +490,6 @@ parameters:
- name: NAME
- name: INSTALLNAMESPACE
- name: PACKAGE
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: EXPRESSIONSVALUE1
@@ -668,8 +527,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -689,7 +546,6 @@ parameters:
- name: NAME
- name: INSTALLNAMESPACE
- name: PACKAGE
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
@@ -732,8 +588,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
config:
configType: Inline
inline:
@@ -756,7 +610,6 @@ parameters:
- name: PACKAGE
- name: CHANNEL
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
@@ -794,8 +647,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -810,7 +661,6 @@ parameters:
- name: INSTALLNAMESPACE
- name: PACKAGE
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
@@ -848,8 +698,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -862,7 +710,6 @@ parameters:
- name: NAME
- name: INSTALLNAMESPACE
- name: PACKAGE
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
@@ -900,8 +747,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -917,7 +762,6 @@ parameters:
- name: INSTALLNAMESPACE
- name: PACKAGE
- name: CHANNEL
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
@@ -954,8 +798,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
config:
configType: Inline
inline:
@@ -977,7 +819,6 @@ parameters:
- name: PACKAGE
- name: CHANNEL
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
@@ -1016,8 +857,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
config:
configType: Inline
inline:
@@ -1037,7 +876,6 @@ parameters:
- name: WATCHNS
- name: PACKAGE
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: SOURCETYPE
@@ -1078,8 +916,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -1097,7 +933,6 @@ parameters:
- name: PACKAGE
- name: CHANNEL
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
@@ -1135,8 +970,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -1151,7 +984,6 @@ parameters:
- name: PACKAGE
- name: CHANNEL
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: SOURCETYPE
@@ -1185,8 +1017,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -1198,7 +1028,6 @@ parameters:
- name: INSTALLNAMESPACE
- name: PACKAGE
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: SOURCETYPE
@@ -1233,8 +1062,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -1243,7 +1070,6 @@ parameters:
- name: NAME
- name: INSTALLNAMESPACE
- name: PACKAGE
-- name: SANAME
- name: SOURCETYPE
value: "Catalog"
@@ -1277,8 +1103,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -1291,7 +1115,6 @@ parameters:
- name: INSTALLNAMESPACE
- name: PACKAGE
- name: CHANNEL
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: SOURCETYPE
@@ -1503,1813 +1326,6 @@ func testQeTestdataOlmItdmsFullMirrorYaml() (*asset, error) {
return a, nil
}
-var _testQeTestdataOlmPrefligthClusterroleYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-preflight-clusterrole-template
-objects:
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}"
- rules:
-parameters:
- - name: NAME
-`)
-
-func testQeTestdataOlmPrefligthClusterroleYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmPrefligthClusterroleYaml, nil
-}
-
-func testQeTestdataOlmPrefligthClusterroleYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmPrefligthClusterroleYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/prefligth-clusterrole.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-var _testQeTestdataOlmSaAdminYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-admin-template
-objects:
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-admin-clusterrole"
- rules:
- - apiGroups:
- - "*"
- resources:
- - "*"
- verbs:
- - "*"
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-admin-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-admin-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
-
-`)
-
-func testQeTestdataOlmSaAdminYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmSaAdminYaml, nil
-}
-
-func testQeTestdataOlmSaAdminYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmSaAdminYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/sa-admin.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-var _testQeTestdataOlmSaNginxInsufficientBundleBoxcutterYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-insufficient-bundle-boxcutter-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- # resourceNames:
- # - nginx-ok-v3283-754-15pkpuong3owt1jn01uoyj8lm6p8jlxh03kuouq67dmv
- # - nginx-ok-v3283-754-2r5zqsa9t9nk0tln1f8x36ws3ks9r8cgwi70s2dgnl82
- # - nginx-ok-v3283-75493-metrics-reader
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- # resourceNames:
- # - nginx-ok-v3283-754-15pkpuong3owt1jn01uoyj8lm6p8jlxh03kuouq67dmv
- # - nginx-ok-v3283-754-2r5zqsa9t9nk0tln1f8x36ws3ks9r8cgwi70s2dgnl82
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- # resourceNames: [nginx-ok-v3283-75493-controller-manager]
- # - apiGroups: [""]
- # resources: [serviceaccounts]
- # verbs: [create]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- # resourceNames: [nginx-ok-v3283-75493-controller-manager-metrics-service]
- - apiGroups: [""]
- resources: [services]
- verbs: [create]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- # resourceNames: [nginx-ok-v3283-75493-controller-manager]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - ""
- resources:
- - secrets
- - pods
- - pods/exec
- - pods/log
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
-`)
-
-func testQeTestdataOlmSaNginxInsufficientBundleBoxcutterYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmSaNginxInsufficientBundleBoxcutterYaml, nil
-}
-
-func testQeTestdataOlmSaNginxInsufficientBundleBoxcutterYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmSaNginxInsufficientBundleBoxcutterYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/sa-nginx-insufficient-bundle-boxcutter.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-var _testQeTestdataOlmSaNginxInsufficientBundleYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-insufficient-bundle-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- # resourceNames:
- # - nginx-ok-v3283-754-15pkpuong3owt1jn01uoyj8lm6p8jlxh03kuouq67dmv
- # - nginx-ok-v3283-754-2r5zqsa9t9nk0tln1f8x36ws3ks9r8cgwi70s2dgnl82
- # - nginx-ok-v3283-75493-metrics-reader
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- # resourceNames:
- # - nginx-ok-v3283-754-15pkpuong3owt1jn01uoyj8lm6p8jlxh03kuouq67dmv
- # - nginx-ok-v3283-754-2r5zqsa9t9nk0tln1f8x36ws3ks9r8cgwi70s2dgnl82
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- # resourceNames: [nginx-ok-v3283-75493-controller-manager]
- # - apiGroups: [""]
- # resources: [serviceaccounts]
- # verbs: [create]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- # resourceNames: [nginx-ok-v3283-75493-controller-manager-metrics-service]
- - apiGroups: [""]
- resources: [services]
- verbs: [create]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- # resourceNames: [nginx-ok-v3283-75493-controller-manager]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - ""
- resources:
- - secrets
- - pods
- - pods/exec
- - pods/log
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
-`)
-
-func testQeTestdataOlmSaNginxInsufficientBundleYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmSaNginxInsufficientBundleYaml, nil
-}
-
-func testQeTestdataOlmSaNginxInsufficientBundleYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmSaNginxInsufficientBundleYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/sa-nginx-insufficient-bundle.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-var _testQeTestdataOlmSaNginxInsufficientOperandClusterroleBoxcutterYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-insufficient-operand-clusterrole-boxcutter-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [create]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [create]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
-`)
-
-func testQeTestdataOlmSaNginxInsufficientOperandClusterroleBoxcutterYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmSaNginxInsufficientOperandClusterroleBoxcutterYaml, nil
-}
-
-func testQeTestdataOlmSaNginxInsufficientOperandClusterroleBoxcutterYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmSaNginxInsufficientOperandClusterroleBoxcutterYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/sa-nginx-insufficient-operand-clusterrole-boxcutter.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-var _testQeTestdataOlmSaNginxInsufficientOperandClusterroleYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-insufficient-operand-clusterrole-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [create]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [create]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
-`)
-
-func testQeTestdataOlmSaNginxInsufficientOperandClusterroleYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmSaNginxInsufficientOperandClusterroleYaml, nil
-}
-
-func testQeTestdataOlmSaNginxInsufficientOperandClusterroleYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmSaNginxInsufficientOperandClusterroleYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/sa-nginx-insufficient-operand-clusterrole.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-var _testQeTestdataOlmSaNginxInsufficientOperandRbacBoxcutterYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-insufficient-operand-rbac-boxcutter-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [olm.operatorframework.io]
- resources: [clusterobjectsets/finalizers]
- verbs: [update]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [create]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [create]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
-`)
-
-func testQeTestdataOlmSaNginxInsufficientOperandRbacBoxcutterYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmSaNginxInsufficientOperandRbacBoxcutterYaml, nil
-}
-
-func testQeTestdataOlmSaNginxInsufficientOperandRbacBoxcutterYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmSaNginxInsufficientOperandRbacBoxcutterYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/sa-nginx-insufficient-operand-rbac-boxcutter.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-var _testQeTestdataOlmSaNginxInsufficientOperandRbacYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-insufficient-operand-rbac-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [olm.operatorframework.io]
- resources: [clusterextensions/finalizers]
- verbs: [update]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [create]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [create]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
-`)
-
-func testQeTestdataOlmSaNginxInsufficientOperandRbacYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmSaNginxInsufficientOperandRbacYaml, nil
-}
-
-func testQeTestdataOlmSaNginxInsufficientOperandRbacYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmSaNginxInsufficientOperandRbacYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/sa-nginx-insufficient-operand-rbac.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-var _testQeTestdataOlmSaNginxLimitedBoxcutterYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-limited-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [olm.operatorframework.io]
- resources: [clusterobjectsets/finalizers]
- verbs: [update]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts/finalizers]
- verbs: [update]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts/finalizers]
- verbs: [update]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - namespaces
- verbs:
- - get
- - list
- - watch
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - ""
- resources:
- - secrets
- - pods
- - pods/exec
- - pods/log
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
-`)
-
-func testQeTestdataOlmSaNginxLimitedBoxcutterYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmSaNginxLimitedBoxcutterYaml, nil
-}
-
-func testQeTestdataOlmSaNginxLimitedBoxcutterYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmSaNginxLimitedBoxcutterYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/sa-nginx-limited-boxcutter.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-var _testQeTestdataOlmSaNginxLimitedYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-limited-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [olm.operatorframework.io]
- resources: [clusterextensions/finalizers]
- verbs: [update]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - namespaces
- verbs:
- - get
- - list
- - watch
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - ""
- resources:
- - secrets
- - pods
- - pods/exec
- - pods/log
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
-`)
-
-func testQeTestdataOlmSaNginxLimitedYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmSaNginxLimitedYaml, nil
-}
-
-func testQeTestdataOlmSaNginxLimitedYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmSaNginxLimitedYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/sa-nginx-limited.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-var _testQeTestdataOlmSaYaml = []byte(`apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
-`)
-
-func testQeTestdataOlmSaYamlBytes() ([]byte, error) {
- return _testQeTestdataOlmSaYaml, nil
-}
-
-func testQeTestdataOlmSaYaml() (*asset, error) {
- bytes, err := testQeTestdataOlmSaYamlBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "test/qe/testdata/olm/sa.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
@@ -3364,8 +1380,6 @@ func AssetNames() []string {
var _bindata = map[string]func() (*asset, error){
"test/qe/testdata/olm/basic-bd-plain-image.yaml": testQeTestdataOlmBasicBdPlainImageYaml,
"test/qe/testdata/olm/basic-bd-registry-image.yaml": testQeTestdataOlmBasicBdRegistryImageYaml,
- "test/qe/testdata/olm/binding-prefligth.yaml": testQeTestdataOlmBindingPrefligthYaml,
- "test/qe/testdata/olm/binding-prefligth_multirole.yaml": testQeTestdataOlmBindingPrefligth_multiroleYaml,
"test/qe/testdata/olm/cip.yaml": testQeTestdataOlmCipYaml,
"test/qe/testdata/olm/clustercatalog-secret-withlabel.yaml": testQeTestdataOlmClustercatalogSecretWithlabelYaml,
"test/qe/testdata/olm/clustercatalog-secret.yaml": testQeTestdataOlmClustercatalogSecretYaml,
@@ -3390,17 +1404,6 @@ var _bindata = map[string]func() (*asset, error){
"test/qe/testdata/olm/crd-nginxolm74923.yaml": testQeTestdataOlmCrdNginxolm74923Yaml,
"test/qe/testdata/olm/icsp-single-mirror.yaml": testQeTestdataOlmIcspSingleMirrorYaml,
"test/qe/testdata/olm/itdms-full-mirror.yaml": testQeTestdataOlmItdmsFullMirrorYaml,
- "test/qe/testdata/olm/prefligth-clusterrole.yaml": testQeTestdataOlmPrefligthClusterroleYaml,
- "test/qe/testdata/olm/sa-admin.yaml": testQeTestdataOlmSaAdminYaml,
- "test/qe/testdata/olm/sa-nginx-insufficient-bundle-boxcutter.yaml": testQeTestdataOlmSaNginxInsufficientBundleBoxcutterYaml,
- "test/qe/testdata/olm/sa-nginx-insufficient-bundle.yaml": testQeTestdataOlmSaNginxInsufficientBundleYaml,
- "test/qe/testdata/olm/sa-nginx-insufficient-operand-clusterrole-boxcutter.yaml": testQeTestdataOlmSaNginxInsufficientOperandClusterroleBoxcutterYaml,
- "test/qe/testdata/olm/sa-nginx-insufficient-operand-clusterrole.yaml": testQeTestdataOlmSaNginxInsufficientOperandClusterroleYaml,
- "test/qe/testdata/olm/sa-nginx-insufficient-operand-rbac-boxcutter.yaml": testQeTestdataOlmSaNginxInsufficientOperandRbacBoxcutterYaml,
- "test/qe/testdata/olm/sa-nginx-insufficient-operand-rbac.yaml": testQeTestdataOlmSaNginxInsufficientOperandRbacYaml,
- "test/qe/testdata/olm/sa-nginx-limited-boxcutter.yaml": testQeTestdataOlmSaNginxLimitedBoxcutterYaml,
- "test/qe/testdata/olm/sa-nginx-limited.yaml": testQeTestdataOlmSaNginxLimitedYaml,
- "test/qe/testdata/olm/sa.yaml": testQeTestdataOlmSaYaml,
}
// AssetDir returns the file names below a certain
@@ -3452,8 +1455,6 @@ var _bintree = &bintree{nil, map[string]*bintree{
"olm": {nil, map[string]*bintree{
"basic-bd-plain-image.yaml": {testQeTestdataOlmBasicBdPlainImageYaml, map[string]*bintree{}},
"basic-bd-registry-image.yaml": {testQeTestdataOlmBasicBdRegistryImageYaml, map[string]*bintree{}},
- "binding-prefligth.yaml": {testQeTestdataOlmBindingPrefligthYaml, map[string]*bintree{}},
- "binding-prefligth_multirole.yaml": {testQeTestdataOlmBindingPrefligth_multiroleYaml, map[string]*bintree{}},
"cip.yaml": {testQeTestdataOlmCipYaml, map[string]*bintree{}},
"clustercatalog-secret-withlabel.yaml": {testQeTestdataOlmClustercatalogSecretWithlabelYaml, map[string]*bintree{}},
"clustercatalog-secret.yaml": {testQeTestdataOlmClustercatalogSecretYaml, map[string]*bintree{}},
@@ -3470,25 +1471,14 @@ var _bintree = &bintree{nil, map[string]*bintree{
"clusterextension-withselectorlabel-inlineconfig.yaml": {testQeTestdataOlmClusterextensionWithselectorlabelInlineconfigYaml, map[string]*bintree{}},
"clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml": {testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelOwnsingleYaml, map[string]*bintree{}},
"clusterextension-withselectorlabel.yaml": {testQeTestdataOlmClusterextensionWithselectorlabelYaml, map[string]*bintree{}},
- "clusterextension.yaml": {testQeTestdataOlmClusterextensionYaml, map[string]*bintree{}},
- "clusterextensionWithoutChannel.yaml": {testQeTestdataOlmClusterextensionwithoutchannelYaml, map[string]*bintree{}},
- "clusterextensionWithoutChannelVersion.yaml": {testQeTestdataOlmClusterextensionwithoutchannelversionYaml, map[string]*bintree{}},
- "clusterextensionWithoutVersion.yaml": {testQeTestdataOlmClusterextensionwithoutversionYaml, map[string]*bintree{}},
- "cr-webhookTest.yaml": {testQeTestdataOlmCrWebhooktestYaml, map[string]*bintree{}},
- "crd-nginxolm74923.yaml": {testQeTestdataOlmCrdNginxolm74923Yaml, map[string]*bintree{}},
- "icsp-single-mirror.yaml": {testQeTestdataOlmIcspSingleMirrorYaml, map[string]*bintree{}},
- "itdms-full-mirror.yaml": {testQeTestdataOlmItdmsFullMirrorYaml, map[string]*bintree{}},
- "prefligth-clusterrole.yaml": {testQeTestdataOlmPrefligthClusterroleYaml, map[string]*bintree{}},
- "sa-admin.yaml": {testQeTestdataOlmSaAdminYaml, map[string]*bintree{}},
- "sa-nginx-insufficient-bundle-boxcutter.yaml": {testQeTestdataOlmSaNginxInsufficientBundleBoxcutterYaml, map[string]*bintree{}},
- "sa-nginx-insufficient-bundle.yaml": {testQeTestdataOlmSaNginxInsufficientBundleYaml, map[string]*bintree{}},
- "sa-nginx-insufficient-operand-clusterrole-boxcutter.yaml": {testQeTestdataOlmSaNginxInsufficientOperandClusterroleBoxcutterYaml, map[string]*bintree{}},
- "sa-nginx-insufficient-operand-clusterrole.yaml": {testQeTestdataOlmSaNginxInsufficientOperandClusterroleYaml, map[string]*bintree{}},
- "sa-nginx-insufficient-operand-rbac-boxcutter.yaml": {testQeTestdataOlmSaNginxInsufficientOperandRbacBoxcutterYaml, map[string]*bintree{}},
- "sa-nginx-insufficient-operand-rbac.yaml": {testQeTestdataOlmSaNginxInsufficientOperandRbacYaml, map[string]*bintree{}},
- "sa-nginx-limited-boxcutter.yaml": {testQeTestdataOlmSaNginxLimitedBoxcutterYaml, map[string]*bintree{}},
- "sa-nginx-limited.yaml": {testQeTestdataOlmSaNginxLimitedYaml, map[string]*bintree{}},
- "sa.yaml": {testQeTestdataOlmSaYaml, map[string]*bintree{}},
+ "clusterextension.yaml": {testQeTestdataOlmClusterextensionYaml, map[string]*bintree{}},
+ "clusterextensionWithoutChannel.yaml": {testQeTestdataOlmClusterextensionwithoutchannelYaml, map[string]*bintree{}},
+ "clusterextensionWithoutChannelVersion.yaml": {testQeTestdataOlmClusterextensionwithoutchannelversionYaml, map[string]*bintree{}},
+ "clusterextensionWithoutVersion.yaml": {testQeTestdataOlmClusterextensionwithoutversionYaml, map[string]*bintree{}},
+ "cr-webhookTest.yaml": {testQeTestdataOlmCrWebhooktestYaml, map[string]*bintree{}},
+ "crd-nginxolm74923.yaml": {testQeTestdataOlmCrdNginxolm74923Yaml, map[string]*bintree{}},
+ "icsp-single-mirror.yaml": {testQeTestdataOlmIcspSingleMirrorYaml, map[string]*bintree{}},
+ "itdms-full-mirror.yaml": {testQeTestdataOlmItdmsFullMirrorYaml, map[string]*bintree{}},
}},
}},
}},
diff --git a/openshift/tests-extension/pkg/helpers/cluster_extension.go b/openshift/tests-extension/pkg/helpers/cluster_extension.go
index 8441c485ce..428d22ab1d 100644
--- a/openshift/tests-extension/pkg/helpers/cluster_extension.go
+++ b/openshift/tests-extension/pkg/helpers/cluster_extension.go
@@ -3,15 +3,12 @@ package helpers
import (
"context"
"fmt"
- "time"
//nolint:staticcheck // ST1001: dot-imports for readability
. "github.com/onsi/ginkgo/v2"
//nolint:staticcheck // ST1001: dot-imports for readability
. "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
- rbacv1 "k8s.io/api/rbac/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
@@ -47,7 +44,7 @@ func WithCatalogNameSelector(catalogName string) ClusterExtensionOption {
})
}
-// CreateClusterExtension creates a ServiceAccount, ClusterRoleBinding, and ClusterExtension using typed APIs.
+// CreateClusterExtension creates a ClusterExtension using typed APIs.
// It returns the unique suffix and a cleanup function.
func CreateClusterExtension(packageName, version, namespace, unique string, opts ...ClusterExtensionOption) (string, func()) {
ctx := context.TODO()
@@ -56,72 +53,25 @@ func CreateClusterExtension(packageName, version, namespace, unique string, opts
unique = rand.String(4)
}
- saName := "install-test-sa-" + unique
- crbName := "install-test-crb-" + unique
ceName := "install-test-ce-" + unique
- // 1. Create ServiceAccount
- sa := NewServiceAccount(saName, namespace)
- Expect(k8sClient.Create(ctx, sa)).To(Succeed(),
- "failed to create ServiceAccount")
- By("ensuring ServiceAccount is available before proceeding")
- ExpectServiceAccountExists(ctx, saName, namespace)
-
- // 2. Create ClusterRoleBinding
- crb := NewClusterRoleBinding(crbName, "cluster-admin", saName, namespace)
- Expect(k8sClient.Create(ctx, crb)).To(Succeed(), "failed to create ClusterRoleBinding")
- By("ensuring ClusterRoleBinding is available before proceeding")
- ExpectClusterRoleBindingExists(ctx, crbName)
-
// 3. Create ClusterExtension
- ce := NewClusterExtensionObject(packageName, version, ceName, saName, namespace, opts...)
+ ce := NewClusterExtensionObject(packageName, version, ceName, namespace, opts...)
Expect(k8sClient.Create(ctx, ce)).To(Succeed(), "failed to create ClusterExtension")
// Cleanup closure
return ceName, func() {
- By("deleting CluserExtension, ClusterRoleBinding and ServiceAccount")
+ By("deleting CluserExtension")
_ = k8sClient.Delete(ctx, ce)
- _ = k8sClient.Delete(ctx, crb)
- _ = k8sClient.Delete(ctx, sa)
}
}
-// NewServiceAccount creates a new ServiceAccount.
-func NewServiceAccount(name, namespace string) *corev1.ServiceAccount {
- return &corev1.ServiceAccount{
- ObjectMeta: metav1.ObjectMeta{
- Name: name,
- Namespace: namespace,
- },
- }
-}
-
-// NewClusterRoleBinding creates a new ClusterRoleBinding object that binds a ClusterRole to a ServiceAccount.
-func NewClusterRoleBinding(name, roleName, saName, namespace string) *rbacv1.ClusterRoleBinding {
- return &rbacv1.ClusterRoleBinding{
- ObjectMeta: metav1.ObjectMeta{Name: name},
- RoleRef: rbacv1.RoleRef{
- APIGroup: "rbac.authorization.k8s.io",
- Kind: "ClusterRole",
- Name: roleName,
- },
- Subjects: []rbacv1.Subject{{
- Kind: "ServiceAccount",
- Name: saName,
- Namespace: namespace,
- }},
- }
-}
-
-// NewClusterExtensionObject creates a new ClusterExtension object with the specified package, version, name, and ServiceAccount.
-func NewClusterExtensionObject(pkg, version, ceName, saName, namespace string, opts ...ClusterExtensionOption) *olmv1.ClusterExtension {
+// NewClusterExtensionObject creates a new ClusterExtension object with the specified package, version, and name.
+func NewClusterExtensionObject(pkg, version, ceName, namespace string, opts ...ClusterExtensionOption) *olmv1.ClusterExtension {
ext := &olmv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{Name: ceName},
Spec: olmv1.ClusterExtensionSpec{
Namespace: namespace,
- ServiceAccount: olmv1.ServiceAccountReference{
- Name: saName,
- },
Source: olmv1.SourceConfig{
SourceType: olmv1.SourceTypeCatalog,
Catalog: &olmv1.CatalogFilter{
@@ -225,23 +175,3 @@ func EnsureCleanupClusterExtension(ctx context.Context, packageName, crdName str
}
}
}
-
-// ExpectServiceAccountExists waits for a ServiceAccount to be available and visible to the client.
-func ExpectServiceAccountExists(ctx context.Context, name, namespace string) {
- k8sClient := env.Get().K8sClient
- sa := &corev1.ServiceAccount{}
- Eventually(func(g Gomega) {
- err := k8sClient.Get(ctx, client.ObjectKey{Name: name, Namespace: namespace}, sa)
- g.Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to get ServiceAccount %q/%q: %v", namespace, name, err))
- }).WithTimeout(DefaultTimeout).WithPolling(DefaultPolling).Should(Succeed(), "ServiceAccount %q/%q did not become visible within timeout", namespace, name)
-}
-
-// ExpectClusterRoleBindingExists waits for a ClusterRoleBinding to be available and visible to the client.
-func ExpectClusterRoleBindingExists(ctx context.Context, name string) {
- k8sClient := env.Get().K8sClient
- crb := &rbacv1.ClusterRoleBinding{}
- Eventually(func(g Gomega) {
- err := k8sClient.Get(ctx, client.ObjectKey{Name: name}, crb)
- g.Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to get ClusterRoleBinding %q: %v", name, err))
- }).WithTimeout(2*time.Minute).WithPolling(DefaultPolling).Should(Succeed(), "ClusterRoleBinding %q did not become visible within timeout", name)
-}
diff --git a/openshift/tests-extension/pkg/helpers/in_cluster_bundles.go b/openshift/tests-extension/pkg/helpers/in_cluster_bundles.go
index 127078c4a4..c9e84e5233 100644
--- a/openshift/tests-extension/pkg/helpers/in_cluster_bundles.go
+++ b/openshift/tests-extension/pkg/helpers/in_cluster_bundles.go
@@ -80,10 +80,10 @@ func NewCatalogAndClusterBundles(ctx SpecContext, replacements map[string]string
// The builder (and deployer) service accounts are created by OpenShift itself which injects them in the NS.
By(fmt.Sprintf("waiting for builder serviceaccount in %s", nsName))
- ExpectServiceAccountExists(ctx, "builder", nsName)
+ expectServiceAccountExists(ctx, "builder", nsName)
By(fmt.Sprintf("waiting for deployer serviceaccount in %s", nsName))
- ExpectServiceAccountExists(ctx, "deployer", nsName)
+ expectServiceAccountExists(ctx, "deployer", nsName)
By("applying image-puller RoleBinding")
createImagePullerRoleBinding(rbName, nsName)
@@ -230,6 +230,16 @@ func createNamespace(namespace string) {
})
}
+// expectServiceAccountExists waits for a ServiceAccount to be available and visible to the client.
+func expectServiceAccountExists(ctx context.Context, name, namespace string) {
+ k8sClient := env.Get().K8sClient
+ sa := &corev1.ServiceAccount{}
+ Eventually(func(g Gomega) {
+ err := k8sClient.Get(ctx, client.ObjectKey{Name: name, Namespace: namespace}, sa)
+ g.Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to get ServiceAccount %q/%q: %v", namespace, name, err))
+ }).WithTimeout(DefaultTimeout).WithPolling(DefaultPolling).Should(Succeed(), "ServiceAccount %q/%q did not become visible within timeout", namespace, name)
+}
+
func createImageStream(name, namespace string) {
ctx := context.Background()
k8sClient := env.Get().K8sClient
diff --git a/openshift/tests-extension/test/olmv1-deploymentconfig.go b/openshift/tests-extension/test/olmv1-deploymentconfig.go
index 893126ad8c..95e94da6ed 100644
--- a/openshift/tests-extension/test/olmv1-deploymentconfig.go
+++ b/openshift/tests-extension/test/olmv1-deploymentconfig.go
@@ -66,9 +66,9 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMConfigAPI][Skipped:Disconnect
}
})
- // installAndVerify is a helper that creates an install namespace, ServiceAccount,
- // ClusterRoleBinding and ClusterExtension, waits for successful installation, and
- // then calls verify against the resulting DeploymentList. All resources are
+ // installAndVerify is a helper that creates an install namespace and
+ // ClusterExtension, waits for successful installation, and then calls
+ // verify against the resulting DeploymentList. All resources are
// cleaned up via DeferCleanup.
installAndVerify := func(
ctx SpecContext,
@@ -86,21 +86,9 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMConfigAPI][Skipped:Disconnect
_ = k8sClient.Delete(context.Background(), ns, client.PropagationPolicy(metav1.DeletePropagationForeground))
})
- saName := fmt.Sprintf("dc-%s-sa-%s", namePrefix, suffix)
- crbName := fmt.Sprintf("dc-%s-crb-%s", namePrefix, suffix)
ceName := fmt.Sprintf("dc-%s-ce-%s", namePrefix, suffix)
- sa := helpers.NewServiceAccount(saName, installNamespace)
- Expect(k8sClient.Create(ctx, sa)).To(Succeed())
- helpers.ExpectServiceAccountExists(ctx, saName, installNamespace)
- DeferCleanup(func() { _ = k8sClient.Delete(context.Background(), sa) })
-
- crb := helpers.NewClusterRoleBinding(crbName, "cluster-admin", saName, installNamespace)
- Expect(k8sClient.Create(ctx, crb)).To(Succeed())
- helpers.ExpectClusterRoleBindingExists(ctx, crbName)
- DeferCleanup(func() { _ = k8sClient.Delete(context.Background(), crb) })
-
- ce := helpers.NewClusterExtensionObject(opName, "", ceName, saName, installNamespace,
+ ce := helpers.NewClusterExtensionObject(opName, "", ceName, installNamespace,
helpers.WithCatalogNameSelector(ccName))
ce.Spec.Config = &olmv1.ClusterExtensionConfig{
ConfigType: olmv1.ClusterExtensionConfigTypeInline,
@@ -226,21 +214,9 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMConfigAPI][Skipped:Disconnect
_ = k8sClient.Delete(context.Background(), ns, client.PropagationPolicy(metav1.DeletePropagationForeground))
})
- saName := fmt.Sprintf("dc-%s-sa-%s", namePrefix, suffix)
- crbName := fmt.Sprintf("dc-%s-crb-%s", namePrefix, suffix)
ceName := fmt.Sprintf("dc-%s-ce-%s", namePrefix, suffix)
- sa := helpers.NewServiceAccount(saName, installNamespace)
- Expect(k8sClient.Create(ctx, sa)).To(Succeed())
- helpers.ExpectServiceAccountExists(ctx, saName, installNamespace)
- DeferCleanup(func() { _ = k8sClient.Delete(context.Background(), sa) })
-
- crb := helpers.NewClusterRoleBinding(crbName, "cluster-admin", saName, installNamespace)
- Expect(k8sClient.Create(ctx, crb)).To(Succeed())
- helpers.ExpectClusterRoleBindingExists(ctx, crbName)
- DeferCleanup(func() { _ = k8sClient.Delete(context.Background(), crb) })
-
- ce := helpers.NewClusterExtensionObject(opName, "", ceName, saName, installNamespace,
+ ce := helpers.NewClusterExtensionObject(opName, "", ceName, installNamespace,
helpers.WithCatalogNameSelector(ccName))
ce.Spec.Config = &olmv1.ClusterExtensionConfig{
ConfigType: olmv1.ClusterExtensionConfigTypeInline,
diff --git a/openshift/tests-extension/test/olmv1-preflight.go b/openshift/tests-extension/test/olmv1-preflight.go
deleted file mode 100644
index 1d58edf21b..0000000000
--- a/openshift/tests-extension/test/olmv1-preflight.go
+++ /dev/null
@@ -1,324 +0,0 @@
-package test
-
-import (
- "context"
- "fmt"
-
- //nolint:staticcheck // ST1001: dot-imports for readability
- . "github.com/onsi/ginkgo/v2"
- //nolint:staticcheck // ST1001: dot-imports for readability
- . "github.com/onsi/gomega"
-
- "github.com/openshift/api/features"
- "github.com/openshift/origin/test/extended/util/image"
- corev1 "k8s.io/api/core/v1"
- rbacv1 "k8s.io/api/rbac/v1"
- apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/rand"
- "sigs.k8s.io/controller-runtime/pkg/client"
-
- olmv1 "github.com/operator-framework/operator-controller/api/v1"
-
- singleownbundle "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/pkg/bindata/singleown/bundle"
- singleownindex "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/pkg/bindata/singleown/index"
- "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/pkg/env"
- "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/pkg/helpers"
-)
-
-type preflightAuthTestScenario int
-
-const (
- scenarioMissingServicePerms preflightAuthTestScenario = 0
- scenarioMissingCreateVerb preflightAuthTestScenario = 1
- scenarioMissingClusterRoleBindingsPerms preflightAuthTestScenario = 2
- scenarioMissingNamedConfigMapPerms preflightAuthTestScenario = 3
- scenarioMissingClusterExtensionsFinalizerPerms preflightAuthTestScenario = 4
- scenarioMissingEscalateAndBindPerms preflightAuthTestScenario = 5
- scenarioMissingClusterObjectSetsFinalizerPerms preflightAuthTestScenario = 6
-)
-
-const preflightBundleVersion = "0.0.5"
-
-var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMPreflightPermissionChecks][Skipped:Disconnected] OLMv1 operator preflight checks", func() {
- var (
- namespace string
- k8sClient client.Client
- catalogName string
- packageName string
- )
- BeforeEach(func(ctx SpecContext) {
- helpers.RequireOLMv1CapabilityOnOpenshift()
- helpers.RequireImageRegistry(ctx)
- k8sClient = env.Get().K8sClient
- namespace = "preflight-test-ns-" + rand.String(4)
-
- // Use an in-cluster catalog and bundle so tests do not depend on external indexes.
- crdSuffix := rand.String(4)
- packageName = fmt.Sprintf("preflight-operator-%s", crdSuffix)
- crdName := fmt.Sprintf("webhooktests-%s.webhook.operators.coreos.io", crdSuffix)
- helpers.EnsureCleanupClusterExtension(context.Background(), packageName, crdName)
-
- singleownImage := image.LocationFor("quay.io/olmtest/webhook-operator:v0.0.5")
- replacements := map[string]string{
- "{{ TEST-BUNDLE }}": "",
- "{{ NAMESPACE }}": "",
- "{{ TEST-CONTROLLER }}": singleownImage,
- "{{ CRD-SUFFIX }}": crdSuffix,
- "{{ PACKAGE-NAME }}": packageName,
- }
- _, _, catalogName, _ = helpers.NewCatalogAndClusterBundles(ctx, replacements,
- singleownindex.AssetNames, singleownindex.Asset,
- singleownbundle.AssetNames, singleownbundle.Asset,
- )
- By(fmt.Sprintf("catalog %q and package %q are ready", catalogName, packageName))
-
- By(fmt.Sprintf("creating namespace %s", namespace))
- ns := &corev1.Namespace{
- ObjectMeta: metav1.ObjectMeta{
- Name: namespace,
- },
- }
- Expect(k8sClient.Create(context.Background(), ns)).To(Succeed(), "failed to create test namespace")
- DeferCleanup(func() {
- _ = k8sClient.Delete(context.Background(), ns)
- })
- })
-
- It("should report error when {services} are not specified", func(ctx SpecContext) {
- runNegativePreflightTest(ctx, scenarioMissingServicePerms, namespace, packageName, catalogName)
- })
-
- It("should report error when {create} verb is not specified", func(ctx SpecContext) {
- runNegativePreflightTest(ctx, scenarioMissingCreateVerb, namespace, packageName, catalogName)
- })
-
- It("should report error when {ClusterRoleBindings} are not specified", func(ctx SpecContext) {
- runNegativePreflightTest(ctx, scenarioMissingClusterRoleBindingsPerms, namespace, packageName, catalogName)
- })
-
- It("should report error when {ConfigMap:resourceNames} are not all specified", func(ctx SpecContext) {
- runNegativePreflightTest(ctx, scenarioMissingNamedConfigMapPerms, namespace, packageName, catalogName)
- })
-
- It("should report error when {clusterextension/finalizer} is not specified", func(ctx SpecContext) {
- helpers.RequireFeatureGateDisabled(features.FeatureGateNewOLMBoxCutterRuntime)
- runNegativePreflightTest(ctx, scenarioMissingClusterExtensionsFinalizerPerms, namespace, packageName, catalogName)
- })
-
- It("should report error when {clusterobjectsets/finalizer} is not specified", func(ctx SpecContext) {
- helpers.RequireFeatureGateEnabled(features.FeatureGateNewOLMBoxCutterRuntime)
- runNegativePreflightTest(ctx, scenarioMissingClusterObjectSetsFinalizerPerms, namespace, packageName, catalogName)
- })
-
- It("should report error when {escalate, bind} is not specified", func(ctx SpecContext) {
- runNegativePreflightTest(ctx, scenarioMissingEscalateAndBindPerms, namespace, packageName, catalogName)
- })
-})
-
-// runNegativePreflightTest creates a ClusterRole that is missing one required permission,
-// a ClusterExtension that uses it (via the in-cluster catalog), then waits for the preflight failure.
-func runNegativePreflightTest(ctx context.Context, scenario preflightAuthTestScenario, namespace, packageName, catalogName string) {
- k8sClient := env.Get().K8sClient
- unique := rand.String(8)
-
- // Define names
- crName := fmt.Sprintf("install-test-cr-%s", unique)
- saName := fmt.Sprintf("install-test-sa-%s", unique)
- crbName := fmt.Sprintf("install-test-crb-%s", unique)
- ceName := fmt.Sprintf("install-test-ce-%s", unique)
-
- // Step 1: Create deficient ClusterRole
- defCR := createDeficientClusterRole(scenario, crName, ceName)
- Expect(k8sClient.Create(ctx, defCR)).To(Succeed(), "failed to create ClusterRole")
- DeferCleanup(func(ctx SpecContext) {
- _ = k8sClient.Delete(ctx, defCR)
- })
-
- // Step 2: Create matching ServiceAccount
- sa := helpers.NewServiceAccount(saName, namespace)
- Expect(k8sClient.Create(ctx, sa)).To(Succeed(), "failed to create ServiceAccount")
- DeferCleanup(func(ctx SpecContext) {
- _ = k8sClient.Delete(ctx, sa)
- })
-
- // Step 3: Bind SA to the deficient ClusterRole
- crb := helpers.NewClusterRoleBinding(crbName, crName, saName, namespace)
- Expect(k8sClient.Create(ctx, crb)).To(Succeed(), "failed to create ClusterRoleBinding")
- DeferCleanup(func(ctx SpecContext) {
- _ = k8sClient.Delete(ctx, crb)
- })
-
- // Step 4: Create ClusterExtension for that SA using the in-cluster catalog.
- // Set watchNamespace in config so the controller can run preflight; otherwise it fails on config validation first.
- ce := helpers.NewClusterExtensionObject(packageName, preflightBundleVersion, ceName, saName, namespace, helpers.WithCatalogNameSelector(catalogName))
- ce.Spec.Config = &olmv1.ClusterExtensionConfig{
- ConfigType: "Inline",
- Inline: &apiextensionsv1.JSON{
- Raw: []byte(fmt.Sprintf(`{"watchNamespace": "%s"}`, namespace)),
- },
- }
- Expect(k8sClient.Create(ctx, ce)).To(Succeed(), "failed to create ClusterExtension")
- DeferCleanup(func(ctx SpecContext) {
- _ = k8sClient.Delete(ctx, ce)
- })
-
- // Step 5: Wait for the controller to report preflight failure.
- // The error is in the Progressing condition. We only check the message, not True/False, so the test stays stable.
- By("waiting for ClusterExtension to report preflight failure")
- Eventually(func(g Gomega) {
- latest := &olmv1.ClusterExtension{}
- err := k8sClient.Get(ctx, client.ObjectKey{Name: ce.Name}, latest)
- g.Expect(err).NotTo(HaveOccurred())
-
- c := meta.FindStatusCondition(latest.Status.Conditions, olmv1.TypeProgressing)
- g.Expect(c).NotTo(BeNil(), "Progressing condition should be set")
- g.Expect(c.Message).To(ContainSubstring("pre-authorization failed"), "message should report pre-authorization failure")
- }).WithTimeout(helpers.DefaultTimeout).WithPolling(helpers.DefaultPolling).Should(Succeed())
-}
-
-// createDeficientClusterRole returns a ClusterRole that is missing one permission needed by the test scenario.
-func createDeficientClusterRole(scenario preflightAuthTestScenario, name, ceName string) *rbacv1.ClusterRole {
- var baseRules []rbacv1.PolicyRule
- if helpers.IsFeatureGateEnabled(features.FeatureGateNewOLMBoxCutterRuntime) {
- baseRules = []rbacv1.PolicyRule{
- {
- APIGroups: []string{"olm.operatorframework.io"},
- Resources: []string{"clusterobjectsets/finalizers"},
- Verbs: []string{"update"},
- ResourceNames: []string{fmt.Sprintf("%s-1", ceName)},
- },
- }
- } else {
- baseRules = []rbacv1.PolicyRule{
- {
- APIGroups: []string{"olm.operatorframework.io"},
- Resources: []string{"clusterextensions/finalizers"},
- Verbs: []string{"update"},
- ResourceNames: []string{ceName},
- },
- }
- }
-
- baseRules = append(baseRules, []rbacv1.PolicyRule{
- {
- APIGroups: []string{""},
- Resources: []string{"nodes"},
- Verbs: []string{"list"},
- },
- {
- APIGroups: []string{""},
- Resources: []string{"pods", "pods/finalizers", "services", "services/finalizers", "endpoints", "endpoints/finalizers", "persistentvolumeclaims", "persistentvolumeclaims/finalizers", "events", "events/finalizers", "configmaps", "configmaps/finalizers", "secrets", "secrets/finalizers", "pods/log", "limitranges", "limitranges/finalizers", "namespaces", "namespaces/finalizers", "serviceaccounts", "serviceaccounts/finalizers"},
- Verbs: []string{"delete", "deletecollection", "create", "patch", "get", "list", "update", "watch"},
- },
- {
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"clusterroles", "clusterroles/finalizers", "roles", "roles/finalizers", "clusterrolebindings", "clusterrolebindings/finalizers", "rolebindings", "rolebindings/finalizers"},
- Verbs: []string{"delete", "deletecollection", "create", "patch", "get", "list", "update", "watch", "bind", "escalate"},
- },
- }...)
-
- // Copy rules to avoid mutation
- rules := make([]rbacv1.PolicyRule, len(baseRules))
- copy(rules, baseRules)
-
- switch scenario {
- case scenarioMissingServicePerms:
- // Remove services and services/finalizers so preflight fails.
- for i, r := range rules {
- if r.APIGroups[0] == "" {
- filtered := []string{}
- for _, res := range r.Resources {
- if res != "services" && res != "services/finalizers" {
- filtered = append(filtered, res)
- }
- }
- rules[i].Resources = filtered
- }
- }
- case scenarioMissingCreateVerb:
- // Remove the create verb so preflight fails.
- for i, r := range rules {
- if r.APIGroups[0] == "" {
- filtered := []string{}
- for _, v := range r.Verbs {
- if v != "create" {
- filtered = append(filtered, v)
- }
- }
- rules[i].Verbs = filtered
- }
- }
- case scenarioMissingClusterRoleBindingsPerms:
- // Remove clusterrolebindings so preflight fails.
- for i, r := range rules {
- if r.APIGroups[0] == "rbac.authorization.k8s.io" {
- filtered := []string{}
- for _, res := range r.Resources {
- if res != "clusterrolebindings" && res != "clusterrolebindings/finalizers" {
- filtered = append(filtered, res)
- }
- }
- rules[i].Resources = filtered
- }
- }
- case scenarioMissingNamedConfigMapPerms:
- // Allow only one ClusterRole by name so the SA cannot manage the rest; preflight then fails.
- // The singleown bundle uses ClusterRoles like webhook-operator-metrics-reader.
- for i := range rules {
- if rules[i].APIGroups[0] == "rbac.authorization.k8s.io" {
- filtered := []string{}
- for _, res := range rules[i].Resources {
- if res != "clusterroles" && res != "clusterroles/finalizers" {
- filtered = append(filtered, res)
- }
- }
- rules[i].Resources = filtered
- rules = append(rules, rbacv1.PolicyRule{
- APIGroups: []string{"rbac.authorization.k8s.io"},
- Resources: []string{"clusterroles", "clusterroles/finalizers"},
- Verbs: []string{"delete", "deletecollection", "create", "patch", "get", "list", "update", "watch"},
- ResourceNames: []string{"webhook-operator-metrics-reader"},
- })
- break
- }
- }
- case scenarioMissingClusterExtensionsFinalizerPerms:
- // Remove permission for clusterextensions/finalizers so preflight fails.
- filtered := []rbacv1.PolicyRule{}
- for _, r := range rules {
- if len(r.APIGroups) != 1 || r.APIGroups[0] != "olm.operatorframework.io" {
- filtered = append(filtered, r)
- }
- }
- rules = filtered
- case scenarioMissingClusterObjectSetsFinalizerPerms:
- // Remove permission for clusterobjectsets/finalizers so preflight fails.
- filtered := []rbacv1.PolicyRule{}
- for _, r := range rules {
- if len(r.APIGroups) != 1 || r.APIGroups[0] != "olm.operatorframework.io" {
- filtered = append(filtered, r)
- }
- }
- rules = filtered
- case scenarioMissingEscalateAndBindPerms:
- // Remove bind and escalate verbs so preflight fails.
- for i, r := range rules {
- if r.APIGroups[0] == "rbac.authorization.k8s.io" {
- filtered := []string{}
- for _, v := range r.Verbs {
- if v != "bind" && v != "escalate" {
- filtered = append(filtered, v)
- }
- }
- rules[i].Verbs = filtered
- }
- }
- }
-
- return &rbacv1.ClusterRole{
- ObjectMeta: metav1.ObjectMeta{Name: name},
- Rules: rules,
- }
-}
diff --git a/openshift/tests-extension/test/olmv1-singleownnamespace.go b/openshift/tests-extension/test/olmv1-singleownnamespace.go
index 4fb4a547ed..a4c05608bf 100644
--- a/openshift/tests-extension/test/olmv1-singleownnamespace.go
+++ b/openshift/tests-extension/test/olmv1-singleownnamespace.go
@@ -38,7 +38,7 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace] OLMv1 ope
crdSuffix string
)
- var unique, saName, crbName, ceName string
+ var unique, ceName string
BeforeEach(func(ctx SpecContext) {
helpers.RequireOLMv1CapabilityOnOpenshift()
helpers.RequireImageRegistry(ctx)
@@ -46,8 +46,6 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace] OLMv1 ope
unique = rand.String(4)
namespace = fmt.Sprintf("olmv1-%s-ns-%s", testPrefix, unique)
- saName = fmt.Sprintf("install-%s-sa-%s", testPrefix, unique)
- crbName = fmt.Sprintf("install-%s-crb-%s", testPrefix, unique)
ceName = fmt.Sprintf("install-%s-ce-%s", testPrefix, unique)
crdSuffix = unique
@@ -97,30 +95,8 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace] OLMv1 ope
It("should install a cluster extension successfully",
Label("original-name:[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace][Skipped:Disconnected] OLMv1 operator installation support for singleNamespace watch mode with quay-operator should install a cluster extension successfully"),
func(ctx SpecContext) {
- By("creating ServiceAccount")
- sa := helpers.NewServiceAccount(saName, namespace)
- Expect(k8sClient.Create(ctx, sa)).To(Succeed(), "failed to create ServiceAccount %q", saName)
- By("ensuring ServiceAccount is available before proceeding")
- helpers.ExpectServiceAccountExists(ctx, saName, namespace)
- By("registering cleanup for ServiceAccount")
- DeferCleanup(func() {
- By(fmt.Sprintf("cleanup: deleting ServiceAccount %s in namespace %s", sa.Name, sa.Namespace))
- _ = k8sClient.Delete(context.Background(), sa, client.PropagationPolicy(metav1.DeletePropagationForeground))
- })
-
- By("creating ClusterRoleBinding")
- crb := helpers.NewClusterRoleBinding(crbName, "cluster-admin", saName, namespace)
- Expect(k8sClient.Create(ctx, crb)).To(Succeed(), "failed to create ClusterRoleBinding %q", crbName)
- By("ensuring ClusterRoleBinding is available before proceeding")
- helpers.ExpectClusterRoleBindingExists(ctx, crbName)
- By("registering cleanup for ClusterRoleBinding")
- DeferCleanup(func() {
- By(fmt.Sprintf("cleanup: deleting ClusterRoleBinding %s", crb.Name))
- _ = k8sClient.Delete(context.Background(), crb, client.PropagationPolicy(metav1.DeletePropagationForeground))
- })
-
By("creating ClusterExtension with the watch-namespace configured")
- ce := helpers.NewClusterExtensionObject(packageName, "0.0.5", ceName, saName, namespace)
+ ce := helpers.NewClusterExtensionObject(packageName, "0.0.5", ceName, namespace)
ce.Spec.Source.Catalog.Selector = &metav1.LabelSelector{
MatchLabels: map[string]string{
"olm.operatorframework.io/metadata.name": catalogName,
@@ -157,15 +133,13 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace] OLMv1 ope
crdSuffix string
)
- var unique, saName, crbName, ceName string
+ var unique, ceName string
BeforeEach(func(ctx SpecContext) {
helpers.RequireOLMv1CapabilityOnOpenshift()
helpers.RequireImageRegistry(ctx)
k8sClient = env.Get().K8sClient
unique = rand.String(4)
namespace = fmt.Sprintf("olmv1-%s-ns-%s", testPrefix, unique)
- saName = fmt.Sprintf("install-%s-sa-%s", testPrefix, unique)
- crbName = fmt.Sprintf("install-%s-crb-%s", testPrefix, unique)
ceName = fmt.Sprintf("install-%s-ce-%s", testPrefix, unique)
crdSuffix = unique
@@ -215,30 +189,8 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace] OLMv1 ope
It("should install a cluster extension successfully",
Label("original-name:[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace][Skipped:Disconnected] OLMv1 operator installation support for ownNamespace watch mode with quay-operator should install a cluster extension successfully"),
func(ctx SpecContext) {
- By("creating ServiceAccount")
- sa := helpers.NewServiceAccount(saName, namespace)
- Expect(k8sClient.Create(ctx, sa)).To(Succeed(), "failed to create ServiceAccount %q", saName)
- By("ensuring ServiceAccount is available before proceeding")
- helpers.ExpectServiceAccountExists(ctx, saName, namespace)
- By("registering cleanup for ServiceAccount")
- DeferCleanup(func() {
- By(fmt.Sprintf("cleanup: deleting ServiceAccount %s in namespace %s", sa.Name, sa.Namespace))
- _ = k8sClient.Delete(context.Background(), sa, client.PropagationPolicy(metav1.DeletePropagationForeground))
- })
-
- By("creating ClusterRoleBinding")
- crb := helpers.NewClusterRoleBinding(crbName, "cluster-admin", saName, namespace)
- Expect(k8sClient.Create(ctx, crb)).To(Succeed(), "failed to create ClusterRoleBinding %q", crbName)
- By("ensuring ClusterRoleBinding is available before proceeding")
- helpers.ExpectClusterRoleBindingExists(ctx, crbName)
- By("registering cleanup for ClusterRoleBinding")
- DeferCleanup(func() {
- By(fmt.Sprintf("cleanup: deleting ClusterRoleBinding %s", crb.Name))
- _ = k8sClient.Delete(context.Background(), crb, client.PropagationPolicy(metav1.DeletePropagationForeground))
- })
-
By("creating ClusterExtension with the watch-namespace configured")
- ce := helpers.NewClusterExtensionObject(packageName, "0.0.5", ceName, saName, namespace)
+ ce := helpers.NewClusterExtensionObject(packageName, "0.0.5", ceName, namespace)
ce.Spec.Source.Catalog.Selector = &metav1.LabelSelector{
MatchLabels: map[string]string{
"olm.operatorframework.io/metadata.name": catalogName,
@@ -378,29 +330,9 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace] OLMv1 ope
})
}
- saName := fmt.Sprintf("install-webhook-bothns-%s-sa-%s", sc.id, suffix)
- By(fmt.Sprintf("creating ServiceAccount %s for %s scenario", saName, sc.label))
- sa := helpers.NewServiceAccount(saName, installNamespace)
- Expect(k8sClient.Create(ctx, sa)).To(Succeed(), "failed to create ServiceAccount %q", saName)
- helpers.ExpectServiceAccountExists(ctx, saName, installNamespace)
- DeferCleanup(func() {
- By(fmt.Sprintf("cleanup: deleting ServiceAccount %s in namespace %s", sa.Name, sa.Namespace))
- _ = k8sClient.Delete(context.Background(), sa, client.PropagationPolicy(metav1.DeletePropagationForeground))
- })
-
- crbName := fmt.Sprintf("install-webhook-bothns-%s-crb-%s", sc.id, suffix)
- By(fmt.Sprintf("creating ClusterRoleBinding %s for %s scenario", crbName, sc.label))
- crb := helpers.NewClusterRoleBinding(crbName, "cluster-admin", saName, installNamespace)
- Expect(k8sClient.Create(ctx, crb)).To(Succeed(), "failed to create ClusterRoleBinding %q", crbName)
- helpers.ExpectClusterRoleBindingExists(ctx, crbName)
- DeferCleanup(func() {
- By(fmt.Sprintf("cleanup: deleting ClusterRoleBinding %s", crb.Name))
- _ = k8sClient.Delete(context.Background(), crb, client.PropagationPolicy(metav1.DeletePropagationForeground))
- })
-
ceName := fmt.Sprintf("install-webhook-bothns-%s-ce-%s", sc.id, suffix)
By(fmt.Sprintf("creating ClusterExtension %s for %s scenario", ceName, sc.label))
- ce := helpers.NewClusterExtensionObject(packageName, "0.0.5", ceName, saName, installNamespace)
+ ce := helpers.NewClusterExtensionObject(packageName, "0.0.5", ceName, installNamespace)
ce.Spec.Source.Catalog.Selector = &metav1.LabelSelector{
MatchLabels: map[string]string{
"olm.operatorframework.io/metadata.name": catalogName,
@@ -453,9 +385,6 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace] OLMv1 ope
Expect(k8sClient.Delete(ctx, ce, client.PropagationPolicy(deletePolicy))).To(Succeed(), "failed to delete ClusterExtension %q", ceName)
helpers.EnsureCleanupClusterExtension(context.Background(), packageName, crdName)
- Expect(k8sClient.Delete(ctx, crb, client.PropagationPolicy(deletePolicy))).To(Succeed(), "failed to delete ClusterRoleBinding %q", crbName)
- Expect(k8sClient.Delete(ctx, sa, client.PropagationPolicy(deletePolicy))).To(Succeed(), "failed to delete ServiceAccount %q", saName)
-
// Trigger namespace deletion and proceed without blocking. By this point
// EnsureCleanupClusterExtension has completed, meaning the ClusterObjectSet
// teardown has deleted all managed resources (Deployment, Service, etc.) and the
@@ -478,15 +407,13 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace][Serial] O
crdSuffix string
)
- var unique, saName, crbName, ceName string
+ var unique, ceName string
BeforeEach(func(ctx SpecContext) {
helpers.RequireOLMv1CapabilityOnOpenshift()
helpers.RequireImageRegistry(ctx)
k8sClient = env.Get().K8sClient
unique = rand.String(4)
namespace = fmt.Sprintf("olmv1-%s-ns-%s", testPrefix, unique)
- saName = fmt.Sprintf("install-%s-sa-%s", testPrefix, unique)
- crbName = fmt.Sprintf("install-%s-crb-%s", testPrefix, unique)
ceName = fmt.Sprintf("install-%s-ce-%s", testPrefix, unique)
// Build in-cluster bundle and catalog using webhook testdata (supports AllNamespaces mode only)
@@ -533,30 +460,8 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace][Serial] O
It("should fail to install a cluster extension successfully",
Label("original-name:[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace][Skipped:Disconnected] OLMv1 operator installation support for ownNamespace watch mode with an operator that does not support ownNamespace installation mode should fail to install a cluster extension successfully"),
func(ctx SpecContext) {
- By("creating ServiceAccount")
- sa := helpers.NewServiceAccount(saName, namespace)
- Expect(k8sClient.Create(ctx, sa)).To(Succeed(), "failed to create ServiceAccount %q", saName)
- By("ensuring ServiceAccount is available before proceeding")
- helpers.ExpectServiceAccountExists(ctx, saName, namespace)
- By("registering cleanup for ServiceAccount")
- DeferCleanup(func() {
- By(fmt.Sprintf("cleanup: deleting ServiceAccount %s in namespace %s", sa.Name, sa.Namespace))
- _ = k8sClient.Delete(context.Background(), sa, client.PropagationPolicy(metav1.DeletePropagationForeground))
- })
-
- By("creating ClusterRoleBinding")
- crb := helpers.NewClusterRoleBinding(crbName, "cluster-admin", saName, namespace)
- Expect(k8sClient.Create(ctx, crb)).To(Succeed(), "failed to create ClusterRoleBinding %q", crbName)
- By("ensuring ClusterRoleBinding is available before proceeding")
- helpers.ExpectClusterRoleBindingExists(ctx, crbName)
- By("registering cleanup for ClusterRoleBinding")
- DeferCleanup(func() {
- By(fmt.Sprintf("cleanup: deleting ClusterRoleBinding %s", crb.Name))
- _ = k8sClient.Delete(context.Background(), crb, client.PropagationPolicy(metav1.DeletePropagationForeground))
- })
-
By("creating ClusterExtension with the watch-namespace configured using webhook operator that only supports AllNamespaces mode")
- ce := helpers.NewClusterExtensionObject("webhook-operator", "0.0.5", ceName, saName, namespace)
+ ce := helpers.NewClusterExtensionObject("webhook-operator", "0.0.5", ceName, namespace)
ce.Spec.Source.Catalog.Selector = &metav1.LabelSelector{
MatchLabels: map[string]string{
"olm.operatorframework.io/metadata.name": catalogName,
@@ -605,15 +510,13 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace] OLMv1 ope
crdSuffix string
)
- var unique, saName, crbName, ceName string
+ var unique, ceName string
BeforeEach(func(ctx SpecContext) {
helpers.RequireOLMv1CapabilityOnOpenshift()
helpers.RequireImageRegistry(ctx)
k8sClient = env.Get().K8sClient
unique = rand.String(4)
namespace = fmt.Sprintf("olmv1-%s-ns-%s", testPrefix, unique)
- saName = fmt.Sprintf("install-%s-sa-%s", testPrefix, unique)
- crbName = fmt.Sprintf("install-%s-crb-%s", testPrefix, unique)
ceName = fmt.Sprintf("install-%s-ce-%s", testPrefix, unique)
// Generate unique CRD suffix for parallel execution
@@ -669,30 +572,10 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace] OLMv1 ope
It("should fail to install the ClusterExtension when watch namespace is invalid",
Label("original-name:[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace][Skipped:Disconnected][Serial] OLMv1 operator installation should reject invalid watch namespace configuration and update the status conditions accordingly should fail to install the ClusterExtension when watch namespace is invalid"),
func(ctx SpecContext) {
- By("creating ServiceAccount")
- sa := helpers.NewServiceAccount(saName, namespace)
- Expect(k8sClient.Create(ctx, sa)).To(Succeed(), "failed to create ServiceAccount %q", saName)
- By("ensuring ServiceAccount is available before proceeding")
- helpers.ExpectServiceAccountExists(ctx, saName, namespace)
- DeferCleanup(func() {
- By(fmt.Sprintf("cleanup: deleting ServiceAccount %s in namespace %s", sa.Name, sa.Namespace))
- _ = k8sClient.Delete(context.Background(), sa, client.PropagationPolicy(metav1.DeletePropagationForeground))
- })
-
- By("creating ClusterRoleBinding")
- crb := helpers.NewClusterRoleBinding(crbName, "cluster-admin", saName, namespace)
- Expect(k8sClient.Create(ctx, crb)).To(Succeed(), "failed to create ClusterRoleBinding %q", crbName)
- By("ensuring ClusterRoleBinding is available before proceeding")
- helpers.ExpectClusterRoleBindingExists(ctx, crbName)
- DeferCleanup(func() {
- By(fmt.Sprintf("cleanup: deleting ClusterRoleBinding %s", crb.Name))
- _ = k8sClient.Delete(context.Background(), crb, client.PropagationPolicy(metav1.DeletePropagationForeground))
- })
-
invalidWatchNamespace := fmt.Sprintf("%s-", namespace)
By("creating ClusterExtension with an invalid watch namespace configured")
- ce := helpers.NewClusterExtensionObject(packageName, "0.0.5", ceName, saName, namespace)
+ ce := helpers.NewClusterExtensionObject(packageName, "0.0.5", ceName, namespace)
ce.Spec.Source.Catalog.Selector = &metav1.LabelSelector{
MatchLabels: map[string]string{
"olm.operatorframework.io/metadata.name": catalogName,
diff --git a/openshift/tests-extension/test/qe/specs/olmv1_cc.go b/openshift/tests-extension/test/qe/specs/olmv1_cc.go
index f2fbbec3c9..c282a6fc2d 100644
--- a/openshift/tests-extension/test/qe/specs/olmv1_cc.go
+++ b/openshift/tests-extension/test/qe/specs/olmv1_cc.go
@@ -647,20 +647,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
g.It("PolarionID:73289-[OTP][Skipped:Disconnected]Check the deprecation conditions and messages", func() {
var (
- caseID = "73289"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-73289"
- sa = "sa73289"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "73289"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ ns = "ns-73289"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-73289",
Imageref: "quay.io/olmqe/olmtest-operator-index:nginxolm73289",
LabelValue: labelValue,
@@ -672,7 +665,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
PackageName: "nginx73289v1",
Channel: "candidate-v1.0",
Version: "1.0.1",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -684,10 +676,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -787,20 +775,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
g.It("PolarionID:74948-[OTP][Skipped:Disconnected]catalog offer the operator content through https server", func() {
var (
- caseID = "74948"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-74948"
- sa = "sa74948"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "74948"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ ns = "ns-74948"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-74948",
Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm74948",
LabelValue: labelValue,
@@ -812,7 +793,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
PackageName: "nginx74948",
Channel: "candidate-v1.0",
Version: "1.0.3",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -829,10 +809,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Examine the service to confirm that the annotations are present")
describe, err := oc.WithoutNamespace().AsAdmin().Run("describe").Args("service", "catalogd-service", "-n", "openshift-catalogd").Output()
o.Expect(err).NotTo(o.HaveOccurred())
@@ -866,20 +842,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
g.It("PolarionID:74978-[OTP][Level0][Skipped:Disconnected]CRD upgrade will be prevented if the Scope is switched between Namespaced and Cluster", func() {
var (
- caseID = "74978"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-74978"
- sa = "sa74978"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "74978"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ ns = "ns-74978"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-74978",
Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm74978",
LabelValue: labelValue,
@@ -891,7 +860,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
PackageName: "nginx74978",
Channel: "candidate-v1.0",
Version: "1.0.1",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -908,10 +876,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clusterextension v1.0.1")
defer clusterextension.Delete(oc)
clusterextension.Create(oc)
@@ -941,20 +905,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
g.It("PolarionID:75218-[OTP][Skipped:Disconnected]Disabling the CRD Upgrade Safety preflight checks", func() {
var (
- caseID = "75218"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-75218"
- sa = "sa75218"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "75218"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ ns = "ns-75218"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-75218",
Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75218",
LabelValue: labelValue,
@@ -966,7 +923,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
PackageName: "nginx75218",
Channel: "candidate-v1.0",
Version: "1.0.1",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -983,10 +939,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clusterextension v1.0.1")
defer clusterextension.Delete(oc)
clusterextension.Create(oc)
@@ -1045,20 +997,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
g.It("PolarionID:75122-[OTP][Skipped:Disconnected]CRD upgrade check Removing an existing stored version and add a new CRD with no modifications to existing versions", func() {
exutil.SkipForSNOCluster(oc)
var (
- caseID = "75122"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-75122"
- sa = "sa75122"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "75122"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ ns = "ns-75122"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-75122",
Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75122",
LabelValue: labelValue,
@@ -1070,7 +1015,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
PackageName: "nginx75122",
Channel: "candidate-v1.0",
Version: "1.0.1",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1087,10 +1031,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clusterextension v1.0.1")
defer clusterextension.Delete(oc)
clusterextension.Create(oc)
@@ -1128,20 +1068,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
g.It("PolarionID:75123-[OTP][Skipped:Disconnected]CRD upgrade checks for changes in required field and field type", func() {
exutil.SkipForSNOCluster(oc)
var (
- caseID = "75123"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-75123"
- sa = "sa75123"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "75123"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ ns = "ns-75123"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-75123",
Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75123",
LabelValue: labelValue,
@@ -1153,7 +1086,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
PackageName: "nginx75123",
Channel: "candidate-v1.0",
Version: "1.0.1",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1170,10 +1102,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clusterextension v1.0.1")
defer clusterextension.Delete(oc)
clusterextension.Create(oc)
@@ -1218,20 +1146,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
g.It("PolarionID:75124-[OTP][Skipped:Disconnected]CRD upgrade checks for changes in default values", func() {
exutil.SkipForSNOCluster(oc)
var (
- caseID = "75124"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-75124"
- sa = "sa75124"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "75124"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ ns = "ns-75124"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-75124",
Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75124",
LabelValue: labelValue,
@@ -1243,7 +1164,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
PackageName: "nginx75124",
Channel: "candidate-v1.0",
Version: "1.0.1",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1260,10 +1180,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clusterextension v1.0.1")
defer clusterextension.Delete(oc)
clusterextension.Create(oc)
@@ -1295,20 +1211,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
g.It("PolarionID:75515-[OTP][Skipped:Disconnected]CRD upgrade checks for changes in enumeration values", func() {
exutil.SkipForSNOCluster(oc)
var (
- caseID = "75515"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-75515"
- sa = "sa75515"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "75515"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ ns = "ns-75515"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-75515",
Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75515",
LabelValue: labelValue,
@@ -1320,7 +1229,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
PackageName: "nginx75515",
Channel: "candidate-v1.0",
Version: "1.0.1",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1337,10 +1245,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clusterextension v1.0.1")
defer clusterextension.Delete(oc)
clusterextension.Create(oc)
@@ -1373,20 +1277,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
g.It("PolarionID:75516-[OTP][Skipped:Disconnected]CRD upgrade checks for the field maximum minimum changes", func() {
exutil.SkipForSNOCluster(oc)
var (
- caseID = "75516"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-75516"
- sa = "sa75516"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "75516"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ ns = "ns-75516"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-75516",
Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75516",
LabelValue: labelValue,
@@ -1398,7 +1295,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
PackageName: "nginx75516",
Channel: "candidate-v1.0",
Version: "1.0.1",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1415,10 +1311,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clusterextension v1.0.1")
defer clusterextension.Delete(oc)
clusterextension.Create(oc)
diff --git a/openshift/tests-extension/test/qe/specs/olmv1_ce.go b/openshift/tests-extension/test/qe/specs/olmv1_ce.go
index f4706a19e0..5bbea2e08d 100644
--- a/openshift/tests-extension/test/qe/specs/olmv1_ce.go
+++ b/openshift/tests-extension/test/qe/specs/olmv1_ce.go
@@ -161,202 +161,16 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
})
- g.It("PolarionID:68936-[OTP]cluster extension can not be installed with insufficient permission sa for operand", g.Label("original-name:[sig-olmv1][Jira:OLM] clusterextension PolarionID:68936-[Skipped:Disconnected]cluster extension can not be installed with insufficient permission sa for operand"), func() {
- e2e.Logf("Testing ClusterExtension installation failure when ServiceAccount lacks sufficient permissions for operand resources. Originally case 75492, using 68936 for faster execution.")
- exutil.SkipForSNOCluster(oc)
- olmv1util.ValidateAccessEnvironment(oc)
- var (
- caseID = "68936"
- ns = "ns-" + caseID
- sa = caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- // Select template based on Boxcutter runtime feature gate
- saClusterRoleBindingOperandTemplate string
- )
-
- // Use Boxcutter template if BoxcutterRuntime is enabled, otherwise use Helm template
- // Note: Both templates have the same content for this test (both lack finalizers permissions)
- if olmv1util.IsFeaturegateEnabled(oc, "NewOLMBoxCutterRuntime") {
- saClusterRoleBindingOperandTemplate = filepath.Join(baseDir, "sa-nginx-insufficient-operand-clusterrole-boxcutter.yaml")
- } else {
- saClusterRoleBindingOperandTemplate = filepath.Join(baseDir, "sa-nginx-insufficient-operand-clusterrole.yaml")
- }
-
- saCrb := olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- RBACObjects: []olmv1util.ChildResource{
- {Kind: "RoleBinding", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role-binding", sa)}},
- {Kind: "Role", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role", sa)}},
- {Kind: "ClusterRoleBinding", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole-binding", sa),
- fmt.Sprintf("%s-installer-clusterrole-binding", sa)}},
- {Kind: "ClusterRole", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole", sa),
- fmt.Sprintf("%s-installer-clusterrole", sa)}},
- {Kind: "ServiceAccount", Ns: ns, Names: []string{sa}},
- },
- Kinds: "okv68936s",
- Template: saClusterRoleBindingOperandTemplate,
- }
- clustercatalog := olmv1util.ClusterCatalogDescription{
- Name: "clustercatalog-68936",
- Imageref: "quay.io/olmqe/nginx-ok-index:vokv68936",
- LabelValue: labelValue,
- Template: clustercatalogTemplate,
- }
- ceInsufficient := olmv1util.ClusterExtensionDescription{
- Name: "insufficient-68936",
- PackageName: "nginx-ok-v68936",
- Channel: "alpha",
- Version: ">=0.0.1",
- InstallNamespace: ns,
- SaName: sa,
- LabelValue: labelValue,
- Template: clusterextensionTemplate,
- }
-
- g.By("Create namespace")
- defer func() {
- _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").Execute()
- }()
- err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
- o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
-
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
- g.By("Create clustercatalog")
- defer clustercatalog.Delete(oc)
- clustercatalog.Create(oc)
-
- g.By("check Insufficient sa from operand")
- defer ceInsufficient.Delete(oc)
- _ = ceInsufficient.CreateWithoutCheck(oc)
- if olmv1util.IsFeaturegateEnabled(oc, "NewOLMPreflightPermissionChecks") {
- // Env2 (Helm, preflight) or Env3 (Boxcutter, preflight): Both return same preflight error
- ceInsufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "pre-authorization failed", 10, 60, 0)
- } else {
- // Env1 (Helm, no preflight) or Env4 (Boxcutter, no preflight)
- // Error checking order differs between runtimes:
- // - Helm (Env1): checks blockOwnerDeletion first, then privilege escalation
- // - Boxcutter (Env4): checks privilege escalation first, then blockOwnerDeletion
- if olmv1util.IsFeaturegateEnabled(oc, "NewOLMBoxCutterRuntime") {
- // Env4: Boxcutter encounters privilege escalation error before blockOwnerDeletion check
- ceInsufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "is attempting to grant RBAC permissions not currently held", 10, 60, 0)
- } else {
- // Env1: Helm encounters blockOwnerDeletion error
- ceInsufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "cannot set blockOwnerDeletion", 10, 60, 0)
- }
- }
-
- })
-
- g.It("PolarionID:68937-[OTP]cluster extension can not be installed with insufficient permission sa for operand rbac object", g.Label("original-name:[sig-olmv1][Jira:OLM] clusterextension PolarionID:68937-[Skipped:Disconnected]cluster extension can not be installed with insufficient permission sa for operand rbac object"), func() {
- e2e.Logf("Testing ClusterExtension installation failure when ServiceAccount lacks sufficient permissions for operand RBAC objects. Originally case 75492, using 68937 for faster execution.")
- exutil.SkipForSNOCluster(oc)
+ g.It("PolarionID:70723-[OTP][Skipped:Disconnected]olmv1 downgrade version", func() {
olmv1util.ValidateAccessEnvironment(oc)
var (
- caseID = "68937"
- ns = "ns-" + caseID
- sa = caseID
+ caseID = "70723"
labelValue = caseID
+ ns = "ns-70723"
baseDir = exutil.FixturePath("testdata", "olm")
clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- // Select template based on Boxcutter runtime feature gate
- saClusterRoleBindingOperandTemplate string
- )
-
- // Use Boxcutter template if BoxcutterRuntime is enabled, otherwise use Helm template
- if olmv1util.IsFeaturegateEnabled(oc, "NewOLMBoxCutterRuntime") {
- saClusterRoleBindingOperandTemplate = filepath.Join(baseDir, "sa-nginx-insufficient-operand-rbac-boxcutter.yaml")
- } else {
- saClusterRoleBindingOperandTemplate = filepath.Join(baseDir, "sa-nginx-insufficient-operand-rbac.yaml")
- }
-
- saCrb := olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- RBACObjects: []olmv1util.ChildResource{
- {Kind: "RoleBinding", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role-binding", sa)}},
- {Kind: "Role", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role", sa)}},
- {Kind: "ClusterRoleBinding", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole-binding", sa),
- fmt.Sprintf("%s-installer-clusterrole-binding", sa)}},
- {Kind: "ClusterRole", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole", sa),
- fmt.Sprintf("%s-installer-clusterrole", sa)}},
- {Kind: "ServiceAccount", Ns: ns, Names: []string{sa}},
- },
- Kinds: "okv68937s",
- Template: saClusterRoleBindingOperandTemplate,
- }
- clustercatalog := olmv1util.ClusterCatalogDescription{
- Name: "clustercatalog-68937",
- Imageref: "quay.io/olmqe/nginx-ok-index:vokv68937",
- LabelValue: labelValue,
- Template: clustercatalogTemplate,
- }
- ceInsufficient := olmv1util.ClusterExtensionDescription{
- Name: "insufficient-68937",
- PackageName: "nginx-ok-v68937",
- Channel: "alpha",
- Version: ">=0.0.1",
- InstallNamespace: ns,
- SaName: sa,
- LabelValue: labelValue,
- Template: clusterextensionTemplate,
- }
-
- g.By("Create namespace")
- defer func() {
- _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").Execute()
- }()
- err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
- o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
-
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
- g.By("Create clustercatalog")
- defer clustercatalog.Delete(oc)
- clustercatalog.Create(oc)
-
- g.By("check Insufficient sa from operand rbac")
- defer ceInsufficient.Delete(oc)
- _ = ceInsufficient.CreateWithoutCheck(oc)
- if olmv1util.IsFeaturegateEnabled(oc, "NewOLMPreflightPermissionChecks") {
- // Env2 (Helm, preflight) or Env3 (Boxcutter, preflight): Both return same preflight error
- ceInsufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "pre-authorization failed", 10, 60, 0)
- } else {
- // Env1 (Helm, no preflight) or Env4 (Boxcutter, no preflight): Both return K8s API RBAC error
- // The specific error message is the same for both runtimes when encountering the same permission issue
- ceInsufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "permissions not currently held", 10, 60, 0)
- }
-
- })
-
- g.It("PolarionID:70723-[OTP][Skipped:Disconnected]olmv1 downgrade version", func() {
- olmv1util.ValidateAccessEnvironment(oc)
- var (
- caseID = "70723"
- labelValue = caseID
- ns = "ns-70723"
- sa = "sa70723"
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-70723",
Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm70723",
LabelValue: labelValue,
@@ -368,7 +182,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
PackageName: "nginx70723",
Channel: "candidate-v2",
Version: "2.2.1",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -382,10 +195,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -404,606 +213,16 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
clusterextension.WaitClusterExtensionVersion(oc, "2.0.0")
})
- g.It("PolarionID:75492-[OTP][Level0]cluster extension can not be installed with wrong sa or insufficient permission sa", g.Label("original-name:[sig-olmv1][Jira:OLM] clusterextension PolarionID:75492-[Skipped:Disconnected]cluster extension can not be installed with wrong sa or insufficient permission sa"), func() {
- exutil.SkipForSNOCluster(oc)
- olmv1util.ValidateAccessEnvironment(oc)
- var (
- caseID = "75492"
- ns = "ns-" + caseID
- sa = "sa" + caseID
- labelValue = caseID
- catalogName = "clustercatalog-" + caseID
- ceInsufficientName = "ce-insufficient-" + caseID
- ceWrongSaName = "ce-wrongsa-" + caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- // Select template based on Boxcutter runtime feature gate
- saClusterRoleBindingTemplate string
- )
-
- // Use Boxcutter template if BoxcutterRuntime is enabled, otherwise use Helm template
- // Note: Both templates have the same content for this test (both lack finalizers permissions)
- if olmv1util.IsFeaturegateEnabled(oc, "NewOLMBoxCutterRuntime") {
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-nginx-insufficient-bundle-boxcutter.yaml")
- } else {
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-nginx-insufficient-bundle.yaml")
- }
-
- saCrb := olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- RBACObjects: []olmv1util.ChildResource{
- {Kind: "RoleBinding", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role-binding", sa)}},
- {Kind: "Role", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role", sa)}},
- {Kind: "ClusterRoleBinding", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole-binding", sa),
- fmt.Sprintf("%s-installer-clusterrole-binding", sa)}},
- {Kind: "ClusterRole", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole", sa),
- fmt.Sprintf("%s-installer-clusterrole", sa)}},
- {Kind: "ServiceAccount", Ns: ns, Names: []string{sa}},
- },
- Kinds: "okv3277775492s",
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog := olmv1util.ClusterCatalogDescription{
- Name: catalogName,
- Imageref: "quay.io/olmqe/nginx-ok-index:vokv3283",
- LabelValue: labelValue,
- Template: clustercatalogTemplate,
- }
- ce75492Insufficient := olmv1util.ClusterExtensionDescription{
- Name: ceInsufficientName,
- PackageName: "nginx-ok-v3277775492",
- Channel: "alpha",
- Version: ">=0.0.1",
- InstallNamespace: ns,
- SaName: sa,
- LabelValue: labelValue,
- Template: clusterextensionTemplate,
- }
- ce75492WrongSa := olmv1util.ClusterExtensionDescription{
- Name: ceWrongSaName,
- PackageName: "nginx-ok-v3277775492",
- Channel: "alpha",
- Version: ">=0.0.1",
- InstallNamespace: ns,
- SaName: sa + "1",
- LabelValue: labelValue,
- Template: clusterextensionTemplate,
- }
-
- g.By("Create namespace")
- defer func() {
- _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").Execute()
- }()
- err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
- o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
-
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
- g.By("Create clustercatalog")
- defer clustercatalog.Delete(oc)
- clustercatalog.Create(oc)
-
- g.By("check Insufficient sa from bundle")
- defer ce75492Insufficient.Delete(oc)
- _ = ce75492Insufficient.CreateWithoutCheck(oc)
- if olmv1util.IsFeaturegateEnabled(oc, "NewOLMPreflightPermissionChecks") {
- // Env2 (Helm, preflight) or Env3 (Boxcutter, preflight): Both return same preflight error
- ce75492Insufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "pre-authorization failed", 10, 60, 0)
- } else {
- // Env1 (Helm, no preflight) or Env4 (Boxcutter, no preflight)
- // Error checking order differs between runtimes:
- // - Helm (Env1): may encounter CRD creation errors first
- // - Boxcutter (Env4): encounters privilege escalation errors first
- if olmv1util.IsFeaturegateEnabled(oc, "NewOLMBoxCutterRuntime") {
- // Env4: Boxcutter encounters privilege escalation error (missing namespace permissions)
- ce75492Insufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "is attempting to grant RBAC permissions not currently held", 10, 60, 0)
- } else {
- // Env1: Helm may encounter CRD-related errors
- ce75492Insufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "could not get information about the resource CustomResourceDefinition", 10, 60, 0)
- }
- }
- g.By("check wrong sa")
- defer ce75492WrongSa.Delete(oc)
- _ = ce75492WrongSa.CreateWithoutCheck(oc)
- // All environments now validate ServiceAccount existence at the start of the reconciliation
- // pipeline (after finalizer handling, before revision state retrieval). This provides:
- // - Consistent error messages across all feature gate combinations
- // - Fail-fast behavior (no wasted reconciliation cycles)
- // - User-facing error format: "operation cannot proceed due to the following validation error(s):
- // service account \"xxx\" not found in namespace \"yyy\""
- //
- // The validation uses ServiceAccountValidator which performs a direct CoreV1 API Get call.
- ce75492WrongSa.CheckClusterExtensionCondition(oc, "Progressing", "message", "not found", 10, 60, 0)
- })
-
- g.It("PolarionID:75493-[OTP][Level0]cluster extension can be installed with enough permission sa", g.Label("original-name:[sig-olmv1][Jira:OLM] clusterextension PolarionID:75493-[Skipped:Disconnected]cluster extension can be installed with enough permission sa"), func() {
- exutil.SkipForSNOCluster(oc)
- olmv1util.ValidateAccessEnvironment(oc)
- var (
- caseID = "75493"
- ns = "ns-" + caseID
- sa = "sa" + caseID
- labelValue = caseID
- catalogName = "clustercatalog-" + caseID
- ceSufficientName = "ce-sufficient" + caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- // Select template based on runtime: Boxcutter needs clusterobjectsets/finalizers, Helm needs clusterextensions/finalizers
- saTemplate string
- )
- if olmv1util.IsFeaturegateEnabled(oc, "NewOLMBoxCutterRuntime") {
- saTemplate = filepath.Join(baseDir, "sa-nginx-limited-boxcutter.yaml")
- } else {
- saTemplate = filepath.Join(baseDir, "sa-nginx-limited.yaml")
- }
- var (
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- RBACObjects: []olmv1util.ChildResource{
- {Kind: "RoleBinding", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role-binding", sa)}},
- {Kind: "Role", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role", sa)}},
- {Kind: "ClusterRoleBinding", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole-binding", sa),
- fmt.Sprintf("%s-installer-clusterrole-binding", sa)}},
- {Kind: "ClusterRole", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole", sa),
- fmt.Sprintf("%s-installer-clusterrole", sa)}},
- {Kind: "ServiceAccount", Ns: ns, Names: []string{sa}},
- },
- Kinds: "okv3277775493s",
- Template: saTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
- Name: catalogName,
- Imageref: "quay.io/olmqe/nginx-ok-index:vokv3283",
- LabelValue: labelValue,
- Template: clustercatalogTemplate,
- }
- ce75493 = olmv1util.ClusterExtensionDescription{
- Name: ceSufficientName,
- PackageName: "nginx-ok-v3277775493",
- Channel: "alpha",
- Version: ">=0.0.1",
- InstallNamespace: ns,
- SaName: sa,
- LabelValue: labelValue,
- Template: clusterextensionTemplate,
- }
- )
-
- g.By("Create namespace")
- defer func() {
- _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").Execute()
- }()
- err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
- o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
-
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
- g.By("Create clustercatalog")
- defer clustercatalog.Delete(oc)
- clustercatalog.Create(oc)
-
- g.By("check if ce is installed with limited permission")
- defer ce75493.Delete(oc)
- ce75493.Create(oc)
- o.Expect(olmv1util.Appearance(oc, exutil.Appear, "customresourcedefinitions.apiextensions.k8s.io", "okv3277775493s.cache.example.com")).To(o.BeTrue())
- o.Expect(olmv1util.Appearance(oc, exutil.Appear, "services", "nginx-ok-v3283-75493-controller-manager-metrics-service", "-n", ns)).To(o.BeTrue())
- ce75493.Delete(oc)
- o.Expect(olmv1util.Appearance(oc, exutil.Disappear, "customresourcedefinitions.apiextensions.k8s.io", "okv3277775493s.cache.example.com")).To(o.BeTrue())
- o.Expect(olmv1util.Appearance(oc, exutil.Disappear, "services", "nginx-ok-v3283-75493-controller-manager-metrics-service", "-n", ns)).To(o.BeTrue())
- })
-
- g.It("PolarionID:81538-[OTP]preflight check on permission on allns mode", g.Label("original-name:[sig-olmv1][Jira:OLM] clusterextension PolarionID:81538-[Skipped:Disconnected]preflight check on permission on allns mode"), func() {
- if !olmv1util.IsFeaturegateEnabled(oc, "NewOLMPreflightPermissionChecks") {
- g.Skip("NewOLMPreflightPermissionChecks feature gate is disabled. This test requires preflight permission validation to be enabled.")
- }
- exutil.SkipForSNOCluster(oc)
- olmv1util.ValidateAccessEnvironment(oc)
+ g.It("PolarionID:87224-[Skipped:Disconnected]Upgrade version support [Serial]", func() {
var (
- caseID = "81538"
+ caseID = "87224"
ns = "ns-" + caseID
- sa = "sa" + caseID
- labelValue = caseID
- catalogName = "clustercatalog-" + caseID
ceName = "ce-" + caseID
- clusterroleName = ceName + "-clusterrole"
- roleName = ceName + "-role" + "-" + ns
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saTemplate = filepath.Join(baseDir, "sa.yaml")
- bindingTemplate = filepath.Join(baseDir, "binding-prefligth.yaml")
- clusterroleTemplate = filepath.Join(baseDir, "prefligth-clusterrole.yaml")
- clustercatalog = olmv1util.ClusterCatalogDescription{
- Name: catalogName,
- Imageref: "quay.io/olmqe/nginx-ok-index:vokv81538",
- LabelValue: labelValue,
- Template: clustercatalogTemplate,
- }
- ce = olmv1util.ClusterExtensionDescription{
- Name: ceName,
- PackageName: "nginx-ok-v81538",
- Channel: "alpha",
- Version: ">=0.0.1",
- InstallNamespace: ns,
- SaName: sa,
- LabelValue: labelValue,
- Template: clusterextensionTemplate,
- }
- )
-
- g.By("Create namespace")
- defer func() {
- _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").Execute()
- }()
- err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
- o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
-
- g.By("Create clustercatalog")
- defer clustercatalog.Delete(oc)
- clustercatalog.Create(oc)
-
- g.By("create sa")
- paremeters := []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", saTemplate, "-p",
- "NAME=" + sa, "NAMESPACE=" + ns}
- configFileSa, errApplySa := olmv1util.ApplyNamepsaceResourceFromTemplate(oc, ns, paremeters...)
- o.Expect(errApplySa).NotTo(o.HaveOccurred())
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", configFileSa).Execute() }()
-
- g.By("create clusterrole with wrong rule")
- paremeters = []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", clusterroleTemplate, "-p",
- "NAME=" + clusterroleName}
- configFileCLusterroe, errApplyCLusterrole := olmv1util.ApplyClusterResourceFromTemplate(oc, paremeters...)
- o.Expect(errApplyCLusterrole).NotTo(o.HaveOccurred())
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", configFileCLusterroe).Execute() }()
-
- g.By("create binding")
- paremeters = []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", bindingTemplate, "-p",
- "SANAME=" + sa, "NAMESPACE=" + ns, "ROLENAME=" + roleName, "CLUSTERROLESANAME=" + clusterroleName}
- configFileBinding, errApplyBinding := olmv1util.ApplyClusterResourceFromTemplate(oc, paremeters...)
- o.Expect(errApplyBinding).NotTo(o.HaveOccurred())
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", configFileBinding).Execute() }()
-
- g.By("check missing rule")
- defer ce.Delete(oc)
- _ = ce.CreateWithoutCheck(oc)
- ce.CheckClusterExtensionCondition(oc, "Progressing", "message",
- `Namespace:"" Verbs:[get] NonResourceURLs:[/metrics]`, 3, 150, 0)
- ce.CheckClusterExtensionCondition(oc, "Progressing", "message",
- `Namespace:"ns-81538" APIGroups:[] Resources:[services] ResourceNames:[nginx-ok-v81538-controller-manager-metrics-service] Verbs:[delete,get,patch,update]`, 3, 150, 0)
- // Check finalizers permission based on Boxcutter runtime feature gate
- if olmv1util.IsFeaturegateEnabled(oc, "NewOLMBoxCutterRuntime") {
- // Env3: Boxcutter with preflight - expects clusterobjectsets/finalizers
- // Note: In Boxcutter, the ResourceName is the ClusterObjectSet name (ce-81538-1 for first revision)
- ce.CheckClusterExtensionCondition(oc, "Progressing", "message",
- `Namespace:"" APIGroups:[olm.operatorframework.io] Resources:[clusterobjectsets/finalizers] ResourceNames:[ce-81538-1] Verbs:[update]`, 3, 150, 0)
- } else {
- // Env2: Helm with preflight - expects clusterextensions/finalizers
- ce.CheckClusterExtensionCondition(oc, "Progressing", "message",
- `Namespace:"" APIGroups:[olm.operatorframework.io] Resources:[clusterextensions/finalizers] ResourceNames:[ce-81538] Verbs:[update]`, 3, 150, 0)
- }
-
- g.By("generate rbac per missing rule and delete ce")
- jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.type=="%s")].%s}`, "Progressing", "message")
- output, errGet := olmv1util.GetNoEmpty(oc, "clusterextension", ce.Name, "-o", jsonpath)
- o.Expect(errGet).NotTo(o.HaveOccurred())
- e2e.Logf("====%v====", output)
-
- start := "permissions to manage cluster extension:"
- end1 := "authorization evaluation error:"
- end2 := "for resolved bundle"
- filtered := olmv1util.FilterPermissions(output, start, end1, end2)
- e2e.Logf("===============================================================================")
- e2e.Logf("%v", filtered)
- e2e.Logf("===============================================================================")
- rabcDir := e2e.TestContext.OutputDir
- clusterroleFile := filepath.Join(rabcDir, fmt.Sprintf("%s.yaml", clusterroleName))
- roleFile := filepath.Join(rabcDir, fmt.Sprintf("%s.yaml", roleName))
- errGen := olmv1util.GenerateRBACFromMissingRules(filtered, ceName, rabcDir)
- o.Expect(errGen).NotTo(o.HaveOccurred())
-
- g.By("create clusterrole")
- err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", clusterroleFile).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
-
- g.By("create role")
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", roleFile).Execute() }()
- err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", roleFile).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
-
- g.By("check ce again afrer applying correct rules")
- ce.CheckClusterExtensionCondition(oc, "Progressing", "reason", "Succeeded", 10, 600, 0)
- })
-
- g.It("PolarionID:81664-[OTP]preflight check on permission on own ns mode", g.Label("original-name:[sig-olmv1][Jira:OLM] clusterextension PolarionID:81664-[Skipped:Disconnected]preflight check on permission on own ns mode"), func() {
- if !olmv1util.IsFeaturegateEnabled(oc, "NewOLMPreflightPermissionChecks") ||
- !olmv1util.IsFeaturegateEnabled(oc, "NewOLMOwnSingleNamespace") {
- g.Skip("Required feature gates are disabled: NewOLMPreflightPermissionChecks and NewOLMOwnSingleNamespace must both be enabled for this test.")
- }
- exutil.SkipForSNOCluster(oc)
- olmv1util.ValidateAccessEnvironment(oc)
- var (
- caseID = "81664"
- ns = "ns-" + caseID
- sa = "sa" + caseID
labelValue = caseID
- catalogName = "clustercatalog-" + caseID
- ceName = "ce-" + caseID
- clusterroleName = ceName + "-clusterrole"
- roleName = ceName + "-role" + "-" + ns
baseDir = exutil.FixturePath("testdata", "olm")
clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-OwnSingle.yaml")
- saTemplate = filepath.Join(baseDir, "sa.yaml")
- bindingTemplate = filepath.Join(baseDir, "binding-prefligth.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml")
clustercatalog = olmv1util.ClusterCatalogDescription{
- Name: catalogName,
- Imageref: "quay.io/olmqe/nginx-ok-index:vokv81664",
- LabelValue: labelValue,
- Template: clustercatalogTemplate,
- }
- ce = olmv1util.ClusterExtensionDescription{
- Name: ceName,
- PackageName: "nginx-ok-v81664",
- Channel: "alpha",
- Version: ">=0.0.1",
- InstallNamespace: ns,
- WatchNamespace: ns,
- SaName: sa,
- LabelValue: labelValue,
- Template: clusterextensionTemplate,
- }
- )
-
- g.By("Create namespace")
- defer func() {
- _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").Execute()
- }()
- err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
- o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
-
- g.By("Create clustercatalog")
- defer clustercatalog.Delete(oc)
- clustercatalog.Create(oc)
-
- g.By("create sa")
- paremeters := []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", saTemplate, "-p",
- "NAME=" + sa, "NAMESPACE=" + ns}
- configFileSa, errApplySa := olmv1util.ApplyNamepsaceResourceFromTemplate(oc, ns, paremeters...)
- o.Expect(errApplySa).NotTo(o.HaveOccurred())
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", configFileSa).Execute() }()
-
- g.By("check missing rule")
- defer ce.Delete(oc)
- _ = ce.CreateWithoutCheck(oc)
- ce.CheckClusterExtensionCondition(oc, "Progressing", "message",
- `Namespace:"" Verbs:[get] NonResourceURLs:[/metrics]`, 3, 150, 0)
- ce.CheckClusterExtensionCondition(oc, "Progressing", "message",
- `Namespace:"ns-81664" APIGroups:[] Resources:[services] ResourceNames:[nginx-ok-v81664-controller-manager-metrics-service] Verbs:[delete,get,patch,update]`, 3, 150, 0)
- // Check finalizers permission based on Boxcutter runtime feature gate
- if olmv1util.IsFeaturegateEnabled(oc, "NewOLMBoxCutterRuntime") {
- // Env3: Boxcutter with preflight - expects clusterobjectsets/finalizers
- // Note: In Boxcutter, the ResourceName is the ClusterObjectSet name (ce-81664-1 for first revision)
- ce.CheckClusterExtensionCondition(oc, "Progressing", "message",
- `Namespace:"" APIGroups:[olm.operatorframework.io] Resources:[clusterobjectsets/finalizers] ResourceNames:[ce-81664-1] Verbs:[update]`, 3, 150, 0)
- } else {
- // Env2: Helm with preflight - expects clusterextensions/finalizers
- ce.CheckClusterExtensionCondition(oc, "Progressing", "message",
- `Namespace:"" APIGroups:[olm.operatorframework.io] Resources:[clusterextensions/finalizers] ResourceNames:[ce-81664] Verbs:[update]`, 3, 150, 0)
- }
-
- g.By("generate rbac per missing rule and delete ce")
- jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.type=="%s")].%s}`, "Progressing", "message")
- output, errGet := olmv1util.GetNoEmpty(oc, "clusterextension", ce.Name, "-o", jsonpath)
- o.Expect(errGet).NotTo(o.HaveOccurred())
- ce.Delete(oc)
- e2e.Logf("====%v====", output)
-
- start := "permissions to manage cluster extension:"
- end1 := "authorization evaluation error:"
- end2 := "for resolved bundle"
- filtered := olmv1util.FilterPermissions(output, start, end1, end2)
- e2e.Logf("===============================================================================")
- e2e.Logf("%v", filtered)
- e2e.Logf("===============================================================================")
- rabcDir := e2e.TestContext.OutputDir
- clusterroleFile := filepath.Join(rabcDir, fmt.Sprintf("%s.yaml", clusterroleName))
- roleFile := filepath.Join(rabcDir, fmt.Sprintf("%s.yaml", roleName))
- errGen := olmv1util.GenerateRBACFromMissingRules(filtered, ceName, rabcDir)
- o.Expect(errGen).NotTo(o.HaveOccurred())
-
- g.By("create clusterrole")
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", clusterroleFile).Execute() }()
- err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", clusterroleFile).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
-
- g.By("create role")
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", roleFile).Execute() }()
- err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", roleFile).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
-
- g.By("create binding")
- paremeters = []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", bindingTemplate, "-p",
- "SANAME=" + sa, "NAMESPACE=" + ns, "ROLENAME=" + roleName, "CLUSTERROLESANAME=" + clusterroleName}
- configFileBinding, errApplyBinding := olmv1util.ApplyClusterResourceFromTemplate(oc, paremeters...)
- o.Expect(errApplyBinding).NotTo(o.HaveOccurred())
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", configFileBinding).Execute() }()
-
- g.By("check ce again afrer applying correct rules")
- ce.Create(oc)
- })
-
- g.It("PolarionID:81696-[OTP]preflight check on permission on single ns mode", g.Label("original-name:[sig-olmv1][Jira:OLM] clusterextension PolarionID:81696-[Skipped:Disconnected]preflight check on permission on single ns mode"), func() {
- if !olmv1util.IsFeaturegateEnabled(oc, "NewOLMPreflightPermissionChecks") ||
- !olmv1util.IsFeaturegateEnabled(oc, "NewOLMOwnSingleNamespace") {
- g.Skip("Required feature gates are disabled: NewOLMPreflightPermissionChecks and NewOLMOwnSingleNamespace must both be enabled for this test.")
- }
- exutil.SkipForSNOCluster(oc)
- olmv1util.ValidateAccessEnvironment(oc)
- var (
- caseID = "81696"
- ns = "ns-" + caseID
- nsWatch = "ns-" + caseID + "-watch"
- sa = "sa" + caseID
- labelValue = caseID
- catalogName = "clustercatalog-" + caseID
- ceName = "ce-" + caseID
- clusterroleName = ceName + "-clusterrole"
- roleNsName = ceName + "-role" + "-" + ns
- roleNsWatchName = ceName + "-role" + "-" + nsWatch
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-OwnSingle.yaml")
- saTemplate = filepath.Join(baseDir, "sa.yaml")
- bindingTemplate = filepath.Join(baseDir, "binding-prefligth_multirole.yaml")
- clustercatalog = olmv1util.ClusterCatalogDescription{
- Name: catalogName,
- Imageref: "quay.io/olmqe/nginx-ok-index:vokv81696",
- LabelValue: labelValue,
- Template: clustercatalogTemplate,
- }
- ce = olmv1util.ClusterExtensionDescription{
- Name: ceName,
- PackageName: "nginx-ok-v81696",
- Channel: "alpha",
- Version: ">=0.0.1",
- InstallNamespace: ns,
- WatchNamespace: nsWatch,
- SaName: sa,
- LabelValue: labelValue,
- Template: clusterextensionTemplate,
- }
- )
-
- g.By("Create namespace")
- defer func() {
- _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").Execute()
- }()
- err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
- o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
-
- g.By("Create watch namespace")
- defer func() {
- _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", nsWatch, "--ignore-not-found", "--force").Execute()
- }()
- err = oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", nsWatch).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
- o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", nsWatch)).To(o.BeTrue())
-
- g.By("Create clustercatalog")
- defer clustercatalog.Delete(oc)
- clustercatalog.Create(oc)
-
- g.By("create sa")
- paremeters := []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", saTemplate, "-p",
- "NAME=" + sa, "NAMESPACE=" + ns}
- configFileSa, errApplySa := olmv1util.ApplyNamepsaceResourceFromTemplate(oc, ns, paremeters...)
- o.Expect(errApplySa).NotTo(o.HaveOccurred())
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", configFileSa).Execute() }()
-
- g.By("check missing rule")
- defer ce.Delete(oc)
- _ = ce.CreateWithoutCheck(oc)
- ce.CheckClusterExtensionCondition(oc, "Progressing", "message",
- `Namespace:"" Verbs:[get] NonResourceURLs:[/metrics]`, 3, 150, 0)
- ce.CheckClusterExtensionCondition(oc, "Progressing", "message",
- `Namespace:"ns-81696" APIGroups:[] Resources:[services] ResourceNames:[nginx-ok-v81696-controller-manager-metrics-service] Verbs:[delete,get,patch,update]`, 3, 150, 0)
- // Check finalizers permission based on Boxcutter runtime feature gate
- if olmv1util.IsFeaturegateEnabled(oc, "NewOLMBoxCutterRuntime") {
- // Env3: Boxcutter with preflight - expects clusterobjectsets/finalizers
- // Note: In Boxcutter, the ResourceName is the ClusterObjectSet name (ce-81696-1 for first revision)
- ce.CheckClusterExtensionCondition(oc, "Progressing", "message",
- `Namespace:"" APIGroups:[olm.operatorframework.io] Resources:[clusterobjectsets/finalizers] ResourceNames:[ce-81696-1] Verbs:[update]`, 3, 150, 0)
- } else {
- // Env2: Helm with preflight - expects clusterextensions/finalizers
- ce.CheckClusterExtensionCondition(oc, "Progressing", "message",
- `Namespace:"" APIGroups:[olm.operatorframework.io] Resources:[clusterextensions/finalizers] ResourceNames:[ce-81696] Verbs:[update]`, 3, 150, 0)
- }
-
- g.By("generate rbac per missing rule and delete ce")
- jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.type=="%s")].%s}`, "Progressing", "message")
- output, errGet := olmv1util.GetNoEmpty(oc, "clusterextension", ce.Name, "-o", jsonpath)
- o.Expect(errGet).NotTo(o.HaveOccurred())
- ce.Delete(oc)
- e2e.Logf("====%v====", output)
-
- start := "permissions to manage cluster extension:"
- end1 := "authorization evaluation error:"
- end2 := "for resolved bundle"
- filtered := olmv1util.FilterPermissions(output, start, end1, end2)
- e2e.Logf("===============================================================================")
- e2e.Logf("%v", filtered)
- e2e.Logf("===============================================================================")
- rbacDir := e2e.TestContext.OutputDir
- clusterroleFile := filepath.Join(rbacDir, fmt.Sprintf("%s.yaml", clusterroleName))
- roleNsFile := filepath.Join(rbacDir, fmt.Sprintf("%s.yaml", roleNsName))
- roleNsWatchFile := filepath.Join(rbacDir, fmt.Sprintf("%s.yaml", roleNsWatchName))
-
- errGen := olmv1util.GenerateRBACFromMissingRules(filtered, ceName, rbacDir)
- o.Expect(errGen).NotTo(o.HaveOccurred())
-
- g.By("create clusterrole")
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", clusterroleFile).Execute() }()
- err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", clusterroleFile).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
-
- g.By("create role for ns")
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", roleNsFile).Execute() }()
- err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", roleNsFile).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
-
- g.By("create role for ns watch")
- // Check if the watch namespace role file exists before trying to apply it
- // The file may not exist if no permissions are needed for the watch namespace
- if _, err := os.Stat(roleNsWatchFile); err == nil {
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", roleNsWatchFile).Execute() }()
- err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", roleNsWatchFile).Execute()
- o.Expect(err).NotTo(o.HaveOccurred())
- } else {
- e2e.Logf("Watch namespace role file %s does not exist, skipping creation", roleNsWatchFile)
- }
-
- g.By("create binding")
- paremeters = []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", bindingTemplate, "-p",
- "SANAME=" + sa, "NAMESPACE=" + ns, "ROLENAME=" + roleNsName, "CLUSTERROLESANAME=" + clusterroleName,
- "WATCHNAMESPACE=" + nsWatch, "WATCHROLENAME=" + roleNsWatchName}
- configFileBinding, errApplyBinding := olmv1util.ApplyClusterResourceFromTemplate(oc, paremeters...)
- o.Expect(errApplyBinding).NotTo(o.HaveOccurred())
- defer func() { _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", configFileBinding).Execute() }()
-
- g.By("check ce again afrer applying correct rules")
- ce.Create(oc)
- })
-
- g.It("PolarionID:87224-[Skipped:Disconnected]Upgrade version support [Serial]", func() {
- var (
- caseID = "87224"
- ns = "ns-" + caseID
- sa = "sa" + caseID
- ceName = "ce-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-87224",
LabelValue: labelValue,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87224",
@@ -1015,7 +234,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
PackageName: "nginx-ok-v87224",
Version: "0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1043,9 +261,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -1092,20 +307,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
exutil.SkipForSNOCluster(oc)
olmv1util.ValidateAccessEnvironment(oc)
var (
- caseID = "74618"
- ns = "ns-" + caseID
- sa = "sa" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "74618"
+ ns = "ns-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-74618",
Imageref: "quay.io/olmqe/nginx-ok-index:vokv32777",
LabelValue: labelValue,
@@ -1117,7 +325,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1128,7 +335,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Version: ">=0.0.1",
InstallNamespace: ns,
UpgradeConstraintPolicy: "SelfCertified",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1138,7 +344,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1149,7 +354,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Version: ">=0.0.1",
InstallNamespace: ns,
UpgradeConstraintPolicy: "SelfCertified",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1159,7 +363,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1173,10 +376,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -1222,19 +421,17 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
g.It("PolarionID:76843-[OTP][Skipped:Disconnected]support disc with icsp[Timeout:40m] [Disruptive][Slow]", g.Label("original-name:[sig-olmv1][Jira:OLM] clusterextension PolarionID:76843-[Skipped:Disconnected]support disc with icsp[Timeout:30m] [Serial][Disruptive][Slow]"), func() {
exutil.SkipForSNOCluster(oc)
var (
- caseID = "76843"
- ns = "ns-" + caseID
- sa = "sa" + caseID
- labelValue = caseID
- catalogName = "clustercatalog-" + caseID
- ceName = "ce-" + caseID
- iscpName = "icsp-" + caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- icspTemplate = filepath.Join(baseDir, "icsp-single-mirror.yaml")
- icsp = olmv1util.IcspDescription{
+ caseID = "76843"
+ ns = "ns-" + caseID
+ labelValue = caseID
+ catalogName = "clustercatalog-" + caseID
+ ceName = "ce-" + caseID
+ iscpName = "icsp-" + caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ icspTemplate = filepath.Join(baseDir, "icsp-single-mirror.yaml")
+ icsp = olmv1util.IcspDescription{
Name: iscpName,
Mirror: "quay.io/olmqe",
Source: "qe76843.myregistry.io/olmqe",
@@ -1246,18 +443,12 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
LabelValue: labelValue,
Template: clustercatalogTemplate,
}
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
ce76843 = olmv1util.ClusterExtensionDescription{
Name: ceName,
PackageName: "nginx-ok-v76843",
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1291,10 +482,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("check ce to be installed")
defer ce76843.Delete(oc)
ce76843.Create(oc)
@@ -1305,19 +492,17 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
exutil.SkipOnProxyCluster(oc)
exutil.SkipForSNOCluster(oc)
var (
- caseID = "76844"
- ns = "ns-" + caseID
- sa = "sa" + caseID
- labelValue = caseID
- catalogName = "clustercatalog-" + caseID
- ceName = "ce-" + caseID
- itdmsName = "itdms-" + caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- itdmsTemplate = filepath.Join(baseDir, "itdms-full-mirror.yaml")
- itdms = olmv1util.ItdmsDescription{
+ caseID = "76844"
+ ns = "ns-" + caseID
+ labelValue = caseID
+ catalogName = "clustercatalog-" + caseID
+ ceName = "ce-" + caseID
+ itdmsName = "itdms-" + caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ itdmsTemplate = filepath.Join(baseDir, "itdms-full-mirror.yaml")
+ itdms = olmv1util.ItdmsDescription{
Name: itdmsName,
MirrorSite: "quay.io",
SourceSite: "qe76844.myregistry.io",
@@ -1331,18 +516,12 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
LabelValue: labelValue,
Template: clustercatalogTemplate,
}
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
ce76844 = olmv1util.ClusterExtensionDescription{
Name: ceName,
PackageName: "nginx-ok-v76844",
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1374,10 +553,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("check ce to be installed")
defer ce76844.Delete(oc)
ce76844.Create(oc)
@@ -1392,20 +567,18 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
architecture.SkipNonAmd64SingleArch(oc)
exutil.SkipForSNOCluster(oc)
var (
- caseID = "78193"
- ns = "ns-" + caseID
- sa = "sa" + caseID
- labelValue = caseID
- catalogName = "clustercatalog-" + caseID
- catalog1Name = "clustercatalog-" + caseID + "1"
- ceName = "ce-" + caseID
- cipName = "cip-" + caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- cipTemplate = filepath.Join(baseDir, "cip.yaml")
- cip = olmv1util.CipDescription{
+ caseID = "78193"
+ ns = "ns-" + caseID
+ labelValue = caseID
+ catalogName = "clustercatalog-" + caseID
+ catalog1Name = "clustercatalog-" + caseID + "1"
+ ceName = "ce-" + caseID
+ cipName = "cip-" + caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ cipTemplate = filepath.Join(baseDir, "cip.yaml")
+ cip = olmv1util.CipDescription{
Name: cipName,
Repo1: "quay.io/olmqe/nginx-ok-bundle-sigstore",
Repo2: "quay.io/olmqe/nginx-ok-bundle-sigstore1",
@@ -1425,18 +598,12 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
LabelValue: labelValue,
Template: clustercatalogTemplate,
}
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
ce = olmv1util.ClusterExtensionDescription{
Name: ceName,
PackageName: "nginx-ok-v78193",
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1462,10 +629,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clusterextension with olmsigkey signed successfully")
defer ce.Delete(oc)
ce.Create(oc)
@@ -1484,21 +647,19 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
}
exutil.SkipForSNOCluster(oc)
var (
- caseID = "781932"
- ns = "ns-" + caseID
- sa = "sa" + caseID
- imageRef = "quay.io/olmqe/nginx-ok-index-sigstore:vokv" + caseID
- packageName = "nginx-ok-v" + caseID
- labelValue = caseID
- catalogName = "clustercatalog-" + caseID
- ceName = "ce-" + caseID
- cipName = "cip-" + caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- cipTemplate = filepath.Join(baseDir, "cip.yaml")
- cip = olmv1util.CipDescription{
+ caseID = "781932"
+ ns = "ns-" + caseID
+ imageRef = "quay.io/olmqe/nginx-ok-index-sigstore:vokv" + caseID
+ packageName = "nginx-ok-v" + caseID
+ labelValue = caseID
+ catalogName = "clustercatalog-" + caseID
+ ceName = "ce-" + caseID
+ cipName = "cip-" + caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ cipTemplate = filepath.Join(baseDir, "cip.yaml")
+ cip = olmv1util.CipDescription{
Name: cipName,
Repo1: "quay.io/olmqe/nginx-ok-bundle-sigstore",
Repo2: "quay.io/olmqe/nginx-ok-bundle-sigstore1",
@@ -1513,18 +674,12 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
LabelValue: labelValue,
Template: clustercatalogTemplate,
}
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
ce = olmv1util.ClusterExtensionDescription{
Name: ceName,
PackageName: packageName,
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1550,10 +705,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clusterextension with olmsigkey signed successfully")
defer ce.Delete(oc)
ce.Create(oc)
@@ -1564,34 +715,26 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
exutil.SkipForSNOCluster(oc)
// This test validates installation from private container images and depends on cluster-wide pull secrets
var (
- caseID = "76983"
- ns = "ns-" + caseID
- sa = "sa" + caseID
- labelValue = caseID
- catalogName = "clustercatalog-" + caseID
- ceName = "ce-" + caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "76983"
+ ns = "ns-" + caseID
+ labelValue = caseID
+ catalogName = "clustercatalog-" + caseID
+ ceName = "ce-" + caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index-private:vokv76983",
LabelValue: labelValue,
Template: clustercatalogTemplate,
}
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
ce = olmv1util.ClusterExtensionDescription{
Name: ceName,
PackageName: "nginx-ok-v76983",
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1624,10 +767,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("check ce to be installed")
defer ce.Delete(oc)
ce.Create(oc)
@@ -1742,26 +881,15 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
g.It("PolarionID:83026-[OTP][Skipped:Disconnected]clusterextension updates sometimes failed with the following error from the CRDUpgradeCheck resource unknown change and refusing to determine that change is safe", g.Label("original-name:[sig-olmv1][Jira:OLM] clusterextension PolarionID:83026-[Skipped:Disconnected]clusterextension updates sometimes failed with the following error from the CRDUpgradeCheck resource unknown change and refusing to determine that change is safe"), func() {
baseDir := exutil.FixturePath("testdata", "olm")
clusterextensionTemplate := filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saAdminTemplate := filepath.Join(baseDir, "sa-admin.yaml")
g.By("1)install Argocd operator v0.4.0 in a random namespace")
- sa := "argocd-83026"
oc.SetupProject()
- saCrb := olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: oc.Namespace(),
- Template: saAdminTemplate,
- }
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
ceArgocd := olmv1util.ClusterExtensionDescription{
Name: "extension-argocd-83026",
PackageName: "argocd-operator",
Channel: "alpha",
Version: "v0.4.0",
InstallNamespace: oc.Namespace(),
- SaName: sa,
LabelKey: "olm.operatorframework.io/metadata.name",
LabelValue: "openshift-community-operators",
Template: clusterextensionTemplate,
@@ -1783,20 +911,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
g.It("PolarionID:69196-[OTP][Level0][Skipped:Disconnected]Supports Version Ranges during clusterextension upgrade", func() {
var (
- caseID = "69196"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-69196"
- sa = "sa69196"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "69196"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ ns = "ns-69196"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-69196",
LabelValue: labelValue,
Imageref: "quay.io/olmqe/olmtest-operator-index:nginxolm69196",
@@ -1808,7 +929,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
PackageName: "nginx69196",
Channel: "candidate-v1.0",
Version: "1.0.1",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -1822,10 +942,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -1890,15 +1006,8 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
clusterextensionWithoutChannelTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml")
clusterextensionWithoutChannelVersionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannelVersion.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
ns = "ns-68821"
- sa = "sa68821"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-68821",
LabelValue: labelValue,
Imageref: "quay.io/olmqe/olmtest-operator-index:nginxolm68821",
@@ -1911,7 +1020,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Version: ">=0.0.1",
LabelValue: labelValue,
InstallNamespace: ns,
- SaName: sa,
Template: clusterextensionTemplate,
}
)
@@ -1924,10 +1032,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -1971,20 +1075,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
g.It("PolarionID:74108-[OTP][Skipped:Disconnected][Slow]olm v1 supports legacy upgrade edges", func() {
var (
- caseID = "74108"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutVersion.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-74108"
- sa = "sa74108"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "74108"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutVersion.yaml")
+ ns = "ns-74108"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-74108",
Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm74108",
LabelValue: labelValue,
@@ -1996,7 +1093,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
PackageName: "nginx74108",
Channel: "candidate-v0.0",
LabelValue: labelValue,
- SaName: sa,
Template: clusterextensionTemplate,
}
)
@@ -2009,10 +1105,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("1) Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -2155,27 +1247,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
g.It("PolarionID:74923-[OTP][Skipped:Disconnected]no two ClusterExtensions can manage the same underlying object", func() {
var (
- caseID = "74923"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannelVersion.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns1 = "ns-74923-1"
- ns2 = "ns-74923-2"
- sa1 = "sa74923-1"
- sa2 = "sa74923-2"
- saCrb1 = olmv1util.SaCLusterRolebindingDescription{
- Name: sa1,
- Namespace: ns1,
- Template: saClusterRoleBindingTemplate,
- }
- saCrb2 = olmv1util.SaCLusterRolebindingDescription{
- Name: sa2,
- Namespace: ns2,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "74923"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannelVersion.yaml")
+ ns1 = "ns-74923-1"
+ ns2 = "ns-74923-2"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-74923-1",
Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm74923",
LabelValue: labelValue,
@@ -2185,7 +1264,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Name: "clusterextension-74923-1",
PackageName: "nginx74923",
InstallNamespace: ns1,
- SaName: sa1,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -2193,7 +1271,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Name: "clusterextension-74923-2",
PackageName: "nginx74923",
InstallNamespace: ns2,
- SaName: sa2,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -2212,10 +1289,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns1)).To(o.BeTrue())
- g.By("2.2 Create SA for clusterextension1")
- defer saCrb1.Delete(oc)
- saCrb1.Create(oc)
-
g.By("2.3 Create clusterextension1")
defer clusterextension1.Delete(oc)
clusterextension1.Create(oc)
@@ -2230,10 +1303,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns2)).To(o.BeTrue())
- g.By("3.2 Create SA for clusterextension2")
- defer saCrb2.Delete(oc)
- saCrb2.Create(oc)
-
g.By("3.3 Create clusterextension2")
defer clusterextension2.Delete(oc)
_ = clusterextension2.CreateWithoutCheck(oc)
@@ -2284,20 +1353,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
g.It("PolarionID:75501-[OTP][Skipped:Disconnected]the updates of various status fields is orthogonal", func() {
var (
- caseID = "75501"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-75501"
- sa = "sa75501"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "75501"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
+ ns = "ns-75501"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: "clustercatalog-75501",
Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75501",
LabelValue: labelValue,
@@ -2309,7 +1371,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
PackageName: "nginx75501",
Channel: "candidate-v2.1",
Version: "2.1.0",
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -2323,10 +1384,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -2414,14 +1471,7 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
clusterextensionExpressionsTemplate = filepath.Join(baseDir, "clusterextension-withselectorExpressions-WithoutChannelVersion.yaml")
clusterextensionLableExpressionsTemplate = filepath.Join(baseDir, "clusterextension-withselectorLableExpressions-WithoutChannelVersion.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-76685"
- sa = "sa76685"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
+ ns = "ns-76685"
clustercatalog1 = olmv1util.ClusterCatalogDescription{
LabelKey: "olmv1-test",
LabelValue: "ocp-76685-1",
@@ -2447,7 +1497,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Name: "clusterextension-76685",
InstallNamespace: ns,
PackageName: "nginx76685",
- SaName: sa,
Template: clusterextensionTemplate,
}
)
@@ -2460,9 +1509,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
defer clustercatalog1.Delete(oc)
clustercatalog1.Create(oc)
defer clustercatalog2.Delete(oc)
@@ -2541,20 +1587,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
g.It("PolarionID:77972-[OTP][Skipped:Disconnected]olm v1 Supports MaxOCPVersion in properties file", func() {
var (
- caseID = "77972"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-77972"
- sa = "sa77972"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "77972"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml")
+ ns = "ns-77972"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
LabelKey: "olmv1-test",
LabelValue: labelValue,
Name: "clustercatalog-77972",
@@ -2566,7 +1605,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Name: "clusterextension-77972",
InstallNamespace: ns,
PackageName: "nginx77972",
- SaName: sa,
Version: "0.0.1",
LabelValue: labelValue,
Template: clusterextensionTemplate,
@@ -2581,9 +1619,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -2651,20 +1686,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
g.It("PolarionID:82249-[OTP][Skipped:Disconnected]Verify olmv1 support for float type maxOCPVersion in properties file", func() {
var (
- caseID = "82249"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-82249"
- sa = "sa82249"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "82249"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml")
+ ns = "ns-82249"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
LabelKey: "olmv1-test",
Name: "clustercatalog-82249",
LabelValue: labelValue,
@@ -2676,7 +1704,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Name: "clusterextension-82249",
InstallNamespace: ns,
PackageName: "nginx82249",
- SaName: sa,
Version: "0.0.1",
LabelValue: labelValue,
Template: clusterextensionTemplate,
@@ -2691,9 +1718,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -2774,15 +1798,8 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
clusterextensionOwnSingleTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml")
clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-80117"
- nsWatch = "ns-80117-watch"
- sa = "sa80117"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
+ ns = "ns-80117"
+ nsWatch = "ns-80117-watch"
clustercatalog = olmv1util.ClusterCatalogDescription{
LabelKey: "olmv1-test",
LabelValue: labelValue,
@@ -2795,7 +1812,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Name: "clusterextension-80117",
InstallNamespace: ns,
PackageName: "nginx80117",
- SaName: sa,
Version: "1.0.1",
WatchNamespace: nsWatch,
LabelValue: labelValue,
@@ -2805,7 +1821,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Name: "clusterextension-80117",
InstallNamespace: ns,
PackageName: "nginx80117",
- SaName: sa,
Version: "1.1.0",
LabelValue: labelValue,
Template: clusterextensionTemplate,
@@ -2820,9 +1835,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -2917,12 +1929,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
g.By("8) check not support install two same clusterextensions")
ns2 := ns + "-2"
nsWatch2 := nsWatch + "-2"
- sa2 := "sa80117-2"
- saCrb2 := olmv1util.SaCLusterRolebindingDescription{
- Name: sa2,
- Namespace: ns2,
- Template: saClusterRoleBindingTemplate,
- }
defer func() {
_ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns2, "--ignore-not-found").Execute()
@@ -2937,13 +1943,10 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", nsWatch2)).To(o.BeTrue())
- defer saCrb2.Delete(oc)
- saCrb2.Create(oc)
clusterextension2 := olmv1util.ClusterExtensionDescription{
Name: "clusterextension-80117-2",
InstallNamespace: ns2,
PackageName: "nginx80117",
- SaName: sa2,
Version: "2.0.0",
WatchNamespace: nsWatch2,
LabelKey: "olmv1-test",
@@ -2979,14 +1982,7 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
clusterextensionOwnSingleTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml")
clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-80120"
- sa = "sa80120"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
+ ns = "ns-80120"
clustercatalog = olmv1util.ClusterCatalogDescription{
LabelKey: "olmv1-test",
LabelValue: labelValue,
@@ -2999,7 +1995,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Name: "clusterextension-80120",
InstallNamespace: ns,
PackageName: "nginx80120",
- SaName: sa,
Version: "1.0.1",
LabelKey: "olmv1-test",
LabelValue: labelValue,
@@ -3010,7 +2005,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Name: "clusterextension-80120",
InstallNamespace: ns,
PackageName: "nginx80120",
- SaName: sa,
Version: "3.0.0",
LabelKey: "olmv1-test",
LabelValue: labelValue,
@@ -3026,9 +2020,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -3098,7 +2089,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Name: "clusterextension-80120",
InstallNamespace: ns,
PackageName: "nginx80120",
- SaName: sa,
Version: "1.0.1",
WatchNamespace: ns + "flake",
LabelKey: "olmv1-test",
@@ -3122,20 +2112,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
g.It("PolarionID:82136-[OTP][Skipped:Disconnected]olm v1 supports NetworkPolicy resources", func() {
var (
- caseID = "82136"
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- ns = "ns-82136"
- sa = "sa82136"
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "82136"
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml")
+ ns = "ns-82136"
+ clustercatalog = olmv1util.ClusterCatalogDescription{
LabelKey: "olmv1-test",
LabelValue: labelValue,
Name: "clustercatalog-82136",
@@ -3147,7 +2130,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
InstallNamespace: ns,
PackageName: "nginx82136",
Version: "1.0.1",
- SaName: sa,
LabelKey: "olmv1-test",
LabelValue: labelValue,
Template: clusterextensionTemplate,
@@ -3162,10 +2144,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("1) Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -3248,7 +2226,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
var (
caseID = "83979"
ns = "ns-" + caseID
- saName = "sa-" + caseID
catalogName = "clustercatalog-" + caseID
ceName = "ce-" + caseID
validatingName = "validating-webhook-test-" + caseID
@@ -3258,7 +2235,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
baseDir = exutil.FixturePath("testdata", "olm")
clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml")
clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml")
- saTemplate = filepath.Join(baseDir, "sa-admin.yaml")
webhookTemplate = filepath.Join(baseDir, "cr-webhookTest.yaml")
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
@@ -3271,14 +2247,8 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
Channel: "alpha",
Version: "0.0.1",
InstallNamespace: ns,
- SaName: saName,
Template: clusterextensionTemplate,
}
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: saName,
- Namespace: ns,
- Template: saTemplate,
- }
)
g.By("Create namespace")
@@ -3289,10 +2259,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
- g.By("Create service account with admin permissions")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
diff --git a/openshift/tests-extension/test/qe/specs/olmv1_ce_deploymentconfig.go b/openshift/tests-extension/test/qe/specs/olmv1_ce_deploymentconfig.go
index 2f64fe03ba..f9834788e6 100644
--- a/openshift/tests-extension/test/qe/specs/olmv1_ce_deploymentconfig.go
+++ b/openshift/tests-extension/test/qe/specs/olmv1_ce_deploymentconfig.go
@@ -35,16 +35,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87536-deploymentConfig env vars are applied to operator deployment and available in pod", func() {
olmv1util.ValidateAccessEnvironment(oc)
var (
- caseID = "87536"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87536"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Define inline config as JSON string (for ${{}} template parsing)
inlineConfig = `{
@@ -64,11 +62,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
"ANOTHER_VAR": "another-value",
}
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87536",
@@ -81,7 +74,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -98,11 +90,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -149,16 +136,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87537-deploymentConfig env vars override existing bundle env vars with same name", func() {
olmv1util.ValidateAccessEnvironment(oc)
var (
- caseID = "87537"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87537"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Define inline config as JSON string (for ${{}} template parsing)
// ENV1: will override bundle's ENV1=bundle_value1
@@ -183,11 +168,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
"ENV3": "config_value3", // Test Point 3: Add new env var
}
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87537",
@@ -200,7 +180,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -217,11 +196,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -267,20 +241,18 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87539-[Skipped:Disconnected]deploymentConfig envFrom sources are appended to operator deployment without duplicates", func() {
var (
- caseID = "87539"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- cmBundle1 = "test-cm-bundle-1" // Predefined in bundle CSV
- cmBundle2 = "test-cm-bundle-2" // Predefined in bundle CSV
- cmConfigNew = "test-cm-config-new" // New CM from config
- secretConfig = "test-secret-config" // New Secret from config
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87539"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ cmBundle1 = "test-cm-bundle-1" // Predefined in bundle CSV
+ cmBundle2 = "test-cm-bundle-2" // Predefined in bundle CSV
+ cmConfigNew = "test-cm-config-new" // New CM from config
+ secretConfig = "test-secret-config" // New Secret from config
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Define inline config as JSON string (for ${{}} template parsing)
// test-cm-bundle-1: Duplicate with bundle - should NOT be added again (deduplication)
@@ -296,11 +268,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
}
}`
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87539",
@@ -313,7 +280,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -367,11 +333,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("Created Secret: %s", secretConfig)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -453,18 +414,16 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87541-[Skipped:Disconnected]deploymentConfig volumes are appended to operator deployment", func() {
var (
- caseID = "87541"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- cmVolume = "test-cm-vol" // ConfigMap for volume
- secretVolume = "test-secret-vol" // Secret for volume
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87541"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ cmVolume = "test-cm-vol" // ConfigMap for volume
+ secretVolume = "test-secret-vol" // Secret for volume
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Define inline config as JSON string (for ${{}} template parsing)
// Volume 1: Same name as bundle (bundle-emptydir-vol) but different type (ConfigMap vs emptyDir)
@@ -489,11 +448,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
}
}`
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87541",
@@ -506,7 +460,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -545,11 +498,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("Created Secret: %s", secretVolume)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -653,18 +601,16 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87542-[Skipped:Disconnected]deploymentConfig volumeMounts are appended to all operator containers", func() {
var (
- caseID = "87542"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- cmVolume = "test-cm-vol" // ConfigMap for volume
- secretVolume = "test-secret-vol" // Secret for volume
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87542"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ cmVolume = "test-cm-vol" // ConfigMap for volume
+ secretVolume = "test-secret-vol" // Secret for volume
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Define inline config as JSON string (for ${{}} template parsing)
// Volume 1: Same name as bundle (bundle-emptydir-vol) - matches volumeMount 1
@@ -701,11 +647,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
}
}`
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87542",
@@ -718,7 +659,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -757,11 +697,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("Created Secret: %s", secretVolume)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -874,16 +809,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87543-[Skipped:Disconnected]deploymentConfig tolerations are appended to operator deployment without duplicates", func() {
var (
- caseID = "87543"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87543"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Define inline config as JSON string (for ${{}} template parsing)
// bundle-key: Duplicate with bundle - should NOT be added again (deduplication)
@@ -914,11 +847,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
}
}`
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87543",
@@ -931,7 +859,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -948,11 +875,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -1018,16 +940,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87544-[Skipped:Disconnected]deploymentConfig resources completely replace existing resource requirements", func() {
var (
- caseID = "87544"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87544"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Define inline config as JSON string (for ${{}} template parsing)
// Config resources COMPLETELY REPLACE bundle resources (no merge)
@@ -1049,11 +969,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
}
}`
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87544",
@@ -1066,7 +981,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -1083,11 +997,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -1182,16 +1091,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87545-[Skipped:Disconnected]deploymentConfig nodeSelector completely replaces existing node selector", func() {
var (
- caseID = "87545"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87545"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Define inline config as JSON string (for ${{}} template parsing)
// Config nodeSelector COMPLETELY REPLACES bundle nodeSelector (no merge, no partial override)
@@ -1207,11 +1114,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
}
}`
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87545",
@@ -1224,7 +1126,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -1241,11 +1142,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -1333,16 +1229,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87546-[Skipped:Disconnected]deploymentConfig nodeAffinity overrides existing nodeAffinity", func() {
var (
- caseID = "87546"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87546"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Define inline config as JSON string (for ${{}} template parsing)
// This test has TWO phases:
@@ -1377,11 +1271,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
}
}`
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87546",
@@ -1394,7 +1283,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -1411,11 +1299,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -1611,16 +1494,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87547-[Skipped:Disconnected]deploymentConfig podAffinity overrides existing podAffinity", func() {
var (
- caseID = "87547"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87547"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Define inline config as JSON string (for ${{}} template parsing)
// CRITICAL: Only specify podAffinity, NOT nodeAffinity or podAntiAffinity
@@ -1655,11 +1536,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
}
}`
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87546", // Reuse same bundle as 87546
@@ -1672,7 +1548,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -1689,11 +1564,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -1800,16 +1670,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87548-[Skipped:Disconnected]deploymentConfig podAntiAffinity overrides existing podAntiAffinity", func() {
var (
- caseID = "87548"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87548"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Define inline config as JSON string (for ${{}} template parsing)
// CRITICAL: This tests TWO behaviors:
@@ -1847,11 +1715,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
}
}`
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87548",
@@ -1864,7 +1727,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -1881,11 +1743,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -2015,16 +1872,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87549-[Skipped:Disconnected]deploymentConfig annotations are merged with existing taking precedence", func() {
var (
- caseID = "87549"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87549"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Define inline config as JSON string (for ${{}} template parsing)
// NOTE: Due to CSV API limitation, deployment-level and pod-level behave differently:
@@ -2046,11 +1901,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
}
}`
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87549",
@@ -2063,7 +1913,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -2080,11 +1929,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -2195,16 +2039,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87550-[Skipped:Disconnected]deploymentConfig with resources and nodeSelector both work correctly", func() {
var (
- caseID = "87550"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87550"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Configure resources and nodeSelector together
// Test Point 1: Resources applied to all containers in Deployment
@@ -2229,11 +2071,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
}
}`
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87550",
@@ -2246,7 +2083,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -2263,11 +2099,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -2387,16 +2218,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87551-[Skipped:Disconnected]deploymentConfig with env tolerations and resources all work correctly", func() {
var (
- caseID = "87551"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87551"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Configure env, tolerations, and resources together
// Test Point 1: Env vars applied to containers and accessible in pod
@@ -2441,11 +2270,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
"TEST_ENV2": "value2",
}
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87551",
@@ -2458,7 +2282,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -2475,11 +2298,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -2606,16 +2424,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87552-[Skipped:Disconnected]deploymentConfig works correctly when combined with watchNamespace configuration", func() {
var (
- caseID = "87552"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87552"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Configure watchNamespace (SingleNamespace mode) and deploymentConfig together
// Test Point 1: WatchNamespace configuration verified (operator scoped to specific namespace)
@@ -2646,11 +2462,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
"TEST_ENV_WATCH": "watchvalue",
}
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87552",
@@ -2663,7 +2474,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: inlineConfig,
@@ -2691,11 +2501,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", watchNs)).To(o.BeTrue())
e2e.Logf("Created watch namespace: %s (for config test only)", watchNs)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -2811,16 +2616,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87553-[Skipped:Disconnected]adding deploymentConfig multiple fields to existing ClusterExtension works correctly", func() {
var (
- caseID = "87553"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87553"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
// Configuration to add (env + resources)
// Test Point 1: Adding config triggers reconcile
@@ -2850,11 +2653,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
"ADDED_ENV": "added_value",
}
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87553",
@@ -2867,7 +2665,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
// NO InlineConfig initially - will be added later
@@ -2884,11 +2681,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -3072,16 +2864,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87554-[Skipped:Disconnected]modifying deploymentConfig multiple fields in existing ClusterExtension works correctly", func() {
var (
- caseID = "87554"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87554"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Initial configuration (env + resources)
initialConfig = `{
@@ -3129,11 +2919,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
"MODIFIED_ENV": "modified_value",
}
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87554",
@@ -3146,7 +2931,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: initialConfig,
@@ -3163,11 +2947,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -3351,16 +3130,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87555-[Skipped:Disconnected]removing entire deploymentConfig from ClusterExtension reverts all settings to bundle defaults", func() {
var (
- caseID = "87555"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87555"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Initial configuration with multiple fields
// This tests comprehensive removal of all custom configurations
@@ -3416,11 +3193,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
)
var (
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87555",
@@ -3433,7 +3205,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: initialConfig,
@@ -3450,11 +3221,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -3689,16 +3455,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
g.It("PolarionID:87556-[Skipped:Disconnected]removing partial fields from deploymentConfig reverts those fields to bundle defaults while keeping others", func() {
var (
- caseID = "87556"
- ns = "test-ns-" + caseID
- sa = "test-sa-" + caseID
- catalogName = "test-catalog-" + caseID
- extName = "test-ext-" + caseID
- labelValue = caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "87556"
+ ns = "test-ns-" + caseID
+ catalogName = "test-catalog-" + caseID
+ extName = "test-ext-" + caseID
+ labelValue = caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-inlineconfig.yaml")
// Initial configuration with multiple fields (env + resources + tolerations)
// We'll later remove resources and tolerations while keeping env
@@ -3732,11 +3496,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
)
var (
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv87556",
@@ -3749,7 +3508,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
InlineConfig: initialConfig,
@@ -3766,11 +3524,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLMv1 ClusterExtension DeploymentConfi
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())
e2e.Logf("Created namespace: %s", ns)
- g.By("Create ServiceAccount and RBAC for ClusterExtension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("Created ServiceAccount and RBAC: %s", sa)
-
g.By("Create ClusterCatalog with test operator")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
diff --git a/openshift/tests-extension/test/qe/specs/olmv1_ce_watchns.go b/openshift/tests-extension/test/qe/specs/olmv1_ce_watchns.go
index 840e32586a..54a67571cb 100644
--- a/openshift/tests-extension/test/qe/specs/olmv1_ce_watchns.go
+++ b/openshift/tests-extension/test/qe/specs/olmv1_ce_watchns.go
@@ -31,20 +31,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
caseID = "85510"
ns = "ns-" + caseID
nsTarget = "ns-" + caseID + "-target"
- sa = "sa" + caseID
labelValue = caseID
catalogName = "clustercatalog-" + caseID
baseDir = exutil.FixturePath("testdata", "olm")
clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
clusterextensionConfigTemplate = filepath.Join(baseDir, "clusterextension-watchns-config.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv85510",
LabelValue: labelValue,
@@ -68,16 +61,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", nsTarget)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- e2e.Logf("=== ServiceAccount resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ServiceAccount", sa, "-n", ns, "-o", "yaml").Execute()
- e2e.Logf("=== ClusterRole resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ClusterRole", sa+"-installer-admin-clusterrole", "-o", "yaml").Execute()
- e2e.Logf("=== ClusterRoleBinding resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ClusterRoleBinding", sa+"-installer-admin-clusterrole-binding", "-o", "yaml").Execute()
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -92,7 +75,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -111,7 +93,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: "",
Template: clusterextensionConfigTemplate,
@@ -131,7 +112,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: ns,
Template: clusterextensionConfigTemplate,
@@ -151,7 +131,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: nsTarget,
Template: clusterextensionConfigTemplate,
@@ -173,20 +152,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
caseID = "85543"
ns = "ns-" + caseID
nsTarget = "ns-" + caseID + "-target"
- sa = "sa" + caseID
labelValue = caseID
catalogName = "clustercatalog-" + caseID
baseDir = exutil.FixturePath("testdata", "olm")
clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
clusterextensionConfigTemplate = filepath.Join(baseDir, "clusterextension-watchns-config.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv85543",
LabelValue: labelValue,
@@ -210,17 +182,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", nsTarget)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- // Print full RBAC resources for manual test documentation
- e2e.Logf("=== ServiceAccount resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ServiceAccount", sa, "-n", ns, "-o", "yaml").Execute()
- e2e.Logf("=== ClusterRole resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ClusterRole", sa+"-installer-admin-clusterrole", "-o", "yaml").Execute()
- e2e.Logf("=== ClusterRoleBinding resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ClusterRoleBinding", sa+"-installer-admin-clusterrole-binding", "-o", "yaml").Execute()
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -236,7 +197,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -258,7 +218,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: "",
Template: clusterextensionConfigTemplate,
@@ -282,7 +241,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: ns,
Template: clusterextensionConfigTemplate,
@@ -304,7 +262,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: nsTarget,
Template: clusterextensionConfigTemplate,
@@ -327,20 +284,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
caseID = "85546"
ns = "ns-" + caseID
nsTarget = "ns-" + caseID + "-target"
- sa = "sa" + caseID
labelValue = caseID
catalogName = "clustercatalog-" + caseID
baseDir = exutil.FixturePath("testdata", "olm")
clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
clusterextensionConfigTemplate = filepath.Join(baseDir, "clusterextension-watchns-config.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv85546",
LabelValue: labelValue,
@@ -364,17 +314,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", nsTarget)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- // Print full RBAC resources for manual test documentation
- e2e.Logf("=== ServiceAccount resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ServiceAccount", sa, "-n", ns, "-o", "yaml").Execute()
- e2e.Logf("=== ClusterRole resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ClusterRole", sa+"-installer-admin-clusterrole", "-o", "yaml").Execute()
- e2e.Logf("=== ClusterRoleBinding resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ClusterRoleBinding", sa+"-installer-admin-clusterrole-binding", "-o", "yaml").Execute()
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -392,7 +331,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -416,7 +354,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: "",
Template: clusterextensionConfigTemplate,
@@ -440,7 +377,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: ns,
Template: clusterextensionConfigTemplate,
@@ -462,7 +398,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: nsTarget,
Template: clusterextensionConfigTemplate,
@@ -485,20 +420,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
caseID = "85547"
ns = "ns-" + caseID
nsTarget = "ns-" + caseID + "-target"
- sa = "sa" + caseID
labelValue = caseID
catalogName = "clustercatalog-" + caseID
baseDir = exutil.FixturePath("testdata", "olm")
clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
clusterextensionConfigTemplate = filepath.Join(baseDir, "clusterextension-watchns-config.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv85547",
LabelValue: labelValue,
@@ -524,17 +452,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", nsTarget)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- // Print full RBAC resources for manual test documentation
- e2e.Logf("=== ServiceAccount resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ServiceAccount", sa, "-n", ns, "-o", "yaml").Execute()
- e2e.Logf("=== ClusterRole resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ClusterRole", sa+"-installer-admin-clusterrole", "-o", "yaml").Execute()
- e2e.Logf("=== ClusterRoleBinding resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ClusterRoleBinding", sa+"-installer-admin-clusterrole-binding", "-o", "yaml").Execute()
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -555,7 +472,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -577,7 +493,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: "",
Template: clusterextensionConfigTemplate,
@@ -603,7 +518,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: ns,
Template: clusterextensionConfigTemplate,
@@ -626,7 +540,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: nsTarget,
Template: clusterextensionConfigTemplate,
@@ -649,20 +562,13 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
caseID = "85549"
ns = "ns-" + caseID
nsTarget = "ns-" + caseID + "-target"
- sa = "sa" + caseID
labelValue = caseID
catalogName = "clustercatalog-" + caseID
baseDir = exutil.FixturePath("testdata", "olm")
clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml")
clusterextensionConfigTemplate = filepath.Join(baseDir, "clusterextension-watchns-config.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv85549",
LabelValue: labelValue,
@@ -688,17 +594,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", nsTarget)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
- // Print full RBAC resources for manual test documentation
- e2e.Logf("=== ServiceAccount resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ServiceAccount", sa, "-n", ns, "-o", "yaml").Execute()
- e2e.Logf("=== ClusterRole resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ClusterRole", sa+"-installer-admin-clusterrole", "-o", "yaml").Execute()
- e2e.Logf("=== ClusterRoleBinding resource ===")
- _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("ClusterRoleBinding", sa+"-installer-admin-clusterrole-binding", "-o", "yaml").Execute()
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -719,7 +614,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
Template: clusterextensionTemplate,
}
@@ -744,7 +638,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: "",
Template: clusterextensionConfigTemplate,
@@ -769,7 +662,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: ns,
Template: clusterextensionConfigTemplate,
@@ -794,7 +686,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: sa,
LabelValue: labelValue,
WatchNamespace: nsTarget,
Template: clusterextensionConfigTemplate,
@@ -816,21 +707,14 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
g.It("PolarionID:85650-[Skipped:Disconnected]API-level error validation for watchNamespace configuration", func() {
var (
- caseID = "85650"
- ns = "ns-" + caseID
- nsTarget = "ns-" + caseID + "-target"
- sa = "sa" + caseID
- labelValue = caseID
- catalogName = "clustercatalog-" + caseID
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
- saCrb = olmv1util.SaCLusterRolebindingDescription{
- Name: sa,
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
- clustercatalog = olmv1util.ClusterCatalogDescription{
+ caseID = "85650"
+ ns = "ns-" + caseID
+ nsTarget = "ns-" + caseID + "-target"
+ labelValue = caseID
+ catalogName = "clustercatalog-" + caseID
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml")
+ clustercatalog = olmv1util.ClusterCatalogDescription{
Name: catalogName,
Imageref: "quay.io/olmqe/nginx-ok-index:vokv85650",
LabelValue: labelValue,
@@ -854,10 +738,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension watchNamespace config
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", nsTarget)).To(o.BeTrue())
- g.By("Create SA for clusterextension")
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By("Create clustercatalog")
defer clustercatalog.Delete(oc)
clustercatalog.Create(oc)
@@ -875,8 +755,6 @@ spec:
channel: alpha
version: ">=0.0.1"
installNamespace: ` + ns + `
- serviceAccount:
- name: ` + sa + `
selector:
matchLabels:
test: ` + labelValue + `
@@ -900,8 +778,6 @@ spec:
channel: alpha
version: ">=0.0.1"
installNamespace: ` + ns + `
- serviceAccount:
- name: ` + sa + `
selector:
matchLabels:
test: ` + labelValue + `
@@ -926,8 +802,6 @@ spec:
channel: alpha
version: ">=0.0.1"
installNamespace: ` + ns + `
- serviceAccount:
- name: ` + sa + `
selector:
matchLabels:
test: ` + labelValue + `
@@ -952,8 +826,6 @@ spec:
channel: alpha
version: ">=0.0.1"
installNamespace: ` + ns + `
- serviceAccount:
- name: ` + sa + `
selector:
matchLabels:
test: ` + labelValue + `
diff --git a/openshift/tests-extension/test/qe/specs/olmv1_stress.go b/openshift/tests-extension/test/qe/specs/olmv1_stress.go
index ae6baf7df4..0c008d2403 100644
--- a/openshift/tests-extension/test/qe/specs/olmv1_stress.go
+++ b/openshift/tests-extension/test/qe/specs/olmv1_stress.go
@@ -28,21 +28,19 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLM v1 for stress", func() {
// author: kuiwang@redhat.com
g.It("PolarionID:81509-[OTP][Skipped:Disconnected][OlmStress]olmv1 create mass operator to see if they all are installed successfully [Slow][Timeout:330m]", g.Label("StressTest"), g.Label("NonHyperShiftHOST"), func() {
var (
- caseID = "81509"
- prefixCatalog = "catalog-" + caseID
- prefixSa = "sa-" + caseID
- prefixCe = "ce-" + caseID
- prefixNs = "ns-" + caseID
- prefixPackage = "stress-olmv1-c"
- prefixImage = "quay.io/olmqe/stress-index:vokv"
- nsOc = "openshift-operator-controller"
- nsCatalog = "openshift-catalogd"
- catalogLabel = "control-plane=catalogd-controller-manager"
- ocLabel = "control-plane=operator-controller-controller-manager"
- baseDir = exutil.FixturePath("testdata", "olm")
- clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml")
- clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml")
- saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
+ caseID = "81509"
+ prefixCatalog = "catalog-" + caseID
+ prefixCe = "ce-" + caseID
+ prefixNs = "ns-" + caseID
+ prefixPackage = "stress-olmv1-c"
+ prefixImage = "quay.io/olmqe/stress-index:vokv"
+ nsOc = "openshift-operator-controller"
+ nsCatalog = "openshift-catalogd"
+ catalogLabel = "control-plane=catalogd-controller-manager"
+ ocLabel = "control-plane=operator-controller-controller-manager"
+ baseDir = exutil.FixturePath("testdata", "olm")
+ clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml")
+ clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml")
)
if !olmv1util.IsPodReady(oc, nsCatalog, catalogLabel) {
@@ -67,18 +65,12 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLM v1 for stress", func() {
Imageref: fmt.Sprintf("%s%d", prefixImage, i),
Template: clustercatalogTemplate,
}
- saCrb := olmv1util.SaCLusterRolebindingDescription{
- Name: fmt.Sprintf("%s-%d", prefixSa, i),
- Namespace: ns,
- Template: saClusterRoleBindingTemplate,
- }
ce := olmv1util.ClusterExtensionDescription{
Name: fmt.Sprintf("%s-%d", prefixCe, i),
PackageName: fmt.Sprintf("%s%d", prefixPackage, i),
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
- SaName: fmt.Sprintf("%s-%d", prefixSa, i),
Template: clusterextensionTemplate,
}
g.By(fmt.Sprintf("Create namespace for %d", i))
@@ -97,10 +89,6 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] OLM v1 for stress", func() {
o.Expect(err).NotTo(o.HaveOccurred())
clustercatalog.WaitCatalogStatus(oc, "true", "Serving", 0)
- g.By(fmt.Sprintf("Create SA for clusterextension for %d", i))
- defer saCrb.Delete(oc)
- saCrb.Create(oc)
-
g.By(fmt.Sprintf("check ce to be installed for %d", i))
e2e.Logf("=========Create clusterextension %v=========", ce.Name)
defer ce.Delete(oc)
diff --git a/openshift/tests-extension/test/qe/testdata/olm/binding-prefligth.yaml b/openshift/tests-extension/test/qe/testdata/olm/binding-prefligth.yaml
deleted file mode 100644
index e819eeb1e2..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/binding-prefligth.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-binding-preflight-template
-objects:
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${CLUSTERROLESANAME}-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${CLUSTERROLESANAME}"
- subjects:
- - kind: ServiceAccount
- name: "${SANAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${ROLENAME}-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${ROLENAME}"
- namespace: "${NAMESPACE}"
- subjects:
- - kind: ServiceAccount
- name: "${SANAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: SANAME
- - name: ROLENAME
- - name: CLUSTERROLESANAME
- - name: NAMESPACE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/binding-prefligth_multirole.yaml b/openshift/tests-extension/test/qe/testdata/olm/binding-prefligth_multirole.yaml
deleted file mode 100644
index 92b72baf12..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/binding-prefligth_multirole.yaml
+++ /dev/null
@@ -1,52 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-binding-preflight-template
-objects:
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${CLUSTERROLESANAME}-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${CLUSTERROLESANAME}"
- subjects:
- - kind: ServiceAccount
- name: "${SANAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${ROLENAME}-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${ROLENAME}"
- namespace: "${NAMESPACE}"
- subjects:
- - kind: ServiceAccount
- name: "${SANAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${WATCHROLENAME}-binding"
- namespace: "${WATCHNAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${WATCHROLENAME}"
- namespace: "${WATCHNAMESPACE}"
- subjects:
- - kind: ServiceAccount
- name: "${SANAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: SANAME
- - name: ROLENAME
- - name: CLUSTERROLESANAME
- - name: NAMESPACE
- - name: WATCHROLENAME
- - name: WATCHNAMESPACE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-watchns-config.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-watchns-config.yaml
index 137a9c1660..0898f41bfe 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-watchns-config.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-watchns-config.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
config:
configType: Inline
inline:
@@ -32,7 +30,6 @@ parameters:
- name: PACKAGE
- name: CHANNEL
- name: VERSION
-- name: SANAME
- name: WATCHNS
value: ""
- name: POLICY
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorExpressions-WithoutChannelVersion.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorExpressions-WithoutChannelVersion.yaml
index 8b004bc077..9cd539521e 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorExpressions-WithoutChannelVersion.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorExpressions-WithoutChannelVersion.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -26,7 +24,6 @@ parameters:
- name: NAME
- name: INSTALLNAMESPACE
- name: PACKAGE
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: EXPRESSIONSVALUE1
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorLableExpressions-WithoutChannelVersion.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorLableExpressions-WithoutChannelVersion.yaml
index 6210f67695..cbd2eab125 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorLableExpressions-WithoutChannelVersion.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorLableExpressions-WithoutChannelVersion.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -30,7 +28,6 @@ parameters:
- name: NAME
- name: INSTALLNAMESPACE
- name: PACKAGE
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-OwnSingle.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-OwnSingle.yaml
index a786070f4a..1546581430 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-OwnSingle.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-OwnSingle.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
config:
configType: Inline
inline:
@@ -33,7 +31,6 @@ parameters:
- name: PACKAGE
- name: CHANNEL
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutChannel.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutChannel.yaml
index c19df321bf..6fc35c6faf 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutChannel.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutChannel.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -25,7 +23,6 @@ parameters:
- name: INSTALLNAMESPACE
- name: PACKAGE
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutChannelVersion.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutChannelVersion.yaml
index a9acb1d80b..62c74d60e7 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutChannelVersion.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutChannelVersion.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -23,7 +21,6 @@ parameters:
- name: NAME
- name: INSTALLNAMESPACE
- name: PACKAGE
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutVersion.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutVersion.yaml
index fcccd8e72f..15d9bcbc36 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutVersion.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutVersion.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -26,7 +24,6 @@ parameters:
- name: INSTALLNAMESPACE
- name: PACKAGE
- name: CHANNEL
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-inlineconfig.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-inlineconfig.yaml
index 1fa335ee4f..57bcfc25e8 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-inlineconfig.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-inlineconfig.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
config:
configType: Inline
inline:
@@ -32,7 +30,6 @@ parameters:
- name: PACKAGE
- name: CHANNEL
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml
index 7a7dec1ec6..48c3a9e1d2 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
config:
configType: Inline
inline:
@@ -30,7 +28,6 @@ parameters:
- name: WATCHNS
- name: PACKAGE
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: SOURCETYPE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel.yaml
index a3299e826d..0c465ac890 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -28,7 +26,6 @@ parameters:
- name: PACKAGE
- name: CHANNEL
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: LABELVALUE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension.yaml
index 805b32a557..1e7758274e 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextension.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -25,7 +23,6 @@ parameters:
- name: PACKAGE
- name: CHANNEL
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: SOURCETYPE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextensionWithoutChannel.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextensionWithoutChannel.yaml
index 3966fc018a..47e496f53f 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextensionWithoutChannel.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextensionWithoutChannel.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -22,7 +20,6 @@ parameters:
- name: INSTALLNAMESPACE
- name: PACKAGE
- name: VERSION
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: SOURCETYPE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextensionWithoutChannelVersion.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextensionWithoutChannelVersion.yaml
index aba55b9f00..01dc3b8a26 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextensionWithoutChannelVersion.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextensionWithoutChannelVersion.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -19,7 +17,6 @@ parameters:
- name: NAME
- name: INSTALLNAMESPACE
- name: PACKAGE
-- name: SANAME
- name: SOURCETYPE
value: "Catalog"
diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextensionWithoutVersion.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextensionWithoutVersion.yaml
index 0a8cd9e996..9b707b3a3c 100644
--- a/openshift/tests-extension/test/qe/testdata/olm/clusterextensionWithoutVersion.yaml
+++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextensionWithoutVersion.yaml
@@ -9,8 +9,6 @@ objects:
name: "${NAME}"
spec:
namespace: "${INSTALLNAMESPACE}"
- serviceAccount:
- name: "${SANAME}"
source:
sourceType: "${SOURCETYPE}"
catalog:
@@ -23,7 +21,6 @@ parameters:
- name: INSTALLNAMESPACE
- name: PACKAGE
- name: CHANNEL
-- name: SANAME
- name: POLICY
value: "CatalogProvided"
- name: SOURCETYPE
diff --git a/openshift/tests-extension/test/qe/testdata/olm/prefligth-clusterrole.yaml b/openshift/tests-extension/test/qe/testdata/olm/prefligth-clusterrole.yaml
deleted file mode 100644
index df5d334e67..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/prefligth-clusterrole.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-preflight-clusterrole-template
-objects:
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}"
- rules:
-parameters:
- - name: NAME
diff --git a/openshift/tests-extension/test/qe/testdata/olm/sa-admin.yaml b/openshift/tests-extension/test/qe/testdata/olm/sa-admin.yaml
deleted file mode 100644
index ccc593a3ee..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/sa-admin.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-admin-template
-objects:
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-admin-clusterrole"
- rules:
- - apiGroups:
- - "*"
- resources:
- - "*"
- verbs:
- - "*"
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-admin-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-admin-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
-
diff --git a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-bundle-boxcutter.yaml b/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-bundle-boxcutter.yaml
deleted file mode 100644
index 6fd8cf7bb0..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-bundle-boxcutter.yaml
+++ /dev/null
@@ -1,198 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-insufficient-bundle-boxcutter-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- # resourceNames:
- # - nginx-ok-v3283-754-15pkpuong3owt1jn01uoyj8lm6p8jlxh03kuouq67dmv
- # - nginx-ok-v3283-754-2r5zqsa9t9nk0tln1f8x36ws3ks9r8cgwi70s2dgnl82
- # - nginx-ok-v3283-75493-metrics-reader
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- # resourceNames:
- # - nginx-ok-v3283-754-15pkpuong3owt1jn01uoyj8lm6p8jlxh03kuouq67dmv
- # - nginx-ok-v3283-754-2r5zqsa9t9nk0tln1f8x36ws3ks9r8cgwi70s2dgnl82
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- # resourceNames: [nginx-ok-v3283-75493-controller-manager]
- # - apiGroups: [""]
- # resources: [serviceaccounts]
- # verbs: [create]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- # resourceNames: [nginx-ok-v3283-75493-controller-manager-metrics-service]
- - apiGroups: [""]
- resources: [services]
- verbs: [create]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- # resourceNames: [nginx-ok-v3283-75493-controller-manager]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - ""
- resources:
- - secrets
- - pods
- - pods/exec
- - pods/log
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
diff --git a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-bundle.yaml b/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-bundle.yaml
deleted file mode 100644
index 656502f68f..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-bundle.yaml
+++ /dev/null
@@ -1,198 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-insufficient-bundle-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- # resourceNames:
- # - nginx-ok-v3283-754-15pkpuong3owt1jn01uoyj8lm6p8jlxh03kuouq67dmv
- # - nginx-ok-v3283-754-2r5zqsa9t9nk0tln1f8x36ws3ks9r8cgwi70s2dgnl82
- # - nginx-ok-v3283-75493-metrics-reader
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- # resourceNames:
- # - nginx-ok-v3283-754-15pkpuong3owt1jn01uoyj8lm6p8jlxh03kuouq67dmv
- # - nginx-ok-v3283-754-2r5zqsa9t9nk0tln1f8x36ws3ks9r8cgwi70s2dgnl82
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- # resourceNames: [nginx-ok-v3283-75493-controller-manager]
- # - apiGroups: [""]
- # resources: [serviceaccounts]
- # verbs: [create]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- # resourceNames: [nginx-ok-v3283-75493-controller-manager-metrics-service]
- - apiGroups: [""]
- resources: [services]
- verbs: [create]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- # resourceNames: [nginx-ok-v3283-75493-controller-manager]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - ""
- resources:
- - secrets
- - pods
- - pods/exec
- - pods/log
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
diff --git a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-operand-clusterrole-boxcutter.yaml b/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-operand-clusterrole-boxcutter.yaml
deleted file mode 100644
index 84b673ae70..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-operand-clusterrole-boxcutter.yaml
+++ /dev/null
@@ -1,185 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-insufficient-operand-clusterrole-boxcutter-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [create]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [create]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
diff --git a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-operand-clusterrole.yaml b/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-operand-clusterrole.yaml
deleted file mode 100644
index 0f3bbdb2ed..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-operand-clusterrole.yaml
+++ /dev/null
@@ -1,185 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-insufficient-operand-clusterrole-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [create]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [create]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
diff --git a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-operand-rbac-boxcutter.yaml b/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-operand-rbac-boxcutter.yaml
deleted file mode 100644
index 1521d43480..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-operand-rbac-boxcutter.yaml
+++ /dev/null
@@ -1,188 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-insufficient-operand-rbac-boxcutter-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [olm.operatorframework.io]
- resources: [clusterobjectsets/finalizers]
- verbs: [update]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [create]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [create]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
diff --git a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-operand-rbac.yaml b/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-operand-rbac.yaml
deleted file mode 100644
index 05694c9270..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-insufficient-operand-rbac.yaml
+++ /dev/null
@@ -1,188 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-insufficient-operand-rbac-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [olm.operatorframework.io]
- resources: [clusterextensions/finalizers]
- verbs: [update]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [create]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [create]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
diff --git a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-limited-boxcutter.yaml b/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-limited-boxcutter.yaml
deleted file mode 100644
index 0d16d5382e..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-limited-boxcutter.yaml
+++ /dev/null
@@ -1,211 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-limited-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [olm.operatorframework.io]
- resources: [clusterobjectsets/finalizers]
- verbs: [update]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts/finalizers]
- verbs: [update]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts/finalizers]
- verbs: [update]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - namespaces
- verbs:
- - get
- - list
- - watch
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - ""
- resources:
- - secrets
- - pods
- - pods/exec
- - pods/log
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
diff --git a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-limited.yaml b/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-limited.yaml
deleted file mode 100644
index a52367094f..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/sa-nginx-limited.yaml
+++ /dev/null
@@ -1,205 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-nginx-limited-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-clusterrole"
- rules:
- - apiGroups: [olm.operatorframework.io]
- resources: [clusterextensions/finalizers]
- verbs: [update]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [create, list, watch]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [get, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterroles]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [create]
- - apiGroups: [rbac.authorization.k8s.io]
- resources: [clusterrolebindings]
- verbs: [get, list, watch, update, patch, delete]
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: Role
- metadata:
- name: "${NAME}-installer-role"
- namespace: "${NAMESPACE}"
- rules:
- - apiGroups: [""]
- resources: [serviceaccounts]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [""]
- resources: [services]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [get, list, watch, create, update, patch, delete]
- - apiGroups: [apps]
- resources: [deployments]
- verbs: [create]
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: RoleBinding
- metadata:
- name: "${NAME}-installer-role-binding"
- namespace: "${NAMESPACE}"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: "${NAME}-installer-role"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRole
- metadata:
- name: "${NAME}-installer-rbac-clusterrole"
- rules:
- - apiGroups:
- - ""
- resources:
- - namespaces
- verbs:
- - get
- - list
- - watch
- - apiGroups:
- - ""
- resources:
- - configmaps
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
- - apiGroups:
- - ""
- resources:
- - events
- verbs:
- - create
- - patch
- - apiGroups:
- - ""
- resources:
- - secrets
- - pods
- - pods/exec
- - pods/log
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - apps
- resources:
- - deployments
- - daemonsets
- - replicasets
- - statefulsets
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - cache.example.com
- resources:
- - "${KINDS}"
- - "${KINDS}/status"
- - "${KINDS}/finalizers"
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
- - apiGroups:
- - authentication.k8s.io
- resources:
- - tokenreviews
- verbs:
- - create
- - apiGroups:
- - authorization.k8s.io
- resources:
- - subjectaccessreviews
- verbs:
- - create
- - nonResourceURLs:
- - /metrics
- verbs:
- - get
- - apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: "${NAME}-installer-rbac-clusterrole-binding"
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "${NAME}-installer-rbac-clusterrole"
- subjects:
- - kind: ServiceAccount
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
- - name: KINDS
diff --git a/openshift/tests-extension/test/qe/testdata/olm/sa.yaml b/openshift/tests-extension/test/qe/testdata/olm/sa.yaml
deleted file mode 100644
index ba814c0cbd..0000000000
--- a/openshift/tests-extension/test/qe/testdata/olm/sa.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
-apiVersion: template.openshift.io/v1
-kind: Template
-metadata:
- name: olmv1-sa-template
-objects:
- - apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: "${NAME}"
- namespace: "${NAMESPACE}"
-parameters:
- - name: NAME
- - name: NAMESPACE
diff --git a/openshift/tests-extension/test/qe/util/olmv1util/clusterextension.go b/openshift/tests-extension/test/qe/util/olmv1util/clusterextension.go
index d010067af3..6570967229 100644
--- a/openshift/tests-extension/test/qe/util/olmv1util/clusterextension.go
+++ b/openshift/tests-extension/test/qe/util/olmv1util/clusterextension.go
@@ -20,7 +20,6 @@ type ClusterExtensionDescription struct {
Version string
InstallNamespace string
WatchNamespace string
- SaName string
UpgradeConstraintPolicy string
LabelKey string // default is olmv1-test
LabelValue string // suggest to use case id
@@ -82,9 +81,6 @@ func (clusterextension *ClusterExtensionDescription) CreateWithoutCheck(oc *exut
if len(clusterextension.WatchNamespace) > 0 {
parameters = append(parameters, "WATCHNS="+clusterextension.WatchNamespace)
}
- if len(clusterextension.SaName) > 0 {
- parameters = append(parameters, "SANAME="+clusterextension.SaName)
- }
if len(clusterextension.UpgradeConstraintPolicy) > 0 {
parameters = append(parameters, "POLICY="+clusterextension.UpgradeConstraintPolicy)
}
diff --git a/openshift/tests-extension/test/qe/util/olmv1util/sa-clusterrolebinding.go b/openshift/tests-extension/test/qe/util/olmv1util/sa-clusterrolebinding.go
deleted file mode 100644
index 5cc0db827e..0000000000
--- a/openshift/tests-extension/test/qe/util/olmv1util/sa-clusterrolebinding.go
+++ /dev/null
@@ -1,152 +0,0 @@
-package olmv1util
-
-import (
- "fmt"
- "strings"
-
- o "github.com/onsi/gomega"
- e2e "k8s.io/kubernetes/test/e2e/framework"
-
- exutil "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util"
-)
-
-type ChildResource struct {
- Kind string
- Ns string
- Names []string
-}
-
-type SaCLusterRolebindingDescription struct {
- Name string
- Namespace string
- // if it take admin permission, no need to setup RBACObjects and take default value
- RBACObjects []ChildResource
- Kinds string
- Template string
-}
-
-// Create creates ServiceAccount, ClusterRole, and ClusterRoleBinding resources and waits for their appearance
-// Parameters:
-// - oc: CLI client for interacting with the OpenShift cluster
-func (sacrb *SaCLusterRolebindingDescription) Create(oc *exutil.CLI) {
- o.Expect(oc).NotTo(o.BeNil(), "CLI client cannot be nil")
- o.Expect(sacrb.Name).NotTo(o.BeEmpty(), "ServiceAccount ClusterRoleBinding name cannot be empty")
- e2e.Logf("=========Create sacrb %v=========", sacrb.Name)
- err := sacrb.CreateWithoutCheck(oc)
- o.Expect(err).NotTo(o.HaveOccurred())
-
- if len(sacrb.RBACObjects) != 0 {
- sacrb.validateCustomRBACObjects(oc)
- } else {
- sacrb.validateDefaultRBACObjects(oc)
- }
-}
-
-// CreateWithoutCheck creates RBAC resources from template without waiting for appearance verification
-// Parameters:
-// - oc: CLI client for interacting with the OpenShift cluster
-//
-// Returns:
-// - error: error if template application fails, nil on success
-func (sacrb *SaCLusterRolebindingDescription) CreateWithoutCheck(oc *exutil.CLI) error {
- if oc == nil {
- return fmt.Errorf("CLI client cannot be nil")
- }
- if sacrb.Template == "" {
- return fmt.Errorf("template path cannot be empty")
- }
- e2e.Logf("=========CreateWithoutCheck sacrb %v=========", sacrb.Name)
- parameters := []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", sacrb.Template, "-p"}
- if len(sacrb.Name) > 0 {
- parameters = append(parameters, "NAME="+sacrb.Name)
- }
- if len(sacrb.Namespace) > 0 {
- parameters = append(parameters, "NAMESPACE="+sacrb.Namespace)
- }
- if len(sacrb.Kinds) > 0 {
- parameters = append(parameters, "KINDS="+sacrb.Kinds)
- }
- err := exutil.ApplyClusterResourceFromTemplateWithError(oc, parameters...)
- return err
-}
-
-// Delete removes ServiceAccount, ClusterRole, and ClusterRoleBinding resources
-// Parameters:
-// - oc: CLI client for interacting with the OpenShift cluster
-func (sacrb *SaCLusterRolebindingDescription) Delete(oc *exutil.CLI) {
- o.Expect(oc).NotTo(o.BeNil(), "CLI client cannot be nil")
- e2e.Logf("=========Delete sacrb %v=========", sacrb.Name)
- if len(sacrb.RBACObjects) != 0 {
- sacrb.cleanupCustomRBACObjects(oc)
- } else {
- sacrb.cleanupDefaultRBACObjects(oc)
- }
-}
-
-// validateCustomRBACObjects validates custom RBAC objects appearance
-func (sacrb *SaCLusterRolebindingDescription) validateCustomRBACObjects(oc *exutil.CLI) {
- for _, object := range sacrb.RBACObjects {
- if strings.TrimSpace(object.Kind) == "" {
- e2e.Logf("Warning: empty Kind found in RBACObjects, skipping")
- continue
- }
- sacrb.validateObjectNames(oc, object)
- }
-}
-
-// validateDefaultRBACObjects validates default RBAC objects appearance
-func (sacrb *SaCLusterRolebindingDescription) validateDefaultRBACObjects(oc *exutil.CLI) {
- o.Expect(Appearance(oc, exutil.Appear, "ServiceAccount", sacrb.Name, "-n", sacrb.Namespace)).To(o.BeTrue())
- o.Expect(Appearance(oc, exutil.Appear, "ClusterRole", fmt.Sprintf("%s-installer-admin-clusterrole", sacrb.Name))).To(o.BeTrue())
- o.Expect(Appearance(oc, exutil.Appear, "ClusterRoleBinding", fmt.Sprintf("%s-installer-admin-clusterrole-binding", sacrb.Name))).To(o.BeTrue())
-}
-
-// validateObjectNames validates each name in an RBAC object
-func (sacrb *SaCLusterRolebindingDescription) validateObjectNames(oc *exutil.CLI, object ChildResource) {
- for _, name := range object.Names {
- if strings.TrimSpace(name) == "" {
- e2e.Logf("Warning: empty name found in RBACObjects for kind %s, skipping", object.Kind)
- continue
- }
-
- if object.Ns == "" {
- o.Expect(Appearance(oc, exutil.Appear, object.Kind, name)).To(o.BeTrue())
- } else {
- o.Expect(Appearance(oc, exutil.Appear, object.Kind, name, "-n", object.Ns)).To(o.BeTrue())
- }
- }
-}
-
-// cleanupCustomRBACObjects cleans up custom RBAC objects
-func (sacrb *SaCLusterRolebindingDescription) cleanupCustomRBACObjects(oc *exutil.CLI) {
- for _, object := range sacrb.RBACObjects {
- if strings.TrimSpace(object.Kind) == "" {
- e2e.Logf("Warning: empty Kind found in RBACObjects, skipping cleanup")
- continue
- }
- sacrb.cleanupObjectNames(oc, object)
- }
-}
-
-// cleanupDefaultRBACObjects cleans up default RBAC objects
-func (sacrb *SaCLusterRolebindingDescription) cleanupDefaultRBACObjects(oc *exutil.CLI) {
- Cleanup(oc, "ClusterRoleBinding", fmt.Sprintf("%s-installer-admin-clusterrole-binding", sacrb.Name))
- Cleanup(oc, "ClusterRole", fmt.Sprintf("%s-installer-admin-clusterrole", sacrb.Name))
- Cleanup(oc, "ServiceAccount", sacrb.Name, "-n", sacrb.Namespace)
-}
-
-// cleanupObjectNames cleans up each name in an RBAC object
-func (sacrb *SaCLusterRolebindingDescription) cleanupObjectNames(oc *exutil.CLI, object ChildResource) {
- for _, name := range object.Names {
- if strings.TrimSpace(name) == "" {
- e2e.Logf("Warning: empty name found in RBACObjects for kind %s, skipping cleanup", object.Kind)
- continue
- }
-
- if object.Ns == "" {
- Cleanup(oc, object.Kind, name)
- } else {
- Cleanup(oc, object.Kind, name, "-n", object.Ns)
- }
- }
-}
diff --git a/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/ce.yml b/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/ce.yml
index ccd94ba702..ccfe1663e9 100644
--- a/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/ce.yml
+++ b/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/ce.yml
@@ -4,8 +4,6 @@ metadata:
name: "ce-{{.Iteration}}"
spec:
namespace: "{{.prefixNamespace}}-{{.Iteration}}"
- serviceAccount:
- name: "ins-sa-{{.Iteration}}"
source:
sourceType: Catalog
catalog:
diff --git a/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/clusterrole.yml b/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/clusterrole.yml
deleted file mode 100644
index bcf19157d3..0000000000
--- a/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/clusterrole.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: "ins-admin-clusterrole-{{.Iteration}}"
-rules:
- - apiGroups:
- - "*"
- resources:
- - "*"
- verbs:
- - "*"
diff --git a/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/clusterrolebinding.yml b/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/clusterrolebinding.yml
deleted file mode 100644
index cc5b181fc9..0000000000
--- a/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/clusterrolebinding.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
- name: "ins-admin-clusterrole-binding-{{.Iteration}}"
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: "ins-admin-clusterrole-{{.Iteration}}"
-subjects:
- - kind: ServiceAccount
- name: "ins-sa-{{.Iteration}}"
- namespace: "{{.prefixNamespace}}-{{.Iteration}}"
diff --git a/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/sa.yml b/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/sa.yml
deleted file mode 100644
index 2f194c7541..0000000000
--- a/openshift/tests-extension/test/qe/util/stress/manifests/config/pkg-ins-v1/templates/sa.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-apiVersion: v1
-kind: ServiceAccount
-metadata:
- name: "ins-sa-{{.Iteration}}"
diff --git a/openshift/tests-extension/test/webhooks.go b/openshift/tests-extension/test/webhooks.go
index 34c2d3dcab..58ba83992c 100644
--- a/openshift/tests-extension/test/webhooks.go
+++ b/openshift/tests-extension/test/webhooks.go
@@ -433,29 +433,8 @@ func setupWebhookOperator(ctx SpecContext, k8sClient client.Client, webhookOpera
}).WithTimeout(helpers.DefaultTimeout).WithPolling(helpers.DefaultPolling).Should(Succeed())
})
- saName := fmt.Sprintf("%s-installer", webhookOperatorInstallNamespace)
- sa := helpers.NewServiceAccount(saName, webhookOperatorInstallNamespace)
- err = k8sClient.Create(ctx, sa)
- Expect(err).ToNot(HaveOccurred())
- helpers.ExpectServiceAccountExists(ctx, saName, webhookOperatorInstallNamespace)
- // ServiceAccount will be deleted with the namespace, no separate cleanup needed
-
- By("creating a ClusterRoleBinding to cluster-admin for the webhook operator")
- operatorClusterRoleBindingName := fmt.Sprintf("%s-operator-crb", webhookOperatorInstallNamespace)
- operatorClusterRoleBinding := helpers.NewClusterRoleBinding(operatorClusterRoleBindingName, "cluster-admin", saName, webhookOperatorInstallNamespace)
- err = k8sClient.Create(ctx, operatorClusterRoleBinding)
- Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to create ClusterRoleBinding %s",
- operatorClusterRoleBindingName))
- helpers.ExpectClusterRoleBindingExists(ctx, operatorClusterRoleBindingName)
- // Register cleanup for ClusterRoleBinding (cluster-scoped resource)
- DeferCleanup(func(ctx context.Context) {
- By(" NOW cleaning up ClusterRoleBinding (DeferCleanup executing) ")
- By(fmt.Sprintf("cleanup: deleting ClusterRoleBinding %s", operatorClusterRoleBinding.Name))
- _ = k8sClient.Delete(ctx, operatorClusterRoleBinding, client.PropagationPolicy(metav1.DeletePropagationBackground))
- })
-
ceName := webhookOperatorInstallNamespace
- ce := helpers.NewClusterExtensionObject("webhook-operator", "0.0.5", ceName, saName, webhookOperatorInstallNamespace)
+ ce := helpers.NewClusterExtensionObject("webhook-operator", "0.0.5", ceName, webhookOperatorInstallNamespace)
ce.Spec.Source.Catalog.Selector = &metav1.LabelSelector{
MatchLabels: map[string]string{
"olm.operatorframework.io/metadata.name": catalogName,
diff --git a/scripts/install.tpl.sh b/scripts/install.tpl.sh
index 11a2f9a624..89a01e5996 100644
--- a/scripts/install.tpl.sh
+++ b/scripts/install.tpl.sh
@@ -116,6 +116,11 @@ if [ -f "${olmv1_manifest}" ]; then
olmv1_manifest=file://localhost$(realpath ${olmv1_manifest})
fi
+# Clean up old RBAC resources from previous releases. The ClusterRoleBinding was
+# renamed and the custom ClusterRole replaced with cluster-admin.
+kubectl delete clusterrolebinding operator-controller-manager-rolebinding operator-controller-manager-admin-rolebinding --ignore-not-found
+kubectl delete clusterrole operator-controller-manager-role --ignore-not-found
+
curl -L -s "${olmv1_manifest}" | sed "s/olmv1-system/${olmv1_namespace}/g" | kubectl apply -f -
# Wait for the rollout, and then wait for the deployment to be Available
kubectl_wait_rollout "${olmv1_namespace}" "deployment/catalogd-controller-manager" "60s"
diff --git a/test/e2e/features/install.feature b/test/e2e/features/install.feature
index e82ad10e1d..0228673175 100644
--- a/test/e2e/features/install.feature
+++ b/test/e2e/features/install.feature
@@ -6,12 +6,12 @@ Feature: Install ClusterExtension
Background:
Given OLM is available
And an image registry is available
+ And namespace "${TEST_NAMESPACE}" is available
Scenario: Install latest available version
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.2.0 | beta | | CRD, Deployment, ConfigMap |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
When ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -20,8 +20,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -42,7 +40,6 @@ Feature: Install ClusterExtension
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test-mirrored | 1.2.0 | beta | | CRD, Deployment, ConfigMap, ClusterRegistry(mirrored-registry.operator-controller-e2e.svc.cluster.local:5000) |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
When ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -51,8 +48,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -76,7 +71,6 @@ Feature: Install ClusterExtension
And a catalog "extra" with packages:
| package | version | channel | replaces | contents |
| test | 1.2.0 | beta | | CRD, Deployment, ConfigMap |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
When ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -85,8 +79,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -97,39 +89,11 @@ Feature: Install ClusterExtension
found bundles for package "${PACKAGE:test}" in multiple catalogs with the same priority
"""
- Scenario: Report error when ServiceAccount does not exist
- Given a catalog "test" with packages:
- | package | version | channel | replaces | contents |
- | test | 1.2.0 | beta | | CRD, Deployment, ConfigMap |
- When ClusterExtension is applied
- """
- apiVersion: olm.operatorframework.io/v1
- kind: ClusterExtension
- metadata:
- name: ${NAME}
- spec:
- namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: non-existent-sa
- source:
- sourceType: Catalog
- catalog:
- packageName: ${PACKAGE:test}
- selector:
- matchLabels:
- "olm.operatorframework.io/metadata.name": ${CATALOG:test}
- """
- Then ClusterExtension reports Progressing as True with Reason Retrying and Message includes:
- """
- operation cannot proceed due to the following validation error(s): service account "non-existent-sa" not found in namespace "${TEST_NAMESPACE}"
- """
-
@SingleOwnNamespaceInstallSupport
Scenario: watchNamespace config is required for extension supporting single namespace
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| single-namespace-operator | 1.0.0 | alpha | | CRD, Deployment, InstallMode(SingleNamespace) |
- And ServiceAccount "olm-admin" in test namespace is cluster admin
And resource is applied
"""
apiVersion: v1
@@ -145,8 +109,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-admin
source:
sourceType: Catalog
catalog:
@@ -167,8 +129,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-admin
config:
configType: Inline
inline:
@@ -190,7 +150,6 @@ Feature: Install ClusterExtension
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| own-namespace-operator | 1.0.0 | alpha | | CRD, Deployment, InstallMode(OwnNamespace) |
- And ServiceAccount "olm-admin" in test namespace is cluster admin
And ClusterExtension is applied without the watchNamespace configuration
"""
apiVersion: olm.operatorframework.io/v1
@@ -199,8 +158,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-admin
source:
sourceType: Catalog
catalog:
@@ -221,8 +178,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-admin
config:
configType: Inline
inline:
@@ -247,8 +202,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-admin
config:
configType: Inline
inline:
@@ -270,7 +223,6 @@ Feature: Install ClusterExtension
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| webhook-operator | 0.0.1 | alpha | | StaticBundleDir(testdata/images/bundles/webhook-operator/v0.0.1) |
- And ServiceAccount "olm-admin" in test namespace is cluster admin
When ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -279,8 +231,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-admin
source:
sourceType: Catalog
catalog:
@@ -340,7 +290,6 @@ Feature: Install ClusterExtension
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| single-namespace-operator | 1.0.0 | alpha | | CRD, Deployment, InstallMode(SingleNamespace) |
- And ServiceAccount "olm-admin" in test namespace is cluster admin
When ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -349,8 +298,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-admin
config:
configType: Inline
inline:
@@ -369,12 +316,10 @@ Feature: Install ClusterExtension
"""
@SingleOwnNamespaceInstallSupport
- @WebhookProviderCertManager
Scenario: Reject watchNamespace for operator that does not support Single/OwnNamespace install modes
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| webhook-operator | 0.0.1 | alpha | | StaticBundleDir(testdata/images/bundles/webhook-operator/v0.0.1) |
- And ServiceAccount "olm-admin" in test namespace is cluster admin
When ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -383,8 +328,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-admin
config:
configType: Inline
inline:
@@ -403,12 +346,10 @@ Feature: Install ClusterExtension
"""
@BoxcutterRuntime
- @ProgressDeadline
Scenario: Report ClusterExtension as not progressing if the rollout does not become available within given timeout
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.0.2 | alpha | | BadImage |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
And min value for ClusterExtension .spec.progressDeadlineMinutes is set to 1
And min value for ClusterObjectSet .spec.progressDeadlineMinutes is set to 1
When ClusterExtension is applied
@@ -420,13 +361,10 @@ Feature: Install ClusterExtension
spec:
namespace: ${TEST_NAMESPACE}
progressDeadlineMinutes: 1
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
packageName: ${PACKAGE:test}
- # bundle refers bad image references, so that the deployment never becomes available
version: 1.0.2
selector:
matchLabels:
@@ -445,7 +383,6 @@ Feature: Install ClusterExtension
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.0.3 | alpha | | BadImage |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
And min value for ClusterExtension .spec.progressDeadlineMinutes is set to 1
And min value for ClusterObjectSet .spec.progressDeadlineMinutes is set to 1
When ClusterExtension is applied
@@ -457,8 +394,6 @@ Feature: Install ClusterExtension
spec:
namespace: ${TEST_NAMESPACE}
progressDeadlineMinutes: 1
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -480,7 +415,6 @@ Feature: Install ClusterExtension
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.2.0 | beta | | CRD, Deployment, ConfigMap, Property(olm.test-property=some-value) |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
When ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -489,8 +423,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -511,7 +443,6 @@ Feature: Install ClusterExtension
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.2.0 | beta | | CRD, Deployment, ConfigMap |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
When ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -520,8 +451,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -541,7 +470,6 @@ Feature: Install ClusterExtension
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.2.0 | beta | | CRD, Deployment, ConfigMap |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
When ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -550,8 +478,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -578,7 +504,6 @@ Feature: Install ClusterExtension
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.2.0 | beta | | CRD, Deployment, ConfigMap |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
When ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -587,8 +512,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
config:
configType: Inline
inline:
@@ -617,7 +540,6 @@ Feature: Install ClusterExtension
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.0.0 | beta | | LargeCRD(250), Deployment |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
When ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -626,8 +548,6 @@ Feature: Install ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -641,14 +561,11 @@ Feature: Install ClusterExtension
And bundle "${PACKAGE:test}.1.0.0" is installed in version "1.0.0"
And resource "deployment/test-operator-${SCENARIO_ID}" is installed
- @BoxcutterRuntime
- @PreflightPermissions
- Scenario: Boxcutter preflight check detects missing CREATE permissions
+ Scenario: Applying ClusterExtension with deprecated serviceAccount emits warning
Given a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.2.0 | beta | | CRD, Deployment, ConfigMap |
- And ServiceAccount "olm-sa" without create permissions is available in test namespace
- And ClusterExtension is applied
+ When ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
@@ -657,7 +574,7 @@ Feature: Install ClusterExtension
spec:
namespace: ${TEST_NAMESPACE}
serviceAccount:
- name: olm-sa
+ name: some-sa
source:
sourceType: Catalog
catalog:
@@ -666,15 +583,9 @@ Feature: Install ClusterExtension
matchLabels:
"olm.operatorframework.io/metadata.name": ${CATALOG:test}
"""
- And ClusterExtension reports Progressing as True with Reason Retrying and Message includes:
+ Then ClusterExtension apply emits warning:
"""
- pre-authorization failed: service account requires the following permissions to manage cluster extension
+ Warning: Validation failed for ValidatingAdmissionPolicy 'clusterextension-serviceaccount-deprecated' with binding 'clusterextension-serviceaccount-deprecated': spec.serviceAccount is deprecated, ignored, and will be removed in a future release. The operator-controller's cluster-admin service account is used for all cluster interactions.
"""
- And ClusterExtension reports Progressing as True with Reason Retrying and Message includes:
- """
- Verbs:[create]
- """
- When ServiceAccount "olm-sa" with needed permissions is available in test namespace
- Then ClusterExtension is available
- And ClusterExtension reports Progressing as True with Reason Succeeded
- And ClusterExtension reports Installed as True
+ And ClusterExtension is rolled out
+ And ClusterExtension is available
diff --git a/test/e2e/features/proxy.feature b/test/e2e/features/proxy.feature
index 6baf14f913..b5f5276d48 100644
--- a/test/e2e/features/proxy.feature
+++ b/test/e2e/features/proxy.feature
@@ -10,7 +10,7 @@ Feature: HTTPS proxy support for outbound catalog requests
And a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.2.0 | beta | | CRD, Deployment, ConfigMap |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ And namespace "${TEST_NAMESPACE}" is available
@HTTPProxy
Scenario: operator-controller respects HTTPS_PROXY when fetching catalog data
@@ -23,8 +23,6 @@ Feature: HTTPS proxy support for outbound catalog requests
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -54,8 +52,6 @@ Feature: HTTPS proxy support for outbound catalog requests
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
diff --git a/test/e2e/features/recover.feature b/test/e2e/features/recover.feature
index 1dbc7bd753..3aa8749769 100644
--- a/test/e2e/features/recover.feature
+++ b/test/e2e/features/recover.feature
@@ -8,7 +8,7 @@ Feature: Recover cluster extension from errors that might occur during its lifet
| test | 1.2.0 | beta | | CRD, Deployment, ConfigMap |
Scenario: Restore removed resource
- Given ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ Given namespace "${TEST_NAMESPACE}" is available
And ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -17,8 +17,6 @@ Feature: Recover cluster extension from errors that might occur during its lifet
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -41,8 +39,6 @@ Feature: Recover cluster extension from errors that might occur during its lifet
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -52,12 +48,12 @@ Feature: Recover cluster extension from errors that might occur during its lifet
"olm.operatorframework.io/metadata.name": ${CATALOG:test}
"""
And ClusterExtension reports Progressing as True with Reason Retrying
- When ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ When namespace "${TEST_NAMESPACE}" is available
Then ClusterExtension is available
And ClusterExtension reports Progressing as True with Reason Succeeded
Scenario: Install ClusterExtension after conflicting resource is removed
- Given ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ Given namespace "${TEST_NAMESPACE}" is available
And resource is applied
"""
apiVersion: apps/v1
@@ -100,8 +96,6 @@ Feature: Recover cluster extension from errors that might occur during its lifet
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -117,41 +111,6 @@ Feature: Recover cluster extension from errors that might occur during its lifet
And ClusterExtension reports Progressing as True with Reason Succeeded
And ClusterExtension reports Installed as True
- @PreflightPermissions
- Scenario: ClusterExtension installation succeeds after service account gets the required missing permissions to
- manage the bundle's resources
- Given ServiceAccount "olm-sa" is available in test namespace
- And ClusterExtension is applied
- """
- apiVersion: olm.operatorframework.io/v1
- kind: ClusterExtension
- metadata:
- name: ${NAME}
- spec:
- namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
- source:
- sourceType: Catalog
- catalog:
- packageName: ${PACKAGE:test}
- selector:
- matchLabels:
- "olm.operatorframework.io/metadata.name": ${CATALOG:test}
- """
- And ClusterExtension reports Progressing as True with Reason Retrying and Message includes:
- """
- pre-authorization failed: service account requires the following permissions to manage cluster extension:
- """
- And ClusterExtension reports Progressing as True with Reason Retrying and Message includes:
- """
- Namespace:"" APIGroups:[apiextensions.k8s.io] Resources:[customresourcedefinitions] ResourceNames:[e2e-${SCENARIO_ID}tests.e2e-${SCENARIO_ID}.e2e.operatorframework.io] Verbs:[delete,get,patch,update]
- """
- When ServiceAccount "olm-sa" with needed permissions is available in test namespace
- Then ClusterExtension is available
- And ClusterExtension reports Progressing as True with Reason Succeeded
- And ClusterExtension reports Installed as True
-
# CATALOG DELETION RESILIENCE SCENARIOS
Scenario: Auto-healing continues working after catalog deletion
@@ -165,7 +124,7 @@ Feature: Recover cluster extension from errors that might occur during its lifet
# - If the controller stopped reconciling, the configmap would stay deleted
# - Resource restoration is an observable event that PROVES active reconciliation
# - The deployment staying healthy proves the workload continues running
- Given ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ Given namespace "${TEST_NAMESPACE}" is available
And ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -174,8 +133,6 @@ Feature: Recover cluster extension from errors that might occur during its lifet
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -205,7 +162,7 @@ Feature: Recover cluster extension from errors that might occur during its lifet
# - Reconciliation completing (observedGeneration == generation) proves the spec was processed
# - Progressing=Succeeded proves the controller didn't block on missing catalog
# - Extension staying Available proves workload continues running
- Given ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ Given namespace "${TEST_NAMESPACE}" is available
And ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -214,8 +171,6 @@ Feature: Recover cluster extension from errors that might occur during its lifet
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -235,8 +190,6 @@ Feature: Recover cluster extension from errors that might occur during its lifet
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
install:
preflight:
crdUpgradeSafety:
diff --git a/test/e2e/features/revision.feature b/test/e2e/features/revision.feature
index 6a8276d214..0a4ab87627 100644
--- a/test/e2e/features/revision.feature
+++ b/test/e2e/features/revision.feature
@@ -13,9 +13,6 @@ Feature: Install ClusterObjectSet
apiVersion: olm.operatorframework.io/v1
kind: ClusterObjectSet
metadata:
- annotations:
- olm.operatorframework.io/service-account-name: pvc-probe-sa
- olm.operatorframework.io/service-account-namespace: ${TEST_NAMESPACE}
name: ${COS_NAME}
spec:
lifecycleState: Active
@@ -76,9 +73,6 @@ Feature: Install ClusterObjectSet
apiVersion: olm.operatorframework.io/v1
kind: ClusterObjectSet
metadata:
- annotations:
- olm.operatorframework.io/service-account-name: pvc-probe-sa
- olm.operatorframework.io/service-account-namespace: ${TEST_NAMESPACE}
name: ${COS_NAME}
spec:
lifecycleState: Active
@@ -166,9 +160,6 @@ Feature: Install ClusterObjectSet
apiVersion: olm.operatorframework.io/v1
kind: ClusterObjectSet
metadata:
- annotations:
- olm.operatorframework.io/service-account-name: pvc-probe-sa
- olm.operatorframework.io/service-account-namespace: ${TEST_NAMESPACE}
name: ${COS_NAME}
spec:
lifecycleState: Active
@@ -227,9 +218,6 @@ Feature: Install ClusterObjectSet
apiVersion: olm.operatorframework.io/v1
kind: ClusterObjectSet
metadata:
- annotations:
- olm.operatorframework.io/service-account-name: pvc-probe-sa
- olm.operatorframework.io/service-account-namespace: ${TEST_NAMESPACE}
name: ${COS_NAME}
spec:
lifecycleState: Active
@@ -339,7 +327,7 @@ Feature: Install ClusterObjectSet
And ClusterObjectSet "${COS_NAME}" reports Available as True with Reason ProbesSucceeded
Scenario: User can install a ClusterObjectSet with objects stored in Secrets
- Given ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ Given namespace "${TEST_NAMESPACE}" is available
When resource is applied
"""
apiVersion: v1
@@ -415,9 +403,6 @@ Feature: Install ClusterObjectSet
apiVersion: olm.operatorframework.io/v1
kind: ClusterObjectSet
metadata:
- annotations:
- olm.operatorframework.io/service-account-name: olm-sa
- olm.operatorframework.io/service-account-namespace: ${TEST_NAMESPACE}
name: ${COS_NAME}
spec:
lifecycleState: Active
@@ -442,7 +427,7 @@ Feature: Install ClusterObjectSet
And ClusterObjectSet "${COS_NAME}" has observed phase "resources" with a non-empty digest
Scenario: ClusterObjectSet blocks reconciliation when referenced Secret is mutable
- Given ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ Given namespace "${TEST_NAMESPACE}" is available
And resource is applied
"""
apiVersion: v1
@@ -470,9 +455,6 @@ Feature: Install ClusterObjectSet
apiVersion: olm.operatorframework.io/v1
kind: ClusterObjectSet
metadata:
- annotations:
- olm.operatorframework.io/service-account-name: olm-sa
- olm.operatorframework.io/service-account-namespace: ${TEST_NAMESPACE}
name: ${COS_NAME}
spec:
lifecycleState: Active
@@ -492,7 +474,7 @@ Feature: Install ClusterObjectSet
"""
Scenario: ClusterObjectSet blocks reconciliation when referenced Secret content changes
- Given ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ Given namespace "${TEST_NAMESPACE}" is available
When resource is applied
"""
apiVersion: v1
@@ -521,9 +503,6 @@ Feature: Install ClusterObjectSet
apiVersion: olm.operatorframework.io/v1
kind: ClusterObjectSet
metadata:
- annotations:
- olm.operatorframework.io/service-account-name: olm-sa
- olm.operatorframework.io/service-account-namespace: ${TEST_NAMESPACE}
name: ${COS_NAME}
spec:
lifecycleState: Active
@@ -601,16 +580,13 @@ Feature: Install ClusterObjectSet
@ProgressDeadline
Scenario: Archiving a COS with ProgressDeadlineExceeded cleans up its resources
- Given min value for ClusterObjectSet .spec.progressDeadlineMinutes is set to 1
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ Given namespace "${TEST_NAMESPACE}" is available
+ And min value for ClusterObjectSet .spec.progressDeadlineMinutes is set to 1
When ClusterObjectSet is applied
"""
apiVersion: olm.operatorframework.io/v1
kind: ClusterObjectSet
metadata:
- annotations:
- olm.operatorframework.io/service-account-name: olm-sa
- olm.operatorframework.io/service-account-namespace: ${TEST_NAMESPACE}
name: ${COS_NAME}
spec:
lifecycleState: Active
@@ -670,16 +646,13 @@ Feature: Install ClusterObjectSet
@ProgressDeadline
@Serial
Scenario: COS recovers from ProgressDeadlineExceeded to Succeeded when probes pass
- Given min value for ClusterObjectSet .spec.progressDeadlineMinutes is set to 1
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ Given namespace "${TEST_NAMESPACE}" is available
+ And min value for ClusterObjectSet .spec.progressDeadlineMinutes is set to 1
When ClusterObjectSet is applied
"""
apiVersion: olm.operatorframework.io/v1
kind: ClusterObjectSet
metadata:
- annotations:
- olm.operatorframework.io/service-account-name: olm-sa
- olm.operatorframework.io/service-account-namespace: ${TEST_NAMESPACE}
name: ${COS_NAME}
spec:
lifecycleState: Active
diff --git a/test/e2e/features/status.feature b/test/e2e/features/status.feature
index e3621ba623..23acf2a196 100644
--- a/test/e2e/features/status.feature
+++ b/test/e2e/features/status.feature
@@ -9,7 +9,7 @@ Feature: Report status of the managed ClusterExtension workload
And a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.0.0 | alpha | | CRD, Deployment, ConfigMap |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ And namespace "${TEST_NAMESPACE}" is available
And ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -18,8 +18,6 @@ Feature: Report status of the managed ClusterExtension workload
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
diff --git a/test/e2e/features/uninstall.feature b/test/e2e/features/uninstall.feature
index 7401ce1663..bd2fd7b5f4 100644
--- a/test/e2e/features/uninstall.feature
+++ b/test/e2e/features/uninstall.feature
@@ -9,7 +9,7 @@ Feature: Uninstall ClusterExtension
And a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.2.0 | beta | | CRD, Deployment, ConfigMap |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ And namespace "${TEST_NAMESPACE}" is available
And ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -18,8 +18,6 @@ Feature: Uninstall ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -36,10 +34,3 @@ Feature: Uninstall ClusterExtension
When ClusterExtension is removed
Then the ClusterExtension's constituent resources are removed
- Scenario: Removing ClusterExtension resources leads to all installed resources being removed even if the service account is no longer present
- When resource "serviceaccount/olm-sa" is removed
- # Ensure service account is gone before checking to ensure resources are cleaned up whether the service account
- # and its permissions are present on the cluster or not
- And resource "serviceaccount/olm-sa" is eventually not found
- And ClusterExtension is removed
- Then the ClusterExtension's constituent resources are removed
diff --git a/test/e2e/features/update.feature b/test/e2e/features/update.feature
index 1fa5016977..dd4e864228 100644
--- a/test/e2e/features/update.feature
+++ b/test/e2e/features/update.feature
@@ -14,7 +14,7 @@ Feature: Update ClusterExtension
| test | 1.0.2 | alpha | 1.0.0 | BadImage |
| test | 1.0.4 | beta | | CRD, Deployment, ConfigMap |
| test | 1.2.0 | beta | 1.0.1 | CRD, Deployment, ConfigMap |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ And namespace "${TEST_NAMESPACE}" is available
Scenario: Update to a successor version
Given ClusterExtension is applied
@@ -25,8 +25,6 @@ Feature: Update ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -52,8 +50,6 @@ Feature: Update ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -73,8 +69,6 @@ Feature: Update ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -98,8 +92,6 @@ Feature: Update ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -119,8 +111,6 @@ Feature: Update ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -145,8 +135,6 @@ Feature: Update ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -175,8 +163,6 @@ Feature: Update ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -204,8 +190,6 @@ Feature: Update ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -234,8 +218,6 @@ Feature: Update ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -260,8 +242,6 @@ Feature: Update ClusterExtension
name: ${NAME}-dup
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -286,8 +266,6 @@ Feature: Update ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -320,8 +298,6 @@ Feature: Update ClusterExtension
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
@@ -338,3 +314,44 @@ Feature: Update ClusterExtension
Then ClusterExtension reports "${NAME}-1, ${NAME}-2" as active revisions
And ClusterObjectSet "${NAME}-2" reports Progressing as True with Reason RollingOut
And ClusterObjectSet "${NAME}-2" reports Available as False with Reason ProbeFailure
+
+ Scenario: Clearing deprecated serviceAccount field is reconciled without warnings
+ Given ClusterExtension is applied
+ """
+ apiVersion: olm.operatorframework.io/v1
+ kind: ClusterExtension
+ metadata:
+ name: ${NAME}
+ spec:
+ namespace: ${TEST_NAMESPACE}
+ serviceAccount:
+ name: some-sa
+ source:
+ sourceType: Catalog
+ catalog:
+ packageName: ${PACKAGE:test}
+ selector:
+ matchLabels:
+ "olm.operatorframework.io/metadata.name": ${CATALOG:test}
+ """
+ And ClusterExtension is rolled out
+ And ClusterExtension is available
+ When ClusterExtension is applied
+ """
+ apiVersion: olm.operatorframework.io/v1
+ kind: ClusterExtension
+ metadata:
+ name: ${NAME}
+ spec:
+ namespace: ${TEST_NAMESPACE}
+ source:
+ sourceType: Catalog
+ catalog:
+ packageName: ${PACKAGE:test}
+ selector:
+ matchLabels:
+ "olm.operatorframework.io/metadata.name": ${CATALOG:test}
+ """
+ Then ClusterExtension apply does not emit warning
+ And ClusterExtension has been reconciled the latest generation
+ And ClusterExtension is available
diff --git a/test/e2e/features/user-managed-fields.feature b/test/e2e/features/user-managed-fields.feature
index cdd00317c2..b3731ab043 100644
--- a/test/e2e/features/user-managed-fields.feature
+++ b/test/e2e/features/user-managed-fields.feature
@@ -10,7 +10,7 @@ Feature: Preserve user-managed fields on deployed resources
And a catalog "test" with packages:
| package | version | channel | replaces | contents |
| test | 1.2.0 | beta | | CRD, Deployment, ConfigMap |
- And ServiceAccount "olm-sa" with needed permissions is available in test namespace
+ And namespace "${TEST_NAMESPACE}" is available
And ClusterExtension is applied
"""
apiVersion: olm.operatorframework.io/v1
@@ -19,8 +19,6 @@ Feature: Preserve user-managed fields on deployed resources
name: ${NAME}
spec:
namespace: ${TEST_NAMESPACE}
- serviceAccount:
- name: olm-sa
source:
sourceType: Catalog
catalog:
diff --git a/test/e2e/steps/hooks.go b/test/e2e/steps/hooks.go
index 0aec64daec..3a65c9ecdf 100644
--- a/test/e2e/steps/hooks.go
+++ b/test/e2e/steps/hooks.go
@@ -57,6 +57,7 @@ type scenarioContext struct {
deploymentRestores []deploymentRestore
extensionObjects []client.Object
proxy *recordingProxy
+ lastApplyStderr string
}
// GatherClusterExtensionObjects collects all resources related to the ClusterExtension container in
@@ -87,9 +88,7 @@ var (
devMode = false
featureGates = map[featuregate.Feature]bool{
features.WebhookProviderCertManager: true,
- features.PreflightPermissions: false,
features.SingleOwnNamespaceInstallSupport: false,
- features.SyntheticPermissions: false,
features.WebhookProviderOpenshiftServiceCA: false,
features.HelmChartSupport: false,
features.BoxcutterRuntime: false,
diff --git a/test/e2e/steps/steps.go b/test/e2e/steps/steps.go
index 00a10ea64f..07bb569516 100644
--- a/test/e2e/steps/steps.go
+++ b/test/e2e/steps/steps.go
@@ -34,7 +34,6 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/sets"
k8sresource "k8s.io/cli-runtime/pkg/resource"
- "k8s.io/component-base/featuregate"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -151,6 +150,8 @@ func RegisterSteps(sc *godog.ScenarioContext) {
sc.Step(`^(?i)deployment "([^"]+)" reports as (not ready|ready)$`, MarkDeploymentReadiness)
sc.Step(`^(?i)resource apply fails with error msg containing "([^"]+)"$`, ResourceApplyFails)
+ sc.Step(`^(?i)\w+ apply emits warning:$`, ResourceApplyEmitsWarning)
+ sc.Step(`^(?i)\w+ apply does not emit warning$`, ResourceApplyDoesNotEmitWarning)
sc.Step(`^(?i)resource "([^"]+)" is eventually restored$`, ResourceRestored)
sc.Step(`^(?i)resource "([^"]+)" matches$`, ResourceMatches)
sc.Step(`^(?i)rollout restart is performed on "([^"]+)"$`, RolloutRestartIsPerformed)
@@ -164,8 +165,9 @@ func RegisterSteps(sc *godog.ScenarioContext) {
sc.Step(`^(?i)ClusterExtension reconciliation is triggered$`, TriggerClusterExtensionReconciliation)
sc.Step(`^(?i)ServiceAccount "([^"]*)" with permissions to install extensions is available in "([^"]*)" namespace$`, ServiceAccountWithNeededPermissionsIsAvailableInGivenNamespace)
+ sc.Step(`^(?i)namespace "([^"]*)" is available$`, NamespaceIsAvailable)
sc.Step(`^(?i)ServiceAccount "([^"]*)" with needed permissions is available in test namespace$`, ServiceAccountWithNeededPermissionsIsAvailableInTestNamespace)
- sc.Step(`^(?i)ServiceAccount "([^"]*)" without create permissions is available in test namespace$`, ServiceAccountWithoutCreatePermissionsIsAvailableInTestNamespace)
+
sc.Step(`^(?i)ServiceAccount "([^"]*)" is available in test namespace$`, ServiceAccountIsAvailableInNamespace)
sc.Step(`^(?i)ServiceAccount "([^"]*)" in test namespace is cluster admin$`, ServiceAccountWithClusterAdminPermissionsIsAvailableInNamespace)
sc.Step(`^(?i)ServiceAccount "([^"]+)" in test namespace has permissions to fetch "([^"]+)" metrics$`, ServiceAccountWithFetchMetricsPermissions)
@@ -251,12 +253,15 @@ func k8sClient(args ...string) (string, error) {
return output, err
}
-func k8scliWithInput(yaml string, args ...string) (string, error) {
+func k8scliWithInput(yaml string, args ...string) (string, string, error) {
cmd := exec.Command(k8sCli, args...)
cmd.Stdin = bytes.NewBufferString(yaml)
cmd.Env = append(os.Environ(), fmt.Sprintf("KUBECONFIG=%s", kubeconfigPath))
- b, err := cmd.Output()
- return string(b), err
+ var stdoutBuf, stderrBuf bytes.Buffer
+ cmd.Stdout = &stdoutBuf
+ cmd.Stderr = &stderrBuf
+ err := cmd.Run()
+ return stdoutBuf.String(), stderrBuf.String(), err
}
// projectRootDir finds the project root by walking up from the source file until go.mod is found.
@@ -370,11 +375,11 @@ func ResourceApplyFails(ctx context.Context, errMsg string, yamlTemplate *godog.
return fmt.Errorf("failed to parse resource yaml: %v", err)
}
waitFor(ctx, func() bool {
- _, err := k8scliWithInput(yamlContent, "apply", "-f", "-")
+ _, stdErr, err := k8scliWithInput(yamlContent, "apply", "-f", "-")
if err == nil {
return false
}
- if stdErr := stderrOutput(err); !strings.Contains(stdErr, errMsg) {
+ if !strings.Contains(stdErr, errMsg) {
return false
}
return true
@@ -382,6 +387,24 @@ func ResourceApplyFails(ctx context.Context, errMsg string, yamlTemplate *godog.
return nil
}
+// ResourceApplyEmitsWarning asserts the last kubectl apply produced stderr output containing the expected warning.
+func ResourceApplyEmitsWarning(ctx context.Context, expected *godog.DocString) error {
+ sc := scenarioCtx(ctx)
+ expectedText := strings.TrimSpace(expected.Content)
+ if !strings.Contains(sc.lastApplyStderr, expectedText) {
+ return fmt.Errorf("expected apply warning %q, got stderr: %q", expectedText, sc.lastApplyStderr)
+ }
+ return nil
+}
+
+func ResourceApplyDoesNotEmitWarning(ctx context.Context) error {
+ sc := scenarioCtx(ctx)
+ if strings.Contains(sc.lastApplyStderr, "Warning:") {
+ return fmt.Errorf("expected no warnings, got stderr: %q", sc.lastApplyStderr)
+ }
+ return nil
+}
+
// TrackCurrentClusterExtensionForCleanup saves the current ClusterExtension name in the cleanup list
// so it gets deleted at the end of the scenario. Call this before applying a second ClusterExtension
// in the same scenario, because ResourceIsApplied overwrites the tracked name.
@@ -444,10 +467,11 @@ func ResourceIsApplied(ctx context.Context, yamlTemplate *godog.DocString) error
if err != nil {
return fmt.Errorf("failed to marshal resource yaml: %w", err)
}
- out, err := k8scliWithInput(string(annotatedYAML), "apply", "-f", "-")
+ out, stdErr, err := k8scliWithInput(string(annotatedYAML), "apply", "-f", "-")
if err != nil {
- return fmt.Errorf("failed to apply resource %v; err: %w; stderr: %s", out, err, stderrOutput(err))
+ return fmt.Errorf("failed to apply resource %v; err: %w; stderr: %s", out, err, stdErr)
}
+ sc.lastApplyStderr = stdErr
if res.GetKind() == "ClusterExtension" {
sc.clusterExtensionName = res.GetName()
} else if res.GetKind() == "ClusterObjectSet" {
@@ -590,11 +614,6 @@ type msgMatchFn func(string) bool
func alwaysMatch(_ string) bool { return true }
-func isFeatureGateEnabled(feature featuregate.Feature) bool {
- enabled, found := featureGates[feature]
- return enabled && found
-}
-
func messageComparison(ctx context.Context, msg *godog.DocString) msgMatchFn {
msgCmp := alwaysMatch
if msg != nil {
@@ -1283,9 +1302,9 @@ func applyServiceAccount(ctx context.Context, serviceAccount string, keyValue ..
}
// Apply the ServiceAccount configuration
- _, err = k8scliWithInput(yaml, "apply", "-f", "-")
+ _, stdErr, err := k8scliWithInput(yaml, "apply", "-f", "-")
if err != nil {
- return fmt.Errorf("failed to apply ServiceAccount configuration: %v: %s", err, stderrOutput(err))
+ return fmt.Errorf("failed to apply ServiceAccount configuration: %v: %s", err, stdErr)
}
return nil
@@ -1311,9 +1330,9 @@ func applyPermissionsToServiceAccount(ctx context.Context, serviceAccount, rbacT
}
// Apply the RBAC configuration
- _, err = k8scliWithInput(rbacYaml, "apply", "-f", "-")
+ _, rbacStdErr, err := k8scliWithInput(rbacYaml, "apply", "-f", "-")
if err != nil {
- return fmt.Errorf("failed to apply RBAC configuration: %v: %s", err, stderrOutput(err))
+ return fmt.Errorf("failed to apply RBAC configuration: %v: %s", err, rbacStdErr)
}
// Track cluster-scoped RBAC resources for cleanup
@@ -1335,6 +1354,23 @@ func applyPermissionsToServiceAccount(ctx context.Context, serviceAccount, rbacT
return nil
}
+// NamespaceIsAvailable ensures the given namespace exists by applying a namespace template.
+func NamespaceIsAvailable(ctx context.Context, ns string) error {
+ sc := scenarioCtx(ctx)
+ ns = substituteScenarioVars(ns, sc)
+ _, thisFile, _, _ := runtime.Caller(0)
+ yaml, err := templateYaml(filepath.Join(filepath.Dir(thisFile), "testdata", "namespace-template.yaml"), map[string]string{
+ "NAMESPACE": ns,
+ })
+ if err != nil {
+ return fmt.Errorf("failed to template namespace yaml: %v", err)
+ }
+ if _, _, err := k8scliWithInput(yaml, "apply", "-f", "-"); err != nil {
+ return fmt.Errorf("failed to apply namespace %s: %w", ns, err)
+ }
+ return nil
+}
+
// ServiceAccountIsAvailableInNamespace creates a ServiceAccount in the test namespace without RBAC permissions.
func ServiceAccountIsAvailableInNamespace(ctx context.Context, serviceAccount string) error {
return applyServiceAccount(ctx, serviceAccount)
@@ -1351,23 +1387,6 @@ func ServiceAccountWithNeededPermissionsIsAvailableInTestNamespace(ctx context.C
return applyPermissionsToServiceAccount(ctx, serviceAccount, rbacTemplate)
}
-// ServiceAccountWithoutCreatePermissionsIsAvailableInTestNamespace creates a ServiceAccount with permissions that
-// intentionally exclude the "create" verb to test preflight permission validation for Boxcutter applier.
-// This is used to verify that the preflight check properly detects missing CREATE permissions.
-// Note: This function requires both @BoxcutterRuntime and @PreflightPermissions tags.
-func ServiceAccountWithoutCreatePermissionsIsAvailableInTestNamespace(ctx context.Context, serviceAccount string) error {
- // This test is only valid with Boxcutter runtime enabled
- if !isFeatureGateEnabled(features.BoxcutterRuntime) {
- return fmt.Errorf("this step requires BoxcutterRuntime feature gate to be enabled")
- }
- // It also requires preflight permissions checks to be enabled
- if !isFeatureGateEnabled(features.PreflightPermissions) {
- return fmt.Errorf("this step requires PreflightPermissions feature gate to be enabled")
- }
- rbacTemplate := fmt.Sprintf("%s-boxcutter-no-create-rbac-template.yaml", serviceAccount)
- return applyPermissionsToServiceAccount(ctx, serviceAccount, rbacTemplate)
-}
-
// ServiceAccountWithNeededPermissionsIsAvailableInGivenNamespace creates a ServiceAccount and enables creation of any cluster extension on behalf of this account.
func ServiceAccountWithNeededPermissionsIsAvailableInGivenNamespace(ctx context.Context, serviceAccount string, ns string) error {
sc := scenarioCtx(ctx)
@@ -1698,7 +1717,7 @@ spec:
return fmt.Errorf("failed to marshal catalog YAML: %w", err)
}
- if _, err := k8scliWithInput(string(annotatedYAML), "apply", "-f", "-"); err != nil {
+ if _, _, err := k8scliWithInput(string(annotatedYAML), "apply", "-f", "-"); err != nil {
return fmt.Errorf("failed to apply ClusterCatalog: %w", err)
}
diff --git a/test/e2e/steps/testdata/namespace-template.yaml b/test/e2e/steps/testdata/namespace-template.yaml
new file mode 100644
index 0000000000..4db1d8abdc
--- /dev/null
+++ b/test/e2e/steps/testdata/namespace-template.yaml
@@ -0,0 +1,5 @@
+---
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: ${NAMESPACE}
diff --git a/test/e2e/steps/testdata/olm-sa-boxcutter-no-create-rbac-template.yaml b/test/e2e/steps/testdata/olm-sa-boxcutter-no-create-rbac-template.yaml
deleted file mode 100644
index d94f25a4bb..0000000000
--- a/test/e2e/steps/testdata/olm-sa-boxcutter-no-create-rbac-template.yaml
+++ /dev/null
@@ -1,72 +0,0 @@
----
-apiVersion: v1
-kind: Namespace
-metadata:
- name: ${TEST_NAMESPACE}
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: ${TEST_NAMESPACE}-${SERVICEACCOUNT_NAME}-olm-admin-clusterrole
-rules:
- # Allow management of ClusterObjectSet finalizers (e.g. by the Boxcutter applier)
- - apiGroups: [olm.operatorframework.io]
- resources: [clusterobjectsets/finalizers]
- verbs: [update, patch]
- # OLMv0 compatibility requirement for AllNamespaces install
- # https://github.com/operator-framework/operator-lifecycle-manager/blob/dfd0b2bea85038d3c0d65348bc812d297f16b8d2/pkg/controller/operators/olm/operatorgroup.go#L530
- - apiGroups: [ "" ]
- resources:
- - namespaces
- verbs: [ get, list, watch ]
- # Bundle resource management RBAC derived from bundle resource and permissions described in the ClusterServiceVersion
- # NOTE: Intentionally MISSING "create" verb to test preflight check
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [update, get, delete, patch]
- - apiGroups: [""]
- resources:
- - configmaps
- - serviceaccounts
- verbs: [update, list, watch, get, delete, patch]
- - apiGroups: [ "" ]
- resources:
- - events
- verbs: [ patch ]
- - apiGroups: ["apps"]
- resources:
- - deployments
- verbs: [ update, get, delete, patch ]
- - apiGroups: ["networking.k8s.io"]
- resources:
- - networkpolicies
- verbs: [update, list, get, delete, patch]
- - apiGroups: ["rbac.authorization.k8s.io"]
- resources:
- - clusterroles
- - roles
- - clusterrolebindings
- - rolebindings
- verbs: [ update, get, delete, patch ]
- - apiGroups: ["coordination.k8s.io"]
- resources: ["leases"]
- verbs: [update, list, watch, get, delete, patch]
- - apiGroups: ["authorization.k8s.io"]
- resources: ["subjectaccessreviews"]
- verbs: [create]
- - apiGroups: ["authentication.k8s.io"]
- resources: ["tokenreviews"]
- verbs: [create]
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
- name: ${TEST_NAMESPACE}-${SERVICEACCOUNT_NAME}-install-binding
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: ${TEST_NAMESPACE}-${SERVICEACCOUNT_NAME}-olm-admin-clusterrole
-subjects:
- - kind: ServiceAccount
- name: ${SERVICEACCOUNT_NAME}
- namespace: ${TEST_NAMESPACE}
diff --git a/test/e2e/steps/testdata/olm-sa-boxcutter-rbac-template.yaml b/test/e2e/steps/testdata/olm-sa-boxcutter-rbac-template.yaml
deleted file mode 100644
index b2a96661d9..0000000000
--- a/test/e2e/steps/testdata/olm-sa-boxcutter-rbac-template.yaml
+++ /dev/null
@@ -1,71 +0,0 @@
----
-apiVersion: v1
-kind: Namespace
-metadata:
- name: ${TEST_NAMESPACE}
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: ${TEST_NAMESPACE}-${SERVICEACCOUNT_NAME}-olm-admin-clusterrole
-rules:
- # Allow management of ClusterObjectSet finalizers (e.g. by the Boxcutter applier)
- - apiGroups: [olm.operatorframework.io]
- resources: [clusterobjectsets/finalizers]
- verbs: [update, patch]
- # OLMv0 compatibility requirement for AllNamespaces install
- # https://github.com/operator-framework/operator-lifecycle-manager/blob/dfd0b2bea85038d3c0d65348bc812d297f16b8d2/pkg/controller/operators/olm/operatorgroup.go#L530
- - apiGroups: [ "" ]
- resources:
- - namespaces
- verbs: [ get, list, watch ]
- # Bundle resource management RBAC derived from bundle resource and permissions described in the ClusterServiceVersion
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [update, create, get, delete, patch]
- - apiGroups: [""]
- resources:
- - configmaps
- - serviceaccounts
- verbs: [update, create, list, watch, get, delete, patch]
- - apiGroups: [ "" ]
- resources:
- - events
- verbs: [ create, patch ]
- - apiGroups: ["apps"]
- resources:
- - deployments
- verbs: [ update, create, get, delete, patch ]
- - apiGroups: ["networking.k8s.io"]
- resources:
- - networkpolicies
- verbs: [update, create, list, get, delete, patch]
- - apiGroups: ["rbac.authorization.k8s.io"]
- resources:
- - clusterroles
- - roles
- - clusterrolebindings
- - rolebindings
- verbs: [ update, create, get, delete, patch ]
- - apiGroups: ["coordination.k8s.io"]
- resources: ["leases"]
- verbs: [update, create, list, watch, get, delete, patch]
- - apiGroups: ["authorization.k8s.io"]
- resources: ["subjectaccessreviews"]
- verbs: [create]
- - apiGroups: ["authentication.k8s.io"]
- resources: ["tokenreviews"]
- verbs: [create]
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
- name: ${TEST_NAMESPACE}-${SERVICEACCOUNT_NAME}-install-binding
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: ${TEST_NAMESPACE}-${SERVICEACCOUNT_NAME}-olm-admin-clusterrole
-subjects:
- - kind: ServiceAccount
- name: ${SERVICEACCOUNT_NAME}
- namespace: ${TEST_NAMESPACE}
diff --git a/test/e2e/steps/testdata/olm-sa-helm-rbac-template.yaml b/test/e2e/steps/testdata/olm-sa-helm-rbac-template.yaml
deleted file mode 100644
index f41666d925..0000000000
--- a/test/e2e/steps/testdata/olm-sa-helm-rbac-template.yaml
+++ /dev/null
@@ -1,66 +0,0 @@
----
-apiVersion: v1
-kind: Namespace
-metadata:
- name: ${TEST_NAMESPACE}
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: ${TEST_NAMESPACE}-${SERVICEACCOUNT_NAME}-olm-admin-clusterrole
-rules:
- - apiGroups: [olm.operatorframework.io]
- resources: [clusterextensions, clusterextensions/finalizers]
- resourceNames: ["${CLUSTEREXTENSION_NAME}"]
- verbs: [update]
- - apiGroups: [apiextensions.k8s.io]
- resources: [customresourcedefinitions]
- verbs: [update, create, list, watch, get, delete, patch]
- - apiGroups: [""]
- resources:
- - configmaps
- - secrets
- - services
- - serviceaccounts
- - events
- - namespaces
- - persistentvolumes
- - persistentvolumeclaims
- verbs: [update, create, list, watch, get, delete, patch]
- - apiGroups: ["apps"]
- resources:
- - deployments
- verbs: [ update, create, list, watch, get, delete, patch ]
- - apiGroups: ["networking.k8s.io"]
- resources:
- - networkpolicies
- verbs: [ update, create, list, watch, get, delete, patch ]
- - apiGroups: ["rbac.authorization.k8s.io"]
- resources:
- - clusterroles
- - roles
- - clusterrolebindings
- - rolebindings
- verbs: [ update, create, list, watch, get, delete, patch ]
- - apiGroups: ["coordination.k8s.io"]
- resources: ["leases"]
- verbs: [ update, create, list, watch, get, delete, patch ]
- - apiGroups: ["authorization.k8s.io"]
- resources: ["subjectaccessreviews"]
- verbs: [create]
- - apiGroups: ["authentication.k8s.io"]
- resources: ["tokenreviews"]
- verbs: [create]
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
- name: ${TEST_NAMESPACE}-${SERVICEACCOUNT_NAME}-install-binding
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: ${TEST_NAMESPACE}-${SERVICEACCOUNT_NAME}-olm-admin-clusterrole
-subjects:
- - kind: ServiceAccount
- name: ${SERVICEACCOUNT_NAME}
- namespace: ${TEST_NAMESPACE}
diff --git a/test/extension-developer-e2e/extension_developer_test.go b/test/extension-developer-e2e/extension_developer_test.go
index c95ee72d7b..eb8f8c0c9c 100644
--- a/test/extension-developer-e2e/extension_developer_test.go
+++ b/test/extension-developer-e2e/extension_developer_test.go
@@ -18,7 +18,6 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/util/rand"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -123,8 +122,6 @@ func TestExtensionDeveloper(t *testing.T) {
c, err := client.New(cfg, client.Options{Scheme: scheme})
require.NoError(t, err)
- ctx := context.Background()
-
catalog := &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "catalog",
@@ -142,14 +139,6 @@ func TestExtensionDeveloper(t *testing.T) {
installNamespace := "default"
- sa := &corev1.ServiceAccount{
- ObjectMeta: metav1.ObjectMeta{
- Name: fmt.Sprintf("serviceaccount-%s", rand.String(8)),
- Namespace: installNamespace,
- },
- }
- require.NoError(t, c.Create(ctx, sa))
-
clusterExtension := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{
Name: "registryv1",
@@ -162,126 +151,8 @@ func TestExtensionDeveloper(t *testing.T) {
},
},
Namespace: installNamespace,
- ServiceAccount: ocv1.ServiceAccountReference{
- Name: sa.Name,
- },
- },
- }
-
- cr := &rbacv1.ClusterRole{
- ObjectMeta: metav1.ObjectMeta{
- Name: fmt.Sprintf("clusterrole-%s", rand.String(8)),
- },
- Rules: []rbacv1.PolicyRule{
- {
- APIGroups: []string{
- "olm.operatorframework.io",
- },
- Resources: []string{
- "clusterextensions/finalizers",
- },
- Verbs: []string{
- "update",
- },
- ResourceNames: []string{clusterExtension.Name},
- },
- {
- APIGroups: []string{
- "",
- },
- Resources: []string{
- "configmaps",
- "services",
- "serviceaccounts",
- },
- Verbs: []string{
- "create",
- "update",
- "delete",
- "patch",
- "get",
- "list",
- "watch",
- },
- },
- {
- APIGroups: []string{
- "apiextensions.k8s.io",
- },
- Resources: []string{
- "customresourcedefinitions",
- },
- Verbs: []string{
- "create",
- "update",
- "delete",
- "patch",
- "get",
- "list",
- "watch",
- },
- },
- {
- APIGroups: []string{
- "apps",
- },
- Resources: []string{
- "deployments",
- },
- Verbs: []string{
- "create",
- "update",
- "delete",
- "patch",
- "get",
- "list",
- "watch",
- },
- },
- {
- APIGroups: []string{
- "rbac.authorization.k8s.io",
- },
- Resources: []string{
- "clusterroles",
- "roles",
- "clusterrolebindings",
- "rolebindings",
- },
- Verbs: []string{
- "create",
- "update",
- "delete",
- "patch",
- "get",
- "list",
- "watch",
- "bind",
- "escalate",
- },
- },
- },
- }
- require.NoError(t, c.Create(ctx, cr))
-
- crb := &rbacv1.ClusterRoleBinding{
- ObjectMeta: metav1.ObjectMeta{
- Name: fmt.Sprintf("clusterrolebinding-%s", rand.String(8)),
- },
- Subjects: []rbacv1.Subject{
- {
- Kind: "ServiceAccount",
- Name: sa.Name,
- Namespace: sa.Namespace,
- },
- },
- RoleRef: rbacv1.RoleRef{
- APIGroup: "rbac.authorization.k8s.io",
- Kind: "ClusterRole",
- Name: cr.Name,
},
}
- require.NoError(t, c.Create(ctx, crb))
t.Logf("When creating an ClusterExtension that references a package with a %q bundle type", clusterExtension.Name)
require.NoError(t, c.Create(context.Background(), clusterExtension))
diff --git a/vendor/github.com/stretchr/objx/.codeclimate.yml b/vendor/github.com/stretchr/objx/.codeclimate.yml
deleted file mode 100644
index 559fa399c1..0000000000
--- a/vendor/github.com/stretchr/objx/.codeclimate.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-engines:
- gofmt:
- enabled: true
- golint:
- enabled: true
- govet:
- enabled: true
-
-exclude_patterns:
-- ".github/"
-- "vendor/"
-- "codegen/"
-- "*.yml"
-- ".*.yml"
-- "*.md"
-- "Gopkg.*"
-- "doc.go"
-- "type_specific_codegen_test.go"
-- "type_specific_codegen.go"
-- ".gitignore"
-- "LICENSE"
diff --git a/vendor/github.com/stretchr/objx/.gitignore b/vendor/github.com/stretchr/objx/.gitignore
deleted file mode 100644
index ea58090bd2..0000000000
--- a/vendor/github.com/stretchr/objx/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-# Binaries for programs and plugins
-*.exe
-*.dll
-*.so
-*.dylib
-
-# Test binary, build with `go test -c`
-*.test
-
-# Output of the go coverage tool, specifically when used with LiteIDE
-*.out
diff --git a/vendor/github.com/stretchr/objx/LICENSE b/vendor/github.com/stretchr/objx/LICENSE
deleted file mode 100644
index 44d4d9d5a7..0000000000
--- a/vendor/github.com/stretchr/objx/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License
-
-Copyright (c) 2014 Stretchr, Inc.
-Copyright (c) 2017-2018 objx contributors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/stretchr/objx/README.md b/vendor/github.com/stretchr/objx/README.md
deleted file mode 100644
index e9ba830735..0000000000
--- a/vendor/github.com/stretchr/objx/README.md
+++ /dev/null
@@ -1,91 +0,0 @@
-# Objx
-[](https://travis-ci.org/stretchr/objx)
-[](https://goreportcard.com/report/github.com/stretchr/objx)
-[](https://sourcegraph.com/github.com/stretchr/objx)
-[](https://pkg.go.dev/github.com/stretchr/objx)
-
-Objx - Go package for dealing with maps, slices, JSON and other data.
-
-Get started:
-
-- Install Objx with [one line of code](#installation), or [update it with another](#staying-up-to-date)
-- Check out the API Documentation http://pkg.go.dev/github.com/stretchr/objx
-
-## Overview
-Objx provides the `objx.Map` type, which is a `map[string]interface{}` that exposes a powerful `Get` method (among others) that allows you to easily and quickly get access to data within the map, without having to worry too much about type assertions, missing data, default values etc.
-
-### Pattern
-Objx uses a predictable pattern to make access data from within `map[string]interface{}` easy. Call one of the `objx.` functions to create your `objx.Map` to get going:
-
-```go
-m, err := objx.FromJSON(json)
-```
-
-NOTE: Any methods or functions with the `Must` prefix will panic if something goes wrong, the rest will be optimistic and try to figure things out without panicking.
-
-Use `Get` to access the value you're interested in. You can use dot and array
-notation too:
-
-```go
-m.Get("places[0].latlng")
-```
-
-Once you have sought the `Value` you're interested in, you can use the `Is*` methods to determine its type.
-
-```go
-if m.Get("code").IsStr() { // Your code... }
-```
-
-Or you can just assume the type, and use one of the strong type methods to extract the real value:
-
-```go
-m.Get("code").Int()
-```
-
-If there's no value there (or if it's the wrong type) then a default value will be returned, or you can be explicit about the default value.
-
-```go
-Get("code").Int(-1)
-```
-If you're dealing with a slice of data as a value, Objx provides many useful methods for iterating, manipulating and selecting that data. You can find out more by exploring the index below.
-
-### Reading data
-A simple example of how to use Objx:
-
-```go
-// Use MustFromJSON to make an objx.Map from some JSON
-m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`)
-
-// Get the details
-name := m.Get("name").Str()
-age := m.Get("age").Int()
-
-// Get their nickname (or use their name if they don't have one)
-nickname := m.Get("nickname").Str(name)
-```
-
-### Ranging
-Since `objx.Map` is a `map[string]interface{}` you can treat it as such. For example, to `range` the data, do what you would expect:
-
-```go
-m := objx.MustFromJSON(json)
-for key, value := range m {
- // Your code...
-}
-```
-
-## Installation
-To install Objx, use go get:
-
- go get github.com/stretchr/objx
-
-### Staying up to date
-To update Objx to the latest version, run:
-
- go get -u github.com/stretchr/objx
-
-### Supported go versions
-We currently support the three recent major Go versions.
-
-## Contributing
-Please feel free to submit issues, fork the repository and send pull requests!
diff --git a/vendor/github.com/stretchr/objx/Taskfile.yml b/vendor/github.com/stretchr/objx/Taskfile.yml
deleted file mode 100644
index 8a79e8d674..0000000000
--- a/vendor/github.com/stretchr/objx/Taskfile.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-version: '3'
-
-tasks:
- default:
- deps: [test]
-
- lint:
- desc: Checks code style
- cmds:
- - gofmt -d -s *.go
- - go vet ./...
- silent: true
-
- lint-fix:
- desc: Fixes code style
- cmds:
- - gofmt -w -s *.go
-
- test:
- desc: Runs go tests
- cmds:
- - go test -race ./...
-
- test-coverage:
- desc: Runs go tests and calculates test coverage
- cmds:
- - go test -race -coverprofile=c.out ./...
diff --git a/vendor/github.com/stretchr/objx/accessors.go b/vendor/github.com/stretchr/objx/accessors.go
deleted file mode 100644
index 72f1d1c1ce..0000000000
--- a/vendor/github.com/stretchr/objx/accessors.go
+++ /dev/null
@@ -1,197 +0,0 @@
-package objx
-
-import (
- "reflect"
- "regexp"
- "strconv"
- "strings"
-)
-
-const (
- // PathSeparator is the character used to separate the elements
- // of the keypath.
- //
- // For example, `location.address.city`
- PathSeparator string = "."
-
- // arrayAccessRegexString is the regex used to extract the array number
- // from the access path
- arrayAccessRegexString = `^(.+)\[([0-9]+)\]$`
-
- // mapAccessRegexString is the regex used to extract the map key
- // from the access path
- mapAccessRegexString = `^([^\[]*)\[([^\]]+)\](.*)$`
-)
-
-// arrayAccessRegex is the compiled arrayAccessRegexString
-var arrayAccessRegex = regexp.MustCompile(arrayAccessRegexString)
-
-// mapAccessRegex is the compiled mapAccessRegexString
-var mapAccessRegex = regexp.MustCompile(mapAccessRegexString)
-
-// Get gets the value using the specified selector and
-// returns it inside a new Obj object.
-//
-// If it cannot find the value, Get will return a nil
-// value inside an instance of Obj.
-//
-// Get can only operate directly on map[string]interface{} and []interface.
-//
-// # Example
-//
-// To access the title of the third chapter of the second book, do:
-//
-// o.Get("books[1].chapters[2].title")
-func (m Map) Get(selector string) *Value {
- rawObj := access(m, selector, nil, false)
- return &Value{data: rawObj}
-}
-
-// Set sets the value using the specified selector and
-// returns the object on which Set was called.
-//
-// Set can only operate directly on map[string]interface{} and []interface
-//
-// # Example
-//
-// To set the title of the third chapter of the second book, do:
-//
-// o.Set("books[1].chapters[2].title","Time to Go")
-func (m Map) Set(selector string, value interface{}) Map {
- access(m, selector, value, true)
- return m
-}
-
-// getIndex returns the index, which is hold in s by two branches.
-// It also returns s without the index part, e.g. name[1] will return (1, name).
-// If no index is found, -1 is returned
-func getIndex(s string) (int, string) {
- arrayMatches := arrayAccessRegex.FindStringSubmatch(s)
- if len(arrayMatches) > 0 {
- // Get the key into the map
- selector := arrayMatches[1]
- // Get the index into the array at the key
- // We know this can't fail because arrayMatches[2] is an int for sure
- index, _ := strconv.Atoi(arrayMatches[2])
- return index, selector
- }
- return -1, s
-}
-
-// getKey returns the key which is held in s by two brackets.
-// It also returns the next selector.
-func getKey(s string) (string, string) {
- selSegs := strings.SplitN(s, PathSeparator, 2)
- thisSel := selSegs[0]
- nextSel := ""
-
- if len(selSegs) > 1 {
- nextSel = selSegs[1]
- }
-
- mapMatches := mapAccessRegex.FindStringSubmatch(s)
- if len(mapMatches) > 0 {
- if _, err := strconv.Atoi(mapMatches[2]); err != nil {
- thisSel = mapMatches[1]
- nextSel = "[" + mapMatches[2] + "]" + mapMatches[3]
-
- if thisSel == "" {
- thisSel = mapMatches[2]
- nextSel = mapMatches[3]
- }
-
- if nextSel == "" {
- selSegs = []string{"", ""}
- } else if nextSel[0] == '.' {
- nextSel = nextSel[1:]
- }
- }
- }
-
- return thisSel, nextSel
-}
-
-// access accesses the object using the selector and performs the
-// appropriate action.
-func access(current interface{}, selector string, value interface{}, isSet bool) interface{} {
- thisSel, nextSel := getKey(selector)
-
- indexes := []int{}
- for strings.Contains(thisSel, "[") {
- prevSel := thisSel
- index := -1
- index, thisSel = getIndex(thisSel)
- indexes = append(indexes, index)
- if prevSel == thisSel {
- break
- }
- }
-
- if curMap, ok := current.(Map); ok {
- current = map[string]interface{}(curMap)
- }
- // get the object in question
- switch current.(type) {
- case map[string]interface{}:
- curMSI := current.(map[string]interface{})
- if nextSel == "" && isSet {
- curMSI[thisSel] = value
- return nil
- }
-
- _, ok := curMSI[thisSel].(map[string]interface{})
- if !ok {
- _, ok = curMSI[thisSel].(Map)
- }
-
- if (curMSI[thisSel] == nil || !ok) && len(indexes) == 0 && isSet {
- curMSI[thisSel] = map[string]interface{}{}
- }
-
- current = curMSI[thisSel]
- default:
- current = nil
- }
-
- // do we need to access the item of an array?
- if len(indexes) > 0 {
- num := len(indexes)
- for num > 0 {
- num--
- index := indexes[num]
- indexes = indexes[:num]
- if array, ok := interSlice(current); ok {
- if index < len(array) {
- current = array[index]
- } else {
- current = nil
- break
- }
- }
- }
- }
-
- if nextSel != "" {
- current = access(current, nextSel, value, isSet)
- }
- return current
-}
-
-func interSlice(slice interface{}) ([]interface{}, bool) {
- if array, ok := slice.([]interface{}); ok {
- return array, ok
- }
-
- s := reflect.ValueOf(slice)
- if s.Kind() != reflect.Slice {
- return nil, false
- }
-
- ret := make([]interface{}, s.Len())
-
- for i := 0; i < s.Len(); i++ {
- ret[i] = s.Index(i).Interface()
- }
-
- return ret, true
-}
diff --git a/vendor/github.com/stretchr/objx/conversions.go b/vendor/github.com/stretchr/objx/conversions.go
deleted file mode 100644
index 01c63d7d3b..0000000000
--- a/vendor/github.com/stretchr/objx/conversions.go
+++ /dev/null
@@ -1,280 +0,0 @@
-package objx
-
-import (
- "bytes"
- "encoding/base64"
- "encoding/json"
- "errors"
- "fmt"
- "net/url"
- "strconv"
-)
-
-// SignatureSeparator is the character that is used to
-// separate the Base64 string from the security signature.
-const SignatureSeparator = "_"
-
-// URLValuesSliceKeySuffix is the character that is used to
-// specify a suffix for slices parsed by URLValues.
-// If the suffix is set to "[i]", then the index of the slice
-// is used in place of i
-// Ex: Suffix "[]" would have the form a[]=b&a[]=c
-// OR Suffix "[i]" would have the form a[0]=b&a[1]=c
-// OR Suffix "" would have the form a=b&a=c
-var urlValuesSliceKeySuffix = "[]"
-
-const (
- URLValuesSliceKeySuffixEmpty = ""
- URLValuesSliceKeySuffixArray = "[]"
- URLValuesSliceKeySuffixIndex = "[i]"
-)
-
-// SetURLValuesSliceKeySuffix sets the character that is used to
-// specify a suffix for slices parsed by URLValues.
-// If the suffix is set to "[i]", then the index of the slice
-// is used in place of i
-// Ex: Suffix "[]" would have the form a[]=b&a[]=c
-// OR Suffix "[i]" would have the form a[0]=b&a[1]=c
-// OR Suffix "" would have the form a=b&a=c
-func SetURLValuesSliceKeySuffix(s string) error {
- if s == URLValuesSliceKeySuffixEmpty || s == URLValuesSliceKeySuffixArray || s == URLValuesSliceKeySuffixIndex {
- urlValuesSliceKeySuffix = s
- return nil
- }
-
- return errors.New("objx: Invalid URLValuesSliceKeySuffix provided.")
-}
-
-// JSON converts the contained object to a JSON string
-// representation
-func (m Map) JSON() (string, error) {
- for k, v := range m {
- m[k] = cleanUp(v)
- }
-
- result, err := json.Marshal(m)
- if err != nil {
- err = errors.New("objx: JSON encode failed with: " + err.Error())
- }
- return string(result), err
-}
-
-func cleanUpInterfaceArray(in []interface{}) []interface{} {
- result := make([]interface{}, len(in))
- for i, v := range in {
- result[i] = cleanUp(v)
- }
- return result
-}
-
-func cleanUpInterfaceMap(in map[interface{}]interface{}) Map {
- result := Map{}
- for k, v := range in {
- result[fmt.Sprintf("%v", k)] = cleanUp(v)
- }
- return result
-}
-
-func cleanUpStringMap(in map[string]interface{}) Map {
- result := Map{}
- for k, v := range in {
- result[k] = cleanUp(v)
- }
- return result
-}
-
-func cleanUpMSIArray(in []map[string]interface{}) []Map {
- result := make([]Map, len(in))
- for i, v := range in {
- result[i] = cleanUpStringMap(v)
- }
- return result
-}
-
-func cleanUpMapArray(in []Map) []Map {
- result := make([]Map, len(in))
- for i, v := range in {
- result[i] = cleanUpStringMap(v)
- }
- return result
-}
-
-func cleanUp(v interface{}) interface{} {
- switch v := v.(type) {
- case []interface{}:
- return cleanUpInterfaceArray(v)
- case []map[string]interface{}:
- return cleanUpMSIArray(v)
- case map[interface{}]interface{}:
- return cleanUpInterfaceMap(v)
- case Map:
- return cleanUpStringMap(v)
- case []Map:
- return cleanUpMapArray(v)
- default:
- return v
- }
-}
-
-// MustJSON converts the contained object to a JSON string
-// representation and panics if there is an error
-func (m Map) MustJSON() string {
- result, err := m.JSON()
- if err != nil {
- panic(err.Error())
- }
- return result
-}
-
-// Base64 converts the contained object to a Base64 string
-// representation of the JSON string representation
-func (m Map) Base64() (string, error) {
- var buf bytes.Buffer
-
- jsonData, err := m.JSON()
- if err != nil {
- return "", err
- }
-
- encoder := base64.NewEncoder(base64.StdEncoding, &buf)
- _, _ = encoder.Write([]byte(jsonData))
- _ = encoder.Close()
-
- return buf.String(), nil
-}
-
-// MustBase64 converts the contained object to a Base64 string
-// representation of the JSON string representation and panics
-// if there is an error
-func (m Map) MustBase64() string {
- result, err := m.Base64()
- if err != nil {
- panic(err.Error())
- }
- return result
-}
-
-// SignedBase64 converts the contained object to a Base64 string
-// representation of the JSON string representation and signs it
-// using the provided key.
-func (m Map) SignedBase64(key string) (string, error) {
- base64, err := m.Base64()
- if err != nil {
- return "", err
- }
-
- sig := HashWithKey(base64, key)
- return base64 + SignatureSeparator + sig, nil
-}
-
-// MustSignedBase64 converts the contained object to a Base64 string
-// representation of the JSON string representation and signs it
-// using the provided key and panics if there is an error
-func (m Map) MustSignedBase64(key string) string {
- result, err := m.SignedBase64(key)
- if err != nil {
- panic(err.Error())
- }
- return result
-}
-
-/*
- URL Query
- ------------------------------------------------
-*/
-
-// URLValues creates a url.Values object from an Obj. This
-// function requires that the wrapped object be a map[string]interface{}
-func (m Map) URLValues() url.Values {
- vals := make(url.Values)
-
- m.parseURLValues(m, vals, "")
-
- return vals
-}
-
-func (m Map) parseURLValues(queryMap Map, vals url.Values, key string) {
- useSliceIndex := false
- if urlValuesSliceKeySuffix == "[i]" {
- useSliceIndex = true
- }
-
- for k, v := range queryMap {
- val := &Value{data: v}
- switch {
- case val.IsObjxMap():
- if key == "" {
- m.parseURLValues(val.ObjxMap(), vals, k)
- } else {
- m.parseURLValues(val.ObjxMap(), vals, key+"["+k+"]")
- }
- case val.IsObjxMapSlice():
- sliceKey := k
- if key != "" {
- sliceKey = key + "[" + k + "]"
- }
-
- if useSliceIndex {
- for i, sv := range val.MustObjxMapSlice() {
- sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]"
- m.parseURLValues(sv, vals, sk)
- }
- } else {
- sliceKey = sliceKey + urlValuesSliceKeySuffix
- for _, sv := range val.MustObjxMapSlice() {
- m.parseURLValues(sv, vals, sliceKey)
- }
- }
- case val.IsMSISlice():
- sliceKey := k
- if key != "" {
- sliceKey = key + "[" + k + "]"
- }
-
- if useSliceIndex {
- for i, sv := range val.MustMSISlice() {
- sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]"
- m.parseURLValues(New(sv), vals, sk)
- }
- } else {
- sliceKey = sliceKey + urlValuesSliceKeySuffix
- for _, sv := range val.MustMSISlice() {
- m.parseURLValues(New(sv), vals, sliceKey)
- }
- }
- case val.IsStrSlice(), val.IsBoolSlice(),
- val.IsFloat32Slice(), val.IsFloat64Slice(),
- val.IsIntSlice(), val.IsInt8Slice(), val.IsInt16Slice(), val.IsInt32Slice(), val.IsInt64Slice(),
- val.IsUintSlice(), val.IsUint8Slice(), val.IsUint16Slice(), val.IsUint32Slice(), val.IsUint64Slice():
-
- sliceKey := k
- if key != "" {
- sliceKey = key + "[" + k + "]"
- }
-
- if useSliceIndex {
- for i, sv := range val.StringSlice() {
- sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]"
- vals.Set(sk, sv)
- }
- } else {
- sliceKey = sliceKey + urlValuesSliceKeySuffix
- vals[sliceKey] = val.StringSlice()
- }
-
- default:
- if key == "" {
- vals.Set(k, val.String())
- } else {
- vals.Set(key+"["+k+"]", val.String())
- }
- }
- }
-}
-
-// URLQuery gets an encoded URL query representing the given
-// Obj. This function requires that the wrapped object be a
-// map[string]interface{}
-func (m Map) URLQuery() (string, error) {
- return m.URLValues().Encode(), nil
-}
diff --git a/vendor/github.com/stretchr/objx/doc.go b/vendor/github.com/stretchr/objx/doc.go
deleted file mode 100644
index b170af74b3..0000000000
--- a/vendor/github.com/stretchr/objx/doc.go
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-Package objx provides utilities for dealing with maps, slices, JSON and other data.
-
-# Overview
-
-Objx provides the `objx.Map` type, which is a `map[string]interface{}` that exposes
-a powerful `Get` method (among others) that allows you to easily and quickly get
-access to data within the map, without having to worry too much about type assertions,
-missing data, default values etc.
-
-# Pattern
-
-Objx uses a predictable pattern to make access data from within `map[string]interface{}` easy.
-Call one of the `objx.` functions to create your `objx.Map` to get going:
-
- m, err := objx.FromJSON(json)
-
-NOTE: Any methods or functions with the `Must` prefix will panic if something goes wrong,
-the rest will be optimistic and try to figure things out without panicking.
-
-Use `Get` to access the value you're interested in. You can use dot and array
-notation too:
-
- m.Get("places[0].latlng")
-
-Once you have sought the `Value` you're interested in, you can use the `Is*` methods to determine its type.
-
- if m.Get("code").IsStr() { // Your code... }
-
-Or you can just assume the type, and use one of the strong type methods to extract the real value:
-
- m.Get("code").Int()
-
-If there's no value there (or if it's the wrong type) then a default value will be returned,
-or you can be explicit about the default value.
-
- Get("code").Int(-1)
-
-If you're dealing with a slice of data as a value, Objx provides many useful methods for iterating,
-manipulating and selecting that data. You can find out more by exploring the index below.
-
-# Reading data
-
-A simple example of how to use Objx:
-
- // Use MustFromJSON to make an objx.Map from some JSON
- m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`)
-
- // Get the details
- name := m.Get("name").Str()
- age := m.Get("age").Int()
-
- // Get their nickname (or use their name if they don't have one)
- nickname := m.Get("nickname").Str(name)
-
-# Ranging
-
-Since `objx.Map` is a `map[string]interface{}` you can treat it as such.
-For example, to `range` the data, do what you would expect:
-
- m := objx.MustFromJSON(json)
- for key, value := range m {
- // Your code...
- }
-*/
-package objx
diff --git a/vendor/github.com/stretchr/objx/map.go b/vendor/github.com/stretchr/objx/map.go
deleted file mode 100644
index ab9f9ae67c..0000000000
--- a/vendor/github.com/stretchr/objx/map.go
+++ /dev/null
@@ -1,214 +0,0 @@
-package objx
-
-import (
- "encoding/base64"
- "encoding/json"
- "errors"
- "io/ioutil"
- "net/url"
- "strings"
-)
-
-// MSIConvertable is an interface that defines methods for converting your
-// custom types to a map[string]interface{} representation.
-type MSIConvertable interface {
- // MSI gets a map[string]interface{} (msi) representing the
- // object.
- MSI() map[string]interface{}
-}
-
-// Map provides extended functionality for working with
-// untyped data, in particular map[string]interface (msi).
-type Map map[string]interface{}
-
-// Value returns the internal value instance
-func (m Map) Value() *Value {
- return &Value{data: m}
-}
-
-// Nil represents a nil Map.
-var Nil = New(nil)
-
-// New creates a new Map containing the map[string]interface{} in the data argument.
-// If the data argument is not a map[string]interface, New attempts to call the
-// MSI() method on the MSIConvertable interface to create one.
-func New(data interface{}) Map {
- if _, ok := data.(map[string]interface{}); !ok {
- if converter, ok := data.(MSIConvertable); ok {
- data = converter.MSI()
- } else {
- return nil
- }
- }
- return Map(data.(map[string]interface{}))
-}
-
-// MSI creates a map[string]interface{} and puts it inside a new Map.
-//
-// The arguments follow a key, value pattern.
-//
-// Returns nil if any key argument is non-string or if there are an odd number of arguments.
-//
-// # Example
-//
-// To easily create Maps:
-//
-// m := objx.MSI("name", "Mat", "age", 29, "subobj", objx.MSI("active", true))
-//
-// // creates an Map equivalent to
-// m := objx.Map{"name": "Mat", "age": 29, "subobj": objx.Map{"active": true}}
-func MSI(keyAndValuePairs ...interface{}) Map {
- newMap := Map{}
- keyAndValuePairsLen := len(keyAndValuePairs)
- if keyAndValuePairsLen%2 != 0 {
- return nil
- }
- for i := 0; i < keyAndValuePairsLen; i = i + 2 {
- key := keyAndValuePairs[i]
- value := keyAndValuePairs[i+1]
-
- // make sure the key is a string
- keyString, keyStringOK := key.(string)
- if !keyStringOK {
- return nil
- }
- newMap[keyString] = value
- }
- return newMap
-}
-
-// ****** Conversion Constructors
-
-// MustFromJSON creates a new Map containing the data specified in the
-// jsonString.
-//
-// Panics if the JSON is invalid.
-func MustFromJSON(jsonString string) Map {
- o, err := FromJSON(jsonString)
- if err != nil {
- panic("objx: MustFromJSON failed with error: " + err.Error())
- }
- return o
-}
-
-// MustFromJSONSlice creates a new slice of Map containing the data specified in the
-// jsonString. Works with jsons with a top level array
-//
-// Panics if the JSON is invalid.
-func MustFromJSONSlice(jsonString string) []Map {
- slice, err := FromJSONSlice(jsonString)
- if err != nil {
- panic("objx: MustFromJSONSlice failed with error: " + err.Error())
- }
- return slice
-}
-
-// FromJSON creates a new Map containing the data specified in the
-// jsonString.
-//
-// Returns an error if the JSON is invalid.
-func FromJSON(jsonString string) (Map, error) {
- var m Map
- err := json.Unmarshal([]byte(jsonString), &m)
- if err != nil {
- return Nil, err
- }
- return m, nil
-}
-
-// FromJSONSlice creates a new slice of Map containing the data specified in the
-// jsonString. Works with jsons with a top level array
-//
-// Returns an error if the JSON is invalid.
-func FromJSONSlice(jsonString string) ([]Map, error) {
- var slice []Map
- err := json.Unmarshal([]byte(jsonString), &slice)
- if err != nil {
- return nil, err
- }
- return slice, nil
-}
-
-// FromBase64 creates a new Obj containing the data specified
-// in the Base64 string.
-//
-// The string is an encoded JSON string returned by Base64
-func FromBase64(base64String string) (Map, error) {
- decoder := base64.NewDecoder(base64.StdEncoding, strings.NewReader(base64String))
- decoded, err := ioutil.ReadAll(decoder)
- if err != nil {
- return nil, err
- }
- return FromJSON(string(decoded))
-}
-
-// MustFromBase64 creates a new Obj containing the data specified
-// in the Base64 string and panics if there is an error.
-//
-// The string is an encoded JSON string returned by Base64
-func MustFromBase64(base64String string) Map {
- result, err := FromBase64(base64String)
- if err != nil {
- panic("objx: MustFromBase64 failed with error: " + err.Error())
- }
- return result
-}
-
-// FromSignedBase64 creates a new Obj containing the data specified
-// in the Base64 string.
-//
-// The string is an encoded JSON string returned by SignedBase64
-func FromSignedBase64(base64String, key string) (Map, error) {
- parts := strings.Split(base64String, SignatureSeparator)
- if len(parts) != 2 {
- return nil, errors.New("objx: Signed base64 string is malformed")
- }
-
- sig := HashWithKey(parts[0], key)
- if parts[1] != sig {
- return nil, errors.New("objx: Signature for base64 data does not match")
- }
- return FromBase64(parts[0])
-}
-
-// MustFromSignedBase64 creates a new Obj containing the data specified
-// in the Base64 string and panics if there is an error.
-//
-// The string is an encoded JSON string returned by Base64
-func MustFromSignedBase64(base64String, key string) Map {
- result, err := FromSignedBase64(base64String, key)
- if err != nil {
- panic("objx: MustFromSignedBase64 failed with error: " + err.Error())
- }
- return result
-}
-
-// FromURLQuery generates a new Obj by parsing the specified
-// query.
-//
-// For queries with multiple values, the first value is selected.
-func FromURLQuery(query string) (Map, error) {
- vals, err := url.ParseQuery(query)
- if err != nil {
- return nil, err
- }
- m := Map{}
- for k, vals := range vals {
- m[k] = vals[0]
- }
- return m, nil
-}
-
-// MustFromURLQuery generates a new Obj by parsing the specified
-// query.
-//
-// For queries with multiple values, the first value is selected.
-//
-// Panics if it encounters an error
-func MustFromURLQuery(query string) Map {
- o, err := FromURLQuery(query)
- if err != nil {
- panic("objx: MustFromURLQuery failed with error: " + err.Error())
- }
- return o
-}
diff --git a/vendor/github.com/stretchr/objx/mutations.go b/vendor/github.com/stretchr/objx/mutations.go
deleted file mode 100644
index c3400a3f70..0000000000
--- a/vendor/github.com/stretchr/objx/mutations.go
+++ /dev/null
@@ -1,77 +0,0 @@
-package objx
-
-// Exclude returns a new Map with the keys in the specified []string
-// excluded.
-func (m Map) Exclude(exclude []string) Map {
- excluded := make(Map)
- for k, v := range m {
- if !contains(exclude, k) {
- excluded[k] = v
- }
- }
- return excluded
-}
-
-// Copy creates a shallow copy of the Obj.
-func (m Map) Copy() Map {
- copied := Map{}
- for k, v := range m {
- copied[k] = v
- }
- return copied
-}
-
-// Merge blends the specified map with a copy of this map and returns the result.
-//
-// Keys that appear in both will be selected from the specified map.
-// This method requires that the wrapped object be a map[string]interface{}
-func (m Map) Merge(merge Map) Map {
- return m.Copy().MergeHere(merge)
-}
-
-// MergeHere blends the specified map with this map and returns the current map.
-//
-// Keys that appear in both will be selected from the specified map. The original map
-// will be modified. This method requires that
-// the wrapped object be a map[string]interface{}
-func (m Map) MergeHere(merge Map) Map {
- for k, v := range merge {
- m[k] = v
- }
- return m
-}
-
-// Transform builds a new Obj giving the transformer a chance
-// to change the keys and values as it goes. This method requires that
-// the wrapped object be a map[string]interface{}
-func (m Map) Transform(transformer func(key string, value interface{}) (string, interface{})) Map {
- newMap := Map{}
- for k, v := range m {
- modifiedKey, modifiedVal := transformer(k, v)
- newMap[modifiedKey] = modifiedVal
- }
- return newMap
-}
-
-// TransformKeys builds a new map using the specified key mapping.
-//
-// Unspecified keys will be unaltered.
-// This method requires that the wrapped object be a map[string]interface{}
-func (m Map) TransformKeys(mapping map[string]string) Map {
- return m.Transform(func(key string, value interface{}) (string, interface{}) {
- if newKey, ok := mapping[key]; ok {
- return newKey, value
- }
- return key, value
- })
-}
-
-// Checks if a string slice contains a string
-func contains(s []string, e string) bool {
- for _, a := range s {
- if a == e {
- return true
- }
- }
- return false
-}
diff --git a/vendor/github.com/stretchr/objx/security.go b/vendor/github.com/stretchr/objx/security.go
deleted file mode 100644
index 692be8e2a9..0000000000
--- a/vendor/github.com/stretchr/objx/security.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package objx
-
-import (
- "crypto/sha1"
- "encoding/hex"
-)
-
-// HashWithKey hashes the specified string using the security key
-func HashWithKey(data, key string) string {
- d := sha1.Sum([]byte(data + ":" + key))
- return hex.EncodeToString(d[:])
-}
diff --git a/vendor/github.com/stretchr/objx/tests.go b/vendor/github.com/stretchr/objx/tests.go
deleted file mode 100644
index d9e0b479a4..0000000000
--- a/vendor/github.com/stretchr/objx/tests.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package objx
-
-// Has gets whether there is something at the specified selector
-// or not.
-//
-// If m is nil, Has will always return false.
-func (m Map) Has(selector string) bool {
- if m == nil {
- return false
- }
- return !m.Get(selector).IsNil()
-}
-
-// IsNil gets whether the data is nil or not.
-func (v *Value) IsNil() bool {
- return v == nil || v.data == nil
-}
diff --git a/vendor/github.com/stretchr/objx/type_specific.go b/vendor/github.com/stretchr/objx/type_specific.go
deleted file mode 100644
index 80f88d9fa2..0000000000
--- a/vendor/github.com/stretchr/objx/type_specific.go
+++ /dev/null
@@ -1,346 +0,0 @@
-package objx
-
-/*
- MSI (map[string]interface{} and []map[string]interface{})
-*/
-
-// MSI gets the value as a map[string]interface{}, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) MSI(optionalDefault ...map[string]interface{}) map[string]interface{} {
- if s, ok := v.data.(map[string]interface{}); ok {
- return s
- }
- if s, ok := v.data.(Map); ok {
- return map[string]interface{}(s)
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustMSI gets the value as a map[string]interface{}.
-//
-// Panics if the object is not a map[string]interface{}.
-func (v *Value) MustMSI() map[string]interface{} {
- if s, ok := v.data.(Map); ok {
- return map[string]interface{}(s)
- }
- return v.data.(map[string]interface{})
-}
-
-// MSISlice gets the value as a []map[string]interface{}, returns the optionalDefault
-// value or nil if the value is not a []map[string]interface{}.
-func (v *Value) MSISlice(optionalDefault ...[]map[string]interface{}) []map[string]interface{} {
- if s, ok := v.data.([]map[string]interface{}); ok {
- return s
- }
-
- s := v.ObjxMapSlice()
- if s == nil {
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
- }
-
- result := make([]map[string]interface{}, len(s))
- for i := range s {
- result[i] = s[i].Value().MSI()
- }
- return result
-}
-
-// MustMSISlice gets the value as a []map[string]interface{}.
-//
-// Panics if the object is not a []map[string]interface{}.
-func (v *Value) MustMSISlice() []map[string]interface{} {
- if s := v.MSISlice(); s != nil {
- return s
- }
-
- return v.data.([]map[string]interface{})
-}
-
-// IsMSI gets whether the object contained is a map[string]interface{} or not.
-func (v *Value) IsMSI() bool {
- _, ok := v.data.(map[string]interface{})
- if !ok {
- _, ok = v.data.(Map)
- }
- return ok
-}
-
-// IsMSISlice gets whether the object contained is a []map[string]interface{} or not.
-func (v *Value) IsMSISlice() bool {
- _, ok := v.data.([]map[string]interface{})
- if !ok {
- _, ok = v.data.([]Map)
- if !ok {
- s, ok := v.data.([]interface{})
- if ok {
- for i := range s {
- switch s[i].(type) {
- case Map:
- case map[string]interface{}:
- default:
- return false
- }
- }
- return true
- }
- }
- }
- return ok
-}
-
-// EachMSI calls the specified callback for each object
-// in the []map[string]interface{}.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachMSI(callback func(int, map[string]interface{}) bool) *Value {
- for index, val := range v.MustMSISlice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereMSI uses the specified decider function to select items
-// from the []map[string]interface{}. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereMSI(decider func(int, map[string]interface{}) bool) *Value {
- var selected []map[string]interface{}
- v.EachMSI(func(index int, val map[string]interface{}) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupMSI uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]map[string]interface{}.
-func (v *Value) GroupMSI(grouper func(int, map[string]interface{}) string) *Value {
- groups := make(map[string][]map[string]interface{})
- v.EachMSI(func(index int, val map[string]interface{}) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]map[string]interface{}, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceMSI uses the specified function to replace each map[string]interface{}s
-// by iterating each item. The data in the returned result will be a
-// []map[string]interface{} containing the replaced items.
-func (v *Value) ReplaceMSI(replacer func(int, map[string]interface{}) map[string]interface{}) *Value {
- arr := v.MustMSISlice()
- replaced := make([]map[string]interface{}, len(arr))
- v.EachMSI(func(index int, val map[string]interface{}) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectMSI uses the specified collector function to collect a value
-// for each of the map[string]interface{}s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectMSI(collector func(int, map[string]interface{}) interface{}) *Value {
- arr := v.MustMSISlice()
- collected := make([]interface{}, len(arr))
- v.EachMSI(func(index int, val map[string]interface{}) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- ObjxMap ((Map) and [](Map))
-*/
-
-// ObjxMap gets the value as a (Map), returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) ObjxMap(optionalDefault ...(Map)) Map {
- if s, ok := v.data.((Map)); ok {
- return s
- }
- if s, ok := v.data.(map[string]interface{}); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return New(nil)
-}
-
-// MustObjxMap gets the value as a (Map).
-//
-// Panics if the object is not a (Map).
-func (v *Value) MustObjxMap() Map {
- if s, ok := v.data.(map[string]interface{}); ok {
- return s
- }
- return v.data.((Map))
-}
-
-// ObjxMapSlice gets the value as a [](Map), returns the optionalDefault
-// value or nil if the value is not a [](Map).
-func (v *Value) ObjxMapSlice(optionalDefault ...[](Map)) [](Map) {
- if s, ok := v.data.([]Map); ok {
- return s
- }
-
- if s, ok := v.data.([]map[string]interface{}); ok {
- result := make([]Map, len(s))
- for i := range s {
- result[i] = s[i]
- }
- return result
- }
-
- s, ok := v.data.([]interface{})
- if !ok {
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
- }
-
- result := make([]Map, len(s))
- for i := range s {
- switch s[i].(type) {
- case Map:
- result[i] = s[i].(Map)
- case map[string]interface{}:
- result[i] = New(s[i])
- default:
- return nil
- }
- }
- return result
-}
-
-// MustObjxMapSlice gets the value as a [](Map).
-//
-// Panics if the object is not a [](Map).
-func (v *Value) MustObjxMapSlice() [](Map) {
- if s := v.ObjxMapSlice(); s != nil {
- return s
- }
- return v.data.([](Map))
-}
-
-// IsObjxMap gets whether the object contained is a (Map) or not.
-func (v *Value) IsObjxMap() bool {
- _, ok := v.data.((Map))
- if !ok {
- _, ok = v.data.(map[string]interface{})
- }
- return ok
-}
-
-// IsObjxMapSlice gets whether the object contained is a [](Map) or not.
-func (v *Value) IsObjxMapSlice() bool {
- _, ok := v.data.([](Map))
- if !ok {
- _, ok = v.data.([]map[string]interface{})
- if !ok {
- s, ok := v.data.([]interface{})
- if ok {
- for i := range s {
- switch s[i].(type) {
- case Map:
- case map[string]interface{}:
- default:
- return false
- }
- }
- return true
- }
- }
- }
-
- return ok
-}
-
-// EachObjxMap calls the specified callback for each object
-// in the [](Map).
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachObjxMap(callback func(int, Map) bool) *Value {
- for index, val := range v.MustObjxMapSlice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereObjxMap uses the specified decider function to select items
-// from the [](Map). The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereObjxMap(decider func(int, Map) bool) *Value {
- var selected [](Map)
- v.EachObjxMap(func(index int, val Map) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupObjxMap uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][](Map).
-func (v *Value) GroupObjxMap(grouper func(int, Map) string) *Value {
- groups := make(map[string][](Map))
- v.EachObjxMap(func(index int, val Map) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([](Map), 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceObjxMap uses the specified function to replace each (Map)s
-// by iterating each item. The data in the returned result will be a
-// [](Map) containing the replaced items.
-func (v *Value) ReplaceObjxMap(replacer func(int, Map) Map) *Value {
- arr := v.MustObjxMapSlice()
- replaced := make([](Map), len(arr))
- v.EachObjxMap(func(index int, val Map) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectObjxMap uses the specified collector function to collect a value
-// for each of the (Map)s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectObjxMap(collector func(int, Map) interface{}) *Value {
- arr := v.MustObjxMapSlice()
- collected := make([]interface{}, len(arr))
- v.EachObjxMap(func(index int, val Map) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
diff --git a/vendor/github.com/stretchr/objx/type_specific_codegen.go b/vendor/github.com/stretchr/objx/type_specific_codegen.go
deleted file mode 100644
index 45850456e1..0000000000
--- a/vendor/github.com/stretchr/objx/type_specific_codegen.go
+++ /dev/null
@@ -1,2261 +0,0 @@
-package objx
-
-/*
- Inter (interface{} and []interface{})
-*/
-
-// Inter gets the value as a interface{}, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Inter(optionalDefault ...interface{}) interface{} {
- if s, ok := v.data.(interface{}); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustInter gets the value as a interface{}.
-//
-// Panics if the object is not a interface{}.
-func (v *Value) MustInter() interface{} {
- return v.data.(interface{})
-}
-
-// InterSlice gets the value as a []interface{}, returns the optionalDefault
-// value or nil if the value is not a []interface{}.
-func (v *Value) InterSlice(optionalDefault ...[]interface{}) []interface{} {
- if s, ok := v.data.([]interface{}); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustInterSlice gets the value as a []interface{}.
-//
-// Panics if the object is not a []interface{}.
-func (v *Value) MustInterSlice() []interface{} {
- return v.data.([]interface{})
-}
-
-// IsInter gets whether the object contained is a interface{} or not.
-func (v *Value) IsInter() bool {
- _, ok := v.data.(interface{})
- return ok
-}
-
-// IsInterSlice gets whether the object contained is a []interface{} or not.
-func (v *Value) IsInterSlice() bool {
- _, ok := v.data.([]interface{})
- return ok
-}
-
-// EachInter calls the specified callback for each object
-// in the []interface{}.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachInter(callback func(int, interface{}) bool) *Value {
- for index, val := range v.MustInterSlice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereInter uses the specified decider function to select items
-// from the []interface{}. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereInter(decider func(int, interface{}) bool) *Value {
- var selected []interface{}
- v.EachInter(func(index int, val interface{}) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupInter uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]interface{}.
-func (v *Value) GroupInter(grouper func(int, interface{}) string) *Value {
- groups := make(map[string][]interface{})
- v.EachInter(func(index int, val interface{}) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]interface{}, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceInter uses the specified function to replace each interface{}s
-// by iterating each item. The data in the returned result will be a
-// []interface{} containing the replaced items.
-func (v *Value) ReplaceInter(replacer func(int, interface{}) interface{}) *Value {
- arr := v.MustInterSlice()
- replaced := make([]interface{}, len(arr))
- v.EachInter(func(index int, val interface{}) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectInter uses the specified collector function to collect a value
-// for each of the interface{}s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectInter(collector func(int, interface{}) interface{}) *Value {
- arr := v.MustInterSlice()
- collected := make([]interface{}, len(arr))
- v.EachInter(func(index int, val interface{}) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Bool (bool and []bool)
-*/
-
-// Bool gets the value as a bool, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Bool(optionalDefault ...bool) bool {
- if s, ok := v.data.(bool); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return false
-}
-
-// MustBool gets the value as a bool.
-//
-// Panics if the object is not a bool.
-func (v *Value) MustBool() bool {
- return v.data.(bool)
-}
-
-// BoolSlice gets the value as a []bool, returns the optionalDefault
-// value or nil if the value is not a []bool.
-func (v *Value) BoolSlice(optionalDefault ...[]bool) []bool {
- if s, ok := v.data.([]bool); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustBoolSlice gets the value as a []bool.
-//
-// Panics if the object is not a []bool.
-func (v *Value) MustBoolSlice() []bool {
- return v.data.([]bool)
-}
-
-// IsBool gets whether the object contained is a bool or not.
-func (v *Value) IsBool() bool {
- _, ok := v.data.(bool)
- return ok
-}
-
-// IsBoolSlice gets whether the object contained is a []bool or not.
-func (v *Value) IsBoolSlice() bool {
- _, ok := v.data.([]bool)
- return ok
-}
-
-// EachBool calls the specified callback for each object
-// in the []bool.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachBool(callback func(int, bool) bool) *Value {
- for index, val := range v.MustBoolSlice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereBool uses the specified decider function to select items
-// from the []bool. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereBool(decider func(int, bool) bool) *Value {
- var selected []bool
- v.EachBool(func(index int, val bool) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupBool uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]bool.
-func (v *Value) GroupBool(grouper func(int, bool) string) *Value {
- groups := make(map[string][]bool)
- v.EachBool(func(index int, val bool) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]bool, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceBool uses the specified function to replace each bools
-// by iterating each item. The data in the returned result will be a
-// []bool containing the replaced items.
-func (v *Value) ReplaceBool(replacer func(int, bool) bool) *Value {
- arr := v.MustBoolSlice()
- replaced := make([]bool, len(arr))
- v.EachBool(func(index int, val bool) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectBool uses the specified collector function to collect a value
-// for each of the bools in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectBool(collector func(int, bool) interface{}) *Value {
- arr := v.MustBoolSlice()
- collected := make([]interface{}, len(arr))
- v.EachBool(func(index int, val bool) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Str (string and []string)
-*/
-
-// Str gets the value as a string, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Str(optionalDefault ...string) string {
- if s, ok := v.data.(string); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return ""
-}
-
-// MustStr gets the value as a string.
-//
-// Panics if the object is not a string.
-func (v *Value) MustStr() string {
- return v.data.(string)
-}
-
-// StrSlice gets the value as a []string, returns the optionalDefault
-// value or nil if the value is not a []string.
-func (v *Value) StrSlice(optionalDefault ...[]string) []string {
- if s, ok := v.data.([]string); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustStrSlice gets the value as a []string.
-//
-// Panics if the object is not a []string.
-func (v *Value) MustStrSlice() []string {
- return v.data.([]string)
-}
-
-// IsStr gets whether the object contained is a string or not.
-func (v *Value) IsStr() bool {
- _, ok := v.data.(string)
- return ok
-}
-
-// IsStrSlice gets whether the object contained is a []string or not.
-func (v *Value) IsStrSlice() bool {
- _, ok := v.data.([]string)
- return ok
-}
-
-// EachStr calls the specified callback for each object
-// in the []string.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachStr(callback func(int, string) bool) *Value {
- for index, val := range v.MustStrSlice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereStr uses the specified decider function to select items
-// from the []string. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereStr(decider func(int, string) bool) *Value {
- var selected []string
- v.EachStr(func(index int, val string) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupStr uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]string.
-func (v *Value) GroupStr(grouper func(int, string) string) *Value {
- groups := make(map[string][]string)
- v.EachStr(func(index int, val string) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]string, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceStr uses the specified function to replace each strings
-// by iterating each item. The data in the returned result will be a
-// []string containing the replaced items.
-func (v *Value) ReplaceStr(replacer func(int, string) string) *Value {
- arr := v.MustStrSlice()
- replaced := make([]string, len(arr))
- v.EachStr(func(index int, val string) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectStr uses the specified collector function to collect a value
-// for each of the strings in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectStr(collector func(int, string) interface{}) *Value {
- arr := v.MustStrSlice()
- collected := make([]interface{}, len(arr))
- v.EachStr(func(index int, val string) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Int (int and []int)
-*/
-
-// Int gets the value as a int, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Int(optionalDefault ...int) int {
- if s, ok := v.data.(int); ok {
- return s
- }
- if s, ok := v.data.(float64); ok {
- if float64(int(s)) == s {
- return int(s)
- }
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustInt gets the value as a int.
-//
-// Panics if the object is not a int.
-func (v *Value) MustInt() int {
- if s, ok := v.data.(float64); ok {
- if float64(int(s)) == s {
- return int(s)
- }
- }
- return v.data.(int)
-}
-
-// IntSlice gets the value as a []int, returns the optionalDefault
-// value or nil if the value is not a []int.
-func (v *Value) IntSlice(optionalDefault ...[]int) []int {
- if s, ok := v.data.([]int); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustIntSlice gets the value as a []int.
-//
-// Panics if the object is not a []int.
-func (v *Value) MustIntSlice() []int {
- return v.data.([]int)
-}
-
-// IsInt gets whether the object contained is a int or not.
-func (v *Value) IsInt() bool {
- _, ok := v.data.(int)
- return ok
-}
-
-// IsIntSlice gets whether the object contained is a []int or not.
-func (v *Value) IsIntSlice() bool {
- _, ok := v.data.([]int)
- return ok
-}
-
-// EachInt calls the specified callback for each object
-// in the []int.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachInt(callback func(int, int) bool) *Value {
- for index, val := range v.MustIntSlice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereInt uses the specified decider function to select items
-// from the []int. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereInt(decider func(int, int) bool) *Value {
- var selected []int
- v.EachInt(func(index int, val int) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupInt uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]int.
-func (v *Value) GroupInt(grouper func(int, int) string) *Value {
- groups := make(map[string][]int)
- v.EachInt(func(index int, val int) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]int, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceInt uses the specified function to replace each ints
-// by iterating each item. The data in the returned result will be a
-// []int containing the replaced items.
-func (v *Value) ReplaceInt(replacer func(int, int) int) *Value {
- arr := v.MustIntSlice()
- replaced := make([]int, len(arr))
- v.EachInt(func(index int, val int) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectInt uses the specified collector function to collect a value
-// for each of the ints in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectInt(collector func(int, int) interface{}) *Value {
- arr := v.MustIntSlice()
- collected := make([]interface{}, len(arr))
- v.EachInt(func(index int, val int) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Int8 (int8 and []int8)
-*/
-
-// Int8 gets the value as a int8, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Int8(optionalDefault ...int8) int8 {
- if s, ok := v.data.(int8); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustInt8 gets the value as a int8.
-//
-// Panics if the object is not a int8.
-func (v *Value) MustInt8() int8 {
- return v.data.(int8)
-}
-
-// Int8Slice gets the value as a []int8, returns the optionalDefault
-// value or nil if the value is not a []int8.
-func (v *Value) Int8Slice(optionalDefault ...[]int8) []int8 {
- if s, ok := v.data.([]int8); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustInt8Slice gets the value as a []int8.
-//
-// Panics if the object is not a []int8.
-func (v *Value) MustInt8Slice() []int8 {
- return v.data.([]int8)
-}
-
-// IsInt8 gets whether the object contained is a int8 or not.
-func (v *Value) IsInt8() bool {
- _, ok := v.data.(int8)
- return ok
-}
-
-// IsInt8Slice gets whether the object contained is a []int8 or not.
-func (v *Value) IsInt8Slice() bool {
- _, ok := v.data.([]int8)
- return ok
-}
-
-// EachInt8 calls the specified callback for each object
-// in the []int8.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachInt8(callback func(int, int8) bool) *Value {
- for index, val := range v.MustInt8Slice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereInt8 uses the specified decider function to select items
-// from the []int8. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereInt8(decider func(int, int8) bool) *Value {
- var selected []int8
- v.EachInt8(func(index int, val int8) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupInt8 uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]int8.
-func (v *Value) GroupInt8(grouper func(int, int8) string) *Value {
- groups := make(map[string][]int8)
- v.EachInt8(func(index int, val int8) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]int8, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceInt8 uses the specified function to replace each int8s
-// by iterating each item. The data in the returned result will be a
-// []int8 containing the replaced items.
-func (v *Value) ReplaceInt8(replacer func(int, int8) int8) *Value {
- arr := v.MustInt8Slice()
- replaced := make([]int8, len(arr))
- v.EachInt8(func(index int, val int8) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectInt8 uses the specified collector function to collect a value
-// for each of the int8s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectInt8(collector func(int, int8) interface{}) *Value {
- arr := v.MustInt8Slice()
- collected := make([]interface{}, len(arr))
- v.EachInt8(func(index int, val int8) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Int16 (int16 and []int16)
-*/
-
-// Int16 gets the value as a int16, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Int16(optionalDefault ...int16) int16 {
- if s, ok := v.data.(int16); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustInt16 gets the value as a int16.
-//
-// Panics if the object is not a int16.
-func (v *Value) MustInt16() int16 {
- return v.data.(int16)
-}
-
-// Int16Slice gets the value as a []int16, returns the optionalDefault
-// value or nil if the value is not a []int16.
-func (v *Value) Int16Slice(optionalDefault ...[]int16) []int16 {
- if s, ok := v.data.([]int16); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustInt16Slice gets the value as a []int16.
-//
-// Panics if the object is not a []int16.
-func (v *Value) MustInt16Slice() []int16 {
- return v.data.([]int16)
-}
-
-// IsInt16 gets whether the object contained is a int16 or not.
-func (v *Value) IsInt16() bool {
- _, ok := v.data.(int16)
- return ok
-}
-
-// IsInt16Slice gets whether the object contained is a []int16 or not.
-func (v *Value) IsInt16Slice() bool {
- _, ok := v.data.([]int16)
- return ok
-}
-
-// EachInt16 calls the specified callback for each object
-// in the []int16.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachInt16(callback func(int, int16) bool) *Value {
- for index, val := range v.MustInt16Slice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereInt16 uses the specified decider function to select items
-// from the []int16. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereInt16(decider func(int, int16) bool) *Value {
- var selected []int16
- v.EachInt16(func(index int, val int16) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupInt16 uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]int16.
-func (v *Value) GroupInt16(grouper func(int, int16) string) *Value {
- groups := make(map[string][]int16)
- v.EachInt16(func(index int, val int16) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]int16, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceInt16 uses the specified function to replace each int16s
-// by iterating each item. The data in the returned result will be a
-// []int16 containing the replaced items.
-func (v *Value) ReplaceInt16(replacer func(int, int16) int16) *Value {
- arr := v.MustInt16Slice()
- replaced := make([]int16, len(arr))
- v.EachInt16(func(index int, val int16) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectInt16 uses the specified collector function to collect a value
-// for each of the int16s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectInt16(collector func(int, int16) interface{}) *Value {
- arr := v.MustInt16Slice()
- collected := make([]interface{}, len(arr))
- v.EachInt16(func(index int, val int16) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Int32 (int32 and []int32)
-*/
-
-// Int32 gets the value as a int32, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Int32(optionalDefault ...int32) int32 {
- if s, ok := v.data.(int32); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustInt32 gets the value as a int32.
-//
-// Panics if the object is not a int32.
-func (v *Value) MustInt32() int32 {
- return v.data.(int32)
-}
-
-// Int32Slice gets the value as a []int32, returns the optionalDefault
-// value or nil if the value is not a []int32.
-func (v *Value) Int32Slice(optionalDefault ...[]int32) []int32 {
- if s, ok := v.data.([]int32); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustInt32Slice gets the value as a []int32.
-//
-// Panics if the object is not a []int32.
-func (v *Value) MustInt32Slice() []int32 {
- return v.data.([]int32)
-}
-
-// IsInt32 gets whether the object contained is a int32 or not.
-func (v *Value) IsInt32() bool {
- _, ok := v.data.(int32)
- return ok
-}
-
-// IsInt32Slice gets whether the object contained is a []int32 or not.
-func (v *Value) IsInt32Slice() bool {
- _, ok := v.data.([]int32)
- return ok
-}
-
-// EachInt32 calls the specified callback for each object
-// in the []int32.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachInt32(callback func(int, int32) bool) *Value {
- for index, val := range v.MustInt32Slice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereInt32 uses the specified decider function to select items
-// from the []int32. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereInt32(decider func(int, int32) bool) *Value {
- var selected []int32
- v.EachInt32(func(index int, val int32) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupInt32 uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]int32.
-func (v *Value) GroupInt32(grouper func(int, int32) string) *Value {
- groups := make(map[string][]int32)
- v.EachInt32(func(index int, val int32) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]int32, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceInt32 uses the specified function to replace each int32s
-// by iterating each item. The data in the returned result will be a
-// []int32 containing the replaced items.
-func (v *Value) ReplaceInt32(replacer func(int, int32) int32) *Value {
- arr := v.MustInt32Slice()
- replaced := make([]int32, len(arr))
- v.EachInt32(func(index int, val int32) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectInt32 uses the specified collector function to collect a value
-// for each of the int32s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectInt32(collector func(int, int32) interface{}) *Value {
- arr := v.MustInt32Slice()
- collected := make([]interface{}, len(arr))
- v.EachInt32(func(index int, val int32) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Int64 (int64 and []int64)
-*/
-
-// Int64 gets the value as a int64, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Int64(optionalDefault ...int64) int64 {
- if s, ok := v.data.(int64); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustInt64 gets the value as a int64.
-//
-// Panics if the object is not a int64.
-func (v *Value) MustInt64() int64 {
- return v.data.(int64)
-}
-
-// Int64Slice gets the value as a []int64, returns the optionalDefault
-// value or nil if the value is not a []int64.
-func (v *Value) Int64Slice(optionalDefault ...[]int64) []int64 {
- if s, ok := v.data.([]int64); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustInt64Slice gets the value as a []int64.
-//
-// Panics if the object is not a []int64.
-func (v *Value) MustInt64Slice() []int64 {
- return v.data.([]int64)
-}
-
-// IsInt64 gets whether the object contained is a int64 or not.
-func (v *Value) IsInt64() bool {
- _, ok := v.data.(int64)
- return ok
-}
-
-// IsInt64Slice gets whether the object contained is a []int64 or not.
-func (v *Value) IsInt64Slice() bool {
- _, ok := v.data.([]int64)
- return ok
-}
-
-// EachInt64 calls the specified callback for each object
-// in the []int64.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachInt64(callback func(int, int64) bool) *Value {
- for index, val := range v.MustInt64Slice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereInt64 uses the specified decider function to select items
-// from the []int64. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereInt64(decider func(int, int64) bool) *Value {
- var selected []int64
- v.EachInt64(func(index int, val int64) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupInt64 uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]int64.
-func (v *Value) GroupInt64(grouper func(int, int64) string) *Value {
- groups := make(map[string][]int64)
- v.EachInt64(func(index int, val int64) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]int64, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceInt64 uses the specified function to replace each int64s
-// by iterating each item. The data in the returned result will be a
-// []int64 containing the replaced items.
-func (v *Value) ReplaceInt64(replacer func(int, int64) int64) *Value {
- arr := v.MustInt64Slice()
- replaced := make([]int64, len(arr))
- v.EachInt64(func(index int, val int64) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectInt64 uses the specified collector function to collect a value
-// for each of the int64s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectInt64(collector func(int, int64) interface{}) *Value {
- arr := v.MustInt64Slice()
- collected := make([]interface{}, len(arr))
- v.EachInt64(func(index int, val int64) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Uint (uint and []uint)
-*/
-
-// Uint gets the value as a uint, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Uint(optionalDefault ...uint) uint {
- if s, ok := v.data.(uint); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustUint gets the value as a uint.
-//
-// Panics if the object is not a uint.
-func (v *Value) MustUint() uint {
- return v.data.(uint)
-}
-
-// UintSlice gets the value as a []uint, returns the optionalDefault
-// value or nil if the value is not a []uint.
-func (v *Value) UintSlice(optionalDefault ...[]uint) []uint {
- if s, ok := v.data.([]uint); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustUintSlice gets the value as a []uint.
-//
-// Panics if the object is not a []uint.
-func (v *Value) MustUintSlice() []uint {
- return v.data.([]uint)
-}
-
-// IsUint gets whether the object contained is a uint or not.
-func (v *Value) IsUint() bool {
- _, ok := v.data.(uint)
- return ok
-}
-
-// IsUintSlice gets whether the object contained is a []uint or not.
-func (v *Value) IsUintSlice() bool {
- _, ok := v.data.([]uint)
- return ok
-}
-
-// EachUint calls the specified callback for each object
-// in the []uint.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachUint(callback func(int, uint) bool) *Value {
- for index, val := range v.MustUintSlice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereUint uses the specified decider function to select items
-// from the []uint. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereUint(decider func(int, uint) bool) *Value {
- var selected []uint
- v.EachUint(func(index int, val uint) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupUint uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]uint.
-func (v *Value) GroupUint(grouper func(int, uint) string) *Value {
- groups := make(map[string][]uint)
- v.EachUint(func(index int, val uint) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]uint, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceUint uses the specified function to replace each uints
-// by iterating each item. The data in the returned result will be a
-// []uint containing the replaced items.
-func (v *Value) ReplaceUint(replacer func(int, uint) uint) *Value {
- arr := v.MustUintSlice()
- replaced := make([]uint, len(arr))
- v.EachUint(func(index int, val uint) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectUint uses the specified collector function to collect a value
-// for each of the uints in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectUint(collector func(int, uint) interface{}) *Value {
- arr := v.MustUintSlice()
- collected := make([]interface{}, len(arr))
- v.EachUint(func(index int, val uint) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Uint8 (uint8 and []uint8)
-*/
-
-// Uint8 gets the value as a uint8, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Uint8(optionalDefault ...uint8) uint8 {
- if s, ok := v.data.(uint8); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustUint8 gets the value as a uint8.
-//
-// Panics if the object is not a uint8.
-func (v *Value) MustUint8() uint8 {
- return v.data.(uint8)
-}
-
-// Uint8Slice gets the value as a []uint8, returns the optionalDefault
-// value or nil if the value is not a []uint8.
-func (v *Value) Uint8Slice(optionalDefault ...[]uint8) []uint8 {
- if s, ok := v.data.([]uint8); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustUint8Slice gets the value as a []uint8.
-//
-// Panics if the object is not a []uint8.
-func (v *Value) MustUint8Slice() []uint8 {
- return v.data.([]uint8)
-}
-
-// IsUint8 gets whether the object contained is a uint8 or not.
-func (v *Value) IsUint8() bool {
- _, ok := v.data.(uint8)
- return ok
-}
-
-// IsUint8Slice gets whether the object contained is a []uint8 or not.
-func (v *Value) IsUint8Slice() bool {
- _, ok := v.data.([]uint8)
- return ok
-}
-
-// EachUint8 calls the specified callback for each object
-// in the []uint8.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachUint8(callback func(int, uint8) bool) *Value {
- for index, val := range v.MustUint8Slice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereUint8 uses the specified decider function to select items
-// from the []uint8. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereUint8(decider func(int, uint8) bool) *Value {
- var selected []uint8
- v.EachUint8(func(index int, val uint8) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupUint8 uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]uint8.
-func (v *Value) GroupUint8(grouper func(int, uint8) string) *Value {
- groups := make(map[string][]uint8)
- v.EachUint8(func(index int, val uint8) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]uint8, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceUint8 uses the specified function to replace each uint8s
-// by iterating each item. The data in the returned result will be a
-// []uint8 containing the replaced items.
-func (v *Value) ReplaceUint8(replacer func(int, uint8) uint8) *Value {
- arr := v.MustUint8Slice()
- replaced := make([]uint8, len(arr))
- v.EachUint8(func(index int, val uint8) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectUint8 uses the specified collector function to collect a value
-// for each of the uint8s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectUint8(collector func(int, uint8) interface{}) *Value {
- arr := v.MustUint8Slice()
- collected := make([]interface{}, len(arr))
- v.EachUint8(func(index int, val uint8) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Uint16 (uint16 and []uint16)
-*/
-
-// Uint16 gets the value as a uint16, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Uint16(optionalDefault ...uint16) uint16 {
- if s, ok := v.data.(uint16); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustUint16 gets the value as a uint16.
-//
-// Panics if the object is not a uint16.
-func (v *Value) MustUint16() uint16 {
- return v.data.(uint16)
-}
-
-// Uint16Slice gets the value as a []uint16, returns the optionalDefault
-// value or nil if the value is not a []uint16.
-func (v *Value) Uint16Slice(optionalDefault ...[]uint16) []uint16 {
- if s, ok := v.data.([]uint16); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustUint16Slice gets the value as a []uint16.
-//
-// Panics if the object is not a []uint16.
-func (v *Value) MustUint16Slice() []uint16 {
- return v.data.([]uint16)
-}
-
-// IsUint16 gets whether the object contained is a uint16 or not.
-func (v *Value) IsUint16() bool {
- _, ok := v.data.(uint16)
- return ok
-}
-
-// IsUint16Slice gets whether the object contained is a []uint16 or not.
-func (v *Value) IsUint16Slice() bool {
- _, ok := v.data.([]uint16)
- return ok
-}
-
-// EachUint16 calls the specified callback for each object
-// in the []uint16.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachUint16(callback func(int, uint16) bool) *Value {
- for index, val := range v.MustUint16Slice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereUint16 uses the specified decider function to select items
-// from the []uint16. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereUint16(decider func(int, uint16) bool) *Value {
- var selected []uint16
- v.EachUint16(func(index int, val uint16) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupUint16 uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]uint16.
-func (v *Value) GroupUint16(grouper func(int, uint16) string) *Value {
- groups := make(map[string][]uint16)
- v.EachUint16(func(index int, val uint16) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]uint16, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceUint16 uses the specified function to replace each uint16s
-// by iterating each item. The data in the returned result will be a
-// []uint16 containing the replaced items.
-func (v *Value) ReplaceUint16(replacer func(int, uint16) uint16) *Value {
- arr := v.MustUint16Slice()
- replaced := make([]uint16, len(arr))
- v.EachUint16(func(index int, val uint16) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectUint16 uses the specified collector function to collect a value
-// for each of the uint16s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectUint16(collector func(int, uint16) interface{}) *Value {
- arr := v.MustUint16Slice()
- collected := make([]interface{}, len(arr))
- v.EachUint16(func(index int, val uint16) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Uint32 (uint32 and []uint32)
-*/
-
-// Uint32 gets the value as a uint32, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Uint32(optionalDefault ...uint32) uint32 {
- if s, ok := v.data.(uint32); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustUint32 gets the value as a uint32.
-//
-// Panics if the object is not a uint32.
-func (v *Value) MustUint32() uint32 {
- return v.data.(uint32)
-}
-
-// Uint32Slice gets the value as a []uint32, returns the optionalDefault
-// value or nil if the value is not a []uint32.
-func (v *Value) Uint32Slice(optionalDefault ...[]uint32) []uint32 {
- if s, ok := v.data.([]uint32); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustUint32Slice gets the value as a []uint32.
-//
-// Panics if the object is not a []uint32.
-func (v *Value) MustUint32Slice() []uint32 {
- return v.data.([]uint32)
-}
-
-// IsUint32 gets whether the object contained is a uint32 or not.
-func (v *Value) IsUint32() bool {
- _, ok := v.data.(uint32)
- return ok
-}
-
-// IsUint32Slice gets whether the object contained is a []uint32 or not.
-func (v *Value) IsUint32Slice() bool {
- _, ok := v.data.([]uint32)
- return ok
-}
-
-// EachUint32 calls the specified callback for each object
-// in the []uint32.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachUint32(callback func(int, uint32) bool) *Value {
- for index, val := range v.MustUint32Slice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereUint32 uses the specified decider function to select items
-// from the []uint32. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereUint32(decider func(int, uint32) bool) *Value {
- var selected []uint32
- v.EachUint32(func(index int, val uint32) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupUint32 uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]uint32.
-func (v *Value) GroupUint32(grouper func(int, uint32) string) *Value {
- groups := make(map[string][]uint32)
- v.EachUint32(func(index int, val uint32) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]uint32, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceUint32 uses the specified function to replace each uint32s
-// by iterating each item. The data in the returned result will be a
-// []uint32 containing the replaced items.
-func (v *Value) ReplaceUint32(replacer func(int, uint32) uint32) *Value {
- arr := v.MustUint32Slice()
- replaced := make([]uint32, len(arr))
- v.EachUint32(func(index int, val uint32) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectUint32 uses the specified collector function to collect a value
-// for each of the uint32s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectUint32(collector func(int, uint32) interface{}) *Value {
- arr := v.MustUint32Slice()
- collected := make([]interface{}, len(arr))
- v.EachUint32(func(index int, val uint32) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Uint64 (uint64 and []uint64)
-*/
-
-// Uint64 gets the value as a uint64, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Uint64(optionalDefault ...uint64) uint64 {
- if s, ok := v.data.(uint64); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustUint64 gets the value as a uint64.
-//
-// Panics if the object is not a uint64.
-func (v *Value) MustUint64() uint64 {
- return v.data.(uint64)
-}
-
-// Uint64Slice gets the value as a []uint64, returns the optionalDefault
-// value or nil if the value is not a []uint64.
-func (v *Value) Uint64Slice(optionalDefault ...[]uint64) []uint64 {
- if s, ok := v.data.([]uint64); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustUint64Slice gets the value as a []uint64.
-//
-// Panics if the object is not a []uint64.
-func (v *Value) MustUint64Slice() []uint64 {
- return v.data.([]uint64)
-}
-
-// IsUint64 gets whether the object contained is a uint64 or not.
-func (v *Value) IsUint64() bool {
- _, ok := v.data.(uint64)
- return ok
-}
-
-// IsUint64Slice gets whether the object contained is a []uint64 or not.
-func (v *Value) IsUint64Slice() bool {
- _, ok := v.data.([]uint64)
- return ok
-}
-
-// EachUint64 calls the specified callback for each object
-// in the []uint64.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachUint64(callback func(int, uint64) bool) *Value {
- for index, val := range v.MustUint64Slice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereUint64 uses the specified decider function to select items
-// from the []uint64. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereUint64(decider func(int, uint64) bool) *Value {
- var selected []uint64
- v.EachUint64(func(index int, val uint64) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupUint64 uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]uint64.
-func (v *Value) GroupUint64(grouper func(int, uint64) string) *Value {
- groups := make(map[string][]uint64)
- v.EachUint64(func(index int, val uint64) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]uint64, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceUint64 uses the specified function to replace each uint64s
-// by iterating each item. The data in the returned result will be a
-// []uint64 containing the replaced items.
-func (v *Value) ReplaceUint64(replacer func(int, uint64) uint64) *Value {
- arr := v.MustUint64Slice()
- replaced := make([]uint64, len(arr))
- v.EachUint64(func(index int, val uint64) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectUint64 uses the specified collector function to collect a value
-// for each of the uint64s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectUint64(collector func(int, uint64) interface{}) *Value {
- arr := v.MustUint64Slice()
- collected := make([]interface{}, len(arr))
- v.EachUint64(func(index int, val uint64) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Uintptr (uintptr and []uintptr)
-*/
-
-// Uintptr gets the value as a uintptr, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Uintptr(optionalDefault ...uintptr) uintptr {
- if s, ok := v.data.(uintptr); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustUintptr gets the value as a uintptr.
-//
-// Panics if the object is not a uintptr.
-func (v *Value) MustUintptr() uintptr {
- return v.data.(uintptr)
-}
-
-// UintptrSlice gets the value as a []uintptr, returns the optionalDefault
-// value or nil if the value is not a []uintptr.
-func (v *Value) UintptrSlice(optionalDefault ...[]uintptr) []uintptr {
- if s, ok := v.data.([]uintptr); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustUintptrSlice gets the value as a []uintptr.
-//
-// Panics if the object is not a []uintptr.
-func (v *Value) MustUintptrSlice() []uintptr {
- return v.data.([]uintptr)
-}
-
-// IsUintptr gets whether the object contained is a uintptr or not.
-func (v *Value) IsUintptr() bool {
- _, ok := v.data.(uintptr)
- return ok
-}
-
-// IsUintptrSlice gets whether the object contained is a []uintptr or not.
-func (v *Value) IsUintptrSlice() bool {
- _, ok := v.data.([]uintptr)
- return ok
-}
-
-// EachUintptr calls the specified callback for each object
-// in the []uintptr.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachUintptr(callback func(int, uintptr) bool) *Value {
- for index, val := range v.MustUintptrSlice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereUintptr uses the specified decider function to select items
-// from the []uintptr. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereUintptr(decider func(int, uintptr) bool) *Value {
- var selected []uintptr
- v.EachUintptr(func(index int, val uintptr) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupUintptr uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]uintptr.
-func (v *Value) GroupUintptr(grouper func(int, uintptr) string) *Value {
- groups := make(map[string][]uintptr)
- v.EachUintptr(func(index int, val uintptr) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]uintptr, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceUintptr uses the specified function to replace each uintptrs
-// by iterating each item. The data in the returned result will be a
-// []uintptr containing the replaced items.
-func (v *Value) ReplaceUintptr(replacer func(int, uintptr) uintptr) *Value {
- arr := v.MustUintptrSlice()
- replaced := make([]uintptr, len(arr))
- v.EachUintptr(func(index int, val uintptr) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectUintptr uses the specified collector function to collect a value
-// for each of the uintptrs in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectUintptr(collector func(int, uintptr) interface{}) *Value {
- arr := v.MustUintptrSlice()
- collected := make([]interface{}, len(arr))
- v.EachUintptr(func(index int, val uintptr) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Float32 (float32 and []float32)
-*/
-
-// Float32 gets the value as a float32, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Float32(optionalDefault ...float32) float32 {
- if s, ok := v.data.(float32); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustFloat32 gets the value as a float32.
-//
-// Panics if the object is not a float32.
-func (v *Value) MustFloat32() float32 {
- return v.data.(float32)
-}
-
-// Float32Slice gets the value as a []float32, returns the optionalDefault
-// value or nil if the value is not a []float32.
-func (v *Value) Float32Slice(optionalDefault ...[]float32) []float32 {
- if s, ok := v.data.([]float32); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustFloat32Slice gets the value as a []float32.
-//
-// Panics if the object is not a []float32.
-func (v *Value) MustFloat32Slice() []float32 {
- return v.data.([]float32)
-}
-
-// IsFloat32 gets whether the object contained is a float32 or not.
-func (v *Value) IsFloat32() bool {
- _, ok := v.data.(float32)
- return ok
-}
-
-// IsFloat32Slice gets whether the object contained is a []float32 or not.
-func (v *Value) IsFloat32Slice() bool {
- _, ok := v.data.([]float32)
- return ok
-}
-
-// EachFloat32 calls the specified callback for each object
-// in the []float32.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachFloat32(callback func(int, float32) bool) *Value {
- for index, val := range v.MustFloat32Slice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereFloat32 uses the specified decider function to select items
-// from the []float32. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereFloat32(decider func(int, float32) bool) *Value {
- var selected []float32
- v.EachFloat32(func(index int, val float32) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupFloat32 uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]float32.
-func (v *Value) GroupFloat32(grouper func(int, float32) string) *Value {
- groups := make(map[string][]float32)
- v.EachFloat32(func(index int, val float32) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]float32, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceFloat32 uses the specified function to replace each float32s
-// by iterating each item. The data in the returned result will be a
-// []float32 containing the replaced items.
-func (v *Value) ReplaceFloat32(replacer func(int, float32) float32) *Value {
- arr := v.MustFloat32Slice()
- replaced := make([]float32, len(arr))
- v.EachFloat32(func(index int, val float32) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectFloat32 uses the specified collector function to collect a value
-// for each of the float32s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectFloat32(collector func(int, float32) interface{}) *Value {
- arr := v.MustFloat32Slice()
- collected := make([]interface{}, len(arr))
- v.EachFloat32(func(index int, val float32) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Float64 (float64 and []float64)
-*/
-
-// Float64 gets the value as a float64, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Float64(optionalDefault ...float64) float64 {
- if s, ok := v.data.(float64); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustFloat64 gets the value as a float64.
-//
-// Panics if the object is not a float64.
-func (v *Value) MustFloat64() float64 {
- return v.data.(float64)
-}
-
-// Float64Slice gets the value as a []float64, returns the optionalDefault
-// value or nil if the value is not a []float64.
-func (v *Value) Float64Slice(optionalDefault ...[]float64) []float64 {
- if s, ok := v.data.([]float64); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustFloat64Slice gets the value as a []float64.
-//
-// Panics if the object is not a []float64.
-func (v *Value) MustFloat64Slice() []float64 {
- return v.data.([]float64)
-}
-
-// IsFloat64 gets whether the object contained is a float64 or not.
-func (v *Value) IsFloat64() bool {
- _, ok := v.data.(float64)
- return ok
-}
-
-// IsFloat64Slice gets whether the object contained is a []float64 or not.
-func (v *Value) IsFloat64Slice() bool {
- _, ok := v.data.([]float64)
- return ok
-}
-
-// EachFloat64 calls the specified callback for each object
-// in the []float64.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachFloat64(callback func(int, float64) bool) *Value {
- for index, val := range v.MustFloat64Slice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereFloat64 uses the specified decider function to select items
-// from the []float64. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereFloat64(decider func(int, float64) bool) *Value {
- var selected []float64
- v.EachFloat64(func(index int, val float64) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupFloat64 uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]float64.
-func (v *Value) GroupFloat64(grouper func(int, float64) string) *Value {
- groups := make(map[string][]float64)
- v.EachFloat64(func(index int, val float64) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]float64, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceFloat64 uses the specified function to replace each float64s
-// by iterating each item. The data in the returned result will be a
-// []float64 containing the replaced items.
-func (v *Value) ReplaceFloat64(replacer func(int, float64) float64) *Value {
- arr := v.MustFloat64Slice()
- replaced := make([]float64, len(arr))
- v.EachFloat64(func(index int, val float64) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectFloat64 uses the specified collector function to collect a value
-// for each of the float64s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectFloat64(collector func(int, float64) interface{}) *Value {
- arr := v.MustFloat64Slice()
- collected := make([]interface{}, len(arr))
- v.EachFloat64(func(index int, val float64) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Complex64 (complex64 and []complex64)
-*/
-
-// Complex64 gets the value as a complex64, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Complex64(optionalDefault ...complex64) complex64 {
- if s, ok := v.data.(complex64); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustComplex64 gets the value as a complex64.
-//
-// Panics if the object is not a complex64.
-func (v *Value) MustComplex64() complex64 {
- return v.data.(complex64)
-}
-
-// Complex64Slice gets the value as a []complex64, returns the optionalDefault
-// value or nil if the value is not a []complex64.
-func (v *Value) Complex64Slice(optionalDefault ...[]complex64) []complex64 {
- if s, ok := v.data.([]complex64); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustComplex64Slice gets the value as a []complex64.
-//
-// Panics if the object is not a []complex64.
-func (v *Value) MustComplex64Slice() []complex64 {
- return v.data.([]complex64)
-}
-
-// IsComplex64 gets whether the object contained is a complex64 or not.
-func (v *Value) IsComplex64() bool {
- _, ok := v.data.(complex64)
- return ok
-}
-
-// IsComplex64Slice gets whether the object contained is a []complex64 or not.
-func (v *Value) IsComplex64Slice() bool {
- _, ok := v.data.([]complex64)
- return ok
-}
-
-// EachComplex64 calls the specified callback for each object
-// in the []complex64.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachComplex64(callback func(int, complex64) bool) *Value {
- for index, val := range v.MustComplex64Slice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereComplex64 uses the specified decider function to select items
-// from the []complex64. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereComplex64(decider func(int, complex64) bool) *Value {
- var selected []complex64
- v.EachComplex64(func(index int, val complex64) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupComplex64 uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]complex64.
-func (v *Value) GroupComplex64(grouper func(int, complex64) string) *Value {
- groups := make(map[string][]complex64)
- v.EachComplex64(func(index int, val complex64) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]complex64, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceComplex64 uses the specified function to replace each complex64s
-// by iterating each item. The data in the returned result will be a
-// []complex64 containing the replaced items.
-func (v *Value) ReplaceComplex64(replacer func(int, complex64) complex64) *Value {
- arr := v.MustComplex64Slice()
- replaced := make([]complex64, len(arr))
- v.EachComplex64(func(index int, val complex64) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectComplex64 uses the specified collector function to collect a value
-// for each of the complex64s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectComplex64(collector func(int, complex64) interface{}) *Value {
- arr := v.MustComplex64Slice()
- collected := make([]interface{}, len(arr))
- v.EachComplex64(func(index int, val complex64) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
-
-/*
- Complex128 (complex128 and []complex128)
-*/
-
-// Complex128 gets the value as a complex128, returns the optionalDefault
-// value or a system default object if the value is the wrong type.
-func (v *Value) Complex128(optionalDefault ...complex128) complex128 {
- if s, ok := v.data.(complex128); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return 0
-}
-
-// MustComplex128 gets the value as a complex128.
-//
-// Panics if the object is not a complex128.
-func (v *Value) MustComplex128() complex128 {
- return v.data.(complex128)
-}
-
-// Complex128Slice gets the value as a []complex128, returns the optionalDefault
-// value or nil if the value is not a []complex128.
-func (v *Value) Complex128Slice(optionalDefault ...[]complex128) []complex128 {
- if s, ok := v.data.([]complex128); ok {
- return s
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
- return nil
-}
-
-// MustComplex128Slice gets the value as a []complex128.
-//
-// Panics if the object is not a []complex128.
-func (v *Value) MustComplex128Slice() []complex128 {
- return v.data.([]complex128)
-}
-
-// IsComplex128 gets whether the object contained is a complex128 or not.
-func (v *Value) IsComplex128() bool {
- _, ok := v.data.(complex128)
- return ok
-}
-
-// IsComplex128Slice gets whether the object contained is a []complex128 or not.
-func (v *Value) IsComplex128Slice() bool {
- _, ok := v.data.([]complex128)
- return ok
-}
-
-// EachComplex128 calls the specified callback for each object
-// in the []complex128.
-//
-// Panics if the object is the wrong type.
-func (v *Value) EachComplex128(callback func(int, complex128) bool) *Value {
- for index, val := range v.MustComplex128Slice() {
- carryon := callback(index, val)
- if !carryon {
- break
- }
- }
- return v
-}
-
-// WhereComplex128 uses the specified decider function to select items
-// from the []complex128. The object contained in the result will contain
-// only the selected items.
-func (v *Value) WhereComplex128(decider func(int, complex128) bool) *Value {
- var selected []complex128
- v.EachComplex128(func(index int, val complex128) bool {
- shouldSelect := decider(index, val)
- if !shouldSelect {
- selected = append(selected, val)
- }
- return true
- })
- return &Value{data: selected}
-}
-
-// GroupComplex128 uses the specified grouper function to group the items
-// keyed by the return of the grouper. The object contained in the
-// result will contain a map[string][]complex128.
-func (v *Value) GroupComplex128(grouper func(int, complex128) string) *Value {
- groups := make(map[string][]complex128)
- v.EachComplex128(func(index int, val complex128) bool {
- group := grouper(index, val)
- if _, ok := groups[group]; !ok {
- groups[group] = make([]complex128, 0)
- }
- groups[group] = append(groups[group], val)
- return true
- })
- return &Value{data: groups}
-}
-
-// ReplaceComplex128 uses the specified function to replace each complex128s
-// by iterating each item. The data in the returned result will be a
-// []complex128 containing the replaced items.
-func (v *Value) ReplaceComplex128(replacer func(int, complex128) complex128) *Value {
- arr := v.MustComplex128Slice()
- replaced := make([]complex128, len(arr))
- v.EachComplex128(func(index int, val complex128) bool {
- replaced[index] = replacer(index, val)
- return true
- })
- return &Value{data: replaced}
-}
-
-// CollectComplex128 uses the specified collector function to collect a value
-// for each of the complex128s in the slice. The data returned will be a
-// []interface{}.
-func (v *Value) CollectComplex128(collector func(int, complex128) interface{}) *Value {
- arr := v.MustComplex128Slice()
- collected := make([]interface{}, len(arr))
- v.EachComplex128(func(index int, val complex128) bool {
- collected[index] = collector(index, val)
- return true
- })
- return &Value{data: collected}
-}
diff --git a/vendor/github.com/stretchr/objx/value.go b/vendor/github.com/stretchr/objx/value.go
deleted file mode 100644
index 4e5f9b77e6..0000000000
--- a/vendor/github.com/stretchr/objx/value.go
+++ /dev/null
@@ -1,159 +0,0 @@
-package objx
-
-import (
- "fmt"
- "strconv"
-)
-
-// Value provides methods for extracting interface{} data in various
-// types.
-type Value struct {
- // data contains the raw data being managed by this Value
- data interface{}
-}
-
-// Data returns the raw data contained by this Value
-func (v *Value) Data() interface{} {
- return v.data
-}
-
-// String returns the value always as a string
-func (v *Value) String() string {
- switch {
- case v.IsNil():
- return ""
- case v.IsStr():
- return v.Str()
- case v.IsBool():
- return strconv.FormatBool(v.Bool())
- case v.IsFloat32():
- return strconv.FormatFloat(float64(v.Float32()), 'f', -1, 32)
- case v.IsFloat64():
- return strconv.FormatFloat(v.Float64(), 'f', -1, 64)
- case v.IsInt():
- return strconv.FormatInt(int64(v.Int()), 10)
- case v.IsInt8():
- return strconv.FormatInt(int64(v.Int8()), 10)
- case v.IsInt16():
- return strconv.FormatInt(int64(v.Int16()), 10)
- case v.IsInt32():
- return strconv.FormatInt(int64(v.Int32()), 10)
- case v.IsInt64():
- return strconv.FormatInt(v.Int64(), 10)
- case v.IsUint():
- return strconv.FormatUint(uint64(v.Uint()), 10)
- case v.IsUint8():
- return strconv.FormatUint(uint64(v.Uint8()), 10)
- case v.IsUint16():
- return strconv.FormatUint(uint64(v.Uint16()), 10)
- case v.IsUint32():
- return strconv.FormatUint(uint64(v.Uint32()), 10)
- case v.IsUint64():
- return strconv.FormatUint(v.Uint64(), 10)
- }
- return fmt.Sprintf("%#v", v.Data())
-}
-
-// StringSlice returns the value always as a []string
-func (v *Value) StringSlice(optionalDefault ...[]string) []string {
- switch {
- case v.IsStrSlice():
- return v.MustStrSlice()
- case v.IsBoolSlice():
- slice := v.MustBoolSlice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatBool(iv)
- }
- return vals
- case v.IsFloat32Slice():
- slice := v.MustFloat32Slice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatFloat(float64(iv), 'f', -1, 32)
- }
- return vals
- case v.IsFloat64Slice():
- slice := v.MustFloat64Slice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatFloat(iv, 'f', -1, 64)
- }
- return vals
- case v.IsIntSlice():
- slice := v.MustIntSlice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatInt(int64(iv), 10)
- }
- return vals
- case v.IsInt8Slice():
- slice := v.MustInt8Slice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatInt(int64(iv), 10)
- }
- return vals
- case v.IsInt16Slice():
- slice := v.MustInt16Slice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatInt(int64(iv), 10)
- }
- return vals
- case v.IsInt32Slice():
- slice := v.MustInt32Slice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatInt(int64(iv), 10)
- }
- return vals
- case v.IsInt64Slice():
- slice := v.MustInt64Slice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatInt(iv, 10)
- }
- return vals
- case v.IsUintSlice():
- slice := v.MustUintSlice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatUint(uint64(iv), 10)
- }
- return vals
- case v.IsUint8Slice():
- slice := v.MustUint8Slice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatUint(uint64(iv), 10)
- }
- return vals
- case v.IsUint16Slice():
- slice := v.MustUint16Slice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatUint(uint64(iv), 10)
- }
- return vals
- case v.IsUint32Slice():
- slice := v.MustUint32Slice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatUint(uint64(iv), 10)
- }
- return vals
- case v.IsUint64Slice():
- slice := v.MustUint64Slice()
- vals := make([]string, len(slice))
- for i, iv := range slice {
- vals[i] = strconv.FormatUint(iv, 10)
- }
- return vals
- }
- if len(optionalDefault) == 1 {
- return optionalDefault[0]
- }
-
- return []string{}
-}
diff --git a/vendor/github.com/stretchr/testify/mock/doc.go b/vendor/github.com/stretchr/testify/mock/doc.go
deleted file mode 100644
index d6b3c844cc..0000000000
--- a/vendor/github.com/stretchr/testify/mock/doc.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Package mock provides a system by which it is possible to mock your objects
-// and verify calls are happening as expected.
-//
-// # Example Usage
-//
-// The mock package provides an object, Mock, that tracks activity on another object. It is usually
-// embedded into a test object as shown below:
-//
-// type MyTestObject struct {
-// // add a Mock object instance
-// mock.Mock
-//
-// // other fields go here as normal
-// }
-//
-// When implementing the methods of an interface, you wire your functions up
-// to call the Mock.Called(args...) method, and return the appropriate values.
-//
-// For example, to mock a method that saves the name and age of a person and returns
-// the year of their birth or an error, you might write this:
-//
-// func (o *MyTestObject) SavePersonDetails(firstname, lastname string, age int) (int, error) {
-// args := o.Called(firstname, lastname, age)
-// return args.Int(0), args.Error(1)
-// }
-//
-// The Int, Error and Bool methods are examples of strongly typed getters that take the argument
-// index position. Given this argument list:
-//
-// (12, true, "Something")
-//
-// You could read them out strongly typed like this:
-//
-// args.Int(0)
-// args.Bool(1)
-// args.String(2)
-//
-// For objects of your own type, use the generic Arguments.Get(index) method and make a type assertion:
-//
-// return args.Get(0).(*MyObject), args.Get(1).(*AnotherObjectOfMine)
-//
-// This may cause a panic if the object you are getting is nil (the type assertion will fail), in those
-// cases you should check for nil first.
-package mock
diff --git a/vendor/github.com/stretchr/testify/mock/mock.go b/vendor/github.com/stretchr/testify/mock/mock.go
deleted file mode 100644
index efc89deff3..0000000000
--- a/vendor/github.com/stretchr/testify/mock/mock.go
+++ /dev/null
@@ -1,1298 +0,0 @@
-package mock
-
-import (
- "errors"
- "fmt"
- "path"
- "reflect"
- "regexp"
- "runtime"
- "strings"
- "sync"
- "time"
-
- "github.com/davecgh/go-spew/spew"
- "github.com/pmezard/go-difflib/difflib"
- "github.com/stretchr/objx"
-
- "github.com/stretchr/testify/assert"
-)
-
-// regex for GCCGO functions
-var gccgoRE = regexp.MustCompile(`\.pN\d+_`)
-
-// TestingT is an interface wrapper around *testing.T
-type TestingT interface {
- Logf(format string, args ...interface{})
- Errorf(format string, args ...interface{})
- FailNow()
-}
-
-/*
- Call
-*/
-
-// Call represents a method call and is used for setting expectations,
-// as well as recording activity.
-type Call struct {
- Parent *Mock
-
- // The name of the method that was or will be called.
- Method string
-
- // Holds the arguments of the method.
- Arguments Arguments
-
- // Holds the arguments that should be returned when
- // this method is called.
- ReturnArguments Arguments
-
- // Holds the caller info for the On() call
- callerInfo []string
-
- // The number of times to return the return arguments when setting
- // expectations. 0 means to always return the value.
- Repeatability int
-
- // Amount of times this call has been called
- totalCalls int
-
- // Call to this method can be optional
- optional bool
-
- // Holds a channel that will be used to block the Return until it either
- // receives a message or is closed. nil means it returns immediately.
- WaitFor <-chan time.Time
-
- waitTime time.Duration
-
- // Holds a handler used to manipulate arguments content that are passed by
- // reference. It's useful when mocking methods such as unmarshalers or
- // decoders.
- RunFn func(Arguments)
-
- // PanicMsg holds msg to be used to mock panic on the function call
- // if the PanicMsg is set to a non nil string the function call will panic
- // irrespective of other settings
- PanicMsg *string
-
- // Calls which must be satisfied before this call can be
- requires []*Call
-}
-
-func newCall(parent *Mock, methodName string, callerInfo []string, methodArguments Arguments, returnArguments Arguments) *Call {
- return &Call{
- Parent: parent,
- Method: methodName,
- Arguments: methodArguments,
- ReturnArguments: returnArguments,
- callerInfo: callerInfo,
- Repeatability: 0,
- WaitFor: nil,
- RunFn: nil,
- PanicMsg: nil,
- }
-}
-
-func (c *Call) lock() {
- c.Parent.mutex.Lock()
-}
-
-func (c *Call) unlock() {
- c.Parent.mutex.Unlock()
-}
-
-// Return specifies the return arguments for the expectation.
-//
-// Mock.On("DoSomething").Return(errors.New("failed"))
-func (c *Call) Return(returnArguments ...interface{}) *Call {
- c.lock()
- defer c.unlock()
-
- c.ReturnArguments = returnArguments
-
- return c
-}
-
-// Panic specifies if the function call should fail and the panic message
-//
-// Mock.On("DoSomething").Panic("test panic")
-func (c *Call) Panic(msg string) *Call {
- c.lock()
- defer c.unlock()
-
- c.PanicMsg = &msg
-
- return c
-}
-
-// Once indicates that the mock should only return the value once.
-//
-// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Once()
-func (c *Call) Once() *Call {
- return c.Times(1)
-}
-
-// Twice indicates that the mock should only return the value twice.
-//
-// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Twice()
-func (c *Call) Twice() *Call {
- return c.Times(2)
-}
-
-// Times indicates that the mock should only return the indicated number
-// of times.
-//
-// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Times(5)
-func (c *Call) Times(i int) *Call {
- c.lock()
- defer c.unlock()
- c.Repeatability = i
- return c
-}
-
-// WaitUntil sets the channel that will block the mock's return until its closed
-// or a message is received.
-//
-// Mock.On("MyMethod", arg1, arg2).WaitUntil(time.After(time.Second))
-func (c *Call) WaitUntil(w <-chan time.Time) *Call {
- c.lock()
- defer c.unlock()
- c.WaitFor = w
- return c
-}
-
-// After sets how long to block until the call returns
-//
-// Mock.On("MyMethod", arg1, arg2).After(time.Second)
-func (c *Call) After(d time.Duration) *Call {
- c.lock()
- defer c.unlock()
- c.waitTime = d
- return c
-}
-
-// Run sets a handler to be called before returning. It can be used when
-// mocking a method (such as an unmarshaler) that takes a pointer to a struct and
-// sets properties in such struct
-//
-// Mock.On("Unmarshal", AnythingOfType("*map[string]interface{}")).Return().Run(func(args Arguments) {
-// arg := args.Get(0).(*map[string]interface{})
-// arg["foo"] = "bar"
-// })
-func (c *Call) Run(fn func(args Arguments)) *Call {
- c.lock()
- defer c.unlock()
- c.RunFn = fn
- return c
-}
-
-// Maybe allows the method call to be optional. Not calling an optional method
-// will not cause an error while asserting expectations
-func (c *Call) Maybe() *Call {
- c.lock()
- defer c.unlock()
- c.optional = true
- return c
-}
-
-// On chains a new expectation description onto the mocked interface. This
-// allows syntax like.
-//
-// Mock.
-// On("MyMethod", 1).Return(nil).
-// On("MyOtherMethod", 'a', 'b', 'c').Return(errors.New("Some Error"))
-//
-//go:noinline
-func (c *Call) On(methodName string, arguments ...interface{}) *Call {
- return c.Parent.On(methodName, arguments...)
-}
-
-// Unset removes all mock handlers that satisfy the call instance arguments from being
-// called. Only supported on call instances with static input arguments.
-//
-// For example, the only handler remaining after the following would be "MyMethod(2, 2)":
-//
-// Mock.
-// On("MyMethod", 2, 2).Return(0).
-// On("MyMethod", 3, 3).Return(0).
-// On("MyMethod", Anything, Anything).Return(0)
-// Mock.On("MyMethod", 3, 3).Unset()
-func (c *Call) Unset() *Call {
- var unlockOnce sync.Once
-
- for _, arg := range c.Arguments {
- if v := reflect.ValueOf(arg); v.Kind() == reflect.Func {
- panic(fmt.Sprintf("cannot use Func in expectations. Use mock.AnythingOfType(\"%T\")", arg))
- }
- }
-
- c.lock()
- defer unlockOnce.Do(c.unlock)
-
- foundMatchingCall := false
-
- // in-place filter slice for calls to be removed - iterate from 0'th to last skipping unnecessary ones
- var index int // write index
- for _, call := range c.Parent.ExpectedCalls {
- if call.Method == c.Method {
- _, diffCount := call.Arguments.Diff(c.Arguments)
- if diffCount == 0 {
- foundMatchingCall = true
- // Remove from ExpectedCalls - just skip it
- continue
- }
- }
- c.Parent.ExpectedCalls[index] = call
- index++
- }
- // trim slice up to last copied index
- c.Parent.ExpectedCalls = c.Parent.ExpectedCalls[:index]
-
- if !foundMatchingCall {
- unlockOnce.Do(c.unlock)
- c.Parent.fail("\n\nmock: Could not find expected call\n-----------------------------\n\n%s\n\n",
- callString(c.Method, c.Arguments, true),
- )
- }
-
- return c
-}
-
-// NotBefore indicates that the mock should only be called after the referenced
-// calls have been called as expected. The referenced calls may be from the
-// same mock instance and/or other mock instances.
-//
-// Mock.On("Do").Return(nil).NotBefore(
-// Mock.On("Init").Return(nil)
-// )
-func (c *Call) NotBefore(calls ...*Call) *Call {
- c.lock()
- defer c.unlock()
-
- for _, call := range calls {
- if call.Parent == nil {
- panic("not before calls must be created with Mock.On()")
- }
- }
-
- c.requires = append(c.requires, calls...)
- return c
-}
-
-// InOrder defines the order in which the calls should be made
-//
-// For example:
-//
-// InOrder(
-// Mock.On("init").Return(nil),
-// Mock.On("Do").Return(nil),
-// )
-func InOrder(calls ...*Call) {
- for i := 1; i < len(calls); i++ {
- calls[i].NotBefore(calls[i-1])
- }
-}
-
-// Mock is the workhorse used to track activity on another object.
-// For an example of its usage, refer to the "Example Usage" section at the top
-// of this document.
-type Mock struct {
- // Represents the calls that are expected of
- // an object.
- ExpectedCalls []*Call
-
- // Holds the calls that were made to this mocked object.
- Calls []Call
-
- // test is An optional variable that holds the test struct, to be used when an
- // invalid mock call was made.
- test TestingT
-
- // TestData holds any data that might be useful for testing. Testify ignores
- // this data completely allowing you to do whatever you like with it.
- testData objx.Map
-
- mutex sync.Mutex
-}
-
-// String provides a %v format string for Mock.
-// Note: this is used implicitly by Arguments.Diff if a Mock is passed.
-// It exists because go's default %v formatting traverses the struct
-// without acquiring the mutex, which is detected by go test -race.
-func (m *Mock) String() string {
- return fmt.Sprintf("%[1]T<%[1]p>", m)
-}
-
-// TestData holds any data that might be useful for testing. Testify ignores
-// this data completely allowing you to do whatever you like with it.
-func (m *Mock) TestData() objx.Map {
- if m.testData == nil {
- m.testData = make(objx.Map)
- }
-
- return m.testData
-}
-
-/*
- Setting expectations
-*/
-
-// Test sets the [TestingT] on which errors will be reported, otherwise errors
-// will cause a panic.
-// Test should not be called on an object that is going to be used in a
-// goroutine other than the one running the test function.
-func (m *Mock) Test(t TestingT) {
- m.mutex.Lock()
- defer m.mutex.Unlock()
- m.test = t
-}
-
-// fail fails the current test with the given formatted format and args.
-// In case that a test was defined, it uses the test APIs for failing a test,
-// otherwise it uses panic.
-func (m *Mock) fail(format string, args ...interface{}) {
- m.mutex.Lock()
- defer m.mutex.Unlock()
-
- if m.test == nil {
- panic(fmt.Sprintf(format, args...))
- }
- m.test.Errorf(format, args...)
- m.test.FailNow()
-}
-
-// On starts a description of an expectation of the specified method
-// being called.
-//
-// Mock.On("MyMethod", arg1, arg2)
-func (m *Mock) On(methodName string, arguments ...interface{}) *Call {
- for _, arg := range arguments {
- if v := reflect.ValueOf(arg); v.Kind() == reflect.Func {
- panic(fmt.Sprintf("cannot use Func in expectations. Use mock.AnythingOfType(\"%T\")", arg))
- }
- }
-
- m.mutex.Lock()
- defer m.mutex.Unlock()
-
- c := newCall(m, methodName, assert.CallerInfo(), arguments, make([]interface{}, 0))
- m.ExpectedCalls = append(m.ExpectedCalls, c)
- return c
-}
-
-// /*
-// Recording and responding to activity
-// */
-
-func (m *Mock) findExpectedCall(method string, arguments ...interface{}) (int, *Call) {
- var expectedCall *Call
-
- for i, call := range m.ExpectedCalls {
- if call.Method == method {
- _, diffCount := call.Arguments.Diff(arguments)
- if diffCount == 0 {
- expectedCall = call
- if call.Repeatability > -1 {
- return i, call
- }
- }
- }
- }
-
- return -1, expectedCall
-}
-
-type matchCandidate struct {
- call *Call
- mismatch string
- diffCount int
-}
-
-func (c matchCandidate) isBetterMatchThan(other matchCandidate) bool {
- if c.call == nil {
- return false
- }
- if other.call == nil {
- return true
- }
-
- if c.diffCount > other.diffCount {
- return false
- }
- if c.diffCount < other.diffCount {
- return true
- }
-
- if c.call.Repeatability > 0 && other.call.Repeatability <= 0 {
- return true
- }
- return false
-}
-
-func (m *Mock) findClosestCall(method string, arguments ...interface{}) (*Call, string) {
- var bestMatch matchCandidate
-
- for _, call := range m.expectedCalls() {
- if call.Method == method {
-
- errInfo, tempDiffCount := call.Arguments.Diff(arguments)
- tempCandidate := matchCandidate{
- call: call,
- mismatch: errInfo,
- diffCount: tempDiffCount,
- }
- if tempCandidate.isBetterMatchThan(bestMatch) {
- bestMatch = tempCandidate
- }
- }
- }
-
- return bestMatch.call, bestMatch.mismatch
-}
-
-func callString(method string, arguments Arguments, includeArgumentValues bool) string {
- var argValsString string
- if includeArgumentValues {
- var argVals []string
- for argIndex, arg := range arguments {
- if _, ok := arg.(*FunctionalOptionsArgument); ok {
- argVals = append(argVals, fmt.Sprintf("%d: %s", argIndex, arg))
- continue
- }
- argVals = append(argVals, fmt.Sprintf("%d: %#v", argIndex, arg))
- }
- argValsString = fmt.Sprintf("\n\t\t%s", strings.Join(argVals, "\n\t\t"))
- }
-
- return fmt.Sprintf("%s(%s)%s", method, arguments.String(), argValsString)
-}
-
-// Called tells the mock object that a method has been called, and gets an array
-// of arguments to return. Panics if the call is unexpected (i.e. not preceded by
-// appropriate .On .Return() calls)
-// If Call.WaitFor is set, blocks until the channel is closed or receives a message.
-func (m *Mock) Called(arguments ...interface{}) Arguments {
- // get the calling function's name
- pc, _, _, ok := runtime.Caller(1)
- if !ok {
- panic("Couldn't get the caller information")
- }
- functionPath := runtime.FuncForPC(pc).Name()
- // Next four lines are required to use GCCGO function naming conventions.
- // For Ex: github_com_docker_libkv_store_mock.WatchTree.pN39_github_com_docker_libkv_store_mock.Mock
- // uses interface information unlike golang github.com/docker/libkv/store/mock.(*Mock).WatchTree
- // With GCCGO we need to remove interface information starting from pN.
- if gccgoRE.MatchString(functionPath) {
- functionPath = gccgoRE.Split(functionPath, -1)[0]
- }
- parts := strings.Split(functionPath, ".")
- functionName := parts[len(parts)-1]
- return m.MethodCalled(functionName, arguments...)
-}
-
-// MethodCalled tells the mock object that the given method has been called, and gets
-// an array of arguments to return. Panics if the call is unexpected (i.e. not preceded
-// by appropriate .On .Return() calls)
-// If Call.WaitFor is set, blocks until the channel is closed or receives a message.
-func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Arguments {
- m.mutex.Lock()
- // TODO: could combine expected and closes in single loop
- found, call := m.findExpectedCall(methodName, arguments...)
-
- if found < 0 {
- // expected call found, but it has already been called with repeatable times
- if call != nil {
- m.mutex.Unlock()
- m.fail("\nassert: mock: The method has been called over %d times.\n\tEither do one more Mock.On(%#v).Return(...), or remove extra call.\n\tThis call was unexpected:\n\t\t%s\n\tat: %s", call.totalCalls, methodName, callString(methodName, arguments, true), assert.CallerInfo())
- }
- // we have to fail here - because we don't know what to do
- // as the return arguments. This is because:
- //
- // a) this is a totally unexpected call to this method,
- // b) the arguments are not what was expected, or
- // c) the developer has forgotten to add an accompanying On...Return pair.
- closestCall, mismatch := m.findClosestCall(methodName, arguments...)
- m.mutex.Unlock()
-
- if closestCall != nil {
- m.fail("\n\nmock: Unexpected Method Call\n-----------------------------\n\n%s\n\nThe closest call I have is: \n\n%s\n\n%s\nDiff: %s\nat: %s\n",
- callString(methodName, arguments, true),
- callString(methodName, closestCall.Arguments, true),
- diffArguments(closestCall.Arguments, arguments),
- strings.TrimSpace(mismatch),
- assert.CallerInfo(),
- )
- } else {
- m.fail("\nassert: mock: I don't know what to return because the method call was unexpected.\n\tEither do Mock.On(%#v).Return(...) first, or remove the %s() call.\n\tThis method was unexpected:\n\t\t%s\n\tat: %s", methodName, methodName, callString(methodName, arguments, true), assert.CallerInfo())
- }
- }
-
- for _, requirement := range call.requires {
- if satisfied, _ := requirement.Parent.checkExpectation(requirement); !satisfied {
- m.mutex.Unlock()
- m.fail("mock: Unexpected Method Call\n-----------------------------\n\n%s\n\nMust not be called before%s:\n\n%s",
- callString(call.Method, call.Arguments, true),
- func() (s string) {
- if requirement.totalCalls > 0 {
- s = " another call of"
- }
- if call.Parent != requirement.Parent {
- s += " method from another mock instance"
- }
- return
- }(),
- callString(requirement.Method, requirement.Arguments, true),
- )
- }
- }
-
- if call.Repeatability == 1 {
- call.Repeatability = -1
- } else if call.Repeatability > 1 {
- call.Repeatability--
- }
- call.totalCalls++
-
- // add the call
- m.Calls = append(m.Calls, *newCall(m, methodName, assert.CallerInfo(), arguments, call.ReturnArguments))
- m.mutex.Unlock()
-
- // block if specified
- if call.WaitFor != nil {
- <-call.WaitFor
- } else {
- time.Sleep(call.waitTime)
- }
-
- m.mutex.Lock()
- panicMsg := call.PanicMsg
- m.mutex.Unlock()
- if panicMsg != nil {
- panic(*panicMsg)
- }
-
- m.mutex.Lock()
- runFn := call.RunFn
- m.mutex.Unlock()
-
- if runFn != nil {
- runFn(arguments)
- }
-
- m.mutex.Lock()
- returnArgs := call.ReturnArguments
- m.mutex.Unlock()
-
- return returnArgs
-}
-
-/*
- Assertions
-*/
-
-type assertExpectationiser interface {
- AssertExpectations(TestingT) bool
-}
-
-// AssertExpectationsForObjects asserts that everything specified with On and Return
-// of the specified objects was in fact called as expected.
-//
-// Calls may have occurred in any order.
-func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- for _, obj := range testObjects {
- if m, ok := obj.(*Mock); ok {
- t.Logf("Deprecated mock.AssertExpectationsForObjects(myMock.Mock) use mock.AssertExpectationsForObjects(myMock)")
- obj = m
- }
- m := obj.(assertExpectationiser)
- if !m.AssertExpectations(t) {
- t.Logf("Expectations didn't match for Mock: %+v", reflect.TypeOf(m))
- return false
- }
- }
- return true
-}
-
-// AssertExpectations asserts that everything specified with On and Return was
-// in fact called as expected. Calls may have occurred in any order.
-func (m *Mock) AssertExpectations(t TestingT) bool {
- if s, ok := t.(interface{ Skipped() bool }); ok && s.Skipped() {
- return true
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- m.mutex.Lock()
- defer m.mutex.Unlock()
- var failedExpectations int
-
- // iterate through each expectation
- expectedCalls := m.expectedCalls()
- for _, expectedCall := range expectedCalls {
- satisfied, reason := m.checkExpectation(expectedCall)
- if !satisfied {
- failedExpectations++
- t.Logf(reason)
- }
- }
-
- if failedExpectations != 0 {
- t.Errorf("FAIL: %d out of %d expectation(s) were met.\n\tThe code you are testing needs to make %d more call(s).\n\tat: %s", len(expectedCalls)-failedExpectations, len(expectedCalls), failedExpectations, assert.CallerInfo())
- }
-
- return failedExpectations == 0
-}
-
-func (m *Mock) checkExpectation(call *Call) (bool, string) {
- if !call.optional && !m.methodWasCalled(call.Method, call.Arguments) && call.totalCalls == 0 {
- return false, fmt.Sprintf("FAIL:\t%s(%s)\n\t\tat: %s", call.Method, call.Arguments.String(), call.callerInfo)
- }
- if call.Repeatability > 0 {
- return false, fmt.Sprintf("FAIL:\t%s(%s)\n\t\tat: %s", call.Method, call.Arguments.String(), call.callerInfo)
- }
- return true, fmt.Sprintf("PASS:\t%s(%s)", call.Method, call.Arguments.String())
-}
-
-// AssertNumberOfCalls asserts that the method was called expectedCalls times.
-func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- m.mutex.Lock()
- defer m.mutex.Unlock()
- var actualCalls int
- for _, call := range m.calls() {
- if call.Method == methodName {
- actualCalls++
- }
- }
- return assert.Equal(t, expectedCalls, actualCalls, fmt.Sprintf("Expected number of calls (%d) of method %s does not match the actual number of calls (%d).", expectedCalls, methodName, actualCalls))
-}
-
-// AssertCalled asserts that the method was called.
-// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method.
-func (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- m.mutex.Lock()
- defer m.mutex.Unlock()
- if !m.methodWasCalled(methodName, arguments) {
- var calledWithArgs []string
- for _, call := range m.calls() {
- calledWithArgs = append(calledWithArgs, fmt.Sprintf("%v", call.Arguments))
- }
- if len(calledWithArgs) == 0 {
- return assert.Fail(t, "Should have called with given arguments",
- fmt.Sprintf("Expected %q to have been called with:\n%v\nbut no actual calls happened", methodName, arguments))
- }
- return assert.Fail(t, "Should have called with given arguments",
- fmt.Sprintf("Expected %q to have been called with:\n%v\nbut actual calls were:\n %v", methodName, arguments, strings.Join(calledWithArgs, "\n")))
- }
- return true
-}
-
-// AssertNotCalled asserts that the method was not called.
-// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method.
-func (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- m.mutex.Lock()
- defer m.mutex.Unlock()
- if m.methodWasCalled(methodName, arguments) {
- return assert.Fail(t, "Should not have called with given arguments",
- fmt.Sprintf("Expected %q to not have been called with:\n%v\nbut actually it was.", methodName, arguments))
- }
- return true
-}
-
-// IsMethodCallable checking that the method can be called
-// If the method was called more than `Repeatability` return false
-func (m *Mock) IsMethodCallable(t TestingT, methodName string, arguments ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- m.mutex.Lock()
- defer m.mutex.Unlock()
-
- for _, v := range m.ExpectedCalls {
- if v.Method != methodName {
- continue
- }
- if len(arguments) != len(v.Arguments) {
- continue
- }
- if v.Repeatability < v.totalCalls {
- continue
- }
- if isArgsEqual(v.Arguments, arguments) {
- return true
- }
- }
- return false
-}
-
-// isArgsEqual compares arguments
-func isArgsEqual(expected Arguments, args []interface{}) bool {
- if len(expected) != len(args) {
- return false
- }
- for i, v := range args {
- if !reflect.DeepEqual(expected[i], v) {
- return false
- }
- }
- return true
-}
-
-func (m *Mock) methodWasCalled(methodName string, expected []interface{}) bool {
- for _, call := range m.calls() {
- if call.Method == methodName {
-
- _, differences := Arguments(expected).Diff(call.Arguments)
-
- if differences == 0 {
- // found the expected call
- return true
- }
-
- }
- }
- // we didn't find the expected call
- return false
-}
-
-func (m *Mock) expectedCalls() []*Call {
- return append([]*Call{}, m.ExpectedCalls...)
-}
-
-func (m *Mock) calls() []Call {
- return append([]Call{}, m.Calls...)
-}
-
-/*
- Arguments
-*/
-
-// Arguments holds an array of method arguments or return values.
-type Arguments []interface{}
-
-const (
- // Anything is used in Diff and Assert when the argument being tested
- // shouldn't be taken into consideration.
- Anything = "mock.Anything"
-)
-
-// AnythingOfTypeArgument contains the type of an argument
-// for use when type checking. Used in [Arguments.Diff] and [Arguments.Assert].
-//
-// Deprecated: this is an implementation detail that must not be used. Use the [AnythingOfType] constructor instead, example:
-//
-// m.On("Do", mock.AnythingOfType("string"))
-//
-// All explicit type declarations can be replaced with interface{} as is expected by [Mock.On], example:
-//
-// func anyString interface{} {
-// return mock.AnythingOfType("string")
-// }
-type AnythingOfTypeArgument = anythingOfTypeArgument
-
-// anythingOfTypeArgument is a string that contains the type of an argument
-// for use when type checking. Used in Diff and Assert.
-type anythingOfTypeArgument string
-
-// AnythingOfType returns a special value containing the
-// name of the type to check for. The type name will be matched against the type name returned by [reflect.Type.String].
-//
-// Used in Diff and Assert.
-//
-// For example:
-//
-// args.Assert(t, AnythingOfType("string"), AnythingOfType("int"))
-func AnythingOfType(t string) AnythingOfTypeArgument {
- return anythingOfTypeArgument(t)
-}
-
-// IsTypeArgument is a struct that contains the type of an argument
-// for use when type checking. This is an alternative to [AnythingOfType].
-// Used in [Arguments.Diff] and [Arguments.Assert].
-type IsTypeArgument struct {
- t reflect.Type
-}
-
-// IsType returns an IsTypeArgument object containing the type to check for.
-// You can provide a zero-value of the type to check. This is an
-// alternative to [AnythingOfType]. Used in [Arguments.Diff] and [Arguments.Assert].
-//
-// For example:
-//
-// args.Assert(t, IsType(""), IsType(0))
-func IsType(t interface{}) *IsTypeArgument {
- return &IsTypeArgument{t: reflect.TypeOf(t)}
-}
-
-// FunctionalOptionsArgument contains a list of functional options arguments
-// expected for use when matching a list of arguments.
-type FunctionalOptionsArgument struct {
- values []interface{}
-}
-
-// String returns the string representation of FunctionalOptionsArgument
-func (f *FunctionalOptionsArgument) String() string {
- var name string
- if len(f.values) > 0 {
- name = "[]" + reflect.TypeOf(f.values[0]).String()
- }
-
- return strings.Replace(fmt.Sprintf("%#v", f.values), "[]interface {}", name, 1)
-}
-
-// FunctionalOptions returns an [FunctionalOptionsArgument] object containing
-// the expected functional-options to check for.
-//
-// For example:
-//
-// args.Assert(t, FunctionalOptions(foo.Opt1("strValue"), foo.Opt2(613)))
-func FunctionalOptions(values ...interface{}) *FunctionalOptionsArgument {
- return &FunctionalOptionsArgument{
- values: values,
- }
-}
-
-// argumentMatcher performs custom argument matching, returning whether or
-// not the argument is matched by the expectation fixture function.
-type argumentMatcher struct {
- // fn is a function which accepts one argument, and returns a bool.
- fn reflect.Value
-}
-
-func (f argumentMatcher) Matches(argument interface{}) bool {
- expectType := f.fn.Type().In(0)
- expectTypeNilSupported := false
- switch expectType.Kind() {
- case reflect.Interface, reflect.Chan, reflect.Func, reflect.Map, reflect.Slice, reflect.Ptr:
- expectTypeNilSupported = true
- }
-
- argType := reflect.TypeOf(argument)
- var arg reflect.Value
- if argType == nil {
- arg = reflect.New(expectType).Elem()
- } else {
- arg = reflect.ValueOf(argument)
- }
-
- if argType == nil && !expectTypeNilSupported {
- panic(errors.New("attempting to call matcher with nil for non-nil expected type"))
- }
- if argType == nil || argType.AssignableTo(expectType) {
- result := f.fn.Call([]reflect.Value{arg})
- return result[0].Bool()
- }
- return false
-}
-
-func (f argumentMatcher) String() string {
- return fmt.Sprintf("func(%s) bool", f.fn.Type().In(0).String())
-}
-
-// MatchedBy can be used to match a mock call based on only certain properties
-// from a complex struct or some calculation. It takes a function that will be
-// evaluated with the called argument and will return true when there's a match
-// and false otherwise.
-//
-// Example:
-//
-// m.On("Do", MatchedBy(func(req *http.Request) bool { return req.Host == "example.com" }))
-//
-// fn must be a function accepting a single argument (of the expected type)
-// which returns a bool. If fn doesn't match the required signature,
-// MatchedBy() panics.
-func MatchedBy(fn interface{}) argumentMatcher {
- fnType := reflect.TypeOf(fn)
-
- if fnType.Kind() != reflect.Func {
- panic(fmt.Sprintf("assert: arguments: %s is not a func", fn))
- }
- if fnType.NumIn() != 1 {
- panic(fmt.Sprintf("assert: arguments: %s does not take exactly one argument", fn))
- }
- if fnType.NumOut() != 1 || fnType.Out(0).Kind() != reflect.Bool {
- panic(fmt.Sprintf("assert: arguments: %s does not return a bool", fn))
- }
-
- return argumentMatcher{fn: reflect.ValueOf(fn)}
-}
-
-// Get Returns the argument at the specified index.
-func (args Arguments) Get(index int) interface{} {
- if index+1 > len(args) {
- panic(fmt.Sprintf("assert: arguments: Cannot call Get(%d) because there are %d argument(s).", index, len(args)))
- }
- return args[index]
-}
-
-// Is gets whether the objects match the arguments specified.
-func (args Arguments) Is(objects ...interface{}) bool {
- for i, obj := range args {
- if obj != objects[i] {
- return false
- }
- }
- return true
-}
-
-// Diff gets a string describing the differences between the arguments
-// and the specified objects.
-//
-// Returns the diff string and number of differences found.
-func (args Arguments) Diff(objects []interface{}) (string, int) {
- // TODO: could return string as error and nil for No difference
-
- output := "\n"
- var differences int
-
- maxArgCount := len(args)
- if len(objects) > maxArgCount {
- maxArgCount = len(objects)
- }
-
- for i := 0; i < maxArgCount; i++ {
- var actual, expected interface{}
- var actualFmt, expectedFmt string
-
- if len(objects) <= i {
- actual = "(Missing)"
- actualFmt = "(Missing)"
- } else {
- actual = objects[i]
- actualFmt = fmt.Sprintf("(%[1]T=%[1]v)", actual)
- }
-
- if len(args) <= i {
- expected = "(Missing)"
- expectedFmt = "(Missing)"
- } else {
- expected = args[i]
- expectedFmt = fmt.Sprintf("(%[1]T=%[1]v)", expected)
- }
-
- if matcher, ok := expected.(argumentMatcher); ok {
- var matches bool
- func() {
- defer func() {
- if r := recover(); r != nil {
- actualFmt = fmt.Sprintf("panic in argument matcher: %v", r)
- }
- }()
- matches = matcher.Matches(actual)
- }()
- if matches {
- output = fmt.Sprintf("%s\t%d: PASS: %s matched by %s\n", output, i, actualFmt, matcher)
- } else {
- differences++
- output = fmt.Sprintf("%s\t%d: FAIL: %s not matched by %s\n", output, i, actualFmt, matcher)
- }
- } else {
- switch expected := expected.(type) {
- case anythingOfTypeArgument:
- // type checking
- if reflect.TypeOf(actual).Name() != string(expected) && reflect.TypeOf(actual).String() != string(expected) {
- // not match
- differences++
- output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, expected, reflect.TypeOf(actual).Name(), actualFmt)
- }
- case *IsTypeArgument:
- actualT := reflect.TypeOf(actual)
- if actualT != expected.t {
- differences++
- output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, expected.t.Name(), actualT.Name(), actualFmt)
- }
- case *FunctionalOptionsArgument:
- var name string
- if len(expected.values) > 0 {
- name = "[]" + reflect.TypeOf(expected.values[0]).String()
- }
-
- const tName = "[]interface{}"
- if name != reflect.TypeOf(actual).String() && len(expected.values) != 0 {
- differences++
- output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, tName, reflect.TypeOf(actual).Name(), actualFmt)
- } else {
- if ef, af := assertOpts(expected.values, actual); ef == "" && af == "" {
- // match
- output = fmt.Sprintf("%s\t%d: PASS: %s == %s\n", output, i, tName, tName)
- } else {
- // not match
- differences++
- output = fmt.Sprintf("%s\t%d: FAIL: %s != %s\n", output, i, af, ef)
- }
- }
-
- default:
- if assert.ObjectsAreEqual(expected, Anything) || assert.ObjectsAreEqual(actual, Anything) || assert.ObjectsAreEqual(actual, expected) {
- // match
- output = fmt.Sprintf("%s\t%d: PASS: %s == %s\n", output, i, actualFmt, expectedFmt)
- } else {
- // not match
- differences++
- output = fmt.Sprintf("%s\t%d: FAIL: %s != %s\n", output, i, actualFmt, expectedFmt)
- }
- }
- }
-
- }
-
- if differences == 0 {
- return "No differences.", differences
- }
-
- return output, differences
-}
-
-// Assert compares the arguments with the specified objects and fails if
-// they do not exactly match.
-func (args Arguments) Assert(t TestingT, objects ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- // get the differences
- diff, diffCount := args.Diff(objects)
-
- if diffCount == 0 {
- return true
- }
-
- // there are differences... report them...
- t.Logf(diff)
- t.Errorf("%sArguments do not match.", assert.CallerInfo())
-
- return false
-}
-
-// String gets the argument at the specified index. Panics if there is no argument, or
-// if the argument is of the wrong type.
-//
-// If no index is provided, String() returns a complete string representation
-// of the arguments.
-func (args Arguments) String(indexOrNil ...int) string {
- if len(indexOrNil) == 0 {
- // normal String() method - return a string representation of the args
- var argsStr []string
- for _, arg := range args {
- argsStr = append(argsStr, fmt.Sprintf("%T", arg)) // handles nil nicely
- }
- return strings.Join(argsStr, ",")
- } else if len(indexOrNil) == 1 {
- // Index has been specified - get the argument at that index
- index := indexOrNil[0]
- var s string
- var ok bool
- if s, ok = args.Get(index).(string); !ok {
- panic(fmt.Sprintf("assert: arguments: String(%d) failed because object wasn't correct type: %s", index, args.Get(index)))
- }
- return s
- }
-
- panic(fmt.Sprintf("assert: arguments: Wrong number of arguments passed to String. Must be 0 or 1, not %d", len(indexOrNil)))
-}
-
-// Int gets the argument at the specified index. Panics if there is no argument, or
-// if the argument is of the wrong type.
-func (args Arguments) Int(index int) int {
- var s int
- var ok bool
- if s, ok = args.Get(index).(int); !ok {
- panic(fmt.Sprintf("assert: arguments: Int(%d) failed because object wasn't correct type: %v", index, args.Get(index)))
- }
- return s
-}
-
-// Error gets the argument at the specified index. Panics if there is no argument, or
-// if the argument is of the wrong type.
-func (args Arguments) Error(index int) error {
- obj := args.Get(index)
- var s error
- var ok bool
- if obj == nil {
- return nil
- }
- if s, ok = obj.(error); !ok {
- panic(fmt.Sprintf("assert: arguments: Error(%d) failed because object wasn't correct type: %v", index, obj))
- }
- return s
-}
-
-// Bool gets the argument at the specified index. Panics if there is no argument, or
-// if the argument is of the wrong type.
-func (args Arguments) Bool(index int) bool {
- var s bool
- var ok bool
- if s, ok = args.Get(index).(bool); !ok {
- panic(fmt.Sprintf("assert: arguments: Bool(%d) failed because object wasn't correct type: %v", index, args.Get(index)))
- }
- return s
-}
-
-func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) {
- t := reflect.TypeOf(v)
- k := t.Kind()
-
- if k == reflect.Ptr {
- t = t.Elem()
- k = t.Kind()
- }
- return t, k
-}
-
-func diffArguments(expected Arguments, actual Arguments) string {
- if len(expected) != len(actual) {
- return fmt.Sprintf("Provided %v arguments, mocked for %v arguments", len(expected), len(actual))
- }
-
- for x := range expected {
- if diffString := diff(expected[x], actual[x]); diffString != "" {
- return fmt.Sprintf("Difference found in argument %v:\n\n%s", x, diffString)
- }
- }
-
- return ""
-}
-
-// diff returns a diff of both values as long as both are of the same type and
-// are a struct, map, slice or array. Otherwise it returns an empty string.
-func diff(expected interface{}, actual interface{}) string {
- if expected == nil || actual == nil {
- return ""
- }
-
- et, ek := typeAndKind(expected)
- at, _ := typeAndKind(actual)
-
- if et != at {
- return ""
- }
-
- if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array {
- return ""
- }
-
- e := spewConfig.Sdump(expected)
- a := spewConfig.Sdump(actual)
-
- diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{
- A: difflib.SplitLines(e),
- B: difflib.SplitLines(a),
- FromFile: "Expected",
- FromDate: "",
- ToFile: "Actual",
- ToDate: "",
- Context: 1,
- })
-
- return diff
-}
-
-var spewConfig = spew.ConfigState{
- Indent: " ",
- DisablePointerAddresses: true,
- DisableCapacities: true,
- SortKeys: true,
-}
-
-type tHelper interface {
- Helper()
-}
-
-func assertOpts(expected, actual interface{}) (expectedFmt, actualFmt string) {
- expectedOpts := reflect.ValueOf(expected)
- actualOpts := reflect.ValueOf(actual)
-
- var expectedFuncs []*runtime.Func
- var expectedNames []string
- for i := 0; i < expectedOpts.Len(); i++ {
- f := runtimeFunc(expectedOpts.Index(i).Interface())
- expectedFuncs = append(expectedFuncs, f)
- expectedNames = append(expectedNames, funcName(f))
- }
- var actualFuncs []*runtime.Func
- var actualNames []string
- for i := 0; i < actualOpts.Len(); i++ {
- f := runtimeFunc(actualOpts.Index(i).Interface())
- actualFuncs = append(actualFuncs, f)
- actualNames = append(actualNames, funcName(f))
- }
-
- if expectedOpts.Len() != actualOpts.Len() {
- expectedFmt = fmt.Sprintf("%v", expectedNames)
- actualFmt = fmt.Sprintf("%v", actualNames)
- return
- }
-
- for i := 0; i < expectedOpts.Len(); i++ {
- if !isFuncSame(expectedFuncs[i], actualFuncs[i]) {
- expectedFmt = expectedNames[i]
- actualFmt = actualNames[i]
- return
- }
-
- expectedOpt := expectedOpts.Index(i).Interface()
- actualOpt := actualOpts.Index(i).Interface()
-
- ot := reflect.TypeOf(expectedOpt)
- var expectedValues []reflect.Value
- var actualValues []reflect.Value
- if ot.NumIn() == 0 {
- return
- }
-
- for i := 0; i < ot.NumIn(); i++ {
- vt := ot.In(i).Elem()
- expectedValues = append(expectedValues, reflect.New(vt))
- actualValues = append(actualValues, reflect.New(vt))
- }
-
- reflect.ValueOf(expectedOpt).Call(expectedValues)
- reflect.ValueOf(actualOpt).Call(actualValues)
-
- for i := 0; i < ot.NumIn(); i++ {
- if expectedArg, actualArg := expectedValues[i].Interface(), actualValues[i].Interface(); !assert.ObjectsAreEqual(expectedArg, actualArg) {
- expectedFmt = fmt.Sprintf("%s(%T) -> %#v", expectedNames[i], expectedArg, expectedArg)
- actualFmt = fmt.Sprintf("%s(%T) -> %#v", expectedNames[i], actualArg, actualArg)
- return
- }
- }
- }
-
- return "", ""
-}
-
-func runtimeFunc(opt interface{}) *runtime.Func {
- return runtime.FuncForPC(reflect.ValueOf(opt).Pointer())
-}
-
-func funcName(f *runtime.Func) string {
- name := f.Name()
- trimmed := strings.TrimSuffix(path.Base(name), path.Ext(name))
- splitted := strings.Split(trimmed, ".")
-
- if len(splitted) == 0 {
- return trimmed
- }
-
- return splitted[len(splitted)-1]
-}
-
-func isFuncSame(f1, f2 *runtime.Func) bool {
- f1File, f1Loc := f1.FileLine(f1.Entry())
- f2File, f2Loc := f2.FileLine(f2.Entry())
-
- return f1File == f2File && f1Loc == f2Loc
-}
diff --git a/vendor/k8s.io/client-go/discovery/fake/discovery.go b/vendor/k8s.io/client-go/discovery/fake/discovery.go
deleted file mode 100644
index e5d9e7f800..0000000000
--- a/vendor/k8s.io/client-go/discovery/fake/discovery.go
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fake
-
-import (
- "fmt"
- "net/http"
-
- openapi_v2 "github.com/google/gnostic-models/openapiv2"
-
- "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/version"
- "k8s.io/client-go/discovery"
- "k8s.io/client-go/openapi"
- kubeversion "k8s.io/client-go/pkg/version"
- restclient "k8s.io/client-go/rest"
- "k8s.io/client-go/testing"
-)
-
-// FakeDiscovery implements discovery.DiscoveryInterface and sometimes calls testing.Fake.Invoke with an action,
-// but doesn't respect the return value if any. There is a way to fake static values like ServerVersion by using the Faked... fields on the struct.
-type FakeDiscovery struct {
- *testing.Fake
- FakedServerVersion *version.Info
-}
-
-// ServerResourcesForGroupVersion returns the supported resources for a group
-// and version.
-func (c *FakeDiscovery) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) {
- action := testing.ActionImpl{
- Verb: "get",
- Resource: schema.GroupVersionResource{Resource: "resource"},
- }
- if _, err := c.Invokes(action, nil); err != nil {
- return nil, err
- }
- for _, resourceList := range c.Resources {
- if resourceList.GroupVersion == groupVersion {
- return resourceList, nil
- }
- }
- return nil, &errors.StatusError{
- ErrStatus: metav1.Status{
- Status: metav1.StatusFailure,
- Code: http.StatusNotFound,
- Reason: metav1.StatusReasonNotFound,
- Message: fmt.Sprintf("the server could not find the requested resource, GroupVersion %q not found", groupVersion),
- }}
-}
-
-// ServerGroupsAndResources returns the supported groups and resources for all groups and versions.
-func (c *FakeDiscovery) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) {
- sgs, err := c.ServerGroups()
- if err != nil {
- return nil, nil, err
- }
- resultGroups := []*metav1.APIGroup{}
- for i := range sgs.Groups {
- resultGroups = append(resultGroups, &sgs.Groups[i])
- }
-
- action := testing.ActionImpl{
- Verb: "get",
- Resource: schema.GroupVersionResource{Resource: "resource"},
- }
- if _, err = c.Invokes(action, nil); err != nil {
- return resultGroups, c.Resources, err
- }
- return resultGroups, c.Resources, nil
-}
-
-// ServerPreferredResources returns the supported resources with the version
-// preferred by the server.
-func (c *FakeDiscovery) ServerPreferredResources() ([]*metav1.APIResourceList, error) {
- return nil, nil
-}
-
-// ServerPreferredNamespacedResources returns the supported namespaced resources
-// with the version preferred by the server.
-func (c *FakeDiscovery) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error) {
- return nil, nil
-}
-
-// ServerGroups returns the supported groups, with information like supported
-// versions and the preferred version.
-func (c *FakeDiscovery) ServerGroups() (*metav1.APIGroupList, error) {
- action := testing.ActionImpl{
- Verb: "get",
- Resource: schema.GroupVersionResource{Resource: "group"},
- }
- if _, err := c.Invokes(action, nil); err != nil {
- return nil, err
- }
-
- groups := map[string]*metav1.APIGroup{}
-
- for _, res := range c.Resources {
- gv, err := schema.ParseGroupVersion(res.GroupVersion)
- if err != nil {
- return nil, err
- }
- group := groups[gv.Group]
- if group == nil {
- group = &metav1.APIGroup{
- Name: gv.Group,
- PreferredVersion: metav1.GroupVersionForDiscovery{
- GroupVersion: res.GroupVersion,
- Version: gv.Version,
- },
- }
- groups[gv.Group] = group
- }
-
- group.Versions = append(group.Versions, metav1.GroupVersionForDiscovery{
- GroupVersion: res.GroupVersion,
- Version: gv.Version,
- })
- }
-
- list := &metav1.APIGroupList{}
- for _, apiGroup := range groups {
- list.Groups = append(list.Groups, *apiGroup)
- }
-
- return list, nil
-
-}
-
-// ServerVersion retrieves and parses the server's version.
-func (c *FakeDiscovery) ServerVersion() (*version.Info, error) {
- action := testing.ActionImpl{}
- action.Verb = "get"
- action.Resource = schema.GroupVersionResource{Resource: "version"}
- _, err := c.Invokes(action, nil)
- if err != nil {
- return nil, err
- }
-
- if c.FakedServerVersion != nil {
- return c.FakedServerVersion, nil
- }
-
- versionInfo := kubeversion.Get()
- return &versionInfo, nil
-}
-
-// OpenAPISchema retrieves and parses the swagger API schema the server supports.
-func (c *FakeDiscovery) OpenAPISchema() (*openapi_v2.Document, error) {
- return &openapi_v2.Document{}, nil
-}
-
-func (c *FakeDiscovery) OpenAPIV3() openapi.Client {
- panic("unimplemented")
-}
-
-// RESTClient returns a RESTClient that is used to communicate with API server
-// by this client implementation.
-func (c *FakeDiscovery) RESTClient() restclient.Interface {
- return nil
-}
-
-func (c *FakeDiscovery) WithLegacy() discovery.DiscoveryInterface {
- panic("unimplemented")
-}
diff --git a/vendor/k8s.io/client-go/dynamic/dynamicinformer/informer.go b/vendor/k8s.io/client-go/dynamic/dynamicinformer/informer.go
deleted file mode 100644
index b933c13798..0000000000
--- a/vendor/k8s.io/client-go/dynamic/dynamicinformer/informer.go
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package dynamicinformer
-
-import (
- "context"
- "sync"
- "time"
-
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/watch"
- "k8s.io/client-go/dynamic"
- "k8s.io/client-go/dynamic/dynamiclister"
- "k8s.io/client-go/informers"
- "k8s.io/client-go/tools/cache"
-)
-
-// NewDynamicSharedInformerFactory constructs a new instance of dynamicSharedInformerFactory for all namespaces.
-func NewDynamicSharedInformerFactory(client dynamic.Interface, defaultResync time.Duration) DynamicSharedInformerFactory {
- return NewFilteredDynamicSharedInformerFactory(client, defaultResync, metav1.NamespaceAll, nil)
-}
-
-// NewFilteredDynamicSharedInformerFactory constructs a new instance of dynamicSharedInformerFactory.
-// Listers obtained via this factory will be subject to the same filters as specified here.
-func NewFilteredDynamicSharedInformerFactory(client dynamic.Interface, defaultResync time.Duration, namespace string, tweakListOptions TweakListOptionsFunc) DynamicSharedInformerFactory {
- return &dynamicSharedInformerFactory{
- client: client,
- defaultResync: defaultResync,
- namespace: namespace,
- informers: map[schema.GroupVersionResource]informers.GenericInformer{},
- startedInformers: make(map[schema.GroupVersionResource]bool),
- tweakListOptions: tweakListOptions,
- }
-}
-
-type dynamicSharedInformerFactory struct {
- client dynamic.Interface
- defaultResync time.Duration
- namespace string
-
- lock sync.Mutex
- informers map[schema.GroupVersionResource]informers.GenericInformer
- // startedInformers is used for tracking which informers have been started.
- // This allows Start() to be called multiple times safely.
- startedInformers map[schema.GroupVersionResource]bool
- tweakListOptions TweakListOptionsFunc
-
- // wg tracks how many goroutines were started.
- wg sync.WaitGroup
- // shuttingDown is true when Shutdown has been called. It may still be running
- // because it needs to wait for goroutines.
- shuttingDown bool
-}
-
-var _ DynamicSharedInformerFactory = &dynamicSharedInformerFactory{}
-
-func (f *dynamicSharedInformerFactory) ForResource(gvr schema.GroupVersionResource) informers.GenericInformer {
- f.lock.Lock()
- defer f.lock.Unlock()
-
- key := gvr
- informer, exists := f.informers[key]
- if exists {
- return informer
- }
-
- informer = NewFilteredDynamicInformer(f.client, gvr, f.namespace, f.defaultResync, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
- f.informers[key] = informer
-
- return informer
-}
-
-// Start initializes all requested informers.
-func (f *dynamicSharedInformerFactory) Start(stopCh <-chan struct{}) {
- f.lock.Lock()
- defer f.lock.Unlock()
-
- if f.shuttingDown {
- return
- }
-
- for informerType, informer := range f.informers {
- if !f.startedInformers[informerType] {
- f.wg.Add(1)
- // We need a new variable in each loop iteration,
- // otherwise the goroutine would use the loop variable
- // and that keeps changing.
- informer := informer.Informer()
- go func() {
- defer f.wg.Done()
- informer.Run(stopCh)
- }()
- f.startedInformers[informerType] = true
- }
- }
-}
-
-// WaitForCacheSync waits for all started informers' cache were synced.
-func (f *dynamicSharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[schema.GroupVersionResource]bool {
- informers := func() map[schema.GroupVersionResource]cache.SharedIndexInformer {
- f.lock.Lock()
- defer f.lock.Unlock()
-
- informers := map[schema.GroupVersionResource]cache.SharedIndexInformer{}
- for informerType, informer := range f.informers {
- if f.startedInformers[informerType] {
- informers[informerType] = informer.Informer()
- }
- }
- return informers
- }()
-
- res := map[schema.GroupVersionResource]bool{}
- for informType, informer := range informers {
- res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced)
- }
- return res
-}
-
-func (f *dynamicSharedInformerFactory) Shutdown() {
- // Will return immediately if there is nothing to wait for.
- defer f.wg.Wait()
-
- f.lock.Lock()
- defer f.lock.Unlock()
- f.shuttingDown = true
-}
-
-// NewFilteredDynamicInformer constructs a new informer for a dynamic type.
-func NewFilteredDynamicInformer(client dynamic.Interface, gvr schema.GroupVersionResource, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions TweakListOptionsFunc) informers.GenericInformer {
- return &dynamicInformer{
- gvr: gvr,
- informer: cache.NewSharedIndexInformerWithOptions(
- cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{
- ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Resource(gvr).Namespace(namespace).List(context.Background(), options)
- },
- WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Resource(gvr).Namespace(namespace).Watch(context.Background(), options)
- },
- ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Resource(gvr).Namespace(namespace).List(ctx, options)
- },
- WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Resource(gvr).Namespace(namespace).Watch(ctx, options)
- },
- }, client),
- &unstructured.Unstructured{},
- cache.SharedIndexInformerOptions{
- ResyncPeriod: resyncPeriod,
- Indexers: indexers,
- ObjectDescription: gvr.String(),
- },
- ),
- }
-}
-
-type dynamicInformer struct {
- informer cache.SharedIndexInformer
- gvr schema.GroupVersionResource
-}
-
-var _ informers.GenericInformer = &dynamicInformer{}
-
-func (d *dynamicInformer) Informer() cache.SharedIndexInformer {
- return d.informer
-}
-
-func (d *dynamicInformer) Lister() cache.GenericLister {
- return dynamiclister.NewRuntimeObjectShim(dynamiclister.New(d.informer.GetIndexer(), d.gvr))
-}
diff --git a/vendor/k8s.io/client-go/dynamic/dynamicinformer/interface.go b/vendor/k8s.io/client-go/dynamic/dynamicinformer/interface.go
deleted file mode 100644
index 0419ef4f86..0000000000
--- a/vendor/k8s.io/client-go/dynamic/dynamicinformer/interface.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package dynamicinformer
-
-import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/informers"
-)
-
-// DynamicSharedInformerFactory provides access to a shared informer and lister for dynamic client
-type DynamicSharedInformerFactory interface {
- // Start initializes all requested informers. They are handled in goroutines
- // which run until the stop channel gets closed.
- Start(stopCh <-chan struct{})
-
- // ForResource gives generic access to a shared informer of the matching type.
- ForResource(gvr schema.GroupVersionResource) informers.GenericInformer
-
- // WaitForCacheSync blocks until all started informers' caches were synced
- // or the stop channel gets closed.
- WaitForCacheSync(stopCh <-chan struct{}) map[schema.GroupVersionResource]bool
-
- // Shutdown marks a factory as shutting down. At that point no new
- // informers can be started anymore and Start will return without
- // doing anything.
- //
- // In addition, Shutdown blocks until all goroutines have terminated. For that
- // to happen, the close channel(s) that they were started with must be closed,
- // either before Shutdown gets called or while it is waiting.
- //
- // Shutdown may be called multiple times, even concurrently. All such calls will
- // block until all goroutines have terminated.
- Shutdown()
-}
-
-// TweakListOptionsFunc defines the signature of a helper function
-// that wants to provide more listing options to API
-type TweakListOptionsFunc func(*metav1.ListOptions)
diff --git a/vendor/k8s.io/client-go/dynamic/dynamiclister/interface.go b/vendor/k8s.io/client-go/dynamic/dynamiclister/interface.go
deleted file mode 100644
index c39cbee925..0000000000
--- a/vendor/k8s.io/client-go/dynamic/dynamiclister/interface.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package dynamiclister
-
-import (
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/labels"
-)
-
-// Lister helps list resources.
-type Lister interface {
- // List lists all resources in the indexer.
- List(selector labels.Selector) (ret []*unstructured.Unstructured, err error)
- // Get retrieves a resource from the indexer with the given name
- Get(name string) (*unstructured.Unstructured, error)
- // Namespace returns an object that can list and get resources in a given namespace.
- Namespace(namespace string) NamespaceLister
-}
-
-// NamespaceLister helps list and get resources.
-type NamespaceLister interface {
- // List lists all resources in the indexer for a given namespace.
- List(selector labels.Selector) (ret []*unstructured.Unstructured, err error)
- // Get retrieves a resource from the indexer for a given namespace and name.
- Get(name string) (*unstructured.Unstructured, error)
-}
diff --git a/vendor/k8s.io/client-go/dynamic/dynamiclister/lister.go b/vendor/k8s.io/client-go/dynamic/dynamiclister/lister.go
deleted file mode 100644
index a50fc471e9..0000000000
--- a/vendor/k8s.io/client-go/dynamic/dynamiclister/lister.go
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package dynamiclister
-
-import (
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/tools/cache"
-)
-
-var _ Lister = &dynamicLister{}
-var _ NamespaceLister = &dynamicNamespaceLister{}
-
-// dynamicLister implements the Lister interface.
-type dynamicLister struct {
- indexer cache.Indexer
- gvr schema.GroupVersionResource
-}
-
-// New returns a new Lister.
-func New(indexer cache.Indexer, gvr schema.GroupVersionResource) Lister {
- return &dynamicLister{indexer: indexer, gvr: gvr}
-}
-
-// List lists all resources in the indexer.
-func (l *dynamicLister) List(selector labels.Selector) (ret []*unstructured.Unstructured, err error) {
- err = cache.ListAll(l.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*unstructured.Unstructured))
- })
- return ret, err
-}
-
-// Get retrieves a resource from the indexer with the given name
-func (l *dynamicLister) Get(name string) (*unstructured.Unstructured, error) {
- obj, exists, err := l.indexer.GetByKey(name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(l.gvr.GroupResource(), name)
- }
- return obj.(*unstructured.Unstructured), nil
-}
-
-// Namespace returns an object that can list and get resources from a given namespace.
-func (l *dynamicLister) Namespace(namespace string) NamespaceLister {
- return &dynamicNamespaceLister{indexer: l.indexer, namespace: namespace, gvr: l.gvr}
-}
-
-// dynamicNamespaceLister implements the NamespaceLister interface.
-type dynamicNamespaceLister struct {
- indexer cache.Indexer
- namespace string
- gvr schema.GroupVersionResource
-}
-
-// List lists all resources in the indexer for a given namespace.
-func (l *dynamicNamespaceLister) List(selector labels.Selector) (ret []*unstructured.Unstructured, err error) {
- err = cache.ListAllByNamespace(l.indexer, l.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*unstructured.Unstructured))
- })
- return ret, err
-}
-
-// Get retrieves a resource from the indexer for a given namespace and name.
-func (l *dynamicNamespaceLister) Get(name string) (*unstructured.Unstructured, error) {
- obj, exists, err := l.indexer.GetByKey(l.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(l.gvr.GroupResource(), name)
- }
- return obj.(*unstructured.Unstructured), nil
-}
diff --git a/vendor/k8s.io/client-go/dynamic/dynamiclister/shim.go b/vendor/k8s.io/client-go/dynamic/dynamiclister/shim.go
deleted file mode 100644
index 92a5f54af9..0000000000
--- a/vendor/k8s.io/client-go/dynamic/dynamiclister/shim.go
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package dynamiclister
-
-import (
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/client-go/tools/cache"
-)
-
-var _ cache.GenericLister = &dynamicListerShim{}
-var _ cache.GenericNamespaceLister = &dynamicNamespaceListerShim{}
-
-// dynamicListerShim implements the cache.GenericLister interface.
-type dynamicListerShim struct {
- lister Lister
-}
-
-// NewRuntimeObjectShim returns a new shim for Lister.
-// It wraps Lister so that it implements cache.GenericLister interface
-func NewRuntimeObjectShim(lister Lister) cache.GenericLister {
- return &dynamicListerShim{lister: lister}
-}
-
-// List will return all objects across namespaces
-func (s *dynamicListerShim) List(selector labels.Selector) (ret []runtime.Object, err error) {
- objs, err := s.lister.List(selector)
- if err != nil {
- return nil, err
- }
-
- ret = make([]runtime.Object, len(objs))
- for index, obj := range objs {
- ret[index] = obj
- }
- return ret, err
-}
-
-// Get will attempt to retrieve assuming that name==key
-func (s *dynamicListerShim) Get(name string) (runtime.Object, error) {
- return s.lister.Get(name)
-}
-
-func (s *dynamicListerShim) ByNamespace(namespace string) cache.GenericNamespaceLister {
- return &dynamicNamespaceListerShim{
- namespaceLister: s.lister.Namespace(namespace),
- }
-}
-
-// dynamicNamespaceListerShim implements the NamespaceLister interface.
-// It wraps NamespaceLister so that it implements cache.GenericNamespaceLister interface
-type dynamicNamespaceListerShim struct {
- namespaceLister NamespaceLister
-}
-
-// List will return all objects in this namespace
-func (ns *dynamicNamespaceListerShim) List(selector labels.Selector) (ret []runtime.Object, err error) {
- objs, err := ns.namespaceLister.List(selector)
- if err != nil {
- return nil, err
- }
-
- ret = make([]runtime.Object, len(objs))
- for index, obj := range objs {
- ret[index] = obj
- }
- return ret, err
-}
-
-// Get will attempt to retrieve by namespace and name
-func (ns *dynamicNamespaceListerShim) Get(name string) (runtime.Object, error) {
- return ns.namespaceLister.Get(name)
-}
diff --git a/vendor/k8s.io/client-go/dynamic/fake/simple.go b/vendor/k8s.io/client-go/dynamic/fake/simple.go
deleted file mode 100644
index 39b3b64600..0000000000
--- a/vendor/k8s.io/client-go/dynamic/fake/simple.go
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fake
-
-import (
- "context"
- "fmt"
- "strings"
-
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/runtime/serializer"
- "k8s.io/apimachinery/pkg/types"
- "k8s.io/apimachinery/pkg/watch"
- "k8s.io/client-go/dynamic"
- "k8s.io/client-go/testing"
-)
-
-func NewSimpleDynamicClient(scheme *runtime.Scheme, objects ...runtime.Object) *FakeDynamicClient {
- unstructuredScheme := runtime.NewScheme()
- for gvk := range scheme.AllKnownTypes() {
- if unstructuredScheme.Recognizes(gvk) {
- continue
- }
- if strings.HasSuffix(gvk.Kind, "List") {
- unstructuredScheme.AddKnownTypeWithName(gvk, &unstructured.UnstructuredList{})
- continue
- }
- unstructuredScheme.AddKnownTypeWithName(gvk, &unstructured.Unstructured{})
- }
-
- objects, err := convertObjectsToUnstructured(scheme, objects)
- if err != nil {
- panic(err)
- }
-
- for _, obj := range objects {
- gvk := obj.GetObjectKind().GroupVersionKind()
- if !unstructuredScheme.Recognizes(gvk) {
- unstructuredScheme.AddKnownTypeWithName(gvk, &unstructured.Unstructured{})
- }
- gvk.Kind += "List"
- if !unstructuredScheme.Recognizes(gvk) {
- unstructuredScheme.AddKnownTypeWithName(gvk, &unstructured.UnstructuredList{})
- }
- }
-
- return NewSimpleDynamicClientWithCustomListKinds(unstructuredScheme, nil, objects...)
-}
-
-// NewSimpleDynamicClientWithCustomListKinds try not to use this. In general you want to have the scheme have the List types registered
-// and allow the default guessing for resources match. Sometimes that doesn't work, so you can specify a custom mapping here.
-func NewSimpleDynamicClientWithCustomListKinds(scheme *runtime.Scheme, gvrToListKind map[schema.GroupVersionResource]string, objects ...runtime.Object) *FakeDynamicClient {
- // In order to use List with this client, you have to have your lists registered so that the object tracker will find them
- // in the scheme to support the t.scheme.New(listGVK) call when it's building the return value.
- // Since the base fake client needs the listGVK passed through the action (in cases where there are no instances, it
- // cannot look up the actual hits), we need to know a mapping of GVR to listGVK here. For GETs and other types of calls,
- // there is no return value that contains a GVK, so it doesn't have to know the mapping in advance.
-
- // first we attempt to invert known List types from the scheme to auto guess the resource with unsafe guesses
- // this covers common usage of registering types in scheme and passing them
- completeGVRToListKind := map[schema.GroupVersionResource]string{}
- for listGVK := range scheme.AllKnownTypes() {
- if !strings.HasSuffix(listGVK.Kind, "List") {
- continue
- }
- nonListGVK := listGVK.GroupVersion().WithKind(listGVK.Kind[:len(listGVK.Kind)-4])
- plural, _ := meta.UnsafeGuessKindToResource(nonListGVK)
- completeGVRToListKind[plural] = listGVK.Kind
- }
-
- for gvr, listKind := range gvrToListKind {
- if !strings.HasSuffix(listKind, "List") {
- panic("coding error, listGVK must end in List or this fake client doesn't work right")
- }
- listGVK := gvr.GroupVersion().WithKind(listKind)
-
- // if we already have this type registered, just skip it
- if _, err := scheme.New(listGVK); err == nil {
- completeGVRToListKind[gvr] = listKind
- continue
- }
-
- scheme.AddKnownTypeWithName(listGVK, &unstructured.UnstructuredList{})
- completeGVRToListKind[gvr] = listKind
- }
-
- codecs := serializer.NewCodecFactory(scheme)
- o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
- for _, obj := range objects {
- if err := o.Add(obj); err != nil {
- panic(err)
- }
- }
-
- cs := &FakeDynamicClient{scheme: scheme, gvrToListKind: completeGVRToListKind, tracker: o}
- cs.AddReactor("*", "*", testing.ObjectReaction(o))
- cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
- var opts metav1.ListOptions
- if watchAction, ok := action.(testing.WatchActionImpl); ok {
- opts = watchAction.ListOptions
- }
- gvr := action.GetResource()
- ns := action.GetNamespace()
- watch, err := o.Watch(gvr, ns, opts)
- if err != nil {
- return false, nil, err
- }
- return true, watch, nil
- })
-
- return cs
-}
-
-// Clientset implements clientset.Interface. Meant to be embedded into a
-// struct to get a default implementation. This makes faking out just the method
-// you want to test easier.
-type FakeDynamicClient struct {
- testing.Fake
- scheme *runtime.Scheme
- gvrToListKind map[schema.GroupVersionResource]string
- tracker testing.ObjectTracker
-}
-
-type dynamicResourceClient struct {
- client *FakeDynamicClient
- namespace string
- resource schema.GroupVersionResource
- listKind string
-}
-
-var (
- _ dynamic.Interface = &FakeDynamicClient{}
- _ testing.FakeClient = &FakeDynamicClient{}
-)
-
-func (c *FakeDynamicClient) Tracker() testing.ObjectTracker {
- return c.tracker
-}
-
-func (c *FakeDynamicClient) Resource(resource schema.GroupVersionResource) dynamic.NamespaceableResourceInterface {
- return &dynamicResourceClient{client: c, resource: resource, listKind: c.gvrToListKind[resource]}
-}
-
-func (c *FakeDynamicClient) IsWatchListSemanticsUnSupported() bool {
- return true
-}
-
-func (c *dynamicResourceClient) Namespace(ns string) dynamic.ResourceInterface {
- ret := *c
- ret.namespace = ns
- return &ret
-}
-
-func (c *dynamicResourceClient) Create(ctx context.Context, obj *unstructured.Unstructured, opts metav1.CreateOptions, subresources ...string) (*unstructured.Unstructured, error) {
- var uncastRet runtime.Object
- var err error
- switch {
- case len(c.namespace) == 0 && len(subresources) == 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewRootCreateActionWithOptions(c.resource, obj, opts), obj)
-
- case len(c.namespace) == 0 && len(subresources) > 0:
- var accessor metav1.Object // avoid shadowing err
- accessor, err = meta.Accessor(obj)
- if err != nil {
- return nil, err
- }
- name := accessor.GetName()
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewRootCreateSubresourceActionWithOptions(c.resource, name, strings.Join(subresources, "/"), obj, opts), obj)
-
- case len(c.namespace) > 0 && len(subresources) == 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewCreateActionWithOptions(c.resource, c.namespace, obj, opts), obj)
-
- case len(c.namespace) > 0 && len(subresources) > 0:
- var accessor metav1.Object // avoid shadowing err
- accessor, err = meta.Accessor(obj)
- if err != nil {
- return nil, err
- }
- name := accessor.GetName()
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewCreateSubresourceActionWithOptions(c.resource, name, strings.Join(subresources, "/"), c.namespace, obj, opts), obj)
-
- }
-
- if err != nil {
- return nil, err
- }
- if uncastRet == nil {
- return nil, err
- }
-
- ret := &unstructured.Unstructured{}
- if err := c.client.scheme.Convert(uncastRet, ret, nil); err != nil {
- return nil, err
- }
- return ret, err
-}
-
-func (c *dynamicResourceClient) Update(ctx context.Context, obj *unstructured.Unstructured, opts metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error) {
- var uncastRet runtime.Object
- var err error
- switch {
- case len(c.namespace) == 0 && len(subresources) == 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewRootUpdateActionWithOptions(c.resource, obj, opts), obj)
-
- case len(c.namespace) == 0 && len(subresources) > 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewRootUpdateSubresourceActionWithOptions(c.resource, strings.Join(subresources, "/"), obj, opts), obj)
-
- case len(c.namespace) > 0 && len(subresources) == 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewUpdateActionWithOptions(c.resource, c.namespace, obj, opts), obj)
-
- case len(c.namespace) > 0 && len(subresources) > 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewUpdateSubresourceActionWithOptions(c.resource, strings.Join(subresources, "/"), c.namespace, obj, opts), obj)
-
- }
-
- if err != nil {
- return nil, err
- }
- if uncastRet == nil {
- return nil, err
- }
-
- ret := &unstructured.Unstructured{}
- if err := c.client.scheme.Convert(uncastRet, ret, nil); err != nil {
- return nil, err
- }
- return ret, err
-}
-
-func (c *dynamicResourceClient) UpdateStatus(ctx context.Context, obj *unstructured.Unstructured, opts metav1.UpdateOptions) (*unstructured.Unstructured, error) {
- var uncastRet runtime.Object
- var err error
- switch {
- case len(c.namespace) == 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewRootUpdateSubresourceActionWithOptions(c.resource, "status", obj, opts), obj)
-
- case len(c.namespace) > 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewUpdateSubresourceActionWithOptions(c.resource, "status", c.namespace, obj, opts), obj)
-
- }
-
- if err != nil {
- return nil, err
- }
- if uncastRet == nil {
- return nil, err
- }
-
- ret := &unstructured.Unstructured{}
- if err := c.client.scheme.Convert(uncastRet, ret, nil); err != nil {
- return nil, err
- }
- return ret, err
-}
-
-func (c *dynamicResourceClient) Delete(ctx context.Context, name string, opts metav1.DeleteOptions, subresources ...string) error {
- var err error
- switch {
- case len(c.namespace) == 0 && len(subresources) == 0:
- _, err = c.client.Fake.
- Invokes(testing.NewRootDeleteActionWithOptions(c.resource, name, opts), &metav1.Status{Status: "dynamic delete fail"})
-
- case len(c.namespace) == 0 && len(subresources) > 0:
- _, err = c.client.Fake.
- Invokes(testing.NewRootDeleteSubresourceActionWithOptions(c.resource, strings.Join(subresources, "/"), name, opts), &metav1.Status{Status: "dynamic delete fail"})
-
- case len(c.namespace) > 0 && len(subresources) == 0:
- _, err = c.client.Fake.
- Invokes(testing.NewDeleteActionWithOptions(c.resource, c.namespace, name, opts), &metav1.Status{Status: "dynamic delete fail"})
-
- case len(c.namespace) > 0 && len(subresources) > 0:
- _, err = c.client.Fake.
- Invokes(testing.NewDeleteSubresourceActionWithOptions(c.resource, strings.Join(subresources, "/"), c.namespace, name, opts), &metav1.Status{Status: "dynamic delete fail"})
- }
-
- return err
-}
-
-func (c *dynamicResourceClient) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOptions metav1.ListOptions) error {
- var err error
- switch {
- case len(c.namespace) == 0:
- action := testing.NewRootDeleteCollectionActionWithOptions(c.resource, opts, listOptions)
- _, err = c.client.Fake.Invokes(action, &metav1.Status{Status: "dynamic deletecollection fail"})
-
- case len(c.namespace) > 0:
- action := testing.NewDeleteCollectionActionWithOptions(c.resource, c.namespace, opts, listOptions)
- _, err = c.client.Fake.Invokes(action, &metav1.Status{Status: "dynamic deletecollection fail"})
-
- }
-
- return err
-}
-
-func (c *dynamicResourceClient) Get(ctx context.Context, name string, opts metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error) {
- var uncastRet runtime.Object
- var err error
- switch {
- case len(c.namespace) == 0 && len(subresources) == 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewRootGetActionWithOptions(c.resource, name, opts), &metav1.Status{Status: "dynamic get fail"})
-
- case len(c.namespace) == 0 && len(subresources) > 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewRootGetSubresourceActionWithOptions(c.resource, strings.Join(subresources, "/"), name, opts), &metav1.Status{Status: "dynamic get fail"})
-
- case len(c.namespace) > 0 && len(subresources) == 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewGetActionWithOptions(c.resource, c.namespace, name, opts), &metav1.Status{Status: "dynamic get fail"})
-
- case len(c.namespace) > 0 && len(subresources) > 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewGetSubresourceActionWithOptions(c.resource, c.namespace, strings.Join(subresources, "/"), name, opts), &metav1.Status{Status: "dynamic get fail"})
- }
-
- if err != nil {
- return nil, err
- }
- if uncastRet == nil {
- return nil, err
- }
-
- ret := &unstructured.Unstructured{}
- if err := c.client.scheme.Convert(uncastRet, ret, nil); err != nil {
- return nil, err
- }
- return ret, err
-}
-
-func (c *dynamicResourceClient) List(ctx context.Context, opts metav1.ListOptions) (*unstructured.UnstructuredList, error) {
- if len(c.listKind) == 0 {
- panic(fmt.Sprintf("coding error: you must register resource to list kind for every resource you're going to LIST when creating the client. See NewSimpleDynamicClientWithCustomListKinds or register the list into the scheme: %v out of %v", c.resource, c.client.gvrToListKind))
- }
- listGVK := c.resource.GroupVersion().WithKind(c.listKind)
- listForFakeClientGVK := c.resource.GroupVersion().WithKind(c.listKind[:len(c.listKind)-4]) /*base library appends List*/
-
- var obj runtime.Object
- var err error
- switch {
- case len(c.namespace) == 0:
- obj, err = c.client.Fake.
- Invokes(testing.NewRootListActionWithOptions(c.resource, listForFakeClientGVK, opts), &metav1.Status{Status: "dynamic list fail"})
-
- case len(c.namespace) > 0:
- obj, err = c.client.Fake.
- Invokes(testing.NewListActionWithOptions(c.resource, listForFakeClientGVK, c.namespace, opts), &metav1.Status{Status: "dynamic list fail"})
-
- }
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
-
- retUnstructured := &unstructured.Unstructured{}
- if err := c.client.scheme.Convert(obj, retUnstructured, nil); err != nil {
- return nil, err
- }
- entireList, err := retUnstructured.ToList()
- if err != nil {
- return nil, err
- }
-
- list := &unstructured.UnstructuredList{}
- list.SetRemainingItemCount(entireList.GetRemainingItemCount())
- list.SetResourceVersion(entireList.GetResourceVersion())
- list.SetContinue(entireList.GetContinue())
- list.GetObjectKind().SetGroupVersionKind(listGVK)
- for i := range entireList.Items {
- item := &entireList.Items[i]
- metadata, err := meta.Accessor(item)
- if err != nil {
- return nil, err
- }
- if label.Matches(labels.Set(metadata.GetLabels())) {
- list.Items = append(list.Items, *item)
- }
- }
- return list, nil
-}
-
-func (c *dynamicResourceClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
- opts.Watch = true
- switch {
- case len(c.namespace) == 0:
- return c.client.Fake.
- InvokesWatch(testing.NewRootWatchActionWithOptions(c.resource, opts))
-
- case len(c.namespace) > 0:
- return c.client.Fake.
- InvokesWatch(testing.NewWatchActionWithOptions(c.resource, c.namespace, opts))
- }
-
- panic("math broke")
-}
-
-// TODO: opts are currently ignored.
-func (c *dynamicResourceClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*unstructured.Unstructured, error) {
- var uncastRet runtime.Object
- var err error
- switch {
- case len(c.namespace) == 0 && len(subresources) == 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewRootPatchActionWithOptions(c.resource, name, pt, data, opts), &metav1.Status{Status: "dynamic patch fail"})
-
- case len(c.namespace) == 0 && len(subresources) > 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewRootPatchSubresourceActionWithOptions(c.resource, name, pt, data, opts, subresources...), &metav1.Status{Status: "dynamic patch fail"})
-
- case len(c.namespace) > 0 && len(subresources) == 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewPatchActionWithOptions(c.resource, c.namespace, name, pt, data, opts), &metav1.Status{Status: "dynamic patch fail"})
-
- case len(c.namespace) > 0 && len(subresources) > 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewPatchSubresourceActionWithOptions(c.resource, c.namespace, name, pt, data, opts, subresources...), &metav1.Status{Status: "dynamic patch fail"})
-
- }
-
- if err != nil {
- return nil, err
- }
- if uncastRet == nil {
- return nil, err
- }
-
- ret := &unstructured.Unstructured{}
- if err := c.client.scheme.Convert(uncastRet, ret, nil); err != nil {
- return nil, err
- }
- return ret, err
-}
-
-// TODO: opts are currently ignored.
-func (c *dynamicResourceClient) Apply(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions, subresources ...string) (*unstructured.Unstructured, error) {
- outBytes, err := runtime.Encode(unstructured.UnstructuredJSONScheme, obj)
- if err != nil {
- return nil, err
- }
- patchOptions := metav1.PatchOptions{
- Force: &options.Force,
- DryRun: options.DryRun,
- FieldManager: options.FieldManager,
- }
- var uncastRet runtime.Object
- switch {
- case len(c.namespace) == 0 && len(subresources) == 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewRootPatchActionWithOptions(c.resource, name, types.ApplyPatchType, outBytes, patchOptions), &metav1.Status{Status: "dynamic patch fail"})
-
- case len(c.namespace) == 0 && len(subresources) > 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewRootPatchSubresourceActionWithOptions(c.resource, name, types.ApplyPatchType, outBytes, patchOptions, subresources...), &metav1.Status{Status: "dynamic patch fail"})
-
- case len(c.namespace) > 0 && len(subresources) == 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewPatchActionWithOptions(c.resource, c.namespace, name, types.ApplyPatchType, outBytes, patchOptions), &metav1.Status{Status: "dynamic patch fail"})
-
- case len(c.namespace) > 0 && len(subresources) > 0:
- uncastRet, err = c.client.Fake.
- Invokes(testing.NewPatchSubresourceActionWithOptions(c.resource, c.namespace, name, types.ApplyPatchType, outBytes, patchOptions, subresources...), &metav1.Status{Status: "dynamic patch fail"})
-
- }
-
- if err != nil {
- return nil, err
- }
- if uncastRet == nil {
- return nil, err
- }
-
- ret := &unstructured.Unstructured{}
- if err := c.client.scheme.Convert(uncastRet, ret, nil); err != nil {
- return nil, err
- }
- return ret, nil
-}
-
-func (c *dynamicResourceClient) ApplyStatus(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions) (*unstructured.Unstructured, error) {
- return c.Apply(ctx, name, obj, options, "status")
-}
-
-func convertObjectsToUnstructured(s *runtime.Scheme, objs []runtime.Object) ([]runtime.Object, error) {
- ul := make([]runtime.Object, 0, len(objs))
-
- for _, obj := range objs {
- u, err := convertToUnstructured(s, obj)
- if err != nil {
- return nil, err
- }
-
- ul = append(ul, u)
- }
- return ul, nil
-}
-
-func convertToUnstructured(s *runtime.Scheme, obj runtime.Object) (runtime.Object, error) {
- var (
- err error
- u unstructured.Unstructured
- )
-
- u.Object, err = runtime.DefaultUnstructuredConverter.ToUnstructured(obj)
- if err != nil {
- return nil, fmt.Errorf("failed to convert to unstructured: %w", err)
- }
-
- gvk := u.GroupVersionKind()
- if gvk.Group == "" || gvk.Kind == "" {
- gvks, _, err := s.ObjectKinds(obj)
- if err != nil {
- return nil, fmt.Errorf("failed to convert to unstructured - unable to get GVK %w", err)
- }
- apiv, k := gvks[0].ToAPIVersionAndKind()
- u.SetAPIVersion(apiv)
- u.SetKind(k)
- }
- return &u, nil
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go b/vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go
deleted file mode 100644
index 618dd57511..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/watch"
- applyconfigurations "k8s.io/client-go/applyconfigurations"
- "k8s.io/client-go/discovery"
- fakediscovery "k8s.io/client-go/discovery/fake"
- clientset "k8s.io/client-go/kubernetes"
- admissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
- fakeadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake"
- admissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
- fakeadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake"
- admissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
- fakeadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake"
- internalv1alpha1 "k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1"
- fakeinternalv1alpha1 "k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/fake"
- appsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
- fakeappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1/fake"
- appsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
- fakeappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake"
- appsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
- fakeappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake"
- authenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1"
- fakeauthenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1/fake"
- authenticationv1alpha1 "k8s.io/client-go/kubernetes/typed/authentication/v1alpha1"
- fakeauthenticationv1alpha1 "k8s.io/client-go/kubernetes/typed/authentication/v1alpha1/fake"
- authenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1"
- fakeauthenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake"
- authorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
- fakeauthorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1/fake"
- authorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1"
- fakeauthorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake"
- autoscalingv1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1"
- fakeautoscalingv1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake"
- autoscalingv2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2"
- fakeautoscalingv2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake"
- batchv1 "k8s.io/client-go/kubernetes/typed/batch/v1"
- fakebatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1/fake"
- batchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1"
- fakebatchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake"
- certificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1"
- fakecertificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1/fake"
- certificatesv1alpha1 "k8s.io/client-go/kubernetes/typed/certificates/v1alpha1"
- fakecertificatesv1alpha1 "k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake"
- certificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1"
- fakecertificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake"
- coordinationv1 "k8s.io/client-go/kubernetes/typed/coordination/v1"
- fakecoordinationv1 "k8s.io/client-go/kubernetes/typed/coordination/v1/fake"
- coordinationv1alpha2 "k8s.io/client-go/kubernetes/typed/coordination/v1alpha2"
- fakecoordinationv1alpha2 "k8s.io/client-go/kubernetes/typed/coordination/v1alpha2/fake"
- coordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1"
- fakecoordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake"
- corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
- fakecorev1 "k8s.io/client-go/kubernetes/typed/core/v1/fake"
- discoveryv1 "k8s.io/client-go/kubernetes/typed/discovery/v1"
- fakediscoveryv1 "k8s.io/client-go/kubernetes/typed/discovery/v1/fake"
- discoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1"
- fakediscoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake"
- eventsv1 "k8s.io/client-go/kubernetes/typed/events/v1"
- fakeeventsv1 "k8s.io/client-go/kubernetes/typed/events/v1/fake"
- eventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1"
- fakeeventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1/fake"
- extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
- fakeextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake"
- flowcontrolv1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1"
- fakeflowcontrolv1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake"
- flowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1"
- fakeflowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake"
- flowcontrolv1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2"
- fakeflowcontrolv1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake"
- flowcontrolv1beta3 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3"
- fakeflowcontrolv1beta3 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake"
- networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
- fakenetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1/fake"
- networkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
- fakenetworkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake"
- nodev1 "k8s.io/client-go/kubernetes/typed/node/v1"
- fakenodev1 "k8s.io/client-go/kubernetes/typed/node/v1/fake"
- nodev1alpha1 "k8s.io/client-go/kubernetes/typed/node/v1alpha1"
- fakenodev1alpha1 "k8s.io/client-go/kubernetes/typed/node/v1alpha1/fake"
- nodev1beta1 "k8s.io/client-go/kubernetes/typed/node/v1beta1"
- fakenodev1beta1 "k8s.io/client-go/kubernetes/typed/node/v1beta1/fake"
- policyv1 "k8s.io/client-go/kubernetes/typed/policy/v1"
- fakepolicyv1 "k8s.io/client-go/kubernetes/typed/policy/v1/fake"
- policyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
- fakepolicyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake"
- rbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1"
- fakerbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1/fake"
- rbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
- fakerbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake"
- rbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1"
- fakerbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake"
- resourcev1 "k8s.io/client-go/kubernetes/typed/resource/v1"
- fakeresourcev1 "k8s.io/client-go/kubernetes/typed/resource/v1/fake"
- resourcev1alpha3 "k8s.io/client-go/kubernetes/typed/resource/v1alpha3"
- fakeresourcev1alpha3 "k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake"
- resourcev1beta1 "k8s.io/client-go/kubernetes/typed/resource/v1beta1"
- fakeresourcev1beta1 "k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake"
- resourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2"
- fakeresourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake"
- schedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1"
- fakeschedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1/fake"
- schedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2"
- fakeschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake"
- schedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1"
- fakeschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake"
- storagev1 "k8s.io/client-go/kubernetes/typed/storage/v1"
- fakestoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1/fake"
- storagev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1"
- fakestoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake"
- storagev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
- fakestoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake"
- storagemigrationv1beta1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1"
- fakestoragemigrationv1beta1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1/fake"
- "k8s.io/client-go/testing"
-)
-
-// NewSimpleClientset returns a clientset that will respond with the provided objects.
-// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
-// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement
-// for a real clientset and is mostly useful in simple unit tests.
-func NewSimpleClientset(objects ...runtime.Object) *Clientset {
- o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
- for _, obj := range objects {
- if err := o.Add(obj); err != nil {
- panic(err)
- }
- }
-
- cs := &Clientset{tracker: o}
- cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
- cs.AddReactor("*", "*", testing.ObjectReaction(o))
- cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
- var opts metav1.ListOptions
- if watchAction, ok := action.(testing.WatchActionImpl); ok {
- opts = watchAction.ListOptions
- }
- gvr := action.GetResource()
- ns := action.GetNamespace()
- watch, err := o.Watch(gvr, ns, opts)
- if err != nil {
- return false, nil, err
- }
- return true, watch, nil
- })
-
- return cs
-}
-
-// Clientset implements clientset.Interface. Meant to be embedded into a
-// struct to get a default implementation. This makes faking out just the method
-// you want to test easier.
-type Clientset struct {
- testing.Fake
- discovery *fakediscovery.FakeDiscovery
- tracker testing.ObjectTracker
-}
-
-func (c *Clientset) Discovery() discovery.DiscoveryInterface {
- return c.discovery
-}
-
-func (c *Clientset) Tracker() testing.ObjectTracker {
- return c.tracker
-}
-
-// IsWatchListSemanticsUnSupported informs the reflector that this client
-// doesn't support WatchList semantics.
-//
-// This is a synthetic method whose sole purpose is to satisfy the optional
-// interface check performed by the reflector.
-// Returning true signals that WatchList can NOT be used.
-// No additional logic is implemented here.
-func (c *Clientset) IsWatchListSemanticsUnSupported() bool {
- return true
-}
-
-// NewClientset returns a clientset that will respond with the provided objects.
-// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
-// without applying any validations and/or defaults. It shouldn't be considered a replacement
-// for a real clientset and is mostly useful in simple unit tests.
-//
-// Compared to NewSimpleClientset, the Clientset returned here supports field tracking and thus
-// server-side apply. Beware though that support in that for CRDs is missing
-// (https://github.com/kubernetes/kubernetes/issues/126850).
-func NewClientset(objects ...runtime.Object) *Clientset {
- o := testing.NewFieldManagedObjectTracker(
- scheme,
- codecs.UniversalDecoder(),
- applyconfigurations.NewTypeConverter(scheme),
- )
- for _, obj := range objects {
- if err := o.Add(obj); err != nil {
- panic(err)
- }
- }
-
- cs := &Clientset{tracker: o}
- cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
- cs.AddReactor("*", "*", testing.ObjectReaction(o))
- cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
- var opts metav1.ListOptions
- if watchAction, ok := action.(testing.WatchActionImpl); ok {
- opts = watchAction.ListOptions
- }
- gvr := action.GetResource()
- ns := action.GetNamespace()
- watch, err := o.Watch(gvr, ns, opts)
- if err != nil {
- return false, nil, err
- }
- return true, watch, nil
- })
-
- return cs
-}
-
-var (
- _ clientset.Interface = &Clientset{}
- _ testing.FakeClient = &Clientset{}
-)
-
-// AdmissionregistrationV1 retrieves the AdmissionregistrationV1Client
-func (c *Clientset) AdmissionregistrationV1() admissionregistrationv1.AdmissionregistrationV1Interface {
- return &fakeadmissionregistrationv1.FakeAdmissionregistrationV1{Fake: &c.Fake}
-}
-
-// AdmissionregistrationV1alpha1 retrieves the AdmissionregistrationV1alpha1Client
-func (c *Clientset) AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface {
- return &fakeadmissionregistrationv1alpha1.FakeAdmissionregistrationV1alpha1{Fake: &c.Fake}
-}
-
-// AdmissionregistrationV1beta1 retrieves the AdmissionregistrationV1beta1Client
-func (c *Clientset) AdmissionregistrationV1beta1() admissionregistrationv1beta1.AdmissionregistrationV1beta1Interface {
- return &fakeadmissionregistrationv1beta1.FakeAdmissionregistrationV1beta1{Fake: &c.Fake}
-}
-
-// InternalV1alpha1 retrieves the InternalV1alpha1Client
-func (c *Clientset) InternalV1alpha1() internalv1alpha1.InternalV1alpha1Interface {
- return &fakeinternalv1alpha1.FakeInternalV1alpha1{Fake: &c.Fake}
-}
-
-// AppsV1 retrieves the AppsV1Client
-func (c *Clientset) AppsV1() appsv1.AppsV1Interface {
- return &fakeappsv1.FakeAppsV1{Fake: &c.Fake}
-}
-
-// AppsV1beta1 retrieves the AppsV1beta1Client
-func (c *Clientset) AppsV1beta1() appsv1beta1.AppsV1beta1Interface {
- return &fakeappsv1beta1.FakeAppsV1beta1{Fake: &c.Fake}
-}
-
-// AppsV1beta2 retrieves the AppsV1beta2Client
-func (c *Clientset) AppsV1beta2() appsv1beta2.AppsV1beta2Interface {
- return &fakeappsv1beta2.FakeAppsV1beta2{Fake: &c.Fake}
-}
-
-// AuthenticationV1 retrieves the AuthenticationV1Client
-func (c *Clientset) AuthenticationV1() authenticationv1.AuthenticationV1Interface {
- return &fakeauthenticationv1.FakeAuthenticationV1{Fake: &c.Fake}
-}
-
-// AuthenticationV1alpha1 retrieves the AuthenticationV1alpha1Client
-func (c *Clientset) AuthenticationV1alpha1() authenticationv1alpha1.AuthenticationV1alpha1Interface {
- return &fakeauthenticationv1alpha1.FakeAuthenticationV1alpha1{Fake: &c.Fake}
-}
-
-// AuthenticationV1beta1 retrieves the AuthenticationV1beta1Client
-func (c *Clientset) AuthenticationV1beta1() authenticationv1beta1.AuthenticationV1beta1Interface {
- return &fakeauthenticationv1beta1.FakeAuthenticationV1beta1{Fake: &c.Fake}
-}
-
-// AuthorizationV1 retrieves the AuthorizationV1Client
-func (c *Clientset) AuthorizationV1() authorizationv1.AuthorizationV1Interface {
- return &fakeauthorizationv1.FakeAuthorizationV1{Fake: &c.Fake}
-}
-
-// AuthorizationV1beta1 retrieves the AuthorizationV1beta1Client
-func (c *Clientset) AuthorizationV1beta1() authorizationv1beta1.AuthorizationV1beta1Interface {
- return &fakeauthorizationv1beta1.FakeAuthorizationV1beta1{Fake: &c.Fake}
-}
-
-// AutoscalingV1 retrieves the AutoscalingV1Client
-func (c *Clientset) AutoscalingV1() autoscalingv1.AutoscalingV1Interface {
- return &fakeautoscalingv1.FakeAutoscalingV1{Fake: &c.Fake}
-}
-
-// AutoscalingV2 retrieves the AutoscalingV2Client
-func (c *Clientset) AutoscalingV2() autoscalingv2.AutoscalingV2Interface {
- return &fakeautoscalingv2.FakeAutoscalingV2{Fake: &c.Fake}
-}
-
-// BatchV1 retrieves the BatchV1Client
-func (c *Clientset) BatchV1() batchv1.BatchV1Interface {
- return &fakebatchv1.FakeBatchV1{Fake: &c.Fake}
-}
-
-// BatchV1beta1 retrieves the BatchV1beta1Client
-func (c *Clientset) BatchV1beta1() batchv1beta1.BatchV1beta1Interface {
- return &fakebatchv1beta1.FakeBatchV1beta1{Fake: &c.Fake}
-}
-
-// CertificatesV1 retrieves the CertificatesV1Client
-func (c *Clientset) CertificatesV1() certificatesv1.CertificatesV1Interface {
- return &fakecertificatesv1.FakeCertificatesV1{Fake: &c.Fake}
-}
-
-// CertificatesV1beta1 retrieves the CertificatesV1beta1Client
-func (c *Clientset) CertificatesV1beta1() certificatesv1beta1.CertificatesV1beta1Interface {
- return &fakecertificatesv1beta1.FakeCertificatesV1beta1{Fake: &c.Fake}
-}
-
-// CertificatesV1alpha1 retrieves the CertificatesV1alpha1Client
-func (c *Clientset) CertificatesV1alpha1() certificatesv1alpha1.CertificatesV1alpha1Interface {
- return &fakecertificatesv1alpha1.FakeCertificatesV1alpha1{Fake: &c.Fake}
-}
-
-// CoordinationV1alpha2 retrieves the CoordinationV1alpha2Client
-func (c *Clientset) CoordinationV1alpha2() coordinationv1alpha2.CoordinationV1alpha2Interface {
- return &fakecoordinationv1alpha2.FakeCoordinationV1alpha2{Fake: &c.Fake}
-}
-
-// CoordinationV1beta1 retrieves the CoordinationV1beta1Client
-func (c *Clientset) CoordinationV1beta1() coordinationv1beta1.CoordinationV1beta1Interface {
- return &fakecoordinationv1beta1.FakeCoordinationV1beta1{Fake: &c.Fake}
-}
-
-// CoordinationV1 retrieves the CoordinationV1Client
-func (c *Clientset) CoordinationV1() coordinationv1.CoordinationV1Interface {
- return &fakecoordinationv1.FakeCoordinationV1{Fake: &c.Fake}
-}
-
-// CoreV1 retrieves the CoreV1Client
-func (c *Clientset) CoreV1() corev1.CoreV1Interface {
- return &fakecorev1.FakeCoreV1{Fake: &c.Fake}
-}
-
-// DiscoveryV1 retrieves the DiscoveryV1Client
-func (c *Clientset) DiscoveryV1() discoveryv1.DiscoveryV1Interface {
- return &fakediscoveryv1.FakeDiscoveryV1{Fake: &c.Fake}
-}
-
-// DiscoveryV1beta1 retrieves the DiscoveryV1beta1Client
-func (c *Clientset) DiscoveryV1beta1() discoveryv1beta1.DiscoveryV1beta1Interface {
- return &fakediscoveryv1beta1.FakeDiscoveryV1beta1{Fake: &c.Fake}
-}
-
-// EventsV1 retrieves the EventsV1Client
-func (c *Clientset) EventsV1() eventsv1.EventsV1Interface {
- return &fakeeventsv1.FakeEventsV1{Fake: &c.Fake}
-}
-
-// EventsV1beta1 retrieves the EventsV1beta1Client
-func (c *Clientset) EventsV1beta1() eventsv1beta1.EventsV1beta1Interface {
- return &fakeeventsv1beta1.FakeEventsV1beta1{Fake: &c.Fake}
-}
-
-// ExtensionsV1beta1 retrieves the ExtensionsV1beta1Client
-func (c *Clientset) ExtensionsV1beta1() extensionsv1beta1.ExtensionsV1beta1Interface {
- return &fakeextensionsv1beta1.FakeExtensionsV1beta1{Fake: &c.Fake}
-}
-
-// FlowcontrolV1 retrieves the FlowcontrolV1Client
-func (c *Clientset) FlowcontrolV1() flowcontrolv1.FlowcontrolV1Interface {
- return &fakeflowcontrolv1.FakeFlowcontrolV1{Fake: &c.Fake}
-}
-
-// FlowcontrolV1beta1 retrieves the FlowcontrolV1beta1Client
-func (c *Clientset) FlowcontrolV1beta1() flowcontrolv1beta1.FlowcontrolV1beta1Interface {
- return &fakeflowcontrolv1beta1.FakeFlowcontrolV1beta1{Fake: &c.Fake}
-}
-
-// FlowcontrolV1beta2 retrieves the FlowcontrolV1beta2Client
-func (c *Clientset) FlowcontrolV1beta2() flowcontrolv1beta2.FlowcontrolV1beta2Interface {
- return &fakeflowcontrolv1beta2.FakeFlowcontrolV1beta2{Fake: &c.Fake}
-}
-
-// FlowcontrolV1beta3 retrieves the FlowcontrolV1beta3Client
-func (c *Clientset) FlowcontrolV1beta3() flowcontrolv1beta3.FlowcontrolV1beta3Interface {
- return &fakeflowcontrolv1beta3.FakeFlowcontrolV1beta3{Fake: &c.Fake}
-}
-
-// NetworkingV1 retrieves the NetworkingV1Client
-func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface {
- return &fakenetworkingv1.FakeNetworkingV1{Fake: &c.Fake}
-}
-
-// NetworkingV1beta1 retrieves the NetworkingV1beta1Client
-func (c *Clientset) NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface {
- return &fakenetworkingv1beta1.FakeNetworkingV1beta1{Fake: &c.Fake}
-}
-
-// NodeV1 retrieves the NodeV1Client
-func (c *Clientset) NodeV1() nodev1.NodeV1Interface {
- return &fakenodev1.FakeNodeV1{Fake: &c.Fake}
-}
-
-// NodeV1alpha1 retrieves the NodeV1alpha1Client
-func (c *Clientset) NodeV1alpha1() nodev1alpha1.NodeV1alpha1Interface {
- return &fakenodev1alpha1.FakeNodeV1alpha1{Fake: &c.Fake}
-}
-
-// NodeV1beta1 retrieves the NodeV1beta1Client
-func (c *Clientset) NodeV1beta1() nodev1beta1.NodeV1beta1Interface {
- return &fakenodev1beta1.FakeNodeV1beta1{Fake: &c.Fake}
-}
-
-// PolicyV1 retrieves the PolicyV1Client
-func (c *Clientset) PolicyV1() policyv1.PolicyV1Interface {
- return &fakepolicyv1.FakePolicyV1{Fake: &c.Fake}
-}
-
-// PolicyV1beta1 retrieves the PolicyV1beta1Client
-func (c *Clientset) PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface {
- return &fakepolicyv1beta1.FakePolicyV1beta1{Fake: &c.Fake}
-}
-
-// RbacV1 retrieves the RbacV1Client
-func (c *Clientset) RbacV1() rbacv1.RbacV1Interface {
- return &fakerbacv1.FakeRbacV1{Fake: &c.Fake}
-}
-
-// RbacV1beta1 retrieves the RbacV1beta1Client
-func (c *Clientset) RbacV1beta1() rbacv1beta1.RbacV1beta1Interface {
- return &fakerbacv1beta1.FakeRbacV1beta1{Fake: &c.Fake}
-}
-
-// RbacV1alpha1 retrieves the RbacV1alpha1Client
-func (c *Clientset) RbacV1alpha1() rbacv1alpha1.RbacV1alpha1Interface {
- return &fakerbacv1alpha1.FakeRbacV1alpha1{Fake: &c.Fake}
-}
-
-// ResourceV1 retrieves the ResourceV1Client
-func (c *Clientset) ResourceV1() resourcev1.ResourceV1Interface {
- return &fakeresourcev1.FakeResourceV1{Fake: &c.Fake}
-}
-
-// ResourceV1beta2 retrieves the ResourceV1beta2Client
-func (c *Clientset) ResourceV1beta2() resourcev1beta2.ResourceV1beta2Interface {
- return &fakeresourcev1beta2.FakeResourceV1beta2{Fake: &c.Fake}
-}
-
-// ResourceV1beta1 retrieves the ResourceV1beta1Client
-func (c *Clientset) ResourceV1beta1() resourcev1beta1.ResourceV1beta1Interface {
- return &fakeresourcev1beta1.FakeResourceV1beta1{Fake: &c.Fake}
-}
-
-// ResourceV1alpha3 retrieves the ResourceV1alpha3Client
-func (c *Clientset) ResourceV1alpha3() resourcev1alpha3.ResourceV1alpha3Interface {
- return &fakeresourcev1alpha3.FakeResourceV1alpha3{Fake: &c.Fake}
-}
-
-// SchedulingV1alpha2 retrieves the SchedulingV1alpha2Client
-func (c *Clientset) SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2Interface {
- return &fakeschedulingv1alpha2.FakeSchedulingV1alpha2{Fake: &c.Fake}
-}
-
-// SchedulingV1beta1 retrieves the SchedulingV1beta1Client
-func (c *Clientset) SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface {
- return &fakeschedulingv1beta1.FakeSchedulingV1beta1{Fake: &c.Fake}
-}
-
-// SchedulingV1 retrieves the SchedulingV1Client
-func (c *Clientset) SchedulingV1() schedulingv1.SchedulingV1Interface {
- return &fakeschedulingv1.FakeSchedulingV1{Fake: &c.Fake}
-}
-
-// StorageV1beta1 retrieves the StorageV1beta1Client
-func (c *Clientset) StorageV1beta1() storagev1beta1.StorageV1beta1Interface {
- return &fakestoragev1beta1.FakeStorageV1beta1{Fake: &c.Fake}
-}
-
-// StorageV1 retrieves the StorageV1Client
-func (c *Clientset) StorageV1() storagev1.StorageV1Interface {
- return &fakestoragev1.FakeStorageV1{Fake: &c.Fake}
-}
-
-// StorageV1alpha1 retrieves the StorageV1alpha1Client
-func (c *Clientset) StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface {
- return &fakestoragev1alpha1.FakeStorageV1alpha1{Fake: &c.Fake}
-}
-
-// StoragemigrationV1beta1 retrieves the StoragemigrationV1beta1Client
-func (c *Clientset) StoragemigrationV1beta1() storagemigrationv1beta1.StoragemigrationV1beta1Interface {
- return &fakestoragemigrationv1beta1.FakeStoragemigrationV1beta1{Fake: &c.Fake}
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/fake/doc.go
deleted file mode 100644
index 9b99e71670..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// This package has the automatically generated fake clientset.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/fake/register.go b/vendor/k8s.io/client-go/kubernetes/fake/register.go
deleted file mode 100644
index 3b5d98c6a8..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/fake/register.go
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
- admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
- admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1"
- internalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1"
- appsv1 "k8s.io/api/apps/v1"
- appsv1beta1 "k8s.io/api/apps/v1beta1"
- appsv1beta2 "k8s.io/api/apps/v1beta2"
- authenticationv1 "k8s.io/api/authentication/v1"
- authenticationv1alpha1 "k8s.io/api/authentication/v1alpha1"
- authenticationv1beta1 "k8s.io/api/authentication/v1beta1"
- authorizationv1 "k8s.io/api/authorization/v1"
- authorizationv1beta1 "k8s.io/api/authorization/v1beta1"
- autoscalingv1 "k8s.io/api/autoscaling/v1"
- autoscalingv2 "k8s.io/api/autoscaling/v2"
- batchv1 "k8s.io/api/batch/v1"
- batchv1beta1 "k8s.io/api/batch/v1beta1"
- certificatesv1 "k8s.io/api/certificates/v1"
- certificatesv1alpha1 "k8s.io/api/certificates/v1alpha1"
- certificatesv1beta1 "k8s.io/api/certificates/v1beta1"
- coordinationv1 "k8s.io/api/coordination/v1"
- coordinationv1alpha2 "k8s.io/api/coordination/v1alpha2"
- coordinationv1beta1 "k8s.io/api/coordination/v1beta1"
- corev1 "k8s.io/api/core/v1"
- discoveryv1 "k8s.io/api/discovery/v1"
- discoveryv1beta1 "k8s.io/api/discovery/v1beta1"
- eventsv1 "k8s.io/api/events/v1"
- eventsv1beta1 "k8s.io/api/events/v1beta1"
- extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
- flowcontrolv1 "k8s.io/api/flowcontrol/v1"
- flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
- flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2"
- flowcontrolv1beta3 "k8s.io/api/flowcontrol/v1beta3"
- networkingv1 "k8s.io/api/networking/v1"
- networkingv1beta1 "k8s.io/api/networking/v1beta1"
- nodev1 "k8s.io/api/node/v1"
- nodev1alpha1 "k8s.io/api/node/v1alpha1"
- nodev1beta1 "k8s.io/api/node/v1beta1"
- policyv1 "k8s.io/api/policy/v1"
- policyv1beta1 "k8s.io/api/policy/v1beta1"
- rbacv1 "k8s.io/api/rbac/v1"
- rbacv1alpha1 "k8s.io/api/rbac/v1alpha1"
- rbacv1beta1 "k8s.io/api/rbac/v1beta1"
- resourcev1 "k8s.io/api/resource/v1"
- resourcev1alpha3 "k8s.io/api/resource/v1alpha3"
- resourcev1beta1 "k8s.io/api/resource/v1beta1"
- resourcev1beta2 "k8s.io/api/resource/v1beta2"
- schedulingv1 "k8s.io/api/scheduling/v1"
- schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2"
- schedulingv1beta1 "k8s.io/api/scheduling/v1beta1"
- storagev1 "k8s.io/api/storage/v1"
- storagev1alpha1 "k8s.io/api/storage/v1alpha1"
- storagev1beta1 "k8s.io/api/storage/v1beta1"
- storagemigrationv1beta1 "k8s.io/api/storagemigration/v1beta1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- serializer "k8s.io/apimachinery/pkg/runtime/serializer"
- utilruntime "k8s.io/apimachinery/pkg/util/runtime"
-)
-
-var scheme = runtime.NewScheme()
-var codecs = serializer.NewCodecFactory(scheme)
-
-var localSchemeBuilder = runtime.SchemeBuilder{
- admissionregistrationv1.AddToScheme,
- admissionregistrationv1alpha1.AddToScheme,
- admissionregistrationv1beta1.AddToScheme,
- internalv1alpha1.AddToScheme,
- appsv1.AddToScheme,
- appsv1beta1.AddToScheme,
- appsv1beta2.AddToScheme,
- authenticationv1.AddToScheme,
- authenticationv1alpha1.AddToScheme,
- authenticationv1beta1.AddToScheme,
- authorizationv1.AddToScheme,
- authorizationv1beta1.AddToScheme,
- autoscalingv1.AddToScheme,
- autoscalingv2.AddToScheme,
- batchv1.AddToScheme,
- batchv1beta1.AddToScheme,
- certificatesv1.AddToScheme,
- certificatesv1beta1.AddToScheme,
- certificatesv1alpha1.AddToScheme,
- coordinationv1alpha2.AddToScheme,
- coordinationv1beta1.AddToScheme,
- coordinationv1.AddToScheme,
- corev1.AddToScheme,
- discoveryv1.AddToScheme,
- discoveryv1beta1.AddToScheme,
- eventsv1.AddToScheme,
- eventsv1beta1.AddToScheme,
- extensionsv1beta1.AddToScheme,
- flowcontrolv1.AddToScheme,
- flowcontrolv1beta1.AddToScheme,
- flowcontrolv1beta2.AddToScheme,
- flowcontrolv1beta3.AddToScheme,
- networkingv1.AddToScheme,
- networkingv1beta1.AddToScheme,
- nodev1.AddToScheme,
- nodev1alpha1.AddToScheme,
- nodev1beta1.AddToScheme,
- policyv1.AddToScheme,
- policyv1beta1.AddToScheme,
- rbacv1.AddToScheme,
- rbacv1beta1.AddToScheme,
- rbacv1alpha1.AddToScheme,
- resourcev1.AddToScheme,
- resourcev1beta2.AddToScheme,
- resourcev1beta1.AddToScheme,
- resourcev1alpha3.AddToScheme,
- schedulingv1alpha2.AddToScheme,
- schedulingv1beta1.AddToScheme,
- schedulingv1.AddToScheme,
- storagev1beta1.AddToScheme,
- storagev1.AddToScheme,
- storagev1alpha1.AddToScheme,
- storagemigrationv1beta1.AddToScheme,
-}
-
-// AddToScheme adds all types of this clientset into the given scheme. This allows composition
-// of clientsets, like in:
-//
-// import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-// )
-//
-// kclientset, _ := kubernetes.NewForConfig(c)
-// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
-//
-// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
-// correctly.
-var AddToScheme = localSchemeBuilder.AddToScheme
-
-func init() {
- v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
- utilruntime.Must(AddToScheme(scheme))
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_admissionregistration_client.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_admissionregistration_client.go
deleted file mode 100644
index fbe72e9e54..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_admissionregistration_client.go
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAdmissionregistrationV1 struct {
- *testing.Fake
-}
-
-func (c *FakeAdmissionregistrationV1) MutatingAdmissionPolicies() v1.MutatingAdmissionPolicyInterface {
- return newFakeMutatingAdmissionPolicies(c)
-}
-
-func (c *FakeAdmissionregistrationV1) MutatingAdmissionPolicyBindings() v1.MutatingAdmissionPolicyBindingInterface {
- return newFakeMutatingAdmissionPolicyBindings(c)
-}
-
-func (c *FakeAdmissionregistrationV1) MutatingWebhookConfigurations() v1.MutatingWebhookConfigurationInterface {
- return newFakeMutatingWebhookConfigurations(c)
-}
-
-func (c *FakeAdmissionregistrationV1) ValidatingAdmissionPolicies() v1.ValidatingAdmissionPolicyInterface {
- return newFakeValidatingAdmissionPolicies(c)
-}
-
-func (c *FakeAdmissionregistrationV1) ValidatingAdmissionPolicyBindings() v1.ValidatingAdmissionPolicyBindingInterface {
- return newFakeValidatingAdmissionPolicyBindings(c)
-}
-
-func (c *FakeAdmissionregistrationV1) ValidatingWebhookConfigurations() v1.ValidatingWebhookConfigurationInterface {
- return newFakeValidatingWebhookConfigurations(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAdmissionregistrationV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicy.go
deleted file mode 100644
index 80e703b1cd..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicy.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/admissionregistration/v1"
- admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
-)
-
-// fakeMutatingAdmissionPolicies implements MutatingAdmissionPolicyInterface
-type fakeMutatingAdmissionPolicies struct {
- *gentype.FakeClientWithListAndApply[*v1.MutatingAdmissionPolicy, *v1.MutatingAdmissionPolicyList, *admissionregistrationv1.MutatingAdmissionPolicyApplyConfiguration]
- Fake *FakeAdmissionregistrationV1
-}
-
-func newFakeMutatingAdmissionPolicies(fake *FakeAdmissionregistrationV1) typedadmissionregistrationv1.MutatingAdmissionPolicyInterface {
- return &fakeMutatingAdmissionPolicies{
- gentype.NewFakeClientWithListAndApply[*v1.MutatingAdmissionPolicy, *v1.MutatingAdmissionPolicyList, *admissionregistrationv1.MutatingAdmissionPolicyApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("mutatingadmissionpolicies"),
- v1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicy"),
- func() *v1.MutatingAdmissionPolicy { return &v1.MutatingAdmissionPolicy{} },
- func() *v1.MutatingAdmissionPolicyList { return &v1.MutatingAdmissionPolicyList{} },
- func(dst, src *v1.MutatingAdmissionPolicyList) { dst.ListMeta = src.ListMeta },
- func(list *v1.MutatingAdmissionPolicyList) []*v1.MutatingAdmissionPolicy {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.MutatingAdmissionPolicyList, items []*v1.MutatingAdmissionPolicy) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicybinding.go
deleted file mode 100644
index eba7c8406e..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicybinding.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/admissionregistration/v1"
- admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
-)
-
-// fakeMutatingAdmissionPolicyBindings implements MutatingAdmissionPolicyBindingInterface
-type fakeMutatingAdmissionPolicyBindings struct {
- *gentype.FakeClientWithListAndApply[*v1.MutatingAdmissionPolicyBinding, *v1.MutatingAdmissionPolicyBindingList, *admissionregistrationv1.MutatingAdmissionPolicyBindingApplyConfiguration]
- Fake *FakeAdmissionregistrationV1
-}
-
-func newFakeMutatingAdmissionPolicyBindings(fake *FakeAdmissionregistrationV1) typedadmissionregistrationv1.MutatingAdmissionPolicyBindingInterface {
- return &fakeMutatingAdmissionPolicyBindings{
- gentype.NewFakeClientWithListAndApply[*v1.MutatingAdmissionPolicyBinding, *v1.MutatingAdmissionPolicyBindingList, *admissionregistrationv1.MutatingAdmissionPolicyBindingApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("mutatingadmissionpolicybindings"),
- v1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBinding"),
- func() *v1.MutatingAdmissionPolicyBinding { return &v1.MutatingAdmissionPolicyBinding{} },
- func() *v1.MutatingAdmissionPolicyBindingList { return &v1.MutatingAdmissionPolicyBindingList{} },
- func(dst, src *v1.MutatingAdmissionPolicyBindingList) { dst.ListMeta = src.ListMeta },
- func(list *v1.MutatingAdmissionPolicyBindingList) []*v1.MutatingAdmissionPolicyBinding {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.MutatingAdmissionPolicyBindingList, items []*v1.MutatingAdmissionPolicyBinding) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingwebhookconfiguration.go
deleted file mode 100644
index 3dda322485..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingwebhookconfiguration.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/admissionregistration/v1"
- admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
-)
-
-// fakeMutatingWebhookConfigurations implements MutatingWebhookConfigurationInterface
-type fakeMutatingWebhookConfigurations struct {
- *gentype.FakeClientWithListAndApply[*v1.MutatingWebhookConfiguration, *v1.MutatingWebhookConfigurationList, *admissionregistrationv1.MutatingWebhookConfigurationApplyConfiguration]
- Fake *FakeAdmissionregistrationV1
-}
-
-func newFakeMutatingWebhookConfigurations(fake *FakeAdmissionregistrationV1) typedadmissionregistrationv1.MutatingWebhookConfigurationInterface {
- return &fakeMutatingWebhookConfigurations{
- gentype.NewFakeClientWithListAndApply[*v1.MutatingWebhookConfiguration, *v1.MutatingWebhookConfigurationList, *admissionregistrationv1.MutatingWebhookConfigurationApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"),
- v1.SchemeGroupVersion.WithKind("MutatingWebhookConfiguration"),
- func() *v1.MutatingWebhookConfiguration { return &v1.MutatingWebhookConfiguration{} },
- func() *v1.MutatingWebhookConfigurationList { return &v1.MutatingWebhookConfigurationList{} },
- func(dst, src *v1.MutatingWebhookConfigurationList) { dst.ListMeta = src.ListMeta },
- func(list *v1.MutatingWebhookConfigurationList) []*v1.MutatingWebhookConfiguration {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.MutatingWebhookConfigurationList, items []*v1.MutatingWebhookConfiguration) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_validatingadmissionpolicy.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_validatingadmissionpolicy.go
deleted file mode 100644
index 4ad05e8fc4..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_validatingadmissionpolicy.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/admissionregistration/v1"
- admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
-)
-
-// fakeValidatingAdmissionPolicies implements ValidatingAdmissionPolicyInterface
-type fakeValidatingAdmissionPolicies struct {
- *gentype.FakeClientWithListAndApply[*v1.ValidatingAdmissionPolicy, *v1.ValidatingAdmissionPolicyList, *admissionregistrationv1.ValidatingAdmissionPolicyApplyConfiguration]
- Fake *FakeAdmissionregistrationV1
-}
-
-func newFakeValidatingAdmissionPolicies(fake *FakeAdmissionregistrationV1) typedadmissionregistrationv1.ValidatingAdmissionPolicyInterface {
- return &fakeValidatingAdmissionPolicies{
- gentype.NewFakeClientWithListAndApply[*v1.ValidatingAdmissionPolicy, *v1.ValidatingAdmissionPolicyList, *admissionregistrationv1.ValidatingAdmissionPolicyApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("validatingadmissionpolicies"),
- v1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicy"),
- func() *v1.ValidatingAdmissionPolicy { return &v1.ValidatingAdmissionPolicy{} },
- func() *v1.ValidatingAdmissionPolicyList { return &v1.ValidatingAdmissionPolicyList{} },
- func(dst, src *v1.ValidatingAdmissionPolicyList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ValidatingAdmissionPolicyList) []*v1.ValidatingAdmissionPolicy {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.ValidatingAdmissionPolicyList, items []*v1.ValidatingAdmissionPolicy) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_validatingadmissionpolicybinding.go
deleted file mode 100644
index f222663f4a..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_validatingadmissionpolicybinding.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/admissionregistration/v1"
- admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
-)
-
-// fakeValidatingAdmissionPolicyBindings implements ValidatingAdmissionPolicyBindingInterface
-type fakeValidatingAdmissionPolicyBindings struct {
- *gentype.FakeClientWithListAndApply[*v1.ValidatingAdmissionPolicyBinding, *v1.ValidatingAdmissionPolicyBindingList, *admissionregistrationv1.ValidatingAdmissionPolicyBindingApplyConfiguration]
- Fake *FakeAdmissionregistrationV1
-}
-
-func newFakeValidatingAdmissionPolicyBindings(fake *FakeAdmissionregistrationV1) typedadmissionregistrationv1.ValidatingAdmissionPolicyBindingInterface {
- return &fakeValidatingAdmissionPolicyBindings{
- gentype.NewFakeClientWithListAndApply[*v1.ValidatingAdmissionPolicyBinding, *v1.ValidatingAdmissionPolicyBindingList, *admissionregistrationv1.ValidatingAdmissionPolicyBindingApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings"),
- v1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicyBinding"),
- func() *v1.ValidatingAdmissionPolicyBinding { return &v1.ValidatingAdmissionPolicyBinding{} },
- func() *v1.ValidatingAdmissionPolicyBindingList { return &v1.ValidatingAdmissionPolicyBindingList{} },
- func(dst, src *v1.ValidatingAdmissionPolicyBindingList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ValidatingAdmissionPolicyBindingList) []*v1.ValidatingAdmissionPolicyBinding {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.ValidatingAdmissionPolicyBindingList, items []*v1.ValidatingAdmissionPolicyBinding) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_validatingwebhookconfiguration.go
deleted file mode 100644
index 947db961a4..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_validatingwebhookconfiguration.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/admissionregistration/v1"
- admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
-)
-
-// fakeValidatingWebhookConfigurations implements ValidatingWebhookConfigurationInterface
-type fakeValidatingWebhookConfigurations struct {
- *gentype.FakeClientWithListAndApply[*v1.ValidatingWebhookConfiguration, *v1.ValidatingWebhookConfigurationList, *admissionregistrationv1.ValidatingWebhookConfigurationApplyConfiguration]
- Fake *FakeAdmissionregistrationV1
-}
-
-func newFakeValidatingWebhookConfigurations(fake *FakeAdmissionregistrationV1) typedadmissionregistrationv1.ValidatingWebhookConfigurationInterface {
- return &fakeValidatingWebhookConfigurations{
- gentype.NewFakeClientWithListAndApply[*v1.ValidatingWebhookConfiguration, *v1.ValidatingWebhookConfigurationList, *admissionregistrationv1.ValidatingWebhookConfigurationApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"),
- v1.SchemeGroupVersion.WithKind("ValidatingWebhookConfiguration"),
- func() *v1.ValidatingWebhookConfiguration { return &v1.ValidatingWebhookConfiguration{} },
- func() *v1.ValidatingWebhookConfigurationList { return &v1.ValidatingWebhookConfigurationList{} },
- func(dst, src *v1.ValidatingWebhookConfigurationList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ValidatingWebhookConfigurationList) []*v1.ValidatingWebhookConfiguration {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.ValidatingWebhookConfigurationList, items []*v1.ValidatingWebhookConfiguration) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_admissionregistration_client.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_admissionregistration_client.go
deleted file mode 100644
index 3dbd9b4025..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_admissionregistration_client.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAdmissionregistrationV1alpha1 struct {
- *testing.Fake
-}
-
-func (c *FakeAdmissionregistrationV1alpha1) MutatingAdmissionPolicies() v1alpha1.MutatingAdmissionPolicyInterface {
- return newFakeMutatingAdmissionPolicies(c)
-}
-
-func (c *FakeAdmissionregistrationV1alpha1) MutatingAdmissionPolicyBindings() v1alpha1.MutatingAdmissionPolicyBindingInterface {
- return newFakeMutatingAdmissionPolicyBindings(c)
-}
-
-func (c *FakeAdmissionregistrationV1alpha1) ValidatingAdmissionPolicies() v1alpha1.ValidatingAdmissionPolicyInterface {
- return newFakeValidatingAdmissionPolicies(c)
-}
-
-func (c *FakeAdmissionregistrationV1alpha1) ValidatingAdmissionPolicyBindings() v1alpha1.ValidatingAdmissionPolicyBindingInterface {
- return newFakeValidatingAdmissionPolicyBindings(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAdmissionregistrationV1alpha1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_mutatingadmissionpolicy.go
deleted file mode 100644
index 9c07ce315c..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_mutatingadmissionpolicy.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
- admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
-)
-
-// fakeMutatingAdmissionPolicies implements MutatingAdmissionPolicyInterface
-type fakeMutatingAdmissionPolicies struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.MutatingAdmissionPolicy, *v1alpha1.MutatingAdmissionPolicyList, *admissionregistrationv1alpha1.MutatingAdmissionPolicyApplyConfiguration]
- Fake *FakeAdmissionregistrationV1alpha1
-}
-
-func newFakeMutatingAdmissionPolicies(fake *FakeAdmissionregistrationV1alpha1) typedadmissionregistrationv1alpha1.MutatingAdmissionPolicyInterface {
- return &fakeMutatingAdmissionPolicies{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.MutatingAdmissionPolicy, *v1alpha1.MutatingAdmissionPolicyList, *admissionregistrationv1alpha1.MutatingAdmissionPolicyApplyConfiguration](
- fake.Fake,
- "",
- v1alpha1.SchemeGroupVersion.WithResource("mutatingadmissionpolicies"),
- v1alpha1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicy"),
- func() *v1alpha1.MutatingAdmissionPolicy { return &v1alpha1.MutatingAdmissionPolicy{} },
- func() *v1alpha1.MutatingAdmissionPolicyList { return &v1alpha1.MutatingAdmissionPolicyList{} },
- func(dst, src *v1alpha1.MutatingAdmissionPolicyList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.MutatingAdmissionPolicyList) []*v1alpha1.MutatingAdmissionPolicy {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.MutatingAdmissionPolicyList, items []*v1alpha1.MutatingAdmissionPolicy) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_mutatingadmissionpolicybinding.go
deleted file mode 100644
index a7fbb6eb48..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_mutatingadmissionpolicybinding.go
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
- admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
-)
-
-// fakeMutatingAdmissionPolicyBindings implements MutatingAdmissionPolicyBindingInterface
-type fakeMutatingAdmissionPolicyBindings struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.MutatingAdmissionPolicyBinding, *v1alpha1.MutatingAdmissionPolicyBindingList, *admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingApplyConfiguration]
- Fake *FakeAdmissionregistrationV1alpha1
-}
-
-func newFakeMutatingAdmissionPolicyBindings(fake *FakeAdmissionregistrationV1alpha1) typedadmissionregistrationv1alpha1.MutatingAdmissionPolicyBindingInterface {
- return &fakeMutatingAdmissionPolicyBindings{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.MutatingAdmissionPolicyBinding, *v1alpha1.MutatingAdmissionPolicyBindingList, *admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingApplyConfiguration](
- fake.Fake,
- "",
- v1alpha1.SchemeGroupVersion.WithResource("mutatingadmissionpolicybindings"),
- v1alpha1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBinding"),
- func() *v1alpha1.MutatingAdmissionPolicyBinding { return &v1alpha1.MutatingAdmissionPolicyBinding{} },
- func() *v1alpha1.MutatingAdmissionPolicyBindingList {
- return &v1alpha1.MutatingAdmissionPolicyBindingList{}
- },
- func(dst, src *v1alpha1.MutatingAdmissionPolicyBindingList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.MutatingAdmissionPolicyBindingList) []*v1alpha1.MutatingAdmissionPolicyBinding {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.MutatingAdmissionPolicyBindingList, items []*v1alpha1.MutatingAdmissionPolicyBinding) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_validatingadmissionpolicy.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_validatingadmissionpolicy.go
deleted file mode 100644
index aad223e15f..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_validatingadmissionpolicy.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
- admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
-)
-
-// fakeValidatingAdmissionPolicies implements ValidatingAdmissionPolicyInterface
-type fakeValidatingAdmissionPolicies struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.ValidatingAdmissionPolicy, *v1alpha1.ValidatingAdmissionPolicyList, *admissionregistrationv1alpha1.ValidatingAdmissionPolicyApplyConfiguration]
- Fake *FakeAdmissionregistrationV1alpha1
-}
-
-func newFakeValidatingAdmissionPolicies(fake *FakeAdmissionregistrationV1alpha1) typedadmissionregistrationv1alpha1.ValidatingAdmissionPolicyInterface {
- return &fakeValidatingAdmissionPolicies{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.ValidatingAdmissionPolicy, *v1alpha1.ValidatingAdmissionPolicyList, *admissionregistrationv1alpha1.ValidatingAdmissionPolicyApplyConfiguration](
- fake.Fake,
- "",
- v1alpha1.SchemeGroupVersion.WithResource("validatingadmissionpolicies"),
- v1alpha1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicy"),
- func() *v1alpha1.ValidatingAdmissionPolicy { return &v1alpha1.ValidatingAdmissionPolicy{} },
- func() *v1alpha1.ValidatingAdmissionPolicyList { return &v1alpha1.ValidatingAdmissionPolicyList{} },
- func(dst, src *v1alpha1.ValidatingAdmissionPolicyList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.ValidatingAdmissionPolicyList) []*v1alpha1.ValidatingAdmissionPolicy {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.ValidatingAdmissionPolicyList, items []*v1alpha1.ValidatingAdmissionPolicy) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_validatingadmissionpolicybinding.go
deleted file mode 100644
index a22a3f16bc..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake/fake_validatingadmissionpolicybinding.go
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
- admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
-)
-
-// fakeValidatingAdmissionPolicyBindings implements ValidatingAdmissionPolicyBindingInterface
-type fakeValidatingAdmissionPolicyBindings struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.ValidatingAdmissionPolicyBinding, *v1alpha1.ValidatingAdmissionPolicyBindingList, *admissionregistrationv1alpha1.ValidatingAdmissionPolicyBindingApplyConfiguration]
- Fake *FakeAdmissionregistrationV1alpha1
-}
-
-func newFakeValidatingAdmissionPolicyBindings(fake *FakeAdmissionregistrationV1alpha1) typedadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBindingInterface {
- return &fakeValidatingAdmissionPolicyBindings{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.ValidatingAdmissionPolicyBinding, *v1alpha1.ValidatingAdmissionPolicyBindingList, *admissionregistrationv1alpha1.ValidatingAdmissionPolicyBindingApplyConfiguration](
- fake.Fake,
- "",
- v1alpha1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings"),
- v1alpha1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicyBinding"),
- func() *v1alpha1.ValidatingAdmissionPolicyBinding { return &v1alpha1.ValidatingAdmissionPolicyBinding{} },
- func() *v1alpha1.ValidatingAdmissionPolicyBindingList {
- return &v1alpha1.ValidatingAdmissionPolicyBindingList{}
- },
- func(dst, src *v1alpha1.ValidatingAdmissionPolicyBindingList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.ValidatingAdmissionPolicyBindingList) []*v1alpha1.ValidatingAdmissionPolicyBinding {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.ValidatingAdmissionPolicyBindingList, items []*v1alpha1.ValidatingAdmissionPolicyBinding) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_admissionregistration_client.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_admissionregistration_client.go
deleted file mode 100644
index 6c90c3dbeb..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_admissionregistration_client.go
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAdmissionregistrationV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeAdmissionregistrationV1beta1) MutatingAdmissionPolicies() v1beta1.MutatingAdmissionPolicyInterface {
- return newFakeMutatingAdmissionPolicies(c)
-}
-
-func (c *FakeAdmissionregistrationV1beta1) MutatingAdmissionPolicyBindings() v1beta1.MutatingAdmissionPolicyBindingInterface {
- return newFakeMutatingAdmissionPolicyBindings(c)
-}
-
-func (c *FakeAdmissionregistrationV1beta1) MutatingWebhookConfigurations() v1beta1.MutatingWebhookConfigurationInterface {
- return newFakeMutatingWebhookConfigurations(c)
-}
-
-func (c *FakeAdmissionregistrationV1beta1) ValidatingAdmissionPolicies() v1beta1.ValidatingAdmissionPolicyInterface {
- return newFakeValidatingAdmissionPolicies(c)
-}
-
-func (c *FakeAdmissionregistrationV1beta1) ValidatingAdmissionPolicyBindings() v1beta1.ValidatingAdmissionPolicyBindingInterface {
- return newFakeValidatingAdmissionPolicyBindings(c)
-}
-
-func (c *FakeAdmissionregistrationV1beta1) ValidatingWebhookConfigurations() v1beta1.ValidatingWebhookConfigurationInterface {
- return newFakeValidatingWebhookConfigurations(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAdmissionregistrationV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_mutatingadmissionpolicy.go
deleted file mode 100644
index ec7f9fb65b..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_mutatingadmissionpolicy.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/admissionregistration/v1beta1"
- admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
-)
-
-// fakeMutatingAdmissionPolicies implements MutatingAdmissionPolicyInterface
-type fakeMutatingAdmissionPolicies struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.MutatingAdmissionPolicy, *v1beta1.MutatingAdmissionPolicyList, *admissionregistrationv1beta1.MutatingAdmissionPolicyApplyConfiguration]
- Fake *FakeAdmissionregistrationV1beta1
-}
-
-func newFakeMutatingAdmissionPolicies(fake *FakeAdmissionregistrationV1beta1) typedadmissionregistrationv1beta1.MutatingAdmissionPolicyInterface {
- return &fakeMutatingAdmissionPolicies{
- gentype.NewFakeClientWithListAndApply[*v1beta1.MutatingAdmissionPolicy, *v1beta1.MutatingAdmissionPolicyList, *admissionregistrationv1beta1.MutatingAdmissionPolicyApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("mutatingadmissionpolicies"),
- v1beta1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicy"),
- func() *v1beta1.MutatingAdmissionPolicy { return &v1beta1.MutatingAdmissionPolicy{} },
- func() *v1beta1.MutatingAdmissionPolicyList { return &v1beta1.MutatingAdmissionPolicyList{} },
- func(dst, src *v1beta1.MutatingAdmissionPolicyList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.MutatingAdmissionPolicyList) []*v1beta1.MutatingAdmissionPolicy {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.MutatingAdmissionPolicyList, items []*v1beta1.MutatingAdmissionPolicy) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_mutatingadmissionpolicybinding.go
deleted file mode 100644
index 5b2f452fe1..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_mutatingadmissionpolicybinding.go
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/admissionregistration/v1beta1"
- admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
-)
-
-// fakeMutatingAdmissionPolicyBindings implements MutatingAdmissionPolicyBindingInterface
-type fakeMutatingAdmissionPolicyBindings struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.MutatingAdmissionPolicyBinding, *v1beta1.MutatingAdmissionPolicyBindingList, *admissionregistrationv1beta1.MutatingAdmissionPolicyBindingApplyConfiguration]
- Fake *FakeAdmissionregistrationV1beta1
-}
-
-func newFakeMutatingAdmissionPolicyBindings(fake *FakeAdmissionregistrationV1beta1) typedadmissionregistrationv1beta1.MutatingAdmissionPolicyBindingInterface {
- return &fakeMutatingAdmissionPolicyBindings{
- gentype.NewFakeClientWithListAndApply[*v1beta1.MutatingAdmissionPolicyBinding, *v1beta1.MutatingAdmissionPolicyBindingList, *admissionregistrationv1beta1.MutatingAdmissionPolicyBindingApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("mutatingadmissionpolicybindings"),
- v1beta1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBinding"),
- func() *v1beta1.MutatingAdmissionPolicyBinding { return &v1beta1.MutatingAdmissionPolicyBinding{} },
- func() *v1beta1.MutatingAdmissionPolicyBindingList {
- return &v1beta1.MutatingAdmissionPolicyBindingList{}
- },
- func(dst, src *v1beta1.MutatingAdmissionPolicyBindingList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.MutatingAdmissionPolicyBindingList) []*v1beta1.MutatingAdmissionPolicyBinding {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.MutatingAdmissionPolicyBindingList, items []*v1beta1.MutatingAdmissionPolicyBinding) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_mutatingwebhookconfiguration.go
deleted file mode 100644
index c55b2e4f68..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_mutatingwebhookconfiguration.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/admissionregistration/v1beta1"
- admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
-)
-
-// fakeMutatingWebhookConfigurations implements MutatingWebhookConfigurationInterface
-type fakeMutatingWebhookConfigurations struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.MutatingWebhookConfiguration, *v1beta1.MutatingWebhookConfigurationList, *admissionregistrationv1beta1.MutatingWebhookConfigurationApplyConfiguration]
- Fake *FakeAdmissionregistrationV1beta1
-}
-
-func newFakeMutatingWebhookConfigurations(fake *FakeAdmissionregistrationV1beta1) typedadmissionregistrationv1beta1.MutatingWebhookConfigurationInterface {
- return &fakeMutatingWebhookConfigurations{
- gentype.NewFakeClientWithListAndApply[*v1beta1.MutatingWebhookConfiguration, *v1beta1.MutatingWebhookConfigurationList, *admissionregistrationv1beta1.MutatingWebhookConfigurationApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"),
- v1beta1.SchemeGroupVersion.WithKind("MutatingWebhookConfiguration"),
- func() *v1beta1.MutatingWebhookConfiguration { return &v1beta1.MutatingWebhookConfiguration{} },
- func() *v1beta1.MutatingWebhookConfigurationList { return &v1beta1.MutatingWebhookConfigurationList{} },
- func(dst, src *v1beta1.MutatingWebhookConfigurationList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.MutatingWebhookConfigurationList) []*v1beta1.MutatingWebhookConfiguration {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.MutatingWebhookConfigurationList, items []*v1beta1.MutatingWebhookConfiguration) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_validatingadmissionpolicy.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_validatingadmissionpolicy.go
deleted file mode 100644
index e98a5655d5..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_validatingadmissionpolicy.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/admissionregistration/v1beta1"
- admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
-)
-
-// fakeValidatingAdmissionPolicies implements ValidatingAdmissionPolicyInterface
-type fakeValidatingAdmissionPolicies struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.ValidatingAdmissionPolicy, *v1beta1.ValidatingAdmissionPolicyList, *admissionregistrationv1beta1.ValidatingAdmissionPolicyApplyConfiguration]
- Fake *FakeAdmissionregistrationV1beta1
-}
-
-func newFakeValidatingAdmissionPolicies(fake *FakeAdmissionregistrationV1beta1) typedadmissionregistrationv1beta1.ValidatingAdmissionPolicyInterface {
- return &fakeValidatingAdmissionPolicies{
- gentype.NewFakeClientWithListAndApply[*v1beta1.ValidatingAdmissionPolicy, *v1beta1.ValidatingAdmissionPolicyList, *admissionregistrationv1beta1.ValidatingAdmissionPolicyApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("validatingadmissionpolicies"),
- v1beta1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicy"),
- func() *v1beta1.ValidatingAdmissionPolicy { return &v1beta1.ValidatingAdmissionPolicy{} },
- func() *v1beta1.ValidatingAdmissionPolicyList { return &v1beta1.ValidatingAdmissionPolicyList{} },
- func(dst, src *v1beta1.ValidatingAdmissionPolicyList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.ValidatingAdmissionPolicyList) []*v1beta1.ValidatingAdmissionPolicy {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.ValidatingAdmissionPolicyList, items []*v1beta1.ValidatingAdmissionPolicy) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_validatingadmissionpolicybinding.go
deleted file mode 100644
index 3f0f865e9e..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_validatingadmissionpolicybinding.go
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/admissionregistration/v1beta1"
- admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
-)
-
-// fakeValidatingAdmissionPolicyBindings implements ValidatingAdmissionPolicyBindingInterface
-type fakeValidatingAdmissionPolicyBindings struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.ValidatingAdmissionPolicyBinding, *v1beta1.ValidatingAdmissionPolicyBindingList, *admissionregistrationv1beta1.ValidatingAdmissionPolicyBindingApplyConfiguration]
- Fake *FakeAdmissionregistrationV1beta1
-}
-
-func newFakeValidatingAdmissionPolicyBindings(fake *FakeAdmissionregistrationV1beta1) typedadmissionregistrationv1beta1.ValidatingAdmissionPolicyBindingInterface {
- return &fakeValidatingAdmissionPolicyBindings{
- gentype.NewFakeClientWithListAndApply[*v1beta1.ValidatingAdmissionPolicyBinding, *v1beta1.ValidatingAdmissionPolicyBindingList, *admissionregistrationv1beta1.ValidatingAdmissionPolicyBindingApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings"),
- v1beta1.SchemeGroupVersion.WithKind("ValidatingAdmissionPolicyBinding"),
- func() *v1beta1.ValidatingAdmissionPolicyBinding { return &v1beta1.ValidatingAdmissionPolicyBinding{} },
- func() *v1beta1.ValidatingAdmissionPolicyBindingList {
- return &v1beta1.ValidatingAdmissionPolicyBindingList{}
- },
- func(dst, src *v1beta1.ValidatingAdmissionPolicyBindingList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.ValidatingAdmissionPolicyBindingList) []*v1beta1.ValidatingAdmissionPolicyBinding {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.ValidatingAdmissionPolicyBindingList, items []*v1beta1.ValidatingAdmissionPolicyBinding) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_validatingwebhookconfiguration.go
deleted file mode 100644
index 9a83013729..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_validatingwebhookconfiguration.go
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/admissionregistration/v1beta1"
- admissionregistrationv1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
-)
-
-// fakeValidatingWebhookConfigurations implements ValidatingWebhookConfigurationInterface
-type fakeValidatingWebhookConfigurations struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.ValidatingWebhookConfiguration, *v1beta1.ValidatingWebhookConfigurationList, *admissionregistrationv1beta1.ValidatingWebhookConfigurationApplyConfiguration]
- Fake *FakeAdmissionregistrationV1beta1
-}
-
-func newFakeValidatingWebhookConfigurations(fake *FakeAdmissionregistrationV1beta1) typedadmissionregistrationv1beta1.ValidatingWebhookConfigurationInterface {
- return &fakeValidatingWebhookConfigurations{
- gentype.NewFakeClientWithListAndApply[*v1beta1.ValidatingWebhookConfiguration, *v1beta1.ValidatingWebhookConfigurationList, *admissionregistrationv1beta1.ValidatingWebhookConfigurationApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"),
- v1beta1.SchemeGroupVersion.WithKind("ValidatingWebhookConfiguration"),
- func() *v1beta1.ValidatingWebhookConfiguration { return &v1beta1.ValidatingWebhookConfiguration{} },
- func() *v1beta1.ValidatingWebhookConfigurationList {
- return &v1beta1.ValidatingWebhookConfigurationList{}
- },
- func(dst, src *v1beta1.ValidatingWebhookConfigurationList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.ValidatingWebhookConfigurationList) []*v1beta1.ValidatingWebhookConfiguration {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.ValidatingWebhookConfigurationList, items []*v1beta1.ValidatingWebhookConfiguration) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/fake/fake_apiserverinternal_client.go b/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/fake/fake_apiserverinternal_client.go
deleted file mode 100644
index f4f4a78dd9..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/fake/fake_apiserverinternal_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeInternalV1alpha1 struct {
- *testing.Fake
-}
-
-func (c *FakeInternalV1alpha1) StorageVersions() v1alpha1.StorageVersionInterface {
- return newFakeStorageVersions(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeInternalV1alpha1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/fake/fake_storageversion.go b/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/fake/fake_storageversion.go
deleted file mode 100644
index 785c067f8f..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/fake/fake_storageversion.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/apiserverinternal/v1alpha1"
- apiserverinternalv1alpha1 "k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedapiserverinternalv1alpha1 "k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1"
-)
-
-// fakeStorageVersions implements StorageVersionInterface
-type fakeStorageVersions struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.StorageVersion, *v1alpha1.StorageVersionList, *apiserverinternalv1alpha1.StorageVersionApplyConfiguration]
- Fake *FakeInternalV1alpha1
-}
-
-func newFakeStorageVersions(fake *FakeInternalV1alpha1) typedapiserverinternalv1alpha1.StorageVersionInterface {
- return &fakeStorageVersions{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.StorageVersion, *v1alpha1.StorageVersionList, *apiserverinternalv1alpha1.StorageVersionApplyConfiguration](
- fake.Fake,
- "",
- v1alpha1.SchemeGroupVersion.WithResource("storageversions"),
- v1alpha1.SchemeGroupVersion.WithKind("StorageVersion"),
- func() *v1alpha1.StorageVersion { return &v1alpha1.StorageVersion{} },
- func() *v1alpha1.StorageVersionList { return &v1alpha1.StorageVersionList{} },
- func(dst, src *v1alpha1.StorageVersionList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.StorageVersionList) []*v1alpha1.StorageVersion {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.StorageVersionList, items []*v1alpha1.StorageVersion) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_apps_client.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_apps_client.go
deleted file mode 100644
index 76949dbb59..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_apps_client.go
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/apps/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAppsV1 struct {
- *testing.Fake
-}
-
-func (c *FakeAppsV1) ControllerRevisions(namespace string) v1.ControllerRevisionInterface {
- return newFakeControllerRevisions(c, namespace)
-}
-
-func (c *FakeAppsV1) DaemonSets(namespace string) v1.DaemonSetInterface {
- return newFakeDaemonSets(c, namespace)
-}
-
-func (c *FakeAppsV1) Deployments(namespace string) v1.DeploymentInterface {
- return newFakeDeployments(c, namespace)
-}
-
-func (c *FakeAppsV1) ReplicaSets(namespace string) v1.ReplicaSetInterface {
- return newFakeReplicaSets(c, namespace)
-}
-
-func (c *FakeAppsV1) StatefulSets(namespace string) v1.StatefulSetInterface {
- return newFakeStatefulSets(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAppsV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_controllerrevision.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_controllerrevision.go
deleted file mode 100644
index 92a338a5cd..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_controllerrevision.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/apps/v1"
- appsv1 "k8s.io/client-go/applyconfigurations/apps/v1"
- gentype "k8s.io/client-go/gentype"
- typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
-)
-
-// fakeControllerRevisions implements ControllerRevisionInterface
-type fakeControllerRevisions struct {
- *gentype.FakeClientWithListAndApply[*v1.ControllerRevision, *v1.ControllerRevisionList, *appsv1.ControllerRevisionApplyConfiguration]
- Fake *FakeAppsV1
-}
-
-func newFakeControllerRevisions(fake *FakeAppsV1, namespace string) typedappsv1.ControllerRevisionInterface {
- return &fakeControllerRevisions{
- gentype.NewFakeClientWithListAndApply[*v1.ControllerRevision, *v1.ControllerRevisionList, *appsv1.ControllerRevisionApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("controllerrevisions"),
- v1.SchemeGroupVersion.WithKind("ControllerRevision"),
- func() *v1.ControllerRevision { return &v1.ControllerRevision{} },
- func() *v1.ControllerRevisionList { return &v1.ControllerRevisionList{} },
- func(dst, src *v1.ControllerRevisionList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ControllerRevisionList) []*v1.ControllerRevision {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.ControllerRevisionList, items []*v1.ControllerRevision) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_daemonset.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_daemonset.go
deleted file mode 100644
index b1b47c4014..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_daemonset.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/apps/v1"
- appsv1 "k8s.io/client-go/applyconfigurations/apps/v1"
- gentype "k8s.io/client-go/gentype"
- typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
-)
-
-// fakeDaemonSets implements DaemonSetInterface
-type fakeDaemonSets struct {
- *gentype.FakeClientWithListAndApply[*v1.DaemonSet, *v1.DaemonSetList, *appsv1.DaemonSetApplyConfiguration]
- Fake *FakeAppsV1
-}
-
-func newFakeDaemonSets(fake *FakeAppsV1, namespace string) typedappsv1.DaemonSetInterface {
- return &fakeDaemonSets{
- gentype.NewFakeClientWithListAndApply[*v1.DaemonSet, *v1.DaemonSetList, *appsv1.DaemonSetApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("daemonsets"),
- v1.SchemeGroupVersion.WithKind("DaemonSet"),
- func() *v1.DaemonSet { return &v1.DaemonSet{} },
- func() *v1.DaemonSetList { return &v1.DaemonSetList{} },
- func(dst, src *v1.DaemonSetList) { dst.ListMeta = src.ListMeta },
- func(list *v1.DaemonSetList) []*v1.DaemonSet { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.DaemonSetList, items []*v1.DaemonSet) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_deployment.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_deployment.go
deleted file mode 100644
index 7d7ae0ddbf..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_deployment.go
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
- json "encoding/json"
- fmt "fmt"
-
- v1 "k8s.io/api/apps/v1"
- autoscalingv1 "k8s.io/api/autoscaling/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- appsv1 "k8s.io/client-go/applyconfigurations/apps/v1"
- applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1"
- gentype "k8s.io/client-go/gentype"
- typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
- testing "k8s.io/client-go/testing"
-)
-
-// fakeDeployments implements DeploymentInterface
-type fakeDeployments struct {
- *gentype.FakeClientWithListAndApply[*v1.Deployment, *v1.DeploymentList, *appsv1.DeploymentApplyConfiguration]
- Fake *FakeAppsV1
-}
-
-func newFakeDeployments(fake *FakeAppsV1, namespace string) typedappsv1.DeploymentInterface {
- return &fakeDeployments{
- gentype.NewFakeClientWithListAndApply[*v1.Deployment, *v1.DeploymentList, *appsv1.DeploymentApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("deployments"),
- v1.SchemeGroupVersion.WithKind("Deployment"),
- func() *v1.Deployment { return &v1.Deployment{} },
- func() *v1.DeploymentList { return &v1.DeploymentList{} },
- func(dst, src *v1.DeploymentList) { dst.ListMeta = src.ListMeta },
- func(list *v1.DeploymentList) []*v1.Deployment { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.DeploymentList, items []*v1.Deployment) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
-
-// GetScale takes name of the deployment, and returns the corresponding scale object, and an error if there is any.
-func (c *fakeDeployments) GetScale(ctx context.Context, deploymentName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
- emptyResult := &autoscalingv1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", deploymentName, options), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*autoscalingv1.Scale), err
-}
-
-// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
-func (c *fakeDeployments) UpdateScale(ctx context.Context, deploymentName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
- emptyResult := &autoscalingv1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &autoscalingv1.Scale{})
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*autoscalingv1.Scale), err
-}
-
-// ApplyScale takes top resource name and the apply declarative configuration for scale,
-// applies it and returns the applied scale, and an error, if there is any.
-func (c *fakeDeployments) ApplyScale(ctx context.Context, deploymentName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) {
- if scale == nil {
- return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
- }
- data, err := json.Marshal(scale)
- if err != nil {
- return nil, err
- }
- emptyResult := &autoscalingv1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceActionWithOptions(c.Resource(), c.Namespace(), deploymentName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*autoscalingv1.Scale), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_replicaset.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_replicaset.go
deleted file mode 100644
index 691818ec74..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_replicaset.go
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
- json "encoding/json"
- fmt "fmt"
-
- v1 "k8s.io/api/apps/v1"
- autoscalingv1 "k8s.io/api/autoscaling/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- appsv1 "k8s.io/client-go/applyconfigurations/apps/v1"
- applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1"
- gentype "k8s.io/client-go/gentype"
- typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
- testing "k8s.io/client-go/testing"
-)
-
-// fakeReplicaSets implements ReplicaSetInterface
-type fakeReplicaSets struct {
- *gentype.FakeClientWithListAndApply[*v1.ReplicaSet, *v1.ReplicaSetList, *appsv1.ReplicaSetApplyConfiguration]
- Fake *FakeAppsV1
-}
-
-func newFakeReplicaSets(fake *FakeAppsV1, namespace string) typedappsv1.ReplicaSetInterface {
- return &fakeReplicaSets{
- gentype.NewFakeClientWithListAndApply[*v1.ReplicaSet, *v1.ReplicaSetList, *appsv1.ReplicaSetApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("replicasets"),
- v1.SchemeGroupVersion.WithKind("ReplicaSet"),
- func() *v1.ReplicaSet { return &v1.ReplicaSet{} },
- func() *v1.ReplicaSetList { return &v1.ReplicaSetList{} },
- func(dst, src *v1.ReplicaSetList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ReplicaSetList) []*v1.ReplicaSet { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.ReplicaSetList, items []*v1.ReplicaSet) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
-
-// GetScale takes name of the replicaSet, and returns the corresponding scale object, and an error if there is any.
-func (c *fakeReplicaSets) GetScale(ctx context.Context, replicaSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
- emptyResult := &autoscalingv1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", replicaSetName, options), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*autoscalingv1.Scale), err
-}
-
-// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
-func (c *fakeReplicaSets) UpdateScale(ctx context.Context, replicaSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
- emptyResult := &autoscalingv1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &autoscalingv1.Scale{})
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*autoscalingv1.Scale), err
-}
-
-// ApplyScale takes top resource name and the apply declarative configuration for scale,
-// applies it and returns the applied scale, and an error, if there is any.
-func (c *fakeReplicaSets) ApplyScale(ctx context.Context, replicaSetName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) {
- if scale == nil {
- return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
- }
- data, err := json.Marshal(scale)
- if err != nil {
- return nil, err
- }
- emptyResult := &autoscalingv1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceActionWithOptions(c.Resource(), c.Namespace(), replicaSetName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*autoscalingv1.Scale), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_statefulset.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_statefulset.go
deleted file mode 100644
index de3a19da1f..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_statefulset.go
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
- json "encoding/json"
- fmt "fmt"
-
- v1 "k8s.io/api/apps/v1"
- autoscalingv1 "k8s.io/api/autoscaling/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- appsv1 "k8s.io/client-go/applyconfigurations/apps/v1"
- applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1"
- gentype "k8s.io/client-go/gentype"
- typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
- testing "k8s.io/client-go/testing"
-)
-
-// fakeStatefulSets implements StatefulSetInterface
-type fakeStatefulSets struct {
- *gentype.FakeClientWithListAndApply[*v1.StatefulSet, *v1.StatefulSetList, *appsv1.StatefulSetApplyConfiguration]
- Fake *FakeAppsV1
-}
-
-func newFakeStatefulSets(fake *FakeAppsV1, namespace string) typedappsv1.StatefulSetInterface {
- return &fakeStatefulSets{
- gentype.NewFakeClientWithListAndApply[*v1.StatefulSet, *v1.StatefulSetList, *appsv1.StatefulSetApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("statefulsets"),
- v1.SchemeGroupVersion.WithKind("StatefulSet"),
- func() *v1.StatefulSet { return &v1.StatefulSet{} },
- func() *v1.StatefulSetList { return &v1.StatefulSetList{} },
- func(dst, src *v1.StatefulSetList) { dst.ListMeta = src.ListMeta },
- func(list *v1.StatefulSetList) []*v1.StatefulSet { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.StatefulSetList, items []*v1.StatefulSet) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
-
-// GetScale takes name of the statefulSet, and returns the corresponding scale object, and an error if there is any.
-func (c *fakeStatefulSets) GetScale(ctx context.Context, statefulSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
- emptyResult := &autoscalingv1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", statefulSetName, options), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*autoscalingv1.Scale), err
-}
-
-// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
-func (c *fakeStatefulSets) UpdateScale(ctx context.Context, statefulSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
- emptyResult := &autoscalingv1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &autoscalingv1.Scale{})
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*autoscalingv1.Scale), err
-}
-
-// ApplyScale takes top resource name and the apply declarative configuration for scale,
-// applies it and returns the applied scale, and an error, if there is any.
-func (c *fakeStatefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) {
- if scale == nil {
- return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
- }
- data, err := json.Marshal(scale)
- if err != nil {
- return nil, err
- }
- emptyResult := &autoscalingv1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceActionWithOptions(c.Resource(), c.Namespace(), statefulSetName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*autoscalingv1.Scale), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_apps_client.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_apps_client.go
deleted file mode 100644
index ad3d0d6d37..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_apps_client.go
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAppsV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeAppsV1beta1) ControllerRevisions(namespace string) v1beta1.ControllerRevisionInterface {
- return newFakeControllerRevisions(c, namespace)
-}
-
-func (c *FakeAppsV1beta1) Deployments(namespace string) v1beta1.DeploymentInterface {
- return newFakeDeployments(c, namespace)
-}
-
-func (c *FakeAppsV1beta1) StatefulSets(namespace string) v1beta1.StatefulSetInterface {
- return newFakeStatefulSets(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAppsV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_controllerrevision.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_controllerrevision.go
deleted file mode 100644
index fd075b32cd..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_controllerrevision.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/apps/v1beta1"
- appsv1beta1 "k8s.io/client-go/applyconfigurations/apps/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
-)
-
-// fakeControllerRevisions implements ControllerRevisionInterface
-type fakeControllerRevisions struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.ControllerRevision, *v1beta1.ControllerRevisionList, *appsv1beta1.ControllerRevisionApplyConfiguration]
- Fake *FakeAppsV1beta1
-}
-
-func newFakeControllerRevisions(fake *FakeAppsV1beta1, namespace string) typedappsv1beta1.ControllerRevisionInterface {
- return &fakeControllerRevisions{
- gentype.NewFakeClientWithListAndApply[*v1beta1.ControllerRevision, *v1beta1.ControllerRevisionList, *appsv1beta1.ControllerRevisionApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("controllerrevisions"),
- v1beta1.SchemeGroupVersion.WithKind("ControllerRevision"),
- func() *v1beta1.ControllerRevision { return &v1beta1.ControllerRevision{} },
- func() *v1beta1.ControllerRevisionList { return &v1beta1.ControllerRevisionList{} },
- func(dst, src *v1beta1.ControllerRevisionList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.ControllerRevisionList) []*v1beta1.ControllerRevision {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.ControllerRevisionList, items []*v1beta1.ControllerRevision) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_deployment.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_deployment.go
deleted file mode 100644
index edef6cb051..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_deployment.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/apps/v1beta1"
- appsv1beta1 "k8s.io/client-go/applyconfigurations/apps/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
-)
-
-// fakeDeployments implements DeploymentInterface
-type fakeDeployments struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.Deployment, *v1beta1.DeploymentList, *appsv1beta1.DeploymentApplyConfiguration]
- Fake *FakeAppsV1beta1
-}
-
-func newFakeDeployments(fake *FakeAppsV1beta1, namespace string) typedappsv1beta1.DeploymentInterface {
- return &fakeDeployments{
- gentype.NewFakeClientWithListAndApply[*v1beta1.Deployment, *v1beta1.DeploymentList, *appsv1beta1.DeploymentApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("deployments"),
- v1beta1.SchemeGroupVersion.WithKind("Deployment"),
- func() *v1beta1.Deployment { return &v1beta1.Deployment{} },
- func() *v1beta1.DeploymentList { return &v1beta1.DeploymentList{} },
- func(dst, src *v1beta1.DeploymentList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.DeploymentList) []*v1beta1.Deployment { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.DeploymentList, items []*v1beta1.Deployment) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_statefulset.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_statefulset.go
deleted file mode 100644
index e6a87f5903..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/fake_statefulset.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/apps/v1beta1"
- appsv1beta1 "k8s.io/client-go/applyconfigurations/apps/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
-)
-
-// fakeStatefulSets implements StatefulSetInterface
-type fakeStatefulSets struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.StatefulSet, *v1beta1.StatefulSetList, *appsv1beta1.StatefulSetApplyConfiguration]
- Fake *FakeAppsV1beta1
-}
-
-func newFakeStatefulSets(fake *FakeAppsV1beta1, namespace string) typedappsv1beta1.StatefulSetInterface {
- return &fakeStatefulSets{
- gentype.NewFakeClientWithListAndApply[*v1beta1.StatefulSet, *v1beta1.StatefulSetList, *appsv1beta1.StatefulSetApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("statefulsets"),
- v1beta1.SchemeGroupVersion.WithKind("StatefulSet"),
- func() *v1beta1.StatefulSet { return &v1beta1.StatefulSet{} },
- func() *v1beta1.StatefulSetList { return &v1beta1.StatefulSetList{} },
- func(dst, src *v1beta1.StatefulSetList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.StatefulSetList) []*v1beta1.StatefulSet { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.StatefulSetList, items []*v1beta1.StatefulSet) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_apps_client.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_apps_client.go
deleted file mode 100644
index 2a5c3ed98d..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_apps_client.go
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAppsV1beta2 struct {
- *testing.Fake
-}
-
-func (c *FakeAppsV1beta2) ControllerRevisions(namespace string) v1beta2.ControllerRevisionInterface {
- return newFakeControllerRevisions(c, namespace)
-}
-
-func (c *FakeAppsV1beta2) DaemonSets(namespace string) v1beta2.DaemonSetInterface {
- return newFakeDaemonSets(c, namespace)
-}
-
-func (c *FakeAppsV1beta2) Deployments(namespace string) v1beta2.DeploymentInterface {
- return newFakeDeployments(c, namespace)
-}
-
-func (c *FakeAppsV1beta2) ReplicaSets(namespace string) v1beta2.ReplicaSetInterface {
- return newFakeReplicaSets(c, namespace)
-}
-
-func (c *FakeAppsV1beta2) StatefulSets(namespace string) v1beta2.StatefulSetInterface {
- return newFakeStatefulSets(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAppsV1beta2) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_controllerrevision.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_controllerrevision.go
deleted file mode 100644
index f9de53c168..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_controllerrevision.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/api/apps/v1beta2"
- appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2"
- gentype "k8s.io/client-go/gentype"
- typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
-)
-
-// fakeControllerRevisions implements ControllerRevisionInterface
-type fakeControllerRevisions struct {
- *gentype.FakeClientWithListAndApply[*v1beta2.ControllerRevision, *v1beta2.ControllerRevisionList, *appsv1beta2.ControllerRevisionApplyConfiguration]
- Fake *FakeAppsV1beta2
-}
-
-func newFakeControllerRevisions(fake *FakeAppsV1beta2, namespace string) typedappsv1beta2.ControllerRevisionInterface {
- return &fakeControllerRevisions{
- gentype.NewFakeClientWithListAndApply[*v1beta2.ControllerRevision, *v1beta2.ControllerRevisionList, *appsv1beta2.ControllerRevisionApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta2.SchemeGroupVersion.WithResource("controllerrevisions"),
- v1beta2.SchemeGroupVersion.WithKind("ControllerRevision"),
- func() *v1beta2.ControllerRevision { return &v1beta2.ControllerRevision{} },
- func() *v1beta2.ControllerRevisionList { return &v1beta2.ControllerRevisionList{} },
- func(dst, src *v1beta2.ControllerRevisionList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta2.ControllerRevisionList) []*v1beta2.ControllerRevision {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta2.ControllerRevisionList, items []*v1beta2.ControllerRevision) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_daemonset.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_daemonset.go
deleted file mode 100644
index e6ed84e2d8..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_daemonset.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/api/apps/v1beta2"
- appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2"
- gentype "k8s.io/client-go/gentype"
- typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
-)
-
-// fakeDaemonSets implements DaemonSetInterface
-type fakeDaemonSets struct {
- *gentype.FakeClientWithListAndApply[*v1beta2.DaemonSet, *v1beta2.DaemonSetList, *appsv1beta2.DaemonSetApplyConfiguration]
- Fake *FakeAppsV1beta2
-}
-
-func newFakeDaemonSets(fake *FakeAppsV1beta2, namespace string) typedappsv1beta2.DaemonSetInterface {
- return &fakeDaemonSets{
- gentype.NewFakeClientWithListAndApply[*v1beta2.DaemonSet, *v1beta2.DaemonSetList, *appsv1beta2.DaemonSetApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta2.SchemeGroupVersion.WithResource("daemonsets"),
- v1beta2.SchemeGroupVersion.WithKind("DaemonSet"),
- func() *v1beta2.DaemonSet { return &v1beta2.DaemonSet{} },
- func() *v1beta2.DaemonSetList { return &v1beta2.DaemonSetList{} },
- func(dst, src *v1beta2.DaemonSetList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta2.DaemonSetList) []*v1beta2.DaemonSet { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta2.DaemonSetList, items []*v1beta2.DaemonSet) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_deployment.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_deployment.go
deleted file mode 100644
index b240a7d55f..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_deployment.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/api/apps/v1beta2"
- appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2"
- gentype "k8s.io/client-go/gentype"
- typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
-)
-
-// fakeDeployments implements DeploymentInterface
-type fakeDeployments struct {
- *gentype.FakeClientWithListAndApply[*v1beta2.Deployment, *v1beta2.DeploymentList, *appsv1beta2.DeploymentApplyConfiguration]
- Fake *FakeAppsV1beta2
-}
-
-func newFakeDeployments(fake *FakeAppsV1beta2, namespace string) typedappsv1beta2.DeploymentInterface {
- return &fakeDeployments{
- gentype.NewFakeClientWithListAndApply[*v1beta2.Deployment, *v1beta2.DeploymentList, *appsv1beta2.DeploymentApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta2.SchemeGroupVersion.WithResource("deployments"),
- v1beta2.SchemeGroupVersion.WithKind("Deployment"),
- func() *v1beta2.Deployment { return &v1beta2.Deployment{} },
- func() *v1beta2.DeploymentList { return &v1beta2.DeploymentList{} },
- func(dst, src *v1beta2.DeploymentList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta2.DeploymentList) []*v1beta2.Deployment { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta2.DeploymentList, items []*v1beta2.Deployment) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_replicaset.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_replicaset.go
deleted file mode 100644
index ec886dc795..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_replicaset.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/api/apps/v1beta2"
- appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2"
- gentype "k8s.io/client-go/gentype"
- typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
-)
-
-// fakeReplicaSets implements ReplicaSetInterface
-type fakeReplicaSets struct {
- *gentype.FakeClientWithListAndApply[*v1beta2.ReplicaSet, *v1beta2.ReplicaSetList, *appsv1beta2.ReplicaSetApplyConfiguration]
- Fake *FakeAppsV1beta2
-}
-
-func newFakeReplicaSets(fake *FakeAppsV1beta2, namespace string) typedappsv1beta2.ReplicaSetInterface {
- return &fakeReplicaSets{
- gentype.NewFakeClientWithListAndApply[*v1beta2.ReplicaSet, *v1beta2.ReplicaSetList, *appsv1beta2.ReplicaSetApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta2.SchemeGroupVersion.WithResource("replicasets"),
- v1beta2.SchemeGroupVersion.WithKind("ReplicaSet"),
- func() *v1beta2.ReplicaSet { return &v1beta2.ReplicaSet{} },
- func() *v1beta2.ReplicaSetList { return &v1beta2.ReplicaSetList{} },
- func(dst, src *v1beta2.ReplicaSetList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta2.ReplicaSetList) []*v1beta2.ReplicaSet { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta2.ReplicaSetList, items []*v1beta2.ReplicaSet) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_statefulset.go b/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_statefulset.go
deleted file mode 100644
index 6e2cbbf5cc..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake/fake_statefulset.go
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
- json "encoding/json"
- fmt "fmt"
-
- v1beta2 "k8s.io/api/apps/v1beta2"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2"
- gentype "k8s.io/client-go/gentype"
- typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2"
- testing "k8s.io/client-go/testing"
-)
-
-// fakeStatefulSets implements StatefulSetInterface
-type fakeStatefulSets struct {
- *gentype.FakeClientWithListAndApply[*v1beta2.StatefulSet, *v1beta2.StatefulSetList, *appsv1beta2.StatefulSetApplyConfiguration]
- Fake *FakeAppsV1beta2
-}
-
-func newFakeStatefulSets(fake *FakeAppsV1beta2, namespace string) typedappsv1beta2.StatefulSetInterface {
- return &fakeStatefulSets{
- gentype.NewFakeClientWithListAndApply[*v1beta2.StatefulSet, *v1beta2.StatefulSetList, *appsv1beta2.StatefulSetApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta2.SchemeGroupVersion.WithResource("statefulsets"),
- v1beta2.SchemeGroupVersion.WithKind("StatefulSet"),
- func() *v1beta2.StatefulSet { return &v1beta2.StatefulSet{} },
- func() *v1beta2.StatefulSetList { return &v1beta2.StatefulSetList{} },
- func(dst, src *v1beta2.StatefulSetList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta2.StatefulSetList) []*v1beta2.StatefulSet { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta2.StatefulSetList, items []*v1beta2.StatefulSet) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
-
-// GetScale takes name of the statefulSet, and returns the corresponding scale object, and an error if there is any.
-func (c *fakeStatefulSets) GetScale(ctx context.Context, statefulSetName string, options v1.GetOptions) (result *v1beta2.Scale, err error) {
- emptyResult := &v1beta2.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", statefulSetName, options), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*v1beta2.Scale), err
-}
-
-// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
-func (c *fakeStatefulSets) UpdateScale(ctx context.Context, statefulSetName string, scale *v1beta2.Scale, opts v1.UpdateOptions) (result *v1beta2.Scale, err error) {
- emptyResult := &v1beta2.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &v1beta2.Scale{})
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*v1beta2.Scale), err
-}
-
-// ApplyScale takes top resource name and the apply declarative configuration for scale,
-// applies it and returns the applied scale, and an error, if there is any.
-func (c *fakeStatefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *appsv1beta2.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Scale, err error) {
- if scale == nil {
- return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
- }
- data, err := json.Marshal(scale)
- if err != nil {
- return nil, err
- }
- emptyResult := &v1beta2.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceActionWithOptions(c.Resource(), c.Namespace(), statefulSetName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*v1beta2.Scale), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_authentication_client.go b/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_authentication_client.go
deleted file mode 100644
index 569782ff28..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_authentication_client.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/authentication/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAuthenticationV1 struct {
- *testing.Fake
-}
-
-func (c *FakeAuthenticationV1) SelfSubjectReviews() v1.SelfSubjectReviewInterface {
- return newFakeSelfSubjectReviews(c)
-}
-
-func (c *FakeAuthenticationV1) TokenReviews() v1.TokenReviewInterface {
- return newFakeTokenReviews(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAuthenticationV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_selfsubjectreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_selfsubjectreview.go
deleted file mode 100644
index 3a101363f5..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_selfsubjectreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/authentication/v1"
- gentype "k8s.io/client-go/gentype"
- authenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1"
-)
-
-// fakeSelfSubjectReviews implements SelfSubjectReviewInterface
-type fakeSelfSubjectReviews struct {
- *gentype.FakeClient[*v1.SelfSubjectReview]
- Fake *FakeAuthenticationV1
-}
-
-func newFakeSelfSubjectReviews(fake *FakeAuthenticationV1) authenticationv1.SelfSubjectReviewInterface {
- return &fakeSelfSubjectReviews{
- gentype.NewFakeClient[*v1.SelfSubjectReview](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("selfsubjectreviews"),
- v1.SchemeGroupVersion.WithKind("SelfSubjectReview"),
- func() *v1.SelfSubjectReview { return &v1.SelfSubjectReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_tokenreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_tokenreview.go
deleted file mode 100644
index 26d5d37338..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_tokenreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/authentication/v1"
- gentype "k8s.io/client-go/gentype"
- authenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1"
-)
-
-// fakeTokenReviews implements TokenReviewInterface
-type fakeTokenReviews struct {
- *gentype.FakeClient[*v1.TokenReview]
- Fake *FakeAuthenticationV1
-}
-
-func newFakeTokenReviews(fake *FakeAuthenticationV1) authenticationv1.TokenReviewInterface {
- return &fakeTokenReviews{
- gentype.NewFakeClient[*v1.TokenReview](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("tokenreviews"),
- v1.SchemeGroupVersion.WithKind("TokenReview"),
- func() *v1.TokenReview { return &v1.TokenReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1alpha1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1alpha1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1alpha1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1alpha1/fake/fake_authentication_client.go b/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1alpha1/fake/fake_authentication_client.go
deleted file mode 100644
index 3c76aa5a53..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1alpha1/fake/fake_authentication_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/client-go/kubernetes/typed/authentication/v1alpha1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAuthenticationV1alpha1 struct {
- *testing.Fake
-}
-
-func (c *FakeAuthenticationV1alpha1) SelfSubjectReviews() v1alpha1.SelfSubjectReviewInterface {
- return newFakeSelfSubjectReviews(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAuthenticationV1alpha1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1alpha1/fake/fake_selfsubjectreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1alpha1/fake/fake_selfsubjectreview.go
deleted file mode 100644
index 1c0ebe2f05..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1alpha1/fake/fake_selfsubjectreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/authentication/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- authenticationv1alpha1 "k8s.io/client-go/kubernetes/typed/authentication/v1alpha1"
-)
-
-// fakeSelfSubjectReviews implements SelfSubjectReviewInterface
-type fakeSelfSubjectReviews struct {
- *gentype.FakeClient[*v1alpha1.SelfSubjectReview]
- Fake *FakeAuthenticationV1alpha1
-}
-
-func newFakeSelfSubjectReviews(fake *FakeAuthenticationV1alpha1) authenticationv1alpha1.SelfSubjectReviewInterface {
- return &fakeSelfSubjectReviews{
- gentype.NewFakeClient[*v1alpha1.SelfSubjectReview](
- fake.Fake,
- "",
- v1alpha1.SchemeGroupVersion.WithResource("selfsubjectreviews"),
- v1alpha1.SchemeGroupVersion.WithKind("SelfSubjectReview"),
- func() *v1alpha1.SelfSubjectReview { return &v1alpha1.SelfSubjectReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_authentication_client.go b/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_authentication_client.go
deleted file mode 100644
index 28b5517ecb..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_authentication_client.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAuthenticationV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeAuthenticationV1beta1) SelfSubjectReviews() v1beta1.SelfSubjectReviewInterface {
- return newFakeSelfSubjectReviews(c)
-}
-
-func (c *FakeAuthenticationV1beta1) TokenReviews() v1beta1.TokenReviewInterface {
- return newFakeTokenReviews(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAuthenticationV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_selfsubjectreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_selfsubjectreview.go
deleted file mode 100644
index 416c288b80..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_selfsubjectreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/authentication/v1beta1"
- gentype "k8s.io/client-go/gentype"
- authenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1"
-)
-
-// fakeSelfSubjectReviews implements SelfSubjectReviewInterface
-type fakeSelfSubjectReviews struct {
- *gentype.FakeClient[*v1beta1.SelfSubjectReview]
- Fake *FakeAuthenticationV1beta1
-}
-
-func newFakeSelfSubjectReviews(fake *FakeAuthenticationV1beta1) authenticationv1beta1.SelfSubjectReviewInterface {
- return &fakeSelfSubjectReviews{
- gentype.NewFakeClient[*v1beta1.SelfSubjectReview](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("selfsubjectreviews"),
- v1beta1.SchemeGroupVersion.WithKind("SelfSubjectReview"),
- func() *v1beta1.SelfSubjectReview { return &v1beta1.SelfSubjectReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_tokenreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_tokenreview.go
deleted file mode 100644
index daafb9be16..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_tokenreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/authentication/v1beta1"
- gentype "k8s.io/client-go/gentype"
- authenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1"
-)
-
-// fakeTokenReviews implements TokenReviewInterface
-type fakeTokenReviews struct {
- *gentype.FakeClient[*v1beta1.TokenReview]
- Fake *FakeAuthenticationV1beta1
-}
-
-func newFakeTokenReviews(fake *FakeAuthenticationV1beta1) authenticationv1beta1.TokenReviewInterface {
- return &fakeTokenReviews{
- gentype.NewFakeClient[*v1beta1.TokenReview](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("tokenreviews"),
- v1beta1.SchemeGroupVersion.WithKind("TokenReview"),
- func() *v1beta1.TokenReview { return &v1beta1.TokenReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_authorization_client.go b/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_authorization_client.go
deleted file mode 100644
index f96956bb46..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_authorization_client.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAuthorizationV1 struct {
- *testing.Fake
-}
-
-func (c *FakeAuthorizationV1) LocalSubjectAccessReviews(namespace string) v1.LocalSubjectAccessReviewInterface {
- return newFakeLocalSubjectAccessReviews(c, namespace)
-}
-
-func (c *FakeAuthorizationV1) SelfSubjectAccessReviews() v1.SelfSubjectAccessReviewInterface {
- return newFakeSelfSubjectAccessReviews(c)
-}
-
-func (c *FakeAuthorizationV1) SelfSubjectRulesReviews() v1.SelfSubjectRulesReviewInterface {
- return newFakeSelfSubjectRulesReviews(c)
-}
-
-func (c *FakeAuthorizationV1) SubjectAccessReviews() v1.SubjectAccessReviewInterface {
- return newFakeSubjectAccessReviews(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAuthorizationV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_localsubjectaccessreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_localsubjectaccessreview.go
deleted file mode 100644
index 4b07d8763d..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_localsubjectaccessreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/authorization/v1"
- gentype "k8s.io/client-go/gentype"
- authorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
-)
-
-// fakeLocalSubjectAccessReviews implements LocalSubjectAccessReviewInterface
-type fakeLocalSubjectAccessReviews struct {
- *gentype.FakeClient[*v1.LocalSubjectAccessReview]
- Fake *FakeAuthorizationV1
-}
-
-func newFakeLocalSubjectAccessReviews(fake *FakeAuthorizationV1, namespace string) authorizationv1.LocalSubjectAccessReviewInterface {
- return &fakeLocalSubjectAccessReviews{
- gentype.NewFakeClient[*v1.LocalSubjectAccessReview](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("localsubjectaccessreviews"),
- v1.SchemeGroupVersion.WithKind("LocalSubjectAccessReview"),
- func() *v1.LocalSubjectAccessReview { return &v1.LocalSubjectAccessReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_selfsubjectaccessreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_selfsubjectaccessreview.go
deleted file mode 100644
index d55d555d4b..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_selfsubjectaccessreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/authorization/v1"
- gentype "k8s.io/client-go/gentype"
- authorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
-)
-
-// fakeSelfSubjectAccessReviews implements SelfSubjectAccessReviewInterface
-type fakeSelfSubjectAccessReviews struct {
- *gentype.FakeClient[*v1.SelfSubjectAccessReview]
- Fake *FakeAuthorizationV1
-}
-
-func newFakeSelfSubjectAccessReviews(fake *FakeAuthorizationV1) authorizationv1.SelfSubjectAccessReviewInterface {
- return &fakeSelfSubjectAccessReviews{
- gentype.NewFakeClient[*v1.SelfSubjectAccessReview](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"),
- v1.SchemeGroupVersion.WithKind("SelfSubjectAccessReview"),
- func() *v1.SelfSubjectAccessReview { return &v1.SelfSubjectAccessReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_selfsubjectrulesreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_selfsubjectrulesreview.go
deleted file mode 100644
index dcd1e05eab..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_selfsubjectrulesreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/authorization/v1"
- gentype "k8s.io/client-go/gentype"
- authorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
-)
-
-// fakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface
-type fakeSelfSubjectRulesReviews struct {
- *gentype.FakeClient[*v1.SelfSubjectRulesReview]
- Fake *FakeAuthorizationV1
-}
-
-func newFakeSelfSubjectRulesReviews(fake *FakeAuthorizationV1) authorizationv1.SelfSubjectRulesReviewInterface {
- return &fakeSelfSubjectRulesReviews{
- gentype.NewFakeClient[*v1.SelfSubjectRulesReview](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"),
- v1.SchemeGroupVersion.WithKind("SelfSubjectRulesReview"),
- func() *v1.SelfSubjectRulesReview { return &v1.SelfSubjectRulesReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_subjectaccessreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_subjectaccessreview.go
deleted file mode 100644
index 4710ca6d94..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_subjectaccessreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/authorization/v1"
- gentype "k8s.io/client-go/gentype"
- authorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
-)
-
-// fakeSubjectAccessReviews implements SubjectAccessReviewInterface
-type fakeSubjectAccessReviews struct {
- *gentype.FakeClient[*v1.SubjectAccessReview]
- Fake *FakeAuthorizationV1
-}
-
-func newFakeSubjectAccessReviews(fake *FakeAuthorizationV1) authorizationv1.SubjectAccessReviewInterface {
- return &fakeSubjectAccessReviews{
- gentype.NewFakeClient[*v1.SubjectAccessReview](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("subjectaccessreviews"),
- v1.SchemeGroupVersion.WithKind("SubjectAccessReview"),
- func() *v1.SubjectAccessReview { return &v1.SubjectAccessReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_authorization_client.go b/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_authorization_client.go
deleted file mode 100644
index 38fa676f47..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_authorization_client.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAuthorizationV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeAuthorizationV1beta1) LocalSubjectAccessReviews(namespace string) v1beta1.LocalSubjectAccessReviewInterface {
- return newFakeLocalSubjectAccessReviews(c, namespace)
-}
-
-func (c *FakeAuthorizationV1beta1) SelfSubjectAccessReviews() v1beta1.SelfSubjectAccessReviewInterface {
- return newFakeSelfSubjectAccessReviews(c)
-}
-
-func (c *FakeAuthorizationV1beta1) SelfSubjectRulesReviews() v1beta1.SelfSubjectRulesReviewInterface {
- return newFakeSelfSubjectRulesReviews(c)
-}
-
-func (c *FakeAuthorizationV1beta1) SubjectAccessReviews() v1beta1.SubjectAccessReviewInterface {
- return newFakeSubjectAccessReviews(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAuthorizationV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_localsubjectaccessreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_localsubjectaccessreview.go
deleted file mode 100644
index 7a874c5ba4..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_localsubjectaccessreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/authorization/v1beta1"
- gentype "k8s.io/client-go/gentype"
- authorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1"
-)
-
-// fakeLocalSubjectAccessReviews implements LocalSubjectAccessReviewInterface
-type fakeLocalSubjectAccessReviews struct {
- *gentype.FakeClient[*v1beta1.LocalSubjectAccessReview]
- Fake *FakeAuthorizationV1beta1
-}
-
-func newFakeLocalSubjectAccessReviews(fake *FakeAuthorizationV1beta1, namespace string) authorizationv1beta1.LocalSubjectAccessReviewInterface {
- return &fakeLocalSubjectAccessReviews{
- gentype.NewFakeClient[*v1beta1.LocalSubjectAccessReview](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("localsubjectaccessreviews"),
- v1beta1.SchemeGroupVersion.WithKind("LocalSubjectAccessReview"),
- func() *v1beta1.LocalSubjectAccessReview { return &v1beta1.LocalSubjectAccessReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_selfsubjectaccessreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_selfsubjectaccessreview.go
deleted file mode 100644
index 321a4bf368..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_selfsubjectaccessreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/authorization/v1beta1"
- gentype "k8s.io/client-go/gentype"
- authorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1"
-)
-
-// fakeSelfSubjectAccessReviews implements SelfSubjectAccessReviewInterface
-type fakeSelfSubjectAccessReviews struct {
- *gentype.FakeClient[*v1beta1.SelfSubjectAccessReview]
- Fake *FakeAuthorizationV1beta1
-}
-
-func newFakeSelfSubjectAccessReviews(fake *FakeAuthorizationV1beta1) authorizationv1beta1.SelfSubjectAccessReviewInterface {
- return &fakeSelfSubjectAccessReviews{
- gentype.NewFakeClient[*v1beta1.SelfSubjectAccessReview](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"),
- v1beta1.SchemeGroupVersion.WithKind("SelfSubjectAccessReview"),
- func() *v1beta1.SelfSubjectAccessReview { return &v1beta1.SelfSubjectAccessReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_selfsubjectrulesreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_selfsubjectrulesreview.go
deleted file mode 100644
index 96a737c33e..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_selfsubjectrulesreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/authorization/v1beta1"
- gentype "k8s.io/client-go/gentype"
- authorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1"
-)
-
-// fakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface
-type fakeSelfSubjectRulesReviews struct {
- *gentype.FakeClient[*v1beta1.SelfSubjectRulesReview]
- Fake *FakeAuthorizationV1beta1
-}
-
-func newFakeSelfSubjectRulesReviews(fake *FakeAuthorizationV1beta1) authorizationv1beta1.SelfSubjectRulesReviewInterface {
- return &fakeSelfSubjectRulesReviews{
- gentype.NewFakeClient[*v1beta1.SelfSubjectRulesReview](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"),
- v1beta1.SchemeGroupVersion.WithKind("SelfSubjectRulesReview"),
- func() *v1beta1.SelfSubjectRulesReview { return &v1beta1.SelfSubjectRulesReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_subjectaccessreview.go b/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_subjectaccessreview.go
deleted file mode 100644
index fdb2e1727c..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/fake_subjectaccessreview.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/authorization/v1beta1"
- gentype "k8s.io/client-go/gentype"
- authorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1"
-)
-
-// fakeSubjectAccessReviews implements SubjectAccessReviewInterface
-type fakeSubjectAccessReviews struct {
- *gentype.FakeClient[*v1beta1.SubjectAccessReview]
- Fake *FakeAuthorizationV1beta1
-}
-
-func newFakeSubjectAccessReviews(fake *FakeAuthorizationV1beta1) authorizationv1beta1.SubjectAccessReviewInterface {
- return &fakeSubjectAccessReviews{
- gentype.NewFakeClient[*v1beta1.SubjectAccessReview](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("subjectaccessreviews"),
- v1beta1.SchemeGroupVersion.WithKind("SubjectAccessReview"),
- func() *v1beta1.SubjectAccessReview { return &v1beta1.SubjectAccessReview{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/fake_autoscaling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/fake_autoscaling_client.go
deleted file mode 100644
index 3af0d34670..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/fake_autoscaling_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAutoscalingV1 struct {
- *testing.Fake
-}
-
-func (c *FakeAutoscalingV1) HorizontalPodAutoscalers(namespace string) v1.HorizontalPodAutoscalerInterface {
- return newFakeHorizontalPodAutoscalers(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAutoscalingV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/fake_horizontalpodautoscaler.go b/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/fake_horizontalpodautoscaler.go
deleted file mode 100644
index 4f04d3256c..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/fake_horizontalpodautoscaler.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/autoscaling/v1"
- autoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1"
- gentype "k8s.io/client-go/gentype"
- typedautoscalingv1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1"
-)
-
-// fakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface
-type fakeHorizontalPodAutoscalers struct {
- *gentype.FakeClientWithListAndApply[*v1.HorizontalPodAutoscaler, *v1.HorizontalPodAutoscalerList, *autoscalingv1.HorizontalPodAutoscalerApplyConfiguration]
- Fake *FakeAutoscalingV1
-}
-
-func newFakeHorizontalPodAutoscalers(fake *FakeAutoscalingV1, namespace string) typedautoscalingv1.HorizontalPodAutoscalerInterface {
- return &fakeHorizontalPodAutoscalers{
- gentype.NewFakeClientWithListAndApply[*v1.HorizontalPodAutoscaler, *v1.HorizontalPodAutoscalerList, *autoscalingv1.HorizontalPodAutoscalerApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"),
- v1.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler"),
- func() *v1.HorizontalPodAutoscaler { return &v1.HorizontalPodAutoscaler{} },
- func() *v1.HorizontalPodAutoscalerList { return &v1.HorizontalPodAutoscalerList{} },
- func(dst, src *v1.HorizontalPodAutoscalerList) { dst.ListMeta = src.ListMeta },
- func(list *v1.HorizontalPodAutoscalerList) []*v1.HorizontalPodAutoscaler {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.HorizontalPodAutoscalerList, items []*v1.HorizontalPodAutoscaler) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake/fake_autoscaling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake/fake_autoscaling_client.go
deleted file mode 100644
index b0012fb241..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake/fake_autoscaling_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeAutoscalingV2 struct {
- *testing.Fake
-}
-
-func (c *FakeAutoscalingV2) HorizontalPodAutoscalers(namespace string) v2.HorizontalPodAutoscalerInterface {
- return newFakeHorizontalPodAutoscalers(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeAutoscalingV2) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake/fake_horizontalpodautoscaler.go b/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake/fake_horizontalpodautoscaler.go
deleted file mode 100644
index 66a1f56c70..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake/fake_horizontalpodautoscaler.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v2 "k8s.io/api/autoscaling/v2"
- autoscalingv2 "k8s.io/client-go/applyconfigurations/autoscaling/v2"
- gentype "k8s.io/client-go/gentype"
- typedautoscalingv2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2"
-)
-
-// fakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface
-type fakeHorizontalPodAutoscalers struct {
- *gentype.FakeClientWithListAndApply[*v2.HorizontalPodAutoscaler, *v2.HorizontalPodAutoscalerList, *autoscalingv2.HorizontalPodAutoscalerApplyConfiguration]
- Fake *FakeAutoscalingV2
-}
-
-func newFakeHorizontalPodAutoscalers(fake *FakeAutoscalingV2, namespace string) typedautoscalingv2.HorizontalPodAutoscalerInterface {
- return &fakeHorizontalPodAutoscalers{
- gentype.NewFakeClientWithListAndApply[*v2.HorizontalPodAutoscaler, *v2.HorizontalPodAutoscalerList, *autoscalingv2.HorizontalPodAutoscalerApplyConfiguration](
- fake.Fake,
- namespace,
- v2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"),
- v2.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler"),
- func() *v2.HorizontalPodAutoscaler { return &v2.HorizontalPodAutoscaler{} },
- func() *v2.HorizontalPodAutoscalerList { return &v2.HorizontalPodAutoscalerList{} },
- func(dst, src *v2.HorizontalPodAutoscalerList) { dst.ListMeta = src.ListMeta },
- func(list *v2.HorizontalPodAutoscalerList) []*v2.HorizontalPodAutoscaler {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v2.HorizontalPodAutoscalerList, items []*v2.HorizontalPodAutoscaler) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_batch_client.go b/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_batch_client.go
deleted file mode 100644
index 8fb3d18d86..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_batch_client.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/batch/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeBatchV1 struct {
- *testing.Fake
-}
-
-func (c *FakeBatchV1) CronJobs(namespace string) v1.CronJobInterface {
- return newFakeCronJobs(c, namespace)
-}
-
-func (c *FakeBatchV1) Jobs(namespace string) v1.JobInterface {
- return newFakeJobs(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeBatchV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_cronjob.go b/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_cronjob.go
deleted file mode 100644
index 3624a73bd6..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_cronjob.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/batch/v1"
- batchv1 "k8s.io/client-go/applyconfigurations/batch/v1"
- gentype "k8s.io/client-go/gentype"
- typedbatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1"
-)
-
-// fakeCronJobs implements CronJobInterface
-type fakeCronJobs struct {
- *gentype.FakeClientWithListAndApply[*v1.CronJob, *v1.CronJobList, *batchv1.CronJobApplyConfiguration]
- Fake *FakeBatchV1
-}
-
-func newFakeCronJobs(fake *FakeBatchV1, namespace string) typedbatchv1.CronJobInterface {
- return &fakeCronJobs{
- gentype.NewFakeClientWithListAndApply[*v1.CronJob, *v1.CronJobList, *batchv1.CronJobApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("cronjobs"),
- v1.SchemeGroupVersion.WithKind("CronJob"),
- func() *v1.CronJob { return &v1.CronJob{} },
- func() *v1.CronJobList { return &v1.CronJobList{} },
- func(dst, src *v1.CronJobList) { dst.ListMeta = src.ListMeta },
- func(list *v1.CronJobList) []*v1.CronJob { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.CronJobList, items []*v1.CronJob) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_job.go b/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_job.go
deleted file mode 100644
index 33baee5638..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake/fake_job.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/batch/v1"
- batchv1 "k8s.io/client-go/applyconfigurations/batch/v1"
- gentype "k8s.io/client-go/gentype"
- typedbatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1"
-)
-
-// fakeJobs implements JobInterface
-type fakeJobs struct {
- *gentype.FakeClientWithListAndApply[*v1.Job, *v1.JobList, *batchv1.JobApplyConfiguration]
- Fake *FakeBatchV1
-}
-
-func newFakeJobs(fake *FakeBatchV1, namespace string) typedbatchv1.JobInterface {
- return &fakeJobs{
- gentype.NewFakeClientWithListAndApply[*v1.Job, *v1.JobList, *batchv1.JobApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("jobs"),
- v1.SchemeGroupVersion.WithKind("Job"),
- func() *v1.Job { return &v1.Job{} },
- func() *v1.JobList { return &v1.JobList{} },
- func(dst, src *v1.JobList) { dst.ListMeta = src.ListMeta },
- func(list *v1.JobList) []*v1.Job { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.JobList, items []*v1.Job) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/fake_batch_client.go b/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/fake_batch_client.go
deleted file mode 100644
index 48cabb71e1..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/fake_batch_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeBatchV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeBatchV1beta1) CronJobs(namespace string) v1beta1.CronJobInterface {
- return newFakeCronJobs(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeBatchV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/fake_cronjob.go b/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/fake_cronjob.go
deleted file mode 100644
index 05b99fadc7..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake/fake_cronjob.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/batch/v1beta1"
- batchv1beta1 "k8s.io/client-go/applyconfigurations/batch/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedbatchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1"
-)
-
-// fakeCronJobs implements CronJobInterface
-type fakeCronJobs struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.CronJob, *v1beta1.CronJobList, *batchv1beta1.CronJobApplyConfiguration]
- Fake *FakeBatchV1beta1
-}
-
-func newFakeCronJobs(fake *FakeBatchV1beta1, namespace string) typedbatchv1beta1.CronJobInterface {
- return &fakeCronJobs{
- gentype.NewFakeClientWithListAndApply[*v1beta1.CronJob, *v1beta1.CronJobList, *batchv1beta1.CronJobApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("cronjobs"),
- v1beta1.SchemeGroupVersion.WithKind("CronJob"),
- func() *v1beta1.CronJob { return &v1beta1.CronJob{} },
- func() *v1beta1.CronJobList { return &v1beta1.CronJobList{} },
- func(dst, src *v1beta1.CronJobList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.CronJobList) []*v1beta1.CronJob { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.CronJobList, items []*v1beta1.CronJob) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_certificates_client.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_certificates_client.go
deleted file mode 100644
index 782ebd95ee..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_certificates_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/certificates/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeCertificatesV1 struct {
- *testing.Fake
-}
-
-func (c *FakeCertificatesV1) CertificateSigningRequests() v1.CertificateSigningRequestInterface {
- return newFakeCertificateSigningRequests(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeCertificatesV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_certificatesigningrequest.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_certificatesigningrequest.go
deleted file mode 100644
index 784e74a372..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/fake/fake_certificatesigningrequest.go
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
-
- v1 "k8s.io/api/certificates/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- certificatesv1 "k8s.io/client-go/applyconfigurations/certificates/v1"
- gentype "k8s.io/client-go/gentype"
- typedcertificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1"
- testing "k8s.io/client-go/testing"
-)
-
-// fakeCertificateSigningRequests implements CertificateSigningRequestInterface
-type fakeCertificateSigningRequests struct {
- *gentype.FakeClientWithListAndApply[*v1.CertificateSigningRequest, *v1.CertificateSigningRequestList, *certificatesv1.CertificateSigningRequestApplyConfiguration]
- Fake *FakeCertificatesV1
-}
-
-func newFakeCertificateSigningRequests(fake *FakeCertificatesV1) typedcertificatesv1.CertificateSigningRequestInterface {
- return &fakeCertificateSigningRequests{
- gentype.NewFakeClientWithListAndApply[*v1.CertificateSigningRequest, *v1.CertificateSigningRequestList, *certificatesv1.CertificateSigningRequestApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("certificatesigningrequests"),
- v1.SchemeGroupVersion.WithKind("CertificateSigningRequest"),
- func() *v1.CertificateSigningRequest { return &v1.CertificateSigningRequest{} },
- func() *v1.CertificateSigningRequestList { return &v1.CertificateSigningRequestList{} },
- func(dst, src *v1.CertificateSigningRequestList) { dst.ListMeta = src.ListMeta },
- func(list *v1.CertificateSigningRequestList) []*v1.CertificateSigningRequest {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.CertificateSigningRequestList, items []*v1.CertificateSigningRequest) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
-
-// UpdateApproval takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any.
-func (c *fakeCertificateSigningRequests) UpdateApproval(ctx context.Context, certificateSigningRequestName string, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (result *v1.CertificateSigningRequest, err error) {
- emptyResult := &v1.CertificateSigningRequest{}
- obj, err := c.Fake.
- Invokes(testing.NewRootUpdateSubresourceActionWithOptions(c.Resource(), "approval", certificateSigningRequest, opts), emptyResult)
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*v1.CertificateSigningRequest), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/fake_certificates_client.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/fake_certificates_client.go
deleted file mode 100644
index 491e381005..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/fake_certificates_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/client-go/kubernetes/typed/certificates/v1alpha1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeCertificatesV1alpha1 struct {
- *testing.Fake
-}
-
-func (c *FakeCertificatesV1alpha1) ClusterTrustBundles() v1alpha1.ClusterTrustBundleInterface {
- return newFakeClusterTrustBundles(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeCertificatesV1alpha1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/fake_clustertrustbundle.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/fake_clustertrustbundle.go
deleted file mode 100644
index f2b5fa2927..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/fake_clustertrustbundle.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/certificates/v1alpha1"
- certificatesv1alpha1 "k8s.io/client-go/applyconfigurations/certificates/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedcertificatesv1alpha1 "k8s.io/client-go/kubernetes/typed/certificates/v1alpha1"
-)
-
-// fakeClusterTrustBundles implements ClusterTrustBundleInterface
-type fakeClusterTrustBundles struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.ClusterTrustBundle, *v1alpha1.ClusterTrustBundleList, *certificatesv1alpha1.ClusterTrustBundleApplyConfiguration]
- Fake *FakeCertificatesV1alpha1
-}
-
-func newFakeClusterTrustBundles(fake *FakeCertificatesV1alpha1) typedcertificatesv1alpha1.ClusterTrustBundleInterface {
- return &fakeClusterTrustBundles{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.ClusterTrustBundle, *v1alpha1.ClusterTrustBundleList, *certificatesv1alpha1.ClusterTrustBundleApplyConfiguration](
- fake.Fake,
- "",
- v1alpha1.SchemeGroupVersion.WithResource("clustertrustbundles"),
- v1alpha1.SchemeGroupVersion.WithKind("ClusterTrustBundle"),
- func() *v1alpha1.ClusterTrustBundle { return &v1alpha1.ClusterTrustBundle{} },
- func() *v1alpha1.ClusterTrustBundleList { return &v1alpha1.ClusterTrustBundleList{} },
- func(dst, src *v1alpha1.ClusterTrustBundleList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.ClusterTrustBundleList) []*v1alpha1.ClusterTrustBundle {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.ClusterTrustBundleList, items []*v1alpha1.ClusterTrustBundle) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_certificates_client.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_certificates_client.go
deleted file mode 100644
index b6cef6de71..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_certificates_client.go
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeCertificatesV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeCertificatesV1beta1) CertificateSigningRequests() v1beta1.CertificateSigningRequestInterface {
- return newFakeCertificateSigningRequests(c)
-}
-
-func (c *FakeCertificatesV1beta1) ClusterTrustBundles() v1beta1.ClusterTrustBundleInterface {
- return newFakeClusterTrustBundles(c)
-}
-
-func (c *FakeCertificatesV1beta1) PodCertificateRequests(namespace string) v1beta1.PodCertificateRequestInterface {
- return newFakePodCertificateRequests(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeCertificatesV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_certificatesigningrequest.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_certificatesigningrequest.go
deleted file mode 100644
index a5f144cb81..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_certificatesigningrequest.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/certificates/v1beta1"
- certificatesv1beta1 "k8s.io/client-go/applyconfigurations/certificates/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedcertificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1"
-)
-
-// fakeCertificateSigningRequests implements CertificateSigningRequestInterface
-type fakeCertificateSigningRequests struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.CertificateSigningRequest, *v1beta1.CertificateSigningRequestList, *certificatesv1beta1.CertificateSigningRequestApplyConfiguration]
- Fake *FakeCertificatesV1beta1
-}
-
-func newFakeCertificateSigningRequests(fake *FakeCertificatesV1beta1) typedcertificatesv1beta1.CertificateSigningRequestInterface {
- return &fakeCertificateSigningRequests{
- gentype.NewFakeClientWithListAndApply[*v1beta1.CertificateSigningRequest, *v1beta1.CertificateSigningRequestList, *certificatesv1beta1.CertificateSigningRequestApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("certificatesigningrequests"),
- v1beta1.SchemeGroupVersion.WithKind("CertificateSigningRequest"),
- func() *v1beta1.CertificateSigningRequest { return &v1beta1.CertificateSigningRequest{} },
- func() *v1beta1.CertificateSigningRequestList { return &v1beta1.CertificateSigningRequestList{} },
- func(dst, src *v1beta1.CertificateSigningRequestList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.CertificateSigningRequestList) []*v1beta1.CertificateSigningRequest {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.CertificateSigningRequestList, items []*v1beta1.CertificateSigningRequest) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_certificatesigningrequest_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_certificatesigningrequest_expansion.go
deleted file mode 100644
index 5d881e45ee..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_certificatesigningrequest_expansion.go
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fake
-
-import (
- "context"
-
- certificates "k8s.io/api/certificates/v1beta1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- core "k8s.io/client-go/testing"
-)
-
-func (c *fakeCertificateSigningRequests) UpdateApproval(ctx context.Context, certificateSigningRequest *certificates.CertificateSigningRequest, opts metav1.UpdateOptions) (result *certificates.CertificateSigningRequest, err error) {
- obj, err := c.Fake.
- Invokes(core.NewRootUpdateSubresourceAction(c.Resource(), "approval", certificateSigningRequest), &certificates.CertificateSigningRequest{})
- if obj == nil {
- return nil, err
- }
- return obj.(*certificates.CertificateSigningRequest), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_clustertrustbundle.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_clustertrustbundle.go
deleted file mode 100644
index ff88f73538..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_clustertrustbundle.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/certificates/v1beta1"
- certificatesv1beta1 "k8s.io/client-go/applyconfigurations/certificates/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedcertificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1"
-)
-
-// fakeClusterTrustBundles implements ClusterTrustBundleInterface
-type fakeClusterTrustBundles struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.ClusterTrustBundle, *v1beta1.ClusterTrustBundleList, *certificatesv1beta1.ClusterTrustBundleApplyConfiguration]
- Fake *FakeCertificatesV1beta1
-}
-
-func newFakeClusterTrustBundles(fake *FakeCertificatesV1beta1) typedcertificatesv1beta1.ClusterTrustBundleInterface {
- return &fakeClusterTrustBundles{
- gentype.NewFakeClientWithListAndApply[*v1beta1.ClusterTrustBundle, *v1beta1.ClusterTrustBundleList, *certificatesv1beta1.ClusterTrustBundleApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("clustertrustbundles"),
- v1beta1.SchemeGroupVersion.WithKind("ClusterTrustBundle"),
- func() *v1beta1.ClusterTrustBundle { return &v1beta1.ClusterTrustBundle{} },
- func() *v1beta1.ClusterTrustBundleList { return &v1beta1.ClusterTrustBundleList{} },
- func(dst, src *v1beta1.ClusterTrustBundleList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.ClusterTrustBundleList) []*v1beta1.ClusterTrustBundle {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.ClusterTrustBundleList, items []*v1beta1.ClusterTrustBundle) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_podcertificaterequest.go b/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_podcertificaterequest.go
deleted file mode 100644
index 23c56d9b6f..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake/fake_podcertificaterequest.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/certificates/v1beta1"
- certificatesv1beta1 "k8s.io/client-go/applyconfigurations/certificates/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedcertificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1"
-)
-
-// fakePodCertificateRequests implements PodCertificateRequestInterface
-type fakePodCertificateRequests struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.PodCertificateRequest, *v1beta1.PodCertificateRequestList, *certificatesv1beta1.PodCertificateRequestApplyConfiguration]
- Fake *FakeCertificatesV1beta1
-}
-
-func newFakePodCertificateRequests(fake *FakeCertificatesV1beta1, namespace string) typedcertificatesv1beta1.PodCertificateRequestInterface {
- return &fakePodCertificateRequests{
- gentype.NewFakeClientWithListAndApply[*v1beta1.PodCertificateRequest, *v1beta1.PodCertificateRequestList, *certificatesv1beta1.PodCertificateRequestApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("podcertificaterequests"),
- v1beta1.SchemeGroupVersion.WithKind("PodCertificateRequest"),
- func() *v1beta1.PodCertificateRequest { return &v1beta1.PodCertificateRequest{} },
- func() *v1beta1.PodCertificateRequestList { return &v1beta1.PodCertificateRequestList{} },
- func(dst, src *v1beta1.PodCertificateRequestList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.PodCertificateRequestList) []*v1beta1.PodCertificateRequest {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.PodCertificateRequestList, items []*v1beta1.PodCertificateRequest) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/fake/fake_coordination_client.go b/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/fake/fake_coordination_client.go
deleted file mode 100644
index fba319348a..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/fake/fake_coordination_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/coordination/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeCoordinationV1 struct {
- *testing.Fake
-}
-
-func (c *FakeCoordinationV1) Leases(namespace string) v1.LeaseInterface {
- return newFakeLeases(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeCoordinationV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/fake/fake_lease.go b/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/fake/fake_lease.go
deleted file mode 100644
index 1f0f6acd3d..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/fake/fake_lease.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/coordination/v1"
- coordinationv1 "k8s.io/client-go/applyconfigurations/coordination/v1"
- gentype "k8s.io/client-go/gentype"
- typedcoordinationv1 "k8s.io/client-go/kubernetes/typed/coordination/v1"
-)
-
-// fakeLeases implements LeaseInterface
-type fakeLeases struct {
- *gentype.FakeClientWithListAndApply[*v1.Lease, *v1.LeaseList, *coordinationv1.LeaseApplyConfiguration]
- Fake *FakeCoordinationV1
-}
-
-func newFakeLeases(fake *FakeCoordinationV1, namespace string) typedcoordinationv1.LeaseInterface {
- return &fakeLeases{
- gentype.NewFakeClientWithListAndApply[*v1.Lease, *v1.LeaseList, *coordinationv1.LeaseApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("leases"),
- v1.SchemeGroupVersion.WithKind("Lease"),
- func() *v1.Lease { return &v1.Lease{} },
- func() *v1.LeaseList { return &v1.LeaseList{} },
- func(dst, src *v1.LeaseList) { dst.ListMeta = src.ListMeta },
- func(list *v1.LeaseList) []*v1.Lease { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.LeaseList, items []*v1.Lease) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1alpha2/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1alpha2/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1alpha2/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1alpha2/fake/fake_coordination_client.go b/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1alpha2/fake/fake_coordination_client.go
deleted file mode 100644
index 6b73b67446..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1alpha2/fake/fake_coordination_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha2 "k8s.io/client-go/kubernetes/typed/coordination/v1alpha2"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeCoordinationV1alpha2 struct {
- *testing.Fake
-}
-
-func (c *FakeCoordinationV1alpha2) LeaseCandidates(namespace string) v1alpha2.LeaseCandidateInterface {
- return newFakeLeaseCandidates(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeCoordinationV1alpha2) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1alpha2/fake/fake_leasecandidate.go b/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1alpha2/fake/fake_leasecandidate.go
deleted file mode 100644
index 671a6df0c6..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1alpha2/fake/fake_leasecandidate.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha2 "k8s.io/api/coordination/v1alpha2"
- coordinationv1alpha2 "k8s.io/client-go/applyconfigurations/coordination/v1alpha2"
- gentype "k8s.io/client-go/gentype"
- typedcoordinationv1alpha2 "k8s.io/client-go/kubernetes/typed/coordination/v1alpha2"
-)
-
-// fakeLeaseCandidates implements LeaseCandidateInterface
-type fakeLeaseCandidates struct {
- *gentype.FakeClientWithListAndApply[*v1alpha2.LeaseCandidate, *v1alpha2.LeaseCandidateList, *coordinationv1alpha2.LeaseCandidateApplyConfiguration]
- Fake *FakeCoordinationV1alpha2
-}
-
-func newFakeLeaseCandidates(fake *FakeCoordinationV1alpha2, namespace string) typedcoordinationv1alpha2.LeaseCandidateInterface {
- return &fakeLeaseCandidates{
- gentype.NewFakeClientWithListAndApply[*v1alpha2.LeaseCandidate, *v1alpha2.LeaseCandidateList, *coordinationv1alpha2.LeaseCandidateApplyConfiguration](
- fake.Fake,
- namespace,
- v1alpha2.SchemeGroupVersion.WithResource("leasecandidates"),
- v1alpha2.SchemeGroupVersion.WithKind("LeaseCandidate"),
- func() *v1alpha2.LeaseCandidate { return &v1alpha2.LeaseCandidate{} },
- func() *v1alpha2.LeaseCandidateList { return &v1alpha2.LeaseCandidateList{} },
- func(dst, src *v1alpha2.LeaseCandidateList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha2.LeaseCandidateList) []*v1alpha2.LeaseCandidate {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha2.LeaseCandidateList, items []*v1alpha2.LeaseCandidate) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/fake_coordination_client.go b/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/fake_coordination_client.go
deleted file mode 100644
index c4eca7ecd1..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/fake_coordination_client.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeCoordinationV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeCoordinationV1beta1) Leases(namespace string) v1beta1.LeaseInterface {
- return newFakeLeases(c, namespace)
-}
-
-func (c *FakeCoordinationV1beta1) LeaseCandidates(namespace string) v1beta1.LeaseCandidateInterface {
- return newFakeLeaseCandidates(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeCoordinationV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/fake_lease.go b/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/fake_lease.go
deleted file mode 100644
index bb4b8e04f8..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/fake_lease.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/coordination/v1beta1"
- coordinationv1beta1 "k8s.io/client-go/applyconfigurations/coordination/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedcoordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1"
-)
-
-// fakeLeases implements LeaseInterface
-type fakeLeases struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.Lease, *v1beta1.LeaseList, *coordinationv1beta1.LeaseApplyConfiguration]
- Fake *FakeCoordinationV1beta1
-}
-
-func newFakeLeases(fake *FakeCoordinationV1beta1, namespace string) typedcoordinationv1beta1.LeaseInterface {
- return &fakeLeases{
- gentype.NewFakeClientWithListAndApply[*v1beta1.Lease, *v1beta1.LeaseList, *coordinationv1beta1.LeaseApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("leases"),
- v1beta1.SchemeGroupVersion.WithKind("Lease"),
- func() *v1beta1.Lease { return &v1beta1.Lease{} },
- func() *v1beta1.LeaseList { return &v1beta1.LeaseList{} },
- func(dst, src *v1beta1.LeaseList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.LeaseList) []*v1beta1.Lease { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.LeaseList, items []*v1beta1.Lease) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/fake_leasecandidate.go b/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/fake_leasecandidate.go
deleted file mode 100644
index bd5587b924..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/fake_leasecandidate.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/coordination/v1beta1"
- coordinationv1beta1 "k8s.io/client-go/applyconfigurations/coordination/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedcoordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1"
-)
-
-// fakeLeaseCandidates implements LeaseCandidateInterface
-type fakeLeaseCandidates struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.LeaseCandidate, *v1beta1.LeaseCandidateList, *coordinationv1beta1.LeaseCandidateApplyConfiguration]
- Fake *FakeCoordinationV1beta1
-}
-
-func newFakeLeaseCandidates(fake *FakeCoordinationV1beta1, namespace string) typedcoordinationv1beta1.LeaseCandidateInterface {
- return &fakeLeaseCandidates{
- gentype.NewFakeClientWithListAndApply[*v1beta1.LeaseCandidate, *v1beta1.LeaseCandidateList, *coordinationv1beta1.LeaseCandidateApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("leasecandidates"),
- v1beta1.SchemeGroupVersion.WithKind("LeaseCandidate"),
- func() *v1beta1.LeaseCandidate { return &v1beta1.LeaseCandidate{} },
- func() *v1beta1.LeaseCandidateList { return &v1beta1.LeaseCandidateList{} },
- func(dst, src *v1beta1.LeaseCandidateList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.LeaseCandidateList) []*v1beta1.LeaseCandidate {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.LeaseCandidateList, items []*v1beta1.LeaseCandidate) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_componentstatus.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_componentstatus.go
deleted file mode 100644
index 550277ed4a..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_componentstatus.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakeComponentStatuses implements ComponentStatusInterface
-type fakeComponentStatuses struct {
- *gentype.FakeClientWithListAndApply[*v1.ComponentStatus, *v1.ComponentStatusList, *corev1.ComponentStatusApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakeComponentStatuses(fake *FakeCoreV1) typedcorev1.ComponentStatusInterface {
- return &fakeComponentStatuses{
- gentype.NewFakeClientWithListAndApply[*v1.ComponentStatus, *v1.ComponentStatusList, *corev1.ComponentStatusApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("componentstatuses"),
- v1.SchemeGroupVersion.WithKind("ComponentStatus"),
- func() *v1.ComponentStatus { return &v1.ComponentStatus{} },
- func() *v1.ComponentStatusList { return &v1.ComponentStatusList{} },
- func(dst, src *v1.ComponentStatusList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ComponentStatusList) []*v1.ComponentStatus { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.ComponentStatusList, items []*v1.ComponentStatus) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_configmap.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_configmap.go
deleted file mode 100644
index 1fd5bf40ca..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_configmap.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakeConfigMaps implements ConfigMapInterface
-type fakeConfigMaps struct {
- *gentype.FakeClientWithListAndApply[*v1.ConfigMap, *v1.ConfigMapList, *corev1.ConfigMapApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakeConfigMaps(fake *FakeCoreV1, namespace string) typedcorev1.ConfigMapInterface {
- return &fakeConfigMaps{
- gentype.NewFakeClientWithListAndApply[*v1.ConfigMap, *v1.ConfigMapList, *corev1.ConfigMapApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("configmaps"),
- v1.SchemeGroupVersion.WithKind("ConfigMap"),
- func() *v1.ConfigMap { return &v1.ConfigMap{} },
- func() *v1.ConfigMapList { return &v1.ConfigMapList{} },
- func(dst, src *v1.ConfigMapList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ConfigMapList) []*v1.ConfigMap { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.ConfigMapList, items []*v1.ConfigMap) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_core_client.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_core_client.go
deleted file mode 100644
index e7f7412d04..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_core_client.go
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/core/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeCoreV1 struct {
- *testing.Fake
-}
-
-func (c *FakeCoreV1) ComponentStatuses() v1.ComponentStatusInterface {
- return newFakeComponentStatuses(c)
-}
-
-func (c *FakeCoreV1) ConfigMaps(namespace string) v1.ConfigMapInterface {
- return newFakeConfigMaps(c, namespace)
-}
-
-func (c *FakeCoreV1) Endpoints(namespace string) v1.EndpointsInterface {
- return newFakeEndpoints(c, namespace)
-}
-
-func (c *FakeCoreV1) Events(namespace string) v1.EventInterface {
- return newFakeEvents(c, namespace)
-}
-
-func (c *FakeCoreV1) LimitRanges(namespace string) v1.LimitRangeInterface {
- return newFakeLimitRanges(c, namespace)
-}
-
-func (c *FakeCoreV1) Namespaces() v1.NamespaceInterface {
- return newFakeNamespaces(c)
-}
-
-func (c *FakeCoreV1) Nodes() v1.NodeInterface {
- return newFakeNodes(c)
-}
-
-func (c *FakeCoreV1) PersistentVolumes() v1.PersistentVolumeInterface {
- return newFakePersistentVolumes(c)
-}
-
-func (c *FakeCoreV1) PersistentVolumeClaims(namespace string) v1.PersistentVolumeClaimInterface {
- return newFakePersistentVolumeClaims(c, namespace)
-}
-
-func (c *FakeCoreV1) Pods(namespace string) v1.PodInterface {
- return newFakePods(c, namespace)
-}
-
-func (c *FakeCoreV1) PodTemplates(namespace string) v1.PodTemplateInterface {
- return newFakePodTemplates(c, namespace)
-}
-
-func (c *FakeCoreV1) ReplicationControllers(namespace string) v1.ReplicationControllerInterface {
- return newFakeReplicationControllers(c, namespace)
-}
-
-func (c *FakeCoreV1) ResourceQuotas(namespace string) v1.ResourceQuotaInterface {
- return newFakeResourceQuotas(c, namespace)
-}
-
-func (c *FakeCoreV1) Secrets(namespace string) v1.SecretInterface {
- return newFakeSecrets(c, namespace)
-}
-
-func (c *FakeCoreV1) Services(namespace string) v1.ServiceInterface {
- return newFakeServices(c, namespace)
-}
-
-func (c *FakeCoreV1) ServiceAccounts(namespace string) v1.ServiceAccountInterface {
- return newFakeServiceAccounts(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeCoreV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_endpoints.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_endpoints.go
deleted file mode 100644
index d58c2dab45..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_endpoints.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakeEndpoints implements EndpointsInterface
-type fakeEndpoints struct {
- *gentype.FakeClientWithListAndApply[*v1.Endpoints, *v1.EndpointsList, *corev1.EndpointsApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakeEndpoints(fake *FakeCoreV1, namespace string) typedcorev1.EndpointsInterface {
- return &fakeEndpoints{
- gentype.NewFakeClientWithListAndApply[*v1.Endpoints, *v1.EndpointsList, *corev1.EndpointsApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("endpoints"),
- v1.SchemeGroupVersion.WithKind("Endpoints"),
- func() *v1.Endpoints { return &v1.Endpoints{} },
- func() *v1.EndpointsList { return &v1.EndpointsList{} },
- func(dst, src *v1.EndpointsList) { dst.ListMeta = src.ListMeta },
- func(list *v1.EndpointsList) []*v1.Endpoints { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.EndpointsList, items []*v1.Endpoints) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_event.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_event.go
deleted file mode 100644
index 36ee633c08..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_event.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakeEvents implements EventInterface
-type fakeEvents struct {
- *gentype.FakeClientWithListAndApply[*v1.Event, *v1.EventList, *corev1.EventApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakeEvents(fake *FakeCoreV1, namespace string) typedcorev1.EventInterface {
- return &fakeEvents{
- gentype.NewFakeClientWithListAndApply[*v1.Event, *v1.EventList, *corev1.EventApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("events"),
- v1.SchemeGroupVersion.WithKind("Event"),
- func() *v1.Event { return &v1.Event{} },
- func() *v1.EventList { return &v1.EventList{} },
- func(dst, src *v1.EventList) { dst.ListMeta = src.ListMeta },
- func(list *v1.EventList) []*v1.Event { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.EventList, items []*v1.Event) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_event_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_event_expansion.go
deleted file mode 100644
index 944d6808de..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_event_expansion.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fake
-
-import (
- "context"
-
- v1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/fields"
- "k8s.io/apimachinery/pkg/runtime"
- types "k8s.io/apimachinery/pkg/types"
- core "k8s.io/client-go/testing"
-)
-
-// Deprecated: use CreateWithEventNamespaceWithContext instead.
-func (c *fakeEvents) CreateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
- return c.CreateWithEventNamespaceWithContext(context.Background(), event)
-}
-
-func (c *fakeEvents) CreateWithEventNamespaceWithContext(_ context.Context, event *v1.Event) (*v1.Event, error) {
- var action core.CreateActionImpl
- if c.Namespace() != "" {
- action = core.NewCreateAction(c.Resource(), c.Namespace(), event)
- } else {
- action = core.NewCreateAction(c.Resource(), event.GetNamespace(), event)
- }
- obj, err := c.Fake.Invokes(action, event)
- if obj == nil {
- return nil, err
- }
-
- return obj.(*v1.Event), err
-}
-
-// Update replaces an existing event. Returns the copy of the event the server returns, or an error.
-//
-// Deprecated: use UpdateWithEventNamespaceWithContext instead.
-func (c *fakeEvents) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
- return c.UpdateWithEventNamespaceWithContext(context.Background(), event)
-}
-
-// Update replaces an existing event. Returns the copy of the event the server returns, or an error.
-func (c *fakeEvents) UpdateWithEventNamespaceWithContext(_ context.Context, event *v1.Event) (*v1.Event, error) {
- var action core.UpdateActionImpl
- if c.Namespace() != "" {
- action = core.NewUpdateAction(c.Resource(), c.Namespace(), event)
- } else {
- action = core.NewUpdateAction(c.Resource(), event.GetNamespace(), event)
- }
- obj, err := c.Fake.Invokes(action, event)
- if obj == nil {
- return nil, err
- }
-
- return obj.(*v1.Event), err
-}
-
-// PatchWithEventNamespace patches an existing event. Returns the copy of the event the server returns, or an error.
-// TODO: Should take a PatchType as an argument probably.
-//
-// Deprecated: use PatchWithEventNamespaceWithContext instead.
-func (c *fakeEvents) PatchWithEventNamespace(event *v1.Event, data []byte) (*v1.Event, error) {
- return c.PatchWithEventNamespaceWithContext(context.Background(), event, data)
-}
-
-// PatchWithEventNamespaceWithContext patches an existing event. Returns the copy of the event the server returns, or an error.
-// TODO: Should take a PatchType as an argument probably.
-func (c *fakeEvents) PatchWithEventNamespaceWithContext(_ context.Context, event *v1.Event, data []byte) (*v1.Event, error) {
- // TODO: Should be configurable to support additional patch strategies.
- pt := types.StrategicMergePatchType
- var action core.PatchActionImpl
- if c.Namespace() != "" {
- action = core.NewPatchAction(c.Resource(), c.Namespace(), event.Name, pt, data)
- } else {
- action = core.NewPatchAction(c.Resource(), event.GetNamespace(), event.Name, pt, data)
- }
- obj, err := c.Fake.Invokes(action, event)
- if obj == nil {
- return nil, err
- }
-
- return obj.(*v1.Event), err
-}
-
-// Search returns a list of events matching the specified object.
-//
-// Deprecated: use SearchWithContext instead.
-func (c *fakeEvents) Search(scheme *runtime.Scheme, objOrRef runtime.Object) (*v1.EventList, error) {
- return c.SearchWithContext(context.Background(), scheme, objOrRef)
-}
-
-// SearchWithContext returns a list of events matching the specified object.
-func (c *fakeEvents) SearchWithContext(_ context.Context, scheme *runtime.Scheme, objOrRef runtime.Object) (*v1.EventList, error) {
- var action core.ListActionImpl
- if c.Namespace() != "" {
- action = core.NewListAction(c.Resource(), c.Kind(), c.Namespace(), metav1.ListOptions{})
- } else {
- action = core.NewListAction(c.Resource(), c.Kind(), v1.NamespaceDefault, metav1.ListOptions{})
- }
- obj, err := c.Fake.Invokes(action, &v1.EventList{})
- if obj == nil {
- return nil, err
- }
-
- return obj.(*v1.EventList), err
-}
-
-func (c *fakeEvents) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector {
- action := core.GenericActionImpl{}
- action.Verb = "get-field-selector"
- action.Resource = c.Resource()
-
- c.Fake.Invokes(action, nil)
- return fields.Everything()
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_limitrange.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_limitrange.go
deleted file mode 100644
index 377581f109..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_limitrange.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakeLimitRanges implements LimitRangeInterface
-type fakeLimitRanges struct {
- *gentype.FakeClientWithListAndApply[*v1.LimitRange, *v1.LimitRangeList, *corev1.LimitRangeApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakeLimitRanges(fake *FakeCoreV1, namespace string) typedcorev1.LimitRangeInterface {
- return &fakeLimitRanges{
- gentype.NewFakeClientWithListAndApply[*v1.LimitRange, *v1.LimitRangeList, *corev1.LimitRangeApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("limitranges"),
- v1.SchemeGroupVersion.WithKind("LimitRange"),
- func() *v1.LimitRange { return &v1.LimitRange{} },
- func() *v1.LimitRangeList { return &v1.LimitRangeList{} },
- func(dst, src *v1.LimitRangeList) { dst.ListMeta = src.ListMeta },
- func(list *v1.LimitRangeList) []*v1.LimitRange { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.LimitRangeList, items []*v1.LimitRange) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_namespace.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_namespace.go
deleted file mode 100644
index 2e0ac2d8a5..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_namespace.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakeNamespaces implements NamespaceInterface
-type fakeNamespaces struct {
- *gentype.FakeClientWithListAndApply[*v1.Namespace, *v1.NamespaceList, *corev1.NamespaceApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakeNamespaces(fake *FakeCoreV1) typedcorev1.NamespaceInterface {
- return &fakeNamespaces{
- gentype.NewFakeClientWithListAndApply[*v1.Namespace, *v1.NamespaceList, *corev1.NamespaceApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("namespaces"),
- v1.SchemeGroupVersion.WithKind("Namespace"),
- func() *v1.Namespace { return &v1.Namespace{} },
- func() *v1.NamespaceList { return &v1.NamespaceList{} },
- func(dst, src *v1.NamespaceList) { dst.ListMeta = src.ListMeta },
- func(list *v1.NamespaceList) []*v1.Namespace { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.NamespaceList, items []*v1.Namespace) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_namespace_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_namespace_expansion.go
deleted file mode 100644
index adc2624b53..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_namespace_expansion.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fake
-
-import (
- "context"
-
- v1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- core "k8s.io/client-go/testing"
-)
-
-func (c *fakeNamespaces) Finalize(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (*v1.Namespace, error) {
- action := core.CreateActionImpl{}
- action.Verb = "create"
- action.Resource = c.Resource()
- action.Subresource = "finalize"
- action.Object = namespace
-
- obj, err := c.Fake.Invokes(action, namespace)
- if obj == nil {
- return nil, err
- }
-
- return obj.(*v1.Namespace), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_node.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_node.go
deleted file mode 100644
index 8e59a61e0c..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_node.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakeNodes implements NodeInterface
-type fakeNodes struct {
- *gentype.FakeClientWithListAndApply[*v1.Node, *v1.NodeList, *corev1.NodeApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakeNodes(fake *FakeCoreV1) typedcorev1.NodeInterface {
- return &fakeNodes{
- gentype.NewFakeClientWithListAndApply[*v1.Node, *v1.NodeList, *corev1.NodeApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("nodes"),
- v1.SchemeGroupVersion.WithKind("Node"),
- func() *v1.Node { return &v1.Node{} },
- func() *v1.NodeList { return &v1.NodeList{} },
- func(dst, src *v1.NodeList) { dst.ListMeta = src.ListMeta },
- func(list *v1.NodeList) []*v1.Node { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.NodeList, items []*v1.Node) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_node_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_node_expansion.go
deleted file mode 100644
index 0e5be84953..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_node_expansion.go
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fake
-
-import (
- "context"
-
- v1 "k8s.io/api/core/v1"
- types "k8s.io/apimachinery/pkg/types"
- core "k8s.io/client-go/testing"
-)
-
-// TODO: Should take a PatchType as an argument probably.
-func (c *fakeNodes) PatchStatus(_ context.Context, nodeName string, data []byte) (*v1.Node, error) {
- // TODO: Should be configurable to support additional patch strategies.
- pt := types.StrategicMergePatchType
- obj, err := c.Fake.Invokes(
- core.NewRootPatchSubresourceAction(c.Resource(), nodeName, pt, data, "status"), &v1.Node{})
- if obj == nil {
- return nil, err
- }
-
- return obj.(*v1.Node), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_persistentvolume.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_persistentvolume.go
deleted file mode 100644
index d4cbfcbfbf..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_persistentvolume.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakePersistentVolumes implements PersistentVolumeInterface
-type fakePersistentVolumes struct {
- *gentype.FakeClientWithListAndApply[*v1.PersistentVolume, *v1.PersistentVolumeList, *corev1.PersistentVolumeApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakePersistentVolumes(fake *FakeCoreV1) typedcorev1.PersistentVolumeInterface {
- return &fakePersistentVolumes{
- gentype.NewFakeClientWithListAndApply[*v1.PersistentVolume, *v1.PersistentVolumeList, *corev1.PersistentVolumeApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("persistentvolumes"),
- v1.SchemeGroupVersion.WithKind("PersistentVolume"),
- func() *v1.PersistentVolume { return &v1.PersistentVolume{} },
- func() *v1.PersistentVolumeList { return &v1.PersistentVolumeList{} },
- func(dst, src *v1.PersistentVolumeList) { dst.ListMeta = src.ListMeta },
- func(list *v1.PersistentVolumeList) []*v1.PersistentVolume { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.PersistentVolumeList, items []*v1.PersistentVolume) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_persistentvolumeclaim.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_persistentvolumeclaim.go
deleted file mode 100644
index 3b2511337c..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_persistentvolumeclaim.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakePersistentVolumeClaims implements PersistentVolumeClaimInterface
-type fakePersistentVolumeClaims struct {
- *gentype.FakeClientWithListAndApply[*v1.PersistentVolumeClaim, *v1.PersistentVolumeClaimList, *corev1.PersistentVolumeClaimApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakePersistentVolumeClaims(fake *FakeCoreV1, namespace string) typedcorev1.PersistentVolumeClaimInterface {
- return &fakePersistentVolumeClaims{
- gentype.NewFakeClientWithListAndApply[*v1.PersistentVolumeClaim, *v1.PersistentVolumeClaimList, *corev1.PersistentVolumeClaimApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("persistentvolumeclaims"),
- v1.SchemeGroupVersion.WithKind("PersistentVolumeClaim"),
- func() *v1.PersistentVolumeClaim { return &v1.PersistentVolumeClaim{} },
- func() *v1.PersistentVolumeClaimList { return &v1.PersistentVolumeClaimList{} },
- func(dst, src *v1.PersistentVolumeClaimList) { dst.ListMeta = src.ListMeta },
- func(list *v1.PersistentVolumeClaimList) []*v1.PersistentVolumeClaim {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.PersistentVolumeClaimList, items []*v1.PersistentVolumeClaim) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod.go
deleted file mode 100644
index 7d353bcf10..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod.go
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
-
- v1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
- testing "k8s.io/client-go/testing"
-)
-
-// fakePods implements PodInterface
-type fakePods struct {
- *gentype.FakeClientWithListAndApply[*v1.Pod, *v1.PodList, *corev1.PodApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakePods(fake *FakeCoreV1, namespace string) typedcorev1.PodInterface {
- return &fakePods{
- gentype.NewFakeClientWithListAndApply[*v1.Pod, *v1.PodList, *corev1.PodApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("pods"),
- v1.SchemeGroupVersion.WithKind("Pod"),
- func() *v1.Pod { return &v1.Pod{} },
- func() *v1.PodList { return &v1.PodList{} },
- func(dst, src *v1.PodList) { dst.ListMeta = src.ListMeta },
- func(list *v1.PodList) []*v1.Pod { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.PodList, items []*v1.Pod) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
-
-// UpdateEphemeralContainers takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any.
-func (c *fakePods) UpdateEphemeralContainers(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) {
- emptyResult := &v1.Pod{}
- obj, err := c.Fake.
- Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "ephemeralcontainers", c.Namespace(), pod, opts), &v1.Pod{})
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*v1.Pod), err
-}
-
-// UpdateResize takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any.
-func (c *fakePods) UpdateResize(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) {
- emptyResult := &v1.Pod{}
- obj, err := c.Fake.
- Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "resize", c.Namespace(), pod, opts), &v1.Pod{})
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*v1.Pod), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod_expansion.go
deleted file mode 100644
index 2b607298ca..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod_expansion.go
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fake
-
-import (
- "bytes"
- "context"
- "fmt"
- "io"
- "net/http"
-
- v1 "k8s.io/api/core/v1"
- policyv1 "k8s.io/api/policy/v1"
- policyv1beta1 "k8s.io/api/policy/v1beta1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/client-go/kubernetes/scheme"
- restclient "k8s.io/client-go/rest"
- fakerest "k8s.io/client-go/rest/fake"
- core "k8s.io/client-go/testing"
-)
-
-func (c *fakePods) Bind(ctx context.Context, binding *v1.Binding, opts metav1.CreateOptions) error {
- action := core.CreateActionImpl{}
- action.Verb = "create"
- action.Namespace = binding.Namespace
- action.Resource = c.Resource()
- action.Subresource = "binding"
- action.Object = binding
-
- _, err := c.Fake.Invokes(action, binding)
- return err
-}
-
-func (c *fakePods) GetBinding(name string) (result *v1.Binding, err error) {
- obj, err := c.Fake.
- Invokes(core.NewGetSubresourceAction(c.Resource(), c.Namespace(), "binding", name), &v1.Binding{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1.Binding), err
-}
-
-func (c *fakePods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request {
- action := core.GenericActionImpl{}
- action.Verb = "get"
- action.Namespace = c.Namespace()
- action.Resource = c.Resource()
- action.Subresource = "log"
- action.Value = opts
-
- defaultLogResponse := &runtime.Unknown{Raw: []byte("fake logs")}
- obj, err := c.Fake.Invokes(action, defaultLogResponse)
- logs := defaultLogResponse.Raw
- if err == nil {
- unknown, ok := obj.(*runtime.Unknown)
- if !ok || unknown == nil {
- err = fmt.Errorf("fake Pods.GetLogs expected reactor to return *runtime.Unknown, got %T", obj)
- } else {
- logs = unknown.Raw
- }
- }
-
- fakeClient := &fakerest.RESTClient{
- Client: fakerest.CreateHTTPClient(func(request *http.Request) (*http.Response, error) {
- if err != nil {
- return nil, err
- }
- resp := &http.Response{
- StatusCode: http.StatusOK,
- Body: io.NopCloser(bytes.NewReader(logs)),
- }
- return resp, nil
- }),
- NegotiatedSerializer: scheme.Codecs.WithoutConversion(),
- GroupVersion: c.Kind().GroupVersion(),
- VersionedAPIPath: fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/log", c.Namespace(), name),
- }
- return fakeClient.Request()
-}
-
-func (c *fakePods) Evict(ctx context.Context, eviction *policyv1beta1.Eviction) error {
- return c.EvictV1beta1(ctx, eviction)
-}
-
-func (c *fakePods) EvictV1(ctx context.Context, eviction *policyv1.Eviction) error {
- action := core.CreateActionImpl{}
- action.Verb = "create"
- action.Namespace = c.Namespace()
- action.Resource = c.Resource()
- action.Subresource = "eviction"
- action.Object = eviction
-
- _, err := c.Fake.Invokes(action, eviction)
- return err
-}
-
-func (c *fakePods) EvictV1beta1(ctx context.Context, eviction *policyv1beta1.Eviction) error {
- action := core.CreateActionImpl{}
- action.Verb = "create"
- action.Namespace = c.Namespace()
- action.Resource = c.Resource()
- action.Subresource = "eviction"
- action.Object = eviction
-
- _, err := c.Fake.Invokes(action, eviction)
- return err
-}
-
-func (c *fakePods) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
- return c.Fake.InvokesProxy(core.NewProxyGetAction(c.Resource(), c.Namespace(), scheme, name, port, path, params))
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_podtemplate.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_podtemplate.go
deleted file mode 100644
index d3ff2c4124..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_podtemplate.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakePodTemplates implements PodTemplateInterface
-type fakePodTemplates struct {
- *gentype.FakeClientWithListAndApply[*v1.PodTemplate, *v1.PodTemplateList, *corev1.PodTemplateApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakePodTemplates(fake *FakeCoreV1, namespace string) typedcorev1.PodTemplateInterface {
- return &fakePodTemplates{
- gentype.NewFakeClientWithListAndApply[*v1.PodTemplate, *v1.PodTemplateList, *corev1.PodTemplateApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("podtemplates"),
- v1.SchemeGroupVersion.WithKind("PodTemplate"),
- func() *v1.PodTemplate { return &v1.PodTemplate{} },
- func() *v1.PodTemplateList { return &v1.PodTemplateList{} },
- func(dst, src *v1.PodTemplateList) { dst.ListMeta = src.ListMeta },
- func(list *v1.PodTemplateList) []*v1.PodTemplate { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.PodTemplateList, items []*v1.PodTemplate) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_replicationcontroller.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_replicationcontroller.go
deleted file mode 100644
index 454f099625..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_replicationcontroller.go
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
-
- autoscalingv1 "k8s.io/api/autoscaling/v1"
- v1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
- testing "k8s.io/client-go/testing"
-)
-
-// fakeReplicationControllers implements ReplicationControllerInterface
-type fakeReplicationControllers struct {
- *gentype.FakeClientWithListAndApply[*v1.ReplicationController, *v1.ReplicationControllerList, *corev1.ReplicationControllerApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakeReplicationControllers(fake *FakeCoreV1, namespace string) typedcorev1.ReplicationControllerInterface {
- return &fakeReplicationControllers{
- gentype.NewFakeClientWithListAndApply[*v1.ReplicationController, *v1.ReplicationControllerList, *corev1.ReplicationControllerApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("replicationcontrollers"),
- v1.SchemeGroupVersion.WithKind("ReplicationController"),
- func() *v1.ReplicationController { return &v1.ReplicationController{} },
- func() *v1.ReplicationControllerList { return &v1.ReplicationControllerList{} },
- func(dst, src *v1.ReplicationControllerList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ReplicationControllerList) []*v1.ReplicationController {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.ReplicationControllerList, items []*v1.ReplicationController) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
-
-// GetScale takes name of the replicationController, and returns the corresponding scale object, and an error if there is any.
-func (c *fakeReplicationControllers) GetScale(ctx context.Context, replicationControllerName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
- emptyResult := &autoscalingv1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", replicationControllerName, options), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*autoscalingv1.Scale), err
-}
-
-// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
-func (c *fakeReplicationControllers) UpdateScale(ctx context.Context, replicationControllerName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
- emptyResult := &autoscalingv1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &autoscalingv1.Scale{})
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*autoscalingv1.Scale), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_resourcequota.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_resourcequota.go
deleted file mode 100644
index 4c98389d38..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_resourcequota.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakeResourceQuotas implements ResourceQuotaInterface
-type fakeResourceQuotas struct {
- *gentype.FakeClientWithListAndApply[*v1.ResourceQuota, *v1.ResourceQuotaList, *corev1.ResourceQuotaApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakeResourceQuotas(fake *FakeCoreV1, namespace string) typedcorev1.ResourceQuotaInterface {
- return &fakeResourceQuotas{
- gentype.NewFakeClientWithListAndApply[*v1.ResourceQuota, *v1.ResourceQuotaList, *corev1.ResourceQuotaApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("resourcequotas"),
- v1.SchemeGroupVersion.WithKind("ResourceQuota"),
- func() *v1.ResourceQuota { return &v1.ResourceQuota{} },
- func() *v1.ResourceQuotaList { return &v1.ResourceQuotaList{} },
- func(dst, src *v1.ResourceQuotaList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ResourceQuotaList) []*v1.ResourceQuota { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.ResourceQuotaList, items []*v1.ResourceQuota) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_secret.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_secret.go
deleted file mode 100644
index 779c12c381..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_secret.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakeSecrets implements SecretInterface
-type fakeSecrets struct {
- *gentype.FakeClientWithListAndApply[*v1.Secret, *v1.SecretList, *corev1.SecretApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakeSecrets(fake *FakeCoreV1, namespace string) typedcorev1.SecretInterface {
- return &fakeSecrets{
- gentype.NewFakeClientWithListAndApply[*v1.Secret, *v1.SecretList, *corev1.SecretApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("secrets"),
- v1.SchemeGroupVersion.WithKind("Secret"),
- func() *v1.Secret { return &v1.Secret{} },
- func() *v1.SecretList { return &v1.SecretList{} },
- func(dst, src *v1.SecretList) { dst.ListMeta = src.ListMeta },
- func(list *v1.SecretList) []*v1.Secret { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.SecretList, items []*v1.Secret) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_service.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_service.go
deleted file mode 100644
index 6bab944a4b..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_service.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/core/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
-)
-
-// fakeServices implements ServiceInterface
-type fakeServices struct {
- *gentype.FakeClientWithListAndApply[*v1.Service, *v1.ServiceList, *corev1.ServiceApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakeServices(fake *FakeCoreV1, namespace string) typedcorev1.ServiceInterface {
- return &fakeServices{
- gentype.NewFakeClientWithListAndApply[*v1.Service, *v1.ServiceList, *corev1.ServiceApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("services"),
- v1.SchemeGroupVersion.WithKind("Service"),
- func() *v1.Service { return &v1.Service{} },
- func() *v1.ServiceList { return &v1.ServiceList{} },
- func(dst, src *v1.ServiceList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ServiceList) []*v1.Service { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.ServiceList, items []*v1.Service) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_serviceaccount.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_serviceaccount.go
deleted file mode 100644
index 76df9d62be..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_serviceaccount.go
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
-
- authenticationv1 "k8s.io/api/authentication/v1"
- v1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- corev1 "k8s.io/client-go/applyconfigurations/core/v1"
- gentype "k8s.io/client-go/gentype"
- typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
- testing "k8s.io/client-go/testing"
-)
-
-// fakeServiceAccounts implements ServiceAccountInterface
-type fakeServiceAccounts struct {
- *gentype.FakeClientWithListAndApply[*v1.ServiceAccount, *v1.ServiceAccountList, *corev1.ServiceAccountApplyConfiguration]
- Fake *FakeCoreV1
-}
-
-func newFakeServiceAccounts(fake *FakeCoreV1, namespace string) typedcorev1.ServiceAccountInterface {
- return &fakeServiceAccounts{
- gentype.NewFakeClientWithListAndApply[*v1.ServiceAccount, *v1.ServiceAccountList, *corev1.ServiceAccountApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("serviceaccounts"),
- v1.SchemeGroupVersion.WithKind("ServiceAccount"),
- func() *v1.ServiceAccount { return &v1.ServiceAccount{} },
- func() *v1.ServiceAccountList { return &v1.ServiceAccountList{} },
- func(dst, src *v1.ServiceAccountList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ServiceAccountList) []*v1.ServiceAccount { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.ServiceAccountList, items []*v1.ServiceAccount) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
-
-// CreateToken takes the representation of a tokenRequest and creates it. Returns the server's representation of the tokenRequest, and an error, if there is any.
-func (c *fakeServiceAccounts) CreateToken(ctx context.Context, serviceAccountName string, tokenRequest *authenticationv1.TokenRequest, opts metav1.CreateOptions) (result *authenticationv1.TokenRequest, err error) {
- emptyResult := &authenticationv1.TokenRequest{}
- obj, err := c.Fake.
- Invokes(testing.NewCreateSubresourceActionWithOptions(c.Resource(), serviceAccountName, "token", c.Namespace(), tokenRequest, opts), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*authenticationv1.TokenRequest), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/fake_discovery_client.go b/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/fake_discovery_client.go
deleted file mode 100644
index b64eabdad1..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/fake_discovery_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/discovery/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeDiscoveryV1 struct {
- *testing.Fake
-}
-
-func (c *FakeDiscoveryV1) EndpointSlices(namespace string) v1.EndpointSliceInterface {
- return newFakeEndpointSlices(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeDiscoveryV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/fake_endpointslice.go b/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/fake_endpointslice.go
deleted file mode 100644
index a2b048fd92..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/fake/fake_endpointslice.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/discovery/v1"
- discoveryv1 "k8s.io/client-go/applyconfigurations/discovery/v1"
- gentype "k8s.io/client-go/gentype"
- typeddiscoveryv1 "k8s.io/client-go/kubernetes/typed/discovery/v1"
-)
-
-// fakeEndpointSlices implements EndpointSliceInterface
-type fakeEndpointSlices struct {
- *gentype.FakeClientWithListAndApply[*v1.EndpointSlice, *v1.EndpointSliceList, *discoveryv1.EndpointSliceApplyConfiguration]
- Fake *FakeDiscoveryV1
-}
-
-func newFakeEndpointSlices(fake *FakeDiscoveryV1, namespace string) typeddiscoveryv1.EndpointSliceInterface {
- return &fakeEndpointSlices{
- gentype.NewFakeClientWithListAndApply[*v1.EndpointSlice, *v1.EndpointSliceList, *discoveryv1.EndpointSliceApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("endpointslices"),
- v1.SchemeGroupVersion.WithKind("EndpointSlice"),
- func() *v1.EndpointSlice { return &v1.EndpointSlice{} },
- func() *v1.EndpointSliceList { return &v1.EndpointSliceList{} },
- func(dst, src *v1.EndpointSliceList) { dst.ListMeta = src.ListMeta },
- func(list *v1.EndpointSliceList) []*v1.EndpointSlice { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.EndpointSliceList, items []*v1.EndpointSlice) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_discovery_client.go b/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_discovery_client.go
deleted file mode 100644
index 53fdfe62ef..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_discovery_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeDiscoveryV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeDiscoveryV1beta1) EndpointSlices(namespace string) v1beta1.EndpointSliceInterface {
- return newFakeEndpointSlices(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeDiscoveryV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_endpointslice.go b/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_endpointslice.go
deleted file mode 100644
index b36aeb4d04..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_endpointslice.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/discovery/v1beta1"
- discoveryv1beta1 "k8s.io/client-go/applyconfigurations/discovery/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typeddiscoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1"
-)
-
-// fakeEndpointSlices implements EndpointSliceInterface
-type fakeEndpointSlices struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.EndpointSlice, *v1beta1.EndpointSliceList, *discoveryv1beta1.EndpointSliceApplyConfiguration]
- Fake *FakeDiscoveryV1beta1
-}
-
-func newFakeEndpointSlices(fake *FakeDiscoveryV1beta1, namespace string) typeddiscoveryv1beta1.EndpointSliceInterface {
- return &fakeEndpointSlices{
- gentype.NewFakeClientWithListAndApply[*v1beta1.EndpointSlice, *v1beta1.EndpointSliceList, *discoveryv1beta1.EndpointSliceApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("endpointslices"),
- v1beta1.SchemeGroupVersion.WithKind("EndpointSlice"),
- func() *v1beta1.EndpointSlice { return &v1beta1.EndpointSlice{} },
- func() *v1beta1.EndpointSliceList { return &v1beta1.EndpointSliceList{} },
- func(dst, src *v1beta1.EndpointSliceList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.EndpointSliceList) []*v1beta1.EndpointSlice {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.EndpointSliceList, items []*v1beta1.EndpointSlice) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/events/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/events/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/events/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/events/v1/fake/fake_event.go b/vendor/k8s.io/client-go/kubernetes/typed/events/v1/fake/fake_event.go
deleted file mode 100644
index b9f176d146..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/events/v1/fake/fake_event.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/events/v1"
- eventsv1 "k8s.io/client-go/applyconfigurations/events/v1"
- gentype "k8s.io/client-go/gentype"
- typedeventsv1 "k8s.io/client-go/kubernetes/typed/events/v1"
-)
-
-// fakeEvents implements EventInterface
-type fakeEvents struct {
- *gentype.FakeClientWithListAndApply[*v1.Event, *v1.EventList, *eventsv1.EventApplyConfiguration]
- Fake *FakeEventsV1
-}
-
-func newFakeEvents(fake *FakeEventsV1, namespace string) typedeventsv1.EventInterface {
- return &fakeEvents{
- gentype.NewFakeClientWithListAndApply[*v1.Event, *v1.EventList, *eventsv1.EventApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("events"),
- v1.SchemeGroupVersion.WithKind("Event"),
- func() *v1.Event { return &v1.Event{} },
- func() *v1.EventList { return &v1.EventList{} },
- func(dst, src *v1.EventList) { dst.ListMeta = src.ListMeta },
- func(list *v1.EventList) []*v1.Event { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.EventList, items []*v1.Event) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/events/v1/fake/fake_events_client.go b/vendor/k8s.io/client-go/kubernetes/typed/events/v1/fake/fake_events_client.go
deleted file mode 100644
index ab0ca22b4f..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/events/v1/fake/fake_events_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/events/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeEventsV1 struct {
- *testing.Fake
-}
-
-func (c *FakeEventsV1) Events(namespace string) v1.EventInterface {
- return newFakeEvents(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeEventsV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake/fake_event.go b/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake/fake_event.go
deleted file mode 100644
index 9c9a573265..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake/fake_event.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/events/v1beta1"
- eventsv1beta1 "k8s.io/client-go/applyconfigurations/events/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedeventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1"
-)
-
-// fakeEvents implements EventInterface
-type fakeEvents struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.Event, *v1beta1.EventList, *eventsv1beta1.EventApplyConfiguration]
- Fake *FakeEventsV1beta1
-}
-
-func newFakeEvents(fake *FakeEventsV1beta1, namespace string) typedeventsv1beta1.EventInterface {
- return &fakeEvents{
- gentype.NewFakeClientWithListAndApply[*v1beta1.Event, *v1beta1.EventList, *eventsv1beta1.EventApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("events"),
- v1beta1.SchemeGroupVersion.WithKind("Event"),
- func() *v1beta1.Event { return &v1beta1.Event{} },
- func() *v1beta1.EventList { return &v1beta1.EventList{} },
- func(dst, src *v1beta1.EventList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.EventList) []*v1beta1.Event { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.EventList, items []*v1beta1.Event) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake/fake_event_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake/fake_event_expansion.go
deleted file mode 100644
index 248ff6ea1f..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake/fake_event_expansion.go
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-Copyright 2019 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/events/v1beta1"
- types "k8s.io/apimachinery/pkg/types"
- core "k8s.io/client-go/testing"
-)
-
-// CreateWithEventNamespace creats a new event. Returns the copy of the event the server returns, or an error.
-func (c *fakeEvents) CreateWithEventNamespace(event *v1beta1.Event) (*v1beta1.Event, error) {
- action := core.NewRootCreateAction(c.Resource(), event)
- if c.Namespace() != "" {
- action = core.NewCreateAction(c.Resource(), c.Namespace(), event)
- }
- obj, err := c.Fake.Invokes(action, event)
- if obj == nil {
- return nil, err
- }
-
- return obj.(*v1beta1.Event), err
-}
-
-// UpdateWithEventNamespace replaces an existing event. Returns the copy of the event the server returns, or an error.
-func (c *fakeEvents) UpdateWithEventNamespace(event *v1beta1.Event) (*v1beta1.Event, error) {
- action := core.NewRootUpdateAction(c.Resource(), event)
- if c.Namespace() != "" {
- action = core.NewUpdateAction(c.Resource(), c.Namespace(), event)
- }
- obj, err := c.Fake.Invokes(action, event)
- if obj == nil {
- return nil, err
- }
-
- return obj.(*v1beta1.Event), err
-}
-
-// PatchWithEventNamespace patches an existing event. Returns the copy of the event the server returns, or an error.
-func (c *fakeEvents) PatchWithEventNamespace(event *v1beta1.Event, data []byte) (*v1beta1.Event, error) {
- pt := types.StrategicMergePatchType
- action := core.NewRootPatchAction(c.Resource(), event.Name, pt, data)
- if c.Namespace() != "" {
- action = core.NewPatchAction(c.Resource(), c.Namespace(), event.Name, pt, data)
- }
- obj, err := c.Fake.Invokes(action, event)
- if obj == nil {
- return nil, err
- }
-
- return obj.(*v1beta1.Event), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake/fake_events_client.go b/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake/fake_events_client.go
deleted file mode 100644
index 0b4db4d517..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake/fake_events_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeEventsV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeEventsV1beta1) Events(namespace string) v1beta1.EventInterface {
- return newFakeEvents(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeEventsV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_daemonset.go b/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_daemonset.go
deleted file mode 100644
index 6b6244ca89..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_daemonset.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/extensions/v1beta1"
- extensionsv1beta1 "k8s.io/client-go/applyconfigurations/extensions/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
-)
-
-// fakeDaemonSets implements DaemonSetInterface
-type fakeDaemonSets struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.DaemonSet, *v1beta1.DaemonSetList, *extensionsv1beta1.DaemonSetApplyConfiguration]
- Fake *FakeExtensionsV1beta1
-}
-
-func newFakeDaemonSets(fake *FakeExtensionsV1beta1, namespace string) typedextensionsv1beta1.DaemonSetInterface {
- return &fakeDaemonSets{
- gentype.NewFakeClientWithListAndApply[*v1beta1.DaemonSet, *v1beta1.DaemonSetList, *extensionsv1beta1.DaemonSetApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("daemonsets"),
- v1beta1.SchemeGroupVersion.WithKind("DaemonSet"),
- func() *v1beta1.DaemonSet { return &v1beta1.DaemonSet{} },
- func() *v1beta1.DaemonSetList { return &v1beta1.DaemonSetList{} },
- func(dst, src *v1beta1.DaemonSetList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.DaemonSetList) []*v1beta1.DaemonSet { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.DaemonSetList, items []*v1beta1.DaemonSet) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_deployment.go b/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_deployment.go
deleted file mode 100644
index c8fd8281a7..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_deployment.go
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
- json "encoding/json"
- fmt "fmt"
-
- v1beta1 "k8s.io/api/extensions/v1beta1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- extensionsv1beta1 "k8s.io/client-go/applyconfigurations/extensions/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
- testing "k8s.io/client-go/testing"
-)
-
-// fakeDeployments implements DeploymentInterface
-type fakeDeployments struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.Deployment, *v1beta1.DeploymentList, *extensionsv1beta1.DeploymentApplyConfiguration]
- Fake *FakeExtensionsV1beta1
-}
-
-func newFakeDeployments(fake *FakeExtensionsV1beta1, namespace string) typedextensionsv1beta1.DeploymentInterface {
- return &fakeDeployments{
- gentype.NewFakeClientWithListAndApply[*v1beta1.Deployment, *v1beta1.DeploymentList, *extensionsv1beta1.DeploymentApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("deployments"),
- v1beta1.SchemeGroupVersion.WithKind("Deployment"),
- func() *v1beta1.Deployment { return &v1beta1.Deployment{} },
- func() *v1beta1.DeploymentList { return &v1beta1.DeploymentList{} },
- func(dst, src *v1beta1.DeploymentList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.DeploymentList) []*v1beta1.Deployment { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.DeploymentList, items []*v1beta1.Deployment) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
-
-// GetScale takes name of the deployment, and returns the corresponding scale object, and an error if there is any.
-func (c *fakeDeployments) GetScale(ctx context.Context, deploymentName string, options v1.GetOptions) (result *v1beta1.Scale, err error) {
- emptyResult := &v1beta1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", deploymentName, options), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*v1beta1.Scale), err
-}
-
-// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
-func (c *fakeDeployments) UpdateScale(ctx context.Context, deploymentName string, scale *v1beta1.Scale, opts v1.UpdateOptions) (result *v1beta1.Scale, err error) {
- emptyResult := &v1beta1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &v1beta1.Scale{})
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*v1beta1.Scale), err
-}
-
-// ApplyScale takes top resource name and the apply declarative configuration for scale,
-// applies it and returns the applied scale, and an error, if there is any.
-func (c *fakeDeployments) ApplyScale(ctx context.Context, deploymentName string, scale *extensionsv1beta1.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Scale, err error) {
- if scale == nil {
- return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
- }
- data, err := json.Marshal(scale)
- if err != nil {
- return nil, err
- }
- emptyResult := &v1beta1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceActionWithOptions(c.Resource(), c.Namespace(), deploymentName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*v1beta1.Scale), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_deployment_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_deployment_expansion.go
deleted file mode 100644
index faa1cc810e..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_deployment_expansion.go
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fake
-
-import (
- "context"
-
- "k8s.io/api/extensions/v1beta1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- core "k8s.io/client-go/testing"
-)
-
-func (c *fakeDeployments) Rollback(ctx context.Context, deploymentRollback *v1beta1.DeploymentRollback, opts metav1.CreateOptions) error {
- action := core.CreateActionImpl{}
- action.Verb = "create"
- action.Resource = c.Resource()
- action.Subresource = "rollback"
- action.Object = deploymentRollback
-
- _, err := c.Fake.Invokes(action, deploymentRollback)
- return err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_extensions_client.go b/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_extensions_client.go
deleted file mode 100644
index 87a5ed86e7..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_extensions_client.go
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeExtensionsV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeExtensionsV1beta1) DaemonSets(namespace string) v1beta1.DaemonSetInterface {
- return newFakeDaemonSets(c, namespace)
-}
-
-func (c *FakeExtensionsV1beta1) Deployments(namespace string) v1beta1.DeploymentInterface {
- return newFakeDeployments(c, namespace)
-}
-
-func (c *FakeExtensionsV1beta1) Ingresses(namespace string) v1beta1.IngressInterface {
- return newFakeIngresses(c, namespace)
-}
-
-func (c *FakeExtensionsV1beta1) NetworkPolicies(namespace string) v1beta1.NetworkPolicyInterface {
- return newFakeNetworkPolicies(c, namespace)
-}
-
-func (c *FakeExtensionsV1beta1) ReplicaSets(namespace string) v1beta1.ReplicaSetInterface {
- return newFakeReplicaSets(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeExtensionsV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_ingress.go b/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_ingress.go
deleted file mode 100644
index aaa43d78ae..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_ingress.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/extensions/v1beta1"
- extensionsv1beta1 "k8s.io/client-go/applyconfigurations/extensions/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
-)
-
-// fakeIngresses implements IngressInterface
-type fakeIngresses struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.Ingress, *v1beta1.IngressList, *extensionsv1beta1.IngressApplyConfiguration]
- Fake *FakeExtensionsV1beta1
-}
-
-func newFakeIngresses(fake *FakeExtensionsV1beta1, namespace string) typedextensionsv1beta1.IngressInterface {
- return &fakeIngresses{
- gentype.NewFakeClientWithListAndApply[*v1beta1.Ingress, *v1beta1.IngressList, *extensionsv1beta1.IngressApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("ingresses"),
- v1beta1.SchemeGroupVersion.WithKind("Ingress"),
- func() *v1beta1.Ingress { return &v1beta1.Ingress{} },
- func() *v1beta1.IngressList { return &v1beta1.IngressList{} },
- func(dst, src *v1beta1.IngressList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.IngressList) []*v1beta1.Ingress { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.IngressList, items []*v1beta1.Ingress) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_networkpolicy.go b/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_networkpolicy.go
deleted file mode 100644
index 30f53b9975..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_networkpolicy.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/extensions/v1beta1"
- extensionsv1beta1 "k8s.io/client-go/applyconfigurations/extensions/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
-)
-
-// fakeNetworkPolicies implements NetworkPolicyInterface
-type fakeNetworkPolicies struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.NetworkPolicy, *v1beta1.NetworkPolicyList, *extensionsv1beta1.NetworkPolicyApplyConfiguration]
- Fake *FakeExtensionsV1beta1
-}
-
-func newFakeNetworkPolicies(fake *FakeExtensionsV1beta1, namespace string) typedextensionsv1beta1.NetworkPolicyInterface {
- return &fakeNetworkPolicies{
- gentype.NewFakeClientWithListAndApply[*v1beta1.NetworkPolicy, *v1beta1.NetworkPolicyList, *extensionsv1beta1.NetworkPolicyApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("networkpolicies"),
- v1beta1.SchemeGroupVersion.WithKind("NetworkPolicy"),
- func() *v1beta1.NetworkPolicy { return &v1beta1.NetworkPolicy{} },
- func() *v1beta1.NetworkPolicyList { return &v1beta1.NetworkPolicyList{} },
- func(dst, src *v1beta1.NetworkPolicyList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.NetworkPolicyList) []*v1beta1.NetworkPolicy {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.NetworkPolicyList, items []*v1beta1.NetworkPolicy) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_replicaset.go b/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_replicaset.go
deleted file mode 100644
index 86ae1621dd..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/fake_replicaset.go
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
- json "encoding/json"
- fmt "fmt"
-
- v1beta1 "k8s.io/api/extensions/v1beta1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- extensionsv1beta1 "k8s.io/client-go/applyconfigurations/extensions/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
- testing "k8s.io/client-go/testing"
-)
-
-// fakeReplicaSets implements ReplicaSetInterface
-type fakeReplicaSets struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.ReplicaSet, *v1beta1.ReplicaSetList, *extensionsv1beta1.ReplicaSetApplyConfiguration]
- Fake *FakeExtensionsV1beta1
-}
-
-func newFakeReplicaSets(fake *FakeExtensionsV1beta1, namespace string) typedextensionsv1beta1.ReplicaSetInterface {
- return &fakeReplicaSets{
- gentype.NewFakeClientWithListAndApply[*v1beta1.ReplicaSet, *v1beta1.ReplicaSetList, *extensionsv1beta1.ReplicaSetApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("replicasets"),
- v1beta1.SchemeGroupVersion.WithKind("ReplicaSet"),
- func() *v1beta1.ReplicaSet { return &v1beta1.ReplicaSet{} },
- func() *v1beta1.ReplicaSetList { return &v1beta1.ReplicaSetList{} },
- func(dst, src *v1beta1.ReplicaSetList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.ReplicaSetList) []*v1beta1.ReplicaSet { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.ReplicaSetList, items []*v1beta1.ReplicaSet) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
-
-// GetScale takes name of the replicaSet, and returns the corresponding scale object, and an error if there is any.
-func (c *fakeReplicaSets) GetScale(ctx context.Context, replicaSetName string, options v1.GetOptions) (result *v1beta1.Scale, err error) {
- emptyResult := &v1beta1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewGetSubresourceActionWithOptions(c.Resource(), c.Namespace(), "scale", replicaSetName, options), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*v1beta1.Scale), err
-}
-
-// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
-func (c *fakeReplicaSets) UpdateScale(ctx context.Context, replicaSetName string, scale *v1beta1.Scale, opts v1.UpdateOptions) (result *v1beta1.Scale, err error) {
- emptyResult := &v1beta1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewUpdateSubresourceActionWithOptions(c.Resource(), "scale", c.Namespace(), scale, opts), &v1beta1.Scale{})
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*v1beta1.Scale), err
-}
-
-// ApplyScale takes top resource name and the apply declarative configuration for scale,
-// applies it and returns the applied scale, and an error, if there is any.
-func (c *fakeReplicaSets) ApplyScale(ctx context.Context, replicaSetName string, scale *extensionsv1beta1.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Scale, err error) {
- if scale == nil {
- return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
- }
- data, err := json.Marshal(scale)
- if err != nil {
- return nil, err
- }
- emptyResult := &v1beta1.Scale{}
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceActionWithOptions(c.Resource(), c.Namespace(), replicaSetName, types.ApplyPatchType, data, opts.ToPatchOptions(), "scale"), emptyResult)
-
- if obj == nil {
- return emptyResult, err
- }
- return obj.(*v1beta1.Scale), err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake/fake_flowcontrol_client.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake/fake_flowcontrol_client.go
deleted file mode 100644
index 76238d6170..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake/fake_flowcontrol_client.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeFlowcontrolV1 struct {
- *testing.Fake
-}
-
-func (c *FakeFlowcontrolV1) FlowSchemas() v1.FlowSchemaInterface {
- return newFakeFlowSchemas(c)
-}
-
-func (c *FakeFlowcontrolV1) PriorityLevelConfigurations() v1.PriorityLevelConfigurationInterface {
- return newFakePriorityLevelConfigurations(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeFlowcontrolV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake/fake_flowschema.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake/fake_flowschema.go
deleted file mode 100644
index 6f9405f51b..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake/fake_flowschema.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/flowcontrol/v1"
- flowcontrolv1 "k8s.io/client-go/applyconfigurations/flowcontrol/v1"
- gentype "k8s.io/client-go/gentype"
- typedflowcontrolv1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1"
-)
-
-// fakeFlowSchemas implements FlowSchemaInterface
-type fakeFlowSchemas struct {
- *gentype.FakeClientWithListAndApply[*v1.FlowSchema, *v1.FlowSchemaList, *flowcontrolv1.FlowSchemaApplyConfiguration]
- Fake *FakeFlowcontrolV1
-}
-
-func newFakeFlowSchemas(fake *FakeFlowcontrolV1) typedflowcontrolv1.FlowSchemaInterface {
- return &fakeFlowSchemas{
- gentype.NewFakeClientWithListAndApply[*v1.FlowSchema, *v1.FlowSchemaList, *flowcontrolv1.FlowSchemaApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("flowschemas"),
- v1.SchemeGroupVersion.WithKind("FlowSchema"),
- func() *v1.FlowSchema { return &v1.FlowSchema{} },
- func() *v1.FlowSchemaList { return &v1.FlowSchemaList{} },
- func(dst, src *v1.FlowSchemaList) { dst.ListMeta = src.ListMeta },
- func(list *v1.FlowSchemaList) []*v1.FlowSchema { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.FlowSchemaList, items []*v1.FlowSchema) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake/fake_prioritylevelconfiguration.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake/fake_prioritylevelconfiguration.go
deleted file mode 100644
index a4be23679d..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake/fake_prioritylevelconfiguration.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/flowcontrol/v1"
- flowcontrolv1 "k8s.io/client-go/applyconfigurations/flowcontrol/v1"
- gentype "k8s.io/client-go/gentype"
- typedflowcontrolv1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1"
-)
-
-// fakePriorityLevelConfigurations implements PriorityLevelConfigurationInterface
-type fakePriorityLevelConfigurations struct {
- *gentype.FakeClientWithListAndApply[*v1.PriorityLevelConfiguration, *v1.PriorityLevelConfigurationList, *flowcontrolv1.PriorityLevelConfigurationApplyConfiguration]
- Fake *FakeFlowcontrolV1
-}
-
-func newFakePriorityLevelConfigurations(fake *FakeFlowcontrolV1) typedflowcontrolv1.PriorityLevelConfigurationInterface {
- return &fakePriorityLevelConfigurations{
- gentype.NewFakeClientWithListAndApply[*v1.PriorityLevelConfiguration, *v1.PriorityLevelConfigurationList, *flowcontrolv1.PriorityLevelConfigurationApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("prioritylevelconfigurations"),
- v1.SchemeGroupVersion.WithKind("PriorityLevelConfiguration"),
- func() *v1.PriorityLevelConfiguration { return &v1.PriorityLevelConfiguration{} },
- func() *v1.PriorityLevelConfigurationList { return &v1.PriorityLevelConfigurationList{} },
- func(dst, src *v1.PriorityLevelConfigurationList) { dst.ListMeta = src.ListMeta },
- func(list *v1.PriorityLevelConfigurationList) []*v1.PriorityLevelConfiguration {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.PriorityLevelConfigurationList, items []*v1.PriorityLevelConfiguration) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake/fake_flowcontrol_client.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake/fake_flowcontrol_client.go
deleted file mode 100644
index b70c07cdea..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake/fake_flowcontrol_client.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeFlowcontrolV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeFlowcontrolV1beta1) FlowSchemas() v1beta1.FlowSchemaInterface {
- return newFakeFlowSchemas(c)
-}
-
-func (c *FakeFlowcontrolV1beta1) PriorityLevelConfigurations() v1beta1.PriorityLevelConfigurationInterface {
- return newFakePriorityLevelConfigurations(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeFlowcontrolV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake/fake_flowschema.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake/fake_flowschema.go
deleted file mode 100644
index 600f740c31..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake/fake_flowschema.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/flowcontrol/v1beta1"
- flowcontrolv1beta1 "k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedflowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1"
-)
-
-// fakeFlowSchemas implements FlowSchemaInterface
-type fakeFlowSchemas struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.FlowSchema, *v1beta1.FlowSchemaList, *flowcontrolv1beta1.FlowSchemaApplyConfiguration]
- Fake *FakeFlowcontrolV1beta1
-}
-
-func newFakeFlowSchemas(fake *FakeFlowcontrolV1beta1) typedflowcontrolv1beta1.FlowSchemaInterface {
- return &fakeFlowSchemas{
- gentype.NewFakeClientWithListAndApply[*v1beta1.FlowSchema, *v1beta1.FlowSchemaList, *flowcontrolv1beta1.FlowSchemaApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("flowschemas"),
- v1beta1.SchemeGroupVersion.WithKind("FlowSchema"),
- func() *v1beta1.FlowSchema { return &v1beta1.FlowSchema{} },
- func() *v1beta1.FlowSchemaList { return &v1beta1.FlowSchemaList{} },
- func(dst, src *v1beta1.FlowSchemaList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.FlowSchemaList) []*v1beta1.FlowSchema { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.FlowSchemaList, items []*v1beta1.FlowSchema) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake/fake_prioritylevelconfiguration.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake/fake_prioritylevelconfiguration.go
deleted file mode 100644
index 170c4df9b6..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake/fake_prioritylevelconfiguration.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/flowcontrol/v1beta1"
- flowcontrolv1beta1 "k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedflowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1"
-)
-
-// fakePriorityLevelConfigurations implements PriorityLevelConfigurationInterface
-type fakePriorityLevelConfigurations struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.PriorityLevelConfiguration, *v1beta1.PriorityLevelConfigurationList, *flowcontrolv1beta1.PriorityLevelConfigurationApplyConfiguration]
- Fake *FakeFlowcontrolV1beta1
-}
-
-func newFakePriorityLevelConfigurations(fake *FakeFlowcontrolV1beta1) typedflowcontrolv1beta1.PriorityLevelConfigurationInterface {
- return &fakePriorityLevelConfigurations{
- gentype.NewFakeClientWithListAndApply[*v1beta1.PriorityLevelConfiguration, *v1beta1.PriorityLevelConfigurationList, *flowcontrolv1beta1.PriorityLevelConfigurationApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("prioritylevelconfigurations"),
- v1beta1.SchemeGroupVersion.WithKind("PriorityLevelConfiguration"),
- func() *v1beta1.PriorityLevelConfiguration { return &v1beta1.PriorityLevelConfiguration{} },
- func() *v1beta1.PriorityLevelConfigurationList { return &v1beta1.PriorityLevelConfigurationList{} },
- func(dst, src *v1beta1.PriorityLevelConfigurationList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.PriorityLevelConfigurationList) []*v1beta1.PriorityLevelConfiguration {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.PriorityLevelConfigurationList, items []*v1beta1.PriorityLevelConfiguration) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake/fake_flowcontrol_client.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake/fake_flowcontrol_client.go
deleted file mode 100644
index 1114568d3a..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake/fake_flowcontrol_client.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeFlowcontrolV1beta2 struct {
- *testing.Fake
-}
-
-func (c *FakeFlowcontrolV1beta2) FlowSchemas() v1beta2.FlowSchemaInterface {
- return newFakeFlowSchemas(c)
-}
-
-func (c *FakeFlowcontrolV1beta2) PriorityLevelConfigurations() v1beta2.PriorityLevelConfigurationInterface {
- return newFakePriorityLevelConfigurations(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeFlowcontrolV1beta2) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake/fake_flowschema.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake/fake_flowschema.go
deleted file mode 100644
index 73ed296876..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake/fake_flowschema.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/api/flowcontrol/v1beta2"
- flowcontrolv1beta2 "k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2"
- gentype "k8s.io/client-go/gentype"
- typedflowcontrolv1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2"
-)
-
-// fakeFlowSchemas implements FlowSchemaInterface
-type fakeFlowSchemas struct {
- *gentype.FakeClientWithListAndApply[*v1beta2.FlowSchema, *v1beta2.FlowSchemaList, *flowcontrolv1beta2.FlowSchemaApplyConfiguration]
- Fake *FakeFlowcontrolV1beta2
-}
-
-func newFakeFlowSchemas(fake *FakeFlowcontrolV1beta2) typedflowcontrolv1beta2.FlowSchemaInterface {
- return &fakeFlowSchemas{
- gentype.NewFakeClientWithListAndApply[*v1beta2.FlowSchema, *v1beta2.FlowSchemaList, *flowcontrolv1beta2.FlowSchemaApplyConfiguration](
- fake.Fake,
- "",
- v1beta2.SchemeGroupVersion.WithResource("flowschemas"),
- v1beta2.SchemeGroupVersion.WithKind("FlowSchema"),
- func() *v1beta2.FlowSchema { return &v1beta2.FlowSchema{} },
- func() *v1beta2.FlowSchemaList { return &v1beta2.FlowSchemaList{} },
- func(dst, src *v1beta2.FlowSchemaList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta2.FlowSchemaList) []*v1beta2.FlowSchema { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta2.FlowSchemaList, items []*v1beta2.FlowSchema) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake/fake_prioritylevelconfiguration.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake/fake_prioritylevelconfiguration.go
deleted file mode 100644
index 8ebb58e362..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake/fake_prioritylevelconfiguration.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/api/flowcontrol/v1beta2"
- flowcontrolv1beta2 "k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2"
- gentype "k8s.io/client-go/gentype"
- typedflowcontrolv1beta2 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2"
-)
-
-// fakePriorityLevelConfigurations implements PriorityLevelConfigurationInterface
-type fakePriorityLevelConfigurations struct {
- *gentype.FakeClientWithListAndApply[*v1beta2.PriorityLevelConfiguration, *v1beta2.PriorityLevelConfigurationList, *flowcontrolv1beta2.PriorityLevelConfigurationApplyConfiguration]
- Fake *FakeFlowcontrolV1beta2
-}
-
-func newFakePriorityLevelConfigurations(fake *FakeFlowcontrolV1beta2) typedflowcontrolv1beta2.PriorityLevelConfigurationInterface {
- return &fakePriorityLevelConfigurations{
- gentype.NewFakeClientWithListAndApply[*v1beta2.PriorityLevelConfiguration, *v1beta2.PriorityLevelConfigurationList, *flowcontrolv1beta2.PriorityLevelConfigurationApplyConfiguration](
- fake.Fake,
- "",
- v1beta2.SchemeGroupVersion.WithResource("prioritylevelconfigurations"),
- v1beta2.SchemeGroupVersion.WithKind("PriorityLevelConfiguration"),
- func() *v1beta2.PriorityLevelConfiguration { return &v1beta2.PriorityLevelConfiguration{} },
- func() *v1beta2.PriorityLevelConfigurationList { return &v1beta2.PriorityLevelConfigurationList{} },
- func(dst, src *v1beta2.PriorityLevelConfigurationList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta2.PriorityLevelConfigurationList) []*v1beta2.PriorityLevelConfiguration {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta2.PriorityLevelConfigurationList, items []*v1beta2.PriorityLevelConfiguration) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake/fake_flowcontrol_client.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake/fake_flowcontrol_client.go
deleted file mode 100644
index 8f13bc94ce..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake/fake_flowcontrol_client.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta3 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeFlowcontrolV1beta3 struct {
- *testing.Fake
-}
-
-func (c *FakeFlowcontrolV1beta3) FlowSchemas() v1beta3.FlowSchemaInterface {
- return newFakeFlowSchemas(c)
-}
-
-func (c *FakeFlowcontrolV1beta3) PriorityLevelConfigurations() v1beta3.PriorityLevelConfigurationInterface {
- return newFakePriorityLevelConfigurations(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeFlowcontrolV1beta3) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake/fake_flowschema.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake/fake_flowschema.go
deleted file mode 100644
index 887e8c97c0..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake/fake_flowschema.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta3 "k8s.io/api/flowcontrol/v1beta3"
- flowcontrolv1beta3 "k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3"
- gentype "k8s.io/client-go/gentype"
- typedflowcontrolv1beta3 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3"
-)
-
-// fakeFlowSchemas implements FlowSchemaInterface
-type fakeFlowSchemas struct {
- *gentype.FakeClientWithListAndApply[*v1beta3.FlowSchema, *v1beta3.FlowSchemaList, *flowcontrolv1beta3.FlowSchemaApplyConfiguration]
- Fake *FakeFlowcontrolV1beta3
-}
-
-func newFakeFlowSchemas(fake *FakeFlowcontrolV1beta3) typedflowcontrolv1beta3.FlowSchemaInterface {
- return &fakeFlowSchemas{
- gentype.NewFakeClientWithListAndApply[*v1beta3.FlowSchema, *v1beta3.FlowSchemaList, *flowcontrolv1beta3.FlowSchemaApplyConfiguration](
- fake.Fake,
- "",
- v1beta3.SchemeGroupVersion.WithResource("flowschemas"),
- v1beta3.SchemeGroupVersion.WithKind("FlowSchema"),
- func() *v1beta3.FlowSchema { return &v1beta3.FlowSchema{} },
- func() *v1beta3.FlowSchemaList { return &v1beta3.FlowSchemaList{} },
- func(dst, src *v1beta3.FlowSchemaList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta3.FlowSchemaList) []*v1beta3.FlowSchema { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta3.FlowSchemaList, items []*v1beta3.FlowSchema) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake/fake_prioritylevelconfiguration.go b/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake/fake_prioritylevelconfiguration.go
deleted file mode 100644
index 57ea20cfc7..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake/fake_prioritylevelconfiguration.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta3 "k8s.io/api/flowcontrol/v1beta3"
- flowcontrolv1beta3 "k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3"
- gentype "k8s.io/client-go/gentype"
- typedflowcontrolv1beta3 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3"
-)
-
-// fakePriorityLevelConfigurations implements PriorityLevelConfigurationInterface
-type fakePriorityLevelConfigurations struct {
- *gentype.FakeClientWithListAndApply[*v1beta3.PriorityLevelConfiguration, *v1beta3.PriorityLevelConfigurationList, *flowcontrolv1beta3.PriorityLevelConfigurationApplyConfiguration]
- Fake *FakeFlowcontrolV1beta3
-}
-
-func newFakePriorityLevelConfigurations(fake *FakeFlowcontrolV1beta3) typedflowcontrolv1beta3.PriorityLevelConfigurationInterface {
- return &fakePriorityLevelConfigurations{
- gentype.NewFakeClientWithListAndApply[*v1beta3.PriorityLevelConfiguration, *v1beta3.PriorityLevelConfigurationList, *flowcontrolv1beta3.PriorityLevelConfigurationApplyConfiguration](
- fake.Fake,
- "",
- v1beta3.SchemeGroupVersion.WithResource("prioritylevelconfigurations"),
- v1beta3.SchemeGroupVersion.WithKind("PriorityLevelConfiguration"),
- func() *v1beta3.PriorityLevelConfiguration { return &v1beta3.PriorityLevelConfiguration{} },
- func() *v1beta3.PriorityLevelConfigurationList { return &v1beta3.PriorityLevelConfigurationList{} },
- func(dst, src *v1beta3.PriorityLevelConfigurationList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta3.PriorityLevelConfigurationList) []*v1beta3.PriorityLevelConfiguration {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta3.PriorityLevelConfigurationList, items []*v1beta3.PriorityLevelConfiguration) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_ingress.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_ingress.go
deleted file mode 100644
index 7346dde66e..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_ingress.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/networking/v1"
- networkingv1 "k8s.io/client-go/applyconfigurations/networking/v1"
- gentype "k8s.io/client-go/gentype"
- typednetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
-)
-
-// fakeIngresses implements IngressInterface
-type fakeIngresses struct {
- *gentype.FakeClientWithListAndApply[*v1.Ingress, *v1.IngressList, *networkingv1.IngressApplyConfiguration]
- Fake *FakeNetworkingV1
-}
-
-func newFakeIngresses(fake *FakeNetworkingV1, namespace string) typednetworkingv1.IngressInterface {
- return &fakeIngresses{
- gentype.NewFakeClientWithListAndApply[*v1.Ingress, *v1.IngressList, *networkingv1.IngressApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("ingresses"),
- v1.SchemeGroupVersion.WithKind("Ingress"),
- func() *v1.Ingress { return &v1.Ingress{} },
- func() *v1.IngressList { return &v1.IngressList{} },
- func(dst, src *v1.IngressList) { dst.ListMeta = src.ListMeta },
- func(list *v1.IngressList) []*v1.Ingress { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.IngressList, items []*v1.Ingress) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_ingressclass.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_ingressclass.go
deleted file mode 100644
index c4700a45fe..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_ingressclass.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/networking/v1"
- networkingv1 "k8s.io/client-go/applyconfigurations/networking/v1"
- gentype "k8s.io/client-go/gentype"
- typednetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
-)
-
-// fakeIngressClasses implements IngressClassInterface
-type fakeIngressClasses struct {
- *gentype.FakeClientWithListAndApply[*v1.IngressClass, *v1.IngressClassList, *networkingv1.IngressClassApplyConfiguration]
- Fake *FakeNetworkingV1
-}
-
-func newFakeIngressClasses(fake *FakeNetworkingV1) typednetworkingv1.IngressClassInterface {
- return &fakeIngressClasses{
- gentype.NewFakeClientWithListAndApply[*v1.IngressClass, *v1.IngressClassList, *networkingv1.IngressClassApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("ingressclasses"),
- v1.SchemeGroupVersion.WithKind("IngressClass"),
- func() *v1.IngressClass { return &v1.IngressClass{} },
- func() *v1.IngressClassList { return &v1.IngressClassList{} },
- func(dst, src *v1.IngressClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1.IngressClassList) []*v1.IngressClass { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.IngressClassList, items []*v1.IngressClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_ipaddress.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_ipaddress.go
deleted file mode 100644
index 15f4e3c1ce..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_ipaddress.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/networking/v1"
- networkingv1 "k8s.io/client-go/applyconfigurations/networking/v1"
- gentype "k8s.io/client-go/gentype"
- typednetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
-)
-
-// fakeIPAddresses implements IPAddressInterface
-type fakeIPAddresses struct {
- *gentype.FakeClientWithListAndApply[*v1.IPAddress, *v1.IPAddressList, *networkingv1.IPAddressApplyConfiguration]
- Fake *FakeNetworkingV1
-}
-
-func newFakeIPAddresses(fake *FakeNetworkingV1) typednetworkingv1.IPAddressInterface {
- return &fakeIPAddresses{
- gentype.NewFakeClientWithListAndApply[*v1.IPAddress, *v1.IPAddressList, *networkingv1.IPAddressApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("ipaddresses"),
- v1.SchemeGroupVersion.WithKind("IPAddress"),
- func() *v1.IPAddress { return &v1.IPAddress{} },
- func() *v1.IPAddressList { return &v1.IPAddressList{} },
- func(dst, src *v1.IPAddressList) { dst.ListMeta = src.ListMeta },
- func(list *v1.IPAddressList) []*v1.IPAddress { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.IPAddressList, items []*v1.IPAddress) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_networking_client.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_networking_client.go
deleted file mode 100644
index ba61689e60..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_networking_client.go
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/networking/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeNetworkingV1 struct {
- *testing.Fake
-}
-
-func (c *FakeNetworkingV1) IPAddresses() v1.IPAddressInterface {
- return newFakeIPAddresses(c)
-}
-
-func (c *FakeNetworkingV1) Ingresses(namespace string) v1.IngressInterface {
- return newFakeIngresses(c, namespace)
-}
-
-func (c *FakeNetworkingV1) IngressClasses() v1.IngressClassInterface {
- return newFakeIngressClasses(c)
-}
-
-func (c *FakeNetworkingV1) NetworkPolicies(namespace string) v1.NetworkPolicyInterface {
- return newFakeNetworkPolicies(c, namespace)
-}
-
-func (c *FakeNetworkingV1) ServiceCIDRs() v1.ServiceCIDRInterface {
- return newFakeServiceCIDRs(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeNetworkingV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_networkpolicy.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_networkpolicy.go
deleted file mode 100644
index 8b017351a8..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_networkpolicy.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/networking/v1"
- networkingv1 "k8s.io/client-go/applyconfigurations/networking/v1"
- gentype "k8s.io/client-go/gentype"
- typednetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
-)
-
-// fakeNetworkPolicies implements NetworkPolicyInterface
-type fakeNetworkPolicies struct {
- *gentype.FakeClientWithListAndApply[*v1.NetworkPolicy, *v1.NetworkPolicyList, *networkingv1.NetworkPolicyApplyConfiguration]
- Fake *FakeNetworkingV1
-}
-
-func newFakeNetworkPolicies(fake *FakeNetworkingV1, namespace string) typednetworkingv1.NetworkPolicyInterface {
- return &fakeNetworkPolicies{
- gentype.NewFakeClientWithListAndApply[*v1.NetworkPolicy, *v1.NetworkPolicyList, *networkingv1.NetworkPolicyApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("networkpolicies"),
- v1.SchemeGroupVersion.WithKind("NetworkPolicy"),
- func() *v1.NetworkPolicy { return &v1.NetworkPolicy{} },
- func() *v1.NetworkPolicyList { return &v1.NetworkPolicyList{} },
- func(dst, src *v1.NetworkPolicyList) { dst.ListMeta = src.ListMeta },
- func(list *v1.NetworkPolicyList) []*v1.NetworkPolicy { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.NetworkPolicyList, items []*v1.NetworkPolicy) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_servicecidr.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_servicecidr.go
deleted file mode 100644
index c82391fb40..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_servicecidr.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/networking/v1"
- networkingv1 "k8s.io/client-go/applyconfigurations/networking/v1"
- gentype "k8s.io/client-go/gentype"
- typednetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
-)
-
-// fakeServiceCIDRs implements ServiceCIDRInterface
-type fakeServiceCIDRs struct {
- *gentype.FakeClientWithListAndApply[*v1.ServiceCIDR, *v1.ServiceCIDRList, *networkingv1.ServiceCIDRApplyConfiguration]
- Fake *FakeNetworkingV1
-}
-
-func newFakeServiceCIDRs(fake *FakeNetworkingV1) typednetworkingv1.ServiceCIDRInterface {
- return &fakeServiceCIDRs{
- gentype.NewFakeClientWithListAndApply[*v1.ServiceCIDR, *v1.ServiceCIDRList, *networkingv1.ServiceCIDRApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("servicecidrs"),
- v1.SchemeGroupVersion.WithKind("ServiceCIDR"),
- func() *v1.ServiceCIDR { return &v1.ServiceCIDR{} },
- func() *v1.ServiceCIDRList { return &v1.ServiceCIDRList{} },
- func(dst, src *v1.ServiceCIDRList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ServiceCIDRList) []*v1.ServiceCIDR { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.ServiceCIDRList, items []*v1.ServiceCIDR) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_ingress.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_ingress.go
deleted file mode 100644
index 0d5dc9d64e..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_ingress.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/networking/v1beta1"
- networkingv1beta1 "k8s.io/client-go/applyconfigurations/networking/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typednetworkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
-)
-
-// fakeIngresses implements IngressInterface
-type fakeIngresses struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.Ingress, *v1beta1.IngressList, *networkingv1beta1.IngressApplyConfiguration]
- Fake *FakeNetworkingV1beta1
-}
-
-func newFakeIngresses(fake *FakeNetworkingV1beta1, namespace string) typednetworkingv1beta1.IngressInterface {
- return &fakeIngresses{
- gentype.NewFakeClientWithListAndApply[*v1beta1.Ingress, *v1beta1.IngressList, *networkingv1beta1.IngressApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("ingresses"),
- v1beta1.SchemeGroupVersion.WithKind("Ingress"),
- func() *v1beta1.Ingress { return &v1beta1.Ingress{} },
- func() *v1beta1.IngressList { return &v1beta1.IngressList{} },
- func(dst, src *v1beta1.IngressList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.IngressList) []*v1beta1.Ingress { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.IngressList, items []*v1beta1.Ingress) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_ingressclass.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_ingressclass.go
deleted file mode 100644
index 1c78221847..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_ingressclass.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/networking/v1beta1"
- networkingv1beta1 "k8s.io/client-go/applyconfigurations/networking/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typednetworkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
-)
-
-// fakeIngressClasses implements IngressClassInterface
-type fakeIngressClasses struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.IngressClass, *v1beta1.IngressClassList, *networkingv1beta1.IngressClassApplyConfiguration]
- Fake *FakeNetworkingV1beta1
-}
-
-func newFakeIngressClasses(fake *FakeNetworkingV1beta1) typednetworkingv1beta1.IngressClassInterface {
- return &fakeIngressClasses{
- gentype.NewFakeClientWithListAndApply[*v1beta1.IngressClass, *v1beta1.IngressClassList, *networkingv1beta1.IngressClassApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("ingressclasses"),
- v1beta1.SchemeGroupVersion.WithKind("IngressClass"),
- func() *v1beta1.IngressClass { return &v1beta1.IngressClass{} },
- func() *v1beta1.IngressClassList { return &v1beta1.IngressClassList{} },
- func(dst, src *v1beta1.IngressClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.IngressClassList) []*v1beta1.IngressClass {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.IngressClassList, items []*v1beta1.IngressClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_ipaddress.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_ipaddress.go
deleted file mode 100644
index 1dc63cd69e..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_ipaddress.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/networking/v1beta1"
- networkingv1beta1 "k8s.io/client-go/applyconfigurations/networking/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typednetworkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
-)
-
-// fakeIPAddresses implements IPAddressInterface
-type fakeIPAddresses struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.IPAddress, *v1beta1.IPAddressList, *networkingv1beta1.IPAddressApplyConfiguration]
- Fake *FakeNetworkingV1beta1
-}
-
-func newFakeIPAddresses(fake *FakeNetworkingV1beta1) typednetworkingv1beta1.IPAddressInterface {
- return &fakeIPAddresses{
- gentype.NewFakeClientWithListAndApply[*v1beta1.IPAddress, *v1beta1.IPAddressList, *networkingv1beta1.IPAddressApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("ipaddresses"),
- v1beta1.SchemeGroupVersion.WithKind("IPAddress"),
- func() *v1beta1.IPAddress { return &v1beta1.IPAddress{} },
- func() *v1beta1.IPAddressList { return &v1beta1.IPAddressList{} },
- func(dst, src *v1beta1.IPAddressList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.IPAddressList) []*v1beta1.IPAddress { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.IPAddressList, items []*v1beta1.IPAddress) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_networking_client.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_networking_client.go
deleted file mode 100644
index 59305ee816..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_networking_client.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeNetworkingV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeNetworkingV1beta1) IPAddresses() v1beta1.IPAddressInterface {
- return newFakeIPAddresses(c)
-}
-
-func (c *FakeNetworkingV1beta1) Ingresses(namespace string) v1beta1.IngressInterface {
- return newFakeIngresses(c, namespace)
-}
-
-func (c *FakeNetworkingV1beta1) IngressClasses() v1beta1.IngressClassInterface {
- return newFakeIngressClasses(c)
-}
-
-func (c *FakeNetworkingV1beta1) ServiceCIDRs() v1beta1.ServiceCIDRInterface {
- return newFakeServiceCIDRs(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeNetworkingV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_servicecidr.go b/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_servicecidr.go
deleted file mode 100644
index d8b15206b0..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake/fake_servicecidr.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/networking/v1beta1"
- networkingv1beta1 "k8s.io/client-go/applyconfigurations/networking/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typednetworkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
-)
-
-// fakeServiceCIDRs implements ServiceCIDRInterface
-type fakeServiceCIDRs struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.ServiceCIDR, *v1beta1.ServiceCIDRList, *networkingv1beta1.ServiceCIDRApplyConfiguration]
- Fake *FakeNetworkingV1beta1
-}
-
-func newFakeServiceCIDRs(fake *FakeNetworkingV1beta1) typednetworkingv1beta1.ServiceCIDRInterface {
- return &fakeServiceCIDRs{
- gentype.NewFakeClientWithListAndApply[*v1beta1.ServiceCIDR, *v1beta1.ServiceCIDRList, *networkingv1beta1.ServiceCIDRApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("servicecidrs"),
- v1beta1.SchemeGroupVersion.WithKind("ServiceCIDR"),
- func() *v1beta1.ServiceCIDR { return &v1beta1.ServiceCIDR{} },
- func() *v1beta1.ServiceCIDRList { return &v1beta1.ServiceCIDRList{} },
- func(dst, src *v1beta1.ServiceCIDRList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.ServiceCIDRList) []*v1beta1.ServiceCIDR { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.ServiceCIDRList, items []*v1beta1.ServiceCIDR) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/node/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/node/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/node/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/node/v1/fake/fake_node_client.go b/vendor/k8s.io/client-go/kubernetes/typed/node/v1/fake/fake_node_client.go
deleted file mode 100644
index 72e675bd70..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/node/v1/fake/fake_node_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/node/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeNodeV1 struct {
- *testing.Fake
-}
-
-func (c *FakeNodeV1) RuntimeClasses() v1.RuntimeClassInterface {
- return newFakeRuntimeClasses(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeNodeV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/node/v1/fake/fake_runtimeclass.go b/vendor/k8s.io/client-go/kubernetes/typed/node/v1/fake/fake_runtimeclass.go
deleted file mode 100644
index a9739f7255..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/node/v1/fake/fake_runtimeclass.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/node/v1"
- nodev1 "k8s.io/client-go/applyconfigurations/node/v1"
- gentype "k8s.io/client-go/gentype"
- typednodev1 "k8s.io/client-go/kubernetes/typed/node/v1"
-)
-
-// fakeRuntimeClasses implements RuntimeClassInterface
-type fakeRuntimeClasses struct {
- *gentype.FakeClientWithListAndApply[*v1.RuntimeClass, *v1.RuntimeClassList, *nodev1.RuntimeClassApplyConfiguration]
- Fake *FakeNodeV1
-}
-
-func newFakeRuntimeClasses(fake *FakeNodeV1) typednodev1.RuntimeClassInterface {
- return &fakeRuntimeClasses{
- gentype.NewFakeClientWithListAndApply[*v1.RuntimeClass, *v1.RuntimeClassList, *nodev1.RuntimeClassApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("runtimeclasses"),
- v1.SchemeGroupVersion.WithKind("RuntimeClass"),
- func() *v1.RuntimeClass { return &v1.RuntimeClass{} },
- func() *v1.RuntimeClassList { return &v1.RuntimeClassList{} },
- func(dst, src *v1.RuntimeClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1.RuntimeClassList) []*v1.RuntimeClass { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.RuntimeClassList, items []*v1.RuntimeClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/fake/fake_node_client.go b/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/fake/fake_node_client.go
deleted file mode 100644
index 6a63f99da7..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/fake/fake_node_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/client-go/kubernetes/typed/node/v1alpha1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeNodeV1alpha1 struct {
- *testing.Fake
-}
-
-func (c *FakeNodeV1alpha1) RuntimeClasses() v1alpha1.RuntimeClassInterface {
- return newFakeRuntimeClasses(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeNodeV1alpha1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/fake/fake_runtimeclass.go b/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/fake/fake_runtimeclass.go
deleted file mode 100644
index 6761098c67..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/fake/fake_runtimeclass.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/node/v1alpha1"
- nodev1alpha1 "k8s.io/client-go/applyconfigurations/node/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typednodev1alpha1 "k8s.io/client-go/kubernetes/typed/node/v1alpha1"
-)
-
-// fakeRuntimeClasses implements RuntimeClassInterface
-type fakeRuntimeClasses struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.RuntimeClass, *v1alpha1.RuntimeClassList, *nodev1alpha1.RuntimeClassApplyConfiguration]
- Fake *FakeNodeV1alpha1
-}
-
-func newFakeRuntimeClasses(fake *FakeNodeV1alpha1) typednodev1alpha1.RuntimeClassInterface {
- return &fakeRuntimeClasses{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.RuntimeClass, *v1alpha1.RuntimeClassList, *nodev1alpha1.RuntimeClassApplyConfiguration](
- fake.Fake,
- "",
- v1alpha1.SchemeGroupVersion.WithResource("runtimeclasses"),
- v1alpha1.SchemeGroupVersion.WithKind("RuntimeClass"),
- func() *v1alpha1.RuntimeClass { return &v1alpha1.RuntimeClass{} },
- func() *v1alpha1.RuntimeClassList { return &v1alpha1.RuntimeClassList{} },
- func(dst, src *v1alpha1.RuntimeClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.RuntimeClassList) []*v1alpha1.RuntimeClass {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.RuntimeClassList, items []*v1alpha1.RuntimeClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/fake/fake_node_client.go b/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/fake/fake_node_client.go
deleted file mode 100644
index 6612a9889f..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/fake/fake_node_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/node/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeNodeV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeNodeV1beta1) RuntimeClasses() v1beta1.RuntimeClassInterface {
- return newFakeRuntimeClasses(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeNodeV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/fake/fake_runtimeclass.go b/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/fake/fake_runtimeclass.go
deleted file mode 100644
index 113ae88522..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/fake/fake_runtimeclass.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/node/v1beta1"
- nodev1beta1 "k8s.io/client-go/applyconfigurations/node/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typednodev1beta1 "k8s.io/client-go/kubernetes/typed/node/v1beta1"
-)
-
-// fakeRuntimeClasses implements RuntimeClassInterface
-type fakeRuntimeClasses struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.RuntimeClass, *v1beta1.RuntimeClassList, *nodev1beta1.RuntimeClassApplyConfiguration]
- Fake *FakeNodeV1beta1
-}
-
-func newFakeRuntimeClasses(fake *FakeNodeV1beta1) typednodev1beta1.RuntimeClassInterface {
- return &fakeRuntimeClasses{
- gentype.NewFakeClientWithListAndApply[*v1beta1.RuntimeClass, *v1beta1.RuntimeClassList, *nodev1beta1.RuntimeClassApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("runtimeclasses"),
- v1beta1.SchemeGroupVersion.WithKind("RuntimeClass"),
- func() *v1beta1.RuntimeClass { return &v1beta1.RuntimeClass{} },
- func() *v1beta1.RuntimeClassList { return &v1beta1.RuntimeClassList{} },
- func(dst, src *v1beta1.RuntimeClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.RuntimeClassList) []*v1beta1.RuntimeClass {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.RuntimeClassList, items []*v1beta1.RuntimeClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/fake_eviction.go b/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/fake_eviction.go
deleted file mode 100644
index 247cf19dd8..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/fake_eviction.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/policy/v1"
- gentype "k8s.io/client-go/gentype"
- policyv1 "k8s.io/client-go/kubernetes/typed/policy/v1"
-)
-
-// fakeEvictions implements EvictionInterface
-type fakeEvictions struct {
- *gentype.FakeClient[*v1.Eviction]
- Fake *FakePolicyV1
-}
-
-func newFakeEvictions(fake *FakePolicyV1, namespace string) policyv1.EvictionInterface {
- return &fakeEvictions{
- gentype.NewFakeClient[*v1.Eviction](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("evictions"),
- v1.SchemeGroupVersion.WithKind("Eviction"),
- func() *v1.Eviction { return &v1.Eviction{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/fake_eviction_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/fake_eviction_expansion.go
deleted file mode 100644
index 1e1d5e15b1..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/fake_eviction_expansion.go
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-Copyright 2021 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fake
-
-import (
- "context"
-
- policy "k8s.io/api/policy/v1"
- "k8s.io/apimachinery/pkg/runtime/schema"
- core "k8s.io/client-go/testing"
-)
-
-func (c *fakeEvictions) Evict(ctx context.Context, eviction *policy.Eviction) error {
- action := core.CreateActionImpl{}
- action.Verb = "create"
- action.Namespace = c.Namespace()
- action.Resource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}
- action.Subresource = "eviction"
- action.Object = eviction
-
- _, err := c.Fake.Invokes(action, eviction)
- return err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/fake_poddisruptionbudget.go b/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/fake_poddisruptionbudget.go
deleted file mode 100644
index 98e3b1adb3..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/fake_poddisruptionbudget.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/policy/v1"
- policyv1 "k8s.io/client-go/applyconfigurations/policy/v1"
- gentype "k8s.io/client-go/gentype"
- typedpolicyv1 "k8s.io/client-go/kubernetes/typed/policy/v1"
-)
-
-// fakePodDisruptionBudgets implements PodDisruptionBudgetInterface
-type fakePodDisruptionBudgets struct {
- *gentype.FakeClientWithListAndApply[*v1.PodDisruptionBudget, *v1.PodDisruptionBudgetList, *policyv1.PodDisruptionBudgetApplyConfiguration]
- Fake *FakePolicyV1
-}
-
-func newFakePodDisruptionBudgets(fake *FakePolicyV1, namespace string) typedpolicyv1.PodDisruptionBudgetInterface {
- return &fakePodDisruptionBudgets{
- gentype.NewFakeClientWithListAndApply[*v1.PodDisruptionBudget, *v1.PodDisruptionBudgetList, *policyv1.PodDisruptionBudgetApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("poddisruptionbudgets"),
- v1.SchemeGroupVersion.WithKind("PodDisruptionBudget"),
- func() *v1.PodDisruptionBudget { return &v1.PodDisruptionBudget{} },
- func() *v1.PodDisruptionBudgetList { return &v1.PodDisruptionBudgetList{} },
- func(dst, src *v1.PodDisruptionBudgetList) { dst.ListMeta = src.ListMeta },
- func(list *v1.PodDisruptionBudgetList) []*v1.PodDisruptionBudget {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.PodDisruptionBudgetList, items []*v1.PodDisruptionBudget) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/fake_policy_client.go b/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/fake_policy_client.go
deleted file mode 100644
index 49390c2734..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/fake/fake_policy_client.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/policy/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakePolicyV1 struct {
- *testing.Fake
-}
-
-func (c *FakePolicyV1) Evictions(namespace string) v1.EvictionInterface {
- return newFakeEvictions(c, namespace)
-}
-
-func (c *FakePolicyV1) PodDisruptionBudgets(namespace string) v1.PodDisruptionBudgetInterface {
- return newFakePodDisruptionBudgets(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakePolicyV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_eviction.go b/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_eviction.go
deleted file mode 100644
index fb2a1de083..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_eviction.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/policy/v1beta1"
- gentype "k8s.io/client-go/gentype"
- policyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
-)
-
-// fakeEvictions implements EvictionInterface
-type fakeEvictions struct {
- *gentype.FakeClient[*v1beta1.Eviction]
- Fake *FakePolicyV1beta1
-}
-
-func newFakeEvictions(fake *FakePolicyV1beta1, namespace string) policyv1beta1.EvictionInterface {
- return &fakeEvictions{
- gentype.NewFakeClient[*v1beta1.Eviction](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("evictions"),
- v1beta1.SchemeGroupVersion.WithKind("Eviction"),
- func() *v1beta1.Eviction { return &v1beta1.Eviction{} },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_eviction_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_eviction_expansion.go
deleted file mode 100644
index 30c5df30b3..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_eviction_expansion.go
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fake
-
-import (
- "context"
-
- policy "k8s.io/api/policy/v1beta1"
- "k8s.io/apimachinery/pkg/runtime/schema"
- core "k8s.io/client-go/testing"
-)
-
-func (c *fakeEvictions) Evict(ctx context.Context, eviction *policy.Eviction) error {
- action := core.CreateActionImpl{}
- action.Verb = "create"
- action.Namespace = c.Namespace()
- action.Resource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}
- action.Subresource = "eviction"
- action.Object = eviction
-
- _, err := c.Fake.Invokes(action, eviction)
- return err
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_poddisruptionbudget.go b/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_poddisruptionbudget.go
deleted file mode 100644
index d4cab0b4a5..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_poddisruptionbudget.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/policy/v1beta1"
- policyv1beta1 "k8s.io/client-go/applyconfigurations/policy/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedpolicyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
-)
-
-// fakePodDisruptionBudgets implements PodDisruptionBudgetInterface
-type fakePodDisruptionBudgets struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.PodDisruptionBudget, *v1beta1.PodDisruptionBudgetList, *policyv1beta1.PodDisruptionBudgetApplyConfiguration]
- Fake *FakePolicyV1beta1
-}
-
-func newFakePodDisruptionBudgets(fake *FakePolicyV1beta1, namespace string) typedpolicyv1beta1.PodDisruptionBudgetInterface {
- return &fakePodDisruptionBudgets{
- gentype.NewFakeClientWithListAndApply[*v1beta1.PodDisruptionBudget, *v1beta1.PodDisruptionBudgetList, *policyv1beta1.PodDisruptionBudgetApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("poddisruptionbudgets"),
- v1beta1.SchemeGroupVersion.WithKind("PodDisruptionBudget"),
- func() *v1beta1.PodDisruptionBudget { return &v1beta1.PodDisruptionBudget{} },
- func() *v1beta1.PodDisruptionBudgetList { return &v1beta1.PodDisruptionBudgetList{} },
- func(dst, src *v1beta1.PodDisruptionBudgetList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.PodDisruptionBudgetList) []*v1beta1.PodDisruptionBudget {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.PodDisruptionBudgetList, items []*v1beta1.PodDisruptionBudget) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_policy_client.go b/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_policy_client.go
deleted file mode 100644
index 136935dd43..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_policy_client.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakePolicyV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakePolicyV1beta1) Evictions(namespace string) v1beta1.EvictionInterface {
- return newFakeEvictions(c, namespace)
-}
-
-func (c *FakePolicyV1beta1) PodDisruptionBudgets(namespace string) v1beta1.PodDisruptionBudgetInterface {
- return newFakePodDisruptionBudgets(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakePolicyV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_clusterrole.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_clusterrole.go
deleted file mode 100644
index 82fa39d069..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_clusterrole.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/rbac/v1"
- rbacv1 "k8s.io/client-go/applyconfigurations/rbac/v1"
- gentype "k8s.io/client-go/gentype"
- typedrbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1"
-)
-
-// fakeClusterRoles implements ClusterRoleInterface
-type fakeClusterRoles struct {
- *gentype.FakeClientWithListAndApply[*v1.ClusterRole, *v1.ClusterRoleList, *rbacv1.ClusterRoleApplyConfiguration]
- Fake *FakeRbacV1
-}
-
-func newFakeClusterRoles(fake *FakeRbacV1) typedrbacv1.ClusterRoleInterface {
- return &fakeClusterRoles{
- gentype.NewFakeClientWithListAndApply[*v1.ClusterRole, *v1.ClusterRoleList, *rbacv1.ClusterRoleApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("clusterroles"),
- v1.SchemeGroupVersion.WithKind("ClusterRole"),
- func() *v1.ClusterRole { return &v1.ClusterRole{} },
- func() *v1.ClusterRoleList { return &v1.ClusterRoleList{} },
- func(dst, src *v1.ClusterRoleList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ClusterRoleList) []*v1.ClusterRole { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.ClusterRoleList, items []*v1.ClusterRole) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_clusterrolebinding.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_clusterrolebinding.go
deleted file mode 100644
index 3d1f0d4a9c..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_clusterrolebinding.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/rbac/v1"
- rbacv1 "k8s.io/client-go/applyconfigurations/rbac/v1"
- gentype "k8s.io/client-go/gentype"
- typedrbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1"
-)
-
-// fakeClusterRoleBindings implements ClusterRoleBindingInterface
-type fakeClusterRoleBindings struct {
- *gentype.FakeClientWithListAndApply[*v1.ClusterRoleBinding, *v1.ClusterRoleBindingList, *rbacv1.ClusterRoleBindingApplyConfiguration]
- Fake *FakeRbacV1
-}
-
-func newFakeClusterRoleBindings(fake *FakeRbacV1) typedrbacv1.ClusterRoleBindingInterface {
- return &fakeClusterRoleBindings{
- gentype.NewFakeClientWithListAndApply[*v1.ClusterRoleBinding, *v1.ClusterRoleBindingList, *rbacv1.ClusterRoleBindingApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("clusterrolebindings"),
- v1.SchemeGroupVersion.WithKind("ClusterRoleBinding"),
- func() *v1.ClusterRoleBinding { return &v1.ClusterRoleBinding{} },
- func() *v1.ClusterRoleBindingList { return &v1.ClusterRoleBindingList{} },
- func(dst, src *v1.ClusterRoleBindingList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ClusterRoleBindingList) []*v1.ClusterRoleBinding {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.ClusterRoleBindingList, items []*v1.ClusterRoleBinding) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_rbac_client.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_rbac_client.go
deleted file mode 100644
index db2b31d380..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_rbac_client.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/rbac/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeRbacV1 struct {
- *testing.Fake
-}
-
-func (c *FakeRbacV1) ClusterRoles() v1.ClusterRoleInterface {
- return newFakeClusterRoles(c)
-}
-
-func (c *FakeRbacV1) ClusterRoleBindings() v1.ClusterRoleBindingInterface {
- return newFakeClusterRoleBindings(c)
-}
-
-func (c *FakeRbacV1) Roles(namespace string) v1.RoleInterface {
- return newFakeRoles(c, namespace)
-}
-
-func (c *FakeRbacV1) RoleBindings(namespace string) v1.RoleBindingInterface {
- return newFakeRoleBindings(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeRbacV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_role.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_role.go
deleted file mode 100644
index 3baf41cc71..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_role.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/rbac/v1"
- rbacv1 "k8s.io/client-go/applyconfigurations/rbac/v1"
- gentype "k8s.io/client-go/gentype"
- typedrbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1"
-)
-
-// fakeRoles implements RoleInterface
-type fakeRoles struct {
- *gentype.FakeClientWithListAndApply[*v1.Role, *v1.RoleList, *rbacv1.RoleApplyConfiguration]
- Fake *FakeRbacV1
-}
-
-func newFakeRoles(fake *FakeRbacV1, namespace string) typedrbacv1.RoleInterface {
- return &fakeRoles{
- gentype.NewFakeClientWithListAndApply[*v1.Role, *v1.RoleList, *rbacv1.RoleApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("roles"),
- v1.SchemeGroupVersion.WithKind("Role"),
- func() *v1.Role { return &v1.Role{} },
- func() *v1.RoleList { return &v1.RoleList{} },
- func(dst, src *v1.RoleList) { dst.ListMeta = src.ListMeta },
- func(list *v1.RoleList) []*v1.Role { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.RoleList, items []*v1.Role) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_rolebinding.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_rolebinding.go
deleted file mode 100644
index 28246da577..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/fake/fake_rolebinding.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/rbac/v1"
- rbacv1 "k8s.io/client-go/applyconfigurations/rbac/v1"
- gentype "k8s.io/client-go/gentype"
- typedrbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1"
-)
-
-// fakeRoleBindings implements RoleBindingInterface
-type fakeRoleBindings struct {
- *gentype.FakeClientWithListAndApply[*v1.RoleBinding, *v1.RoleBindingList, *rbacv1.RoleBindingApplyConfiguration]
- Fake *FakeRbacV1
-}
-
-func newFakeRoleBindings(fake *FakeRbacV1, namespace string) typedrbacv1.RoleBindingInterface {
- return &fakeRoleBindings{
- gentype.NewFakeClientWithListAndApply[*v1.RoleBinding, *v1.RoleBindingList, *rbacv1.RoleBindingApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("rolebindings"),
- v1.SchemeGroupVersion.WithKind("RoleBinding"),
- func() *v1.RoleBinding { return &v1.RoleBinding{} },
- func() *v1.RoleBindingList { return &v1.RoleBindingList{} },
- func(dst, src *v1.RoleBindingList) { dst.ListMeta = src.ListMeta },
- func(list *v1.RoleBindingList) []*v1.RoleBinding { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.RoleBindingList, items []*v1.RoleBinding) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_clusterrole.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_clusterrole.go
deleted file mode 100644
index 668999da55..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_clusterrole.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/rbac/v1alpha1"
- rbacv1alpha1 "k8s.io/client-go/applyconfigurations/rbac/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedrbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
-)
-
-// fakeClusterRoles implements ClusterRoleInterface
-type fakeClusterRoles struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.ClusterRole, *v1alpha1.ClusterRoleList, *rbacv1alpha1.ClusterRoleApplyConfiguration]
- Fake *FakeRbacV1alpha1
-}
-
-func newFakeClusterRoles(fake *FakeRbacV1alpha1) typedrbacv1alpha1.ClusterRoleInterface {
- return &fakeClusterRoles{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.ClusterRole, *v1alpha1.ClusterRoleList, *rbacv1alpha1.ClusterRoleApplyConfiguration](
- fake.Fake,
- "",
- v1alpha1.SchemeGroupVersion.WithResource("clusterroles"),
- v1alpha1.SchemeGroupVersion.WithKind("ClusterRole"),
- func() *v1alpha1.ClusterRole { return &v1alpha1.ClusterRole{} },
- func() *v1alpha1.ClusterRoleList { return &v1alpha1.ClusterRoleList{} },
- func(dst, src *v1alpha1.ClusterRoleList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.ClusterRoleList) []*v1alpha1.ClusterRole {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.ClusterRoleList, items []*v1alpha1.ClusterRole) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_clusterrolebinding.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_clusterrolebinding.go
deleted file mode 100644
index 6c275537d0..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_clusterrolebinding.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/rbac/v1alpha1"
- rbacv1alpha1 "k8s.io/client-go/applyconfigurations/rbac/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedrbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
-)
-
-// fakeClusterRoleBindings implements ClusterRoleBindingInterface
-type fakeClusterRoleBindings struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.ClusterRoleBinding, *v1alpha1.ClusterRoleBindingList, *rbacv1alpha1.ClusterRoleBindingApplyConfiguration]
- Fake *FakeRbacV1alpha1
-}
-
-func newFakeClusterRoleBindings(fake *FakeRbacV1alpha1) typedrbacv1alpha1.ClusterRoleBindingInterface {
- return &fakeClusterRoleBindings{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.ClusterRoleBinding, *v1alpha1.ClusterRoleBindingList, *rbacv1alpha1.ClusterRoleBindingApplyConfiguration](
- fake.Fake,
- "",
- v1alpha1.SchemeGroupVersion.WithResource("clusterrolebindings"),
- v1alpha1.SchemeGroupVersion.WithKind("ClusterRoleBinding"),
- func() *v1alpha1.ClusterRoleBinding { return &v1alpha1.ClusterRoleBinding{} },
- func() *v1alpha1.ClusterRoleBindingList { return &v1alpha1.ClusterRoleBindingList{} },
- func(dst, src *v1alpha1.ClusterRoleBindingList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.ClusterRoleBindingList) []*v1alpha1.ClusterRoleBinding {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.ClusterRoleBindingList, items []*v1alpha1.ClusterRoleBinding) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_rbac_client.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_rbac_client.go
deleted file mode 100644
index df66b5ea91..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_rbac_client.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeRbacV1alpha1 struct {
- *testing.Fake
-}
-
-func (c *FakeRbacV1alpha1) ClusterRoles() v1alpha1.ClusterRoleInterface {
- return newFakeClusterRoles(c)
-}
-
-func (c *FakeRbacV1alpha1) ClusterRoleBindings() v1alpha1.ClusterRoleBindingInterface {
- return newFakeClusterRoleBindings(c)
-}
-
-func (c *FakeRbacV1alpha1) Roles(namespace string) v1alpha1.RoleInterface {
- return newFakeRoles(c, namespace)
-}
-
-func (c *FakeRbacV1alpha1) RoleBindings(namespace string) v1alpha1.RoleBindingInterface {
- return newFakeRoleBindings(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeRbacV1alpha1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_role.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_role.go
deleted file mode 100644
index 21ed226cd7..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_role.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/rbac/v1alpha1"
- rbacv1alpha1 "k8s.io/client-go/applyconfigurations/rbac/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedrbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
-)
-
-// fakeRoles implements RoleInterface
-type fakeRoles struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.Role, *v1alpha1.RoleList, *rbacv1alpha1.RoleApplyConfiguration]
- Fake *FakeRbacV1alpha1
-}
-
-func newFakeRoles(fake *FakeRbacV1alpha1, namespace string) typedrbacv1alpha1.RoleInterface {
- return &fakeRoles{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.Role, *v1alpha1.RoleList, *rbacv1alpha1.RoleApplyConfiguration](
- fake.Fake,
- namespace,
- v1alpha1.SchemeGroupVersion.WithResource("roles"),
- v1alpha1.SchemeGroupVersion.WithKind("Role"),
- func() *v1alpha1.Role { return &v1alpha1.Role{} },
- func() *v1alpha1.RoleList { return &v1alpha1.RoleList{} },
- func(dst, src *v1alpha1.RoleList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.RoleList) []*v1alpha1.Role { return gentype.ToPointerSlice(list.Items) },
- func(list *v1alpha1.RoleList, items []*v1alpha1.Role) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_rolebinding.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_rolebinding.go
deleted file mode 100644
index c27d5f262c..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/fake_rolebinding.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/rbac/v1alpha1"
- rbacv1alpha1 "k8s.io/client-go/applyconfigurations/rbac/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedrbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
-)
-
-// fakeRoleBindings implements RoleBindingInterface
-type fakeRoleBindings struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.RoleBinding, *v1alpha1.RoleBindingList, *rbacv1alpha1.RoleBindingApplyConfiguration]
- Fake *FakeRbacV1alpha1
-}
-
-func newFakeRoleBindings(fake *FakeRbacV1alpha1, namespace string) typedrbacv1alpha1.RoleBindingInterface {
- return &fakeRoleBindings{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.RoleBinding, *v1alpha1.RoleBindingList, *rbacv1alpha1.RoleBindingApplyConfiguration](
- fake.Fake,
- namespace,
- v1alpha1.SchemeGroupVersion.WithResource("rolebindings"),
- v1alpha1.SchemeGroupVersion.WithKind("RoleBinding"),
- func() *v1alpha1.RoleBinding { return &v1alpha1.RoleBinding{} },
- func() *v1alpha1.RoleBindingList { return &v1alpha1.RoleBindingList{} },
- func(dst, src *v1alpha1.RoleBindingList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.RoleBindingList) []*v1alpha1.RoleBinding {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.RoleBindingList, items []*v1alpha1.RoleBinding) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrole.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrole.go
deleted file mode 100644
index 55314691ae..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrole.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/rbac/v1beta1"
- rbacv1beta1 "k8s.io/client-go/applyconfigurations/rbac/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedrbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1"
-)
-
-// fakeClusterRoles implements ClusterRoleInterface
-type fakeClusterRoles struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.ClusterRole, *v1beta1.ClusterRoleList, *rbacv1beta1.ClusterRoleApplyConfiguration]
- Fake *FakeRbacV1beta1
-}
-
-func newFakeClusterRoles(fake *FakeRbacV1beta1) typedrbacv1beta1.ClusterRoleInterface {
- return &fakeClusterRoles{
- gentype.NewFakeClientWithListAndApply[*v1beta1.ClusterRole, *v1beta1.ClusterRoleList, *rbacv1beta1.ClusterRoleApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("clusterroles"),
- v1beta1.SchemeGroupVersion.WithKind("ClusterRole"),
- func() *v1beta1.ClusterRole { return &v1beta1.ClusterRole{} },
- func() *v1beta1.ClusterRoleList { return &v1beta1.ClusterRoleList{} },
- func(dst, src *v1beta1.ClusterRoleList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.ClusterRoleList) []*v1beta1.ClusterRole { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.ClusterRoleList, items []*v1beta1.ClusterRole) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrolebinding.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrolebinding.go
deleted file mode 100644
index 63c1945673..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrolebinding.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/rbac/v1beta1"
- rbacv1beta1 "k8s.io/client-go/applyconfigurations/rbac/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedrbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1"
-)
-
-// fakeClusterRoleBindings implements ClusterRoleBindingInterface
-type fakeClusterRoleBindings struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.ClusterRoleBinding, *v1beta1.ClusterRoleBindingList, *rbacv1beta1.ClusterRoleBindingApplyConfiguration]
- Fake *FakeRbacV1beta1
-}
-
-func newFakeClusterRoleBindings(fake *FakeRbacV1beta1) typedrbacv1beta1.ClusterRoleBindingInterface {
- return &fakeClusterRoleBindings{
- gentype.NewFakeClientWithListAndApply[*v1beta1.ClusterRoleBinding, *v1beta1.ClusterRoleBindingList, *rbacv1beta1.ClusterRoleBindingApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("clusterrolebindings"),
- v1beta1.SchemeGroupVersion.WithKind("ClusterRoleBinding"),
- func() *v1beta1.ClusterRoleBinding { return &v1beta1.ClusterRoleBinding{} },
- func() *v1beta1.ClusterRoleBindingList { return &v1beta1.ClusterRoleBindingList{} },
- func(dst, src *v1beta1.ClusterRoleBindingList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.ClusterRoleBindingList) []*v1beta1.ClusterRoleBinding {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.ClusterRoleBindingList, items []*v1beta1.ClusterRoleBinding) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rbac_client.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rbac_client.go
deleted file mode 100644
index 7cfbbe6197..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rbac_client.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeRbacV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeRbacV1beta1) ClusterRoles() v1beta1.ClusterRoleInterface {
- return newFakeClusterRoles(c)
-}
-
-func (c *FakeRbacV1beta1) ClusterRoleBindings() v1beta1.ClusterRoleBindingInterface {
- return newFakeClusterRoleBindings(c)
-}
-
-func (c *FakeRbacV1beta1) Roles(namespace string) v1beta1.RoleInterface {
- return newFakeRoles(c, namespace)
-}
-
-func (c *FakeRbacV1beta1) RoleBindings(namespace string) v1beta1.RoleBindingInterface {
- return newFakeRoleBindings(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeRbacV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_role.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_role.go
deleted file mode 100644
index 44367168c3..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_role.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/rbac/v1beta1"
- rbacv1beta1 "k8s.io/client-go/applyconfigurations/rbac/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedrbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1"
-)
-
-// fakeRoles implements RoleInterface
-type fakeRoles struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.Role, *v1beta1.RoleList, *rbacv1beta1.RoleApplyConfiguration]
- Fake *FakeRbacV1beta1
-}
-
-func newFakeRoles(fake *FakeRbacV1beta1, namespace string) typedrbacv1beta1.RoleInterface {
- return &fakeRoles{
- gentype.NewFakeClientWithListAndApply[*v1beta1.Role, *v1beta1.RoleList, *rbacv1beta1.RoleApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("roles"),
- v1beta1.SchemeGroupVersion.WithKind("Role"),
- func() *v1beta1.Role { return &v1beta1.Role{} },
- func() *v1beta1.RoleList { return &v1beta1.RoleList{} },
- func(dst, src *v1beta1.RoleList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.RoleList) []*v1beta1.Role { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.RoleList, items []*v1beta1.Role) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rolebinding.go b/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rolebinding.go
deleted file mode 100644
index c42560b1db..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rolebinding.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/rbac/v1beta1"
- rbacv1beta1 "k8s.io/client-go/applyconfigurations/rbac/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedrbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1"
-)
-
-// fakeRoleBindings implements RoleBindingInterface
-type fakeRoleBindings struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.RoleBinding, *v1beta1.RoleBindingList, *rbacv1beta1.RoleBindingApplyConfiguration]
- Fake *FakeRbacV1beta1
-}
-
-func newFakeRoleBindings(fake *FakeRbacV1beta1, namespace string) typedrbacv1beta1.RoleBindingInterface {
- return &fakeRoleBindings{
- gentype.NewFakeClientWithListAndApply[*v1beta1.RoleBinding, *v1beta1.RoleBindingList, *rbacv1beta1.RoleBindingApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("rolebindings"),
- v1beta1.SchemeGroupVersion.WithKind("RoleBinding"),
- func() *v1beta1.RoleBinding { return &v1beta1.RoleBinding{} },
- func() *v1beta1.RoleBindingList { return &v1beta1.RoleBindingList{} },
- func(dst, src *v1beta1.RoleBindingList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.RoleBindingList) []*v1beta1.RoleBinding { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.RoleBindingList, items []*v1beta1.RoleBinding) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_deviceclass.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_deviceclass.go
deleted file mode 100644
index 03b976eeeb..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_deviceclass.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/resource/v1"
- resourcev1 "k8s.io/client-go/applyconfigurations/resource/v1"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1 "k8s.io/client-go/kubernetes/typed/resource/v1"
-)
-
-// fakeDeviceClasses implements DeviceClassInterface
-type fakeDeviceClasses struct {
- *gentype.FakeClientWithListAndApply[*v1.DeviceClass, *v1.DeviceClassList, *resourcev1.DeviceClassApplyConfiguration]
- Fake *FakeResourceV1
-}
-
-func newFakeDeviceClasses(fake *FakeResourceV1) typedresourcev1.DeviceClassInterface {
- return &fakeDeviceClasses{
- gentype.NewFakeClientWithListAndApply[*v1.DeviceClass, *v1.DeviceClassList, *resourcev1.DeviceClassApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("deviceclasses"),
- v1.SchemeGroupVersion.WithKind("DeviceClass"),
- func() *v1.DeviceClass { return &v1.DeviceClass{} },
- func() *v1.DeviceClassList { return &v1.DeviceClassList{} },
- func(dst, src *v1.DeviceClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1.DeviceClassList) []*v1.DeviceClass { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.DeviceClassList, items []*v1.DeviceClass) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resource_client.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resource_client.go
deleted file mode 100644
index 53a2954294..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resource_client.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/resource/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeResourceV1 struct {
- *testing.Fake
-}
-
-func (c *FakeResourceV1) DeviceClasses() v1.DeviceClassInterface {
- return newFakeDeviceClasses(c)
-}
-
-func (c *FakeResourceV1) ResourceClaims(namespace string) v1.ResourceClaimInterface {
- return newFakeResourceClaims(c, namespace)
-}
-
-func (c *FakeResourceV1) ResourceClaimTemplates(namespace string) v1.ResourceClaimTemplateInterface {
- return newFakeResourceClaimTemplates(c, namespace)
-}
-
-func (c *FakeResourceV1) ResourceSlices() v1.ResourceSliceInterface {
- return newFakeResourceSlices(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeResourceV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resourceclaim.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resourceclaim.go
deleted file mode 100644
index d897de97ae..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resourceclaim.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/resource/v1"
- resourcev1 "k8s.io/client-go/applyconfigurations/resource/v1"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1 "k8s.io/client-go/kubernetes/typed/resource/v1"
-)
-
-// fakeResourceClaims implements ResourceClaimInterface
-type fakeResourceClaims struct {
- *gentype.FakeClientWithListAndApply[*v1.ResourceClaim, *v1.ResourceClaimList, *resourcev1.ResourceClaimApplyConfiguration]
- Fake *FakeResourceV1
-}
-
-func newFakeResourceClaims(fake *FakeResourceV1, namespace string) typedresourcev1.ResourceClaimInterface {
- return &fakeResourceClaims{
- gentype.NewFakeClientWithListAndApply[*v1.ResourceClaim, *v1.ResourceClaimList, *resourcev1.ResourceClaimApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("resourceclaims"),
- v1.SchemeGroupVersion.WithKind("ResourceClaim"),
- func() *v1.ResourceClaim { return &v1.ResourceClaim{} },
- func() *v1.ResourceClaimList { return &v1.ResourceClaimList{} },
- func(dst, src *v1.ResourceClaimList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ResourceClaimList) []*v1.ResourceClaim { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.ResourceClaimList, items []*v1.ResourceClaim) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resourceclaimtemplate.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resourceclaimtemplate.go
deleted file mode 100644
index 0429c99af0..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resourceclaimtemplate.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/resource/v1"
- resourcev1 "k8s.io/client-go/applyconfigurations/resource/v1"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1 "k8s.io/client-go/kubernetes/typed/resource/v1"
-)
-
-// fakeResourceClaimTemplates implements ResourceClaimTemplateInterface
-type fakeResourceClaimTemplates struct {
- *gentype.FakeClientWithListAndApply[*v1.ResourceClaimTemplate, *v1.ResourceClaimTemplateList, *resourcev1.ResourceClaimTemplateApplyConfiguration]
- Fake *FakeResourceV1
-}
-
-func newFakeResourceClaimTemplates(fake *FakeResourceV1, namespace string) typedresourcev1.ResourceClaimTemplateInterface {
- return &fakeResourceClaimTemplates{
- gentype.NewFakeClientWithListAndApply[*v1.ResourceClaimTemplate, *v1.ResourceClaimTemplateList, *resourcev1.ResourceClaimTemplateApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("resourceclaimtemplates"),
- v1.SchemeGroupVersion.WithKind("ResourceClaimTemplate"),
- func() *v1.ResourceClaimTemplate { return &v1.ResourceClaimTemplate{} },
- func() *v1.ResourceClaimTemplateList { return &v1.ResourceClaimTemplateList{} },
- func(dst, src *v1.ResourceClaimTemplateList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ResourceClaimTemplateList) []*v1.ResourceClaimTemplate {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.ResourceClaimTemplateList, items []*v1.ResourceClaimTemplate) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resourceslice.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resourceslice.go
deleted file mode 100644
index e215531ec8..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1/fake/fake_resourceslice.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/resource/v1"
- resourcev1 "k8s.io/client-go/applyconfigurations/resource/v1"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1 "k8s.io/client-go/kubernetes/typed/resource/v1"
-)
-
-// fakeResourceSlices implements ResourceSliceInterface
-type fakeResourceSlices struct {
- *gentype.FakeClientWithListAndApply[*v1.ResourceSlice, *v1.ResourceSliceList, *resourcev1.ResourceSliceApplyConfiguration]
- Fake *FakeResourceV1
-}
-
-func newFakeResourceSlices(fake *FakeResourceV1) typedresourcev1.ResourceSliceInterface {
- return &fakeResourceSlices{
- gentype.NewFakeClientWithListAndApply[*v1.ResourceSlice, *v1.ResourceSliceList, *resourcev1.ResourceSliceApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("resourceslices"),
- v1.SchemeGroupVersion.WithKind("ResourceSlice"),
- func() *v1.ResourceSlice { return &v1.ResourceSlice{} },
- func() *v1.ResourceSliceList { return &v1.ResourceSliceList{} },
- func(dst, src *v1.ResourceSliceList) { dst.ListMeta = src.ListMeta },
- func(list *v1.ResourceSliceList) []*v1.ResourceSlice { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.ResourceSliceList, items []*v1.ResourceSlice) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_devicetaintrule.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_devicetaintrule.go
deleted file mode 100644
index 62a55561f3..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_devicetaintrule.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha3 "k8s.io/api/resource/v1alpha3"
- resourcev1alpha3 "k8s.io/client-go/applyconfigurations/resource/v1alpha3"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1alpha3 "k8s.io/client-go/kubernetes/typed/resource/v1alpha3"
-)
-
-// fakeDeviceTaintRules implements DeviceTaintRuleInterface
-type fakeDeviceTaintRules struct {
- *gentype.FakeClientWithListAndApply[*v1alpha3.DeviceTaintRule, *v1alpha3.DeviceTaintRuleList, *resourcev1alpha3.DeviceTaintRuleApplyConfiguration]
- Fake *FakeResourceV1alpha3
-}
-
-func newFakeDeviceTaintRules(fake *FakeResourceV1alpha3) typedresourcev1alpha3.DeviceTaintRuleInterface {
- return &fakeDeviceTaintRules{
- gentype.NewFakeClientWithListAndApply[*v1alpha3.DeviceTaintRule, *v1alpha3.DeviceTaintRuleList, *resourcev1alpha3.DeviceTaintRuleApplyConfiguration](
- fake.Fake,
- "",
- v1alpha3.SchemeGroupVersion.WithResource("devicetaintrules"),
- v1alpha3.SchemeGroupVersion.WithKind("DeviceTaintRule"),
- func() *v1alpha3.DeviceTaintRule { return &v1alpha3.DeviceTaintRule{} },
- func() *v1alpha3.DeviceTaintRuleList { return &v1alpha3.DeviceTaintRuleList{} },
- func(dst, src *v1alpha3.DeviceTaintRuleList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha3.DeviceTaintRuleList) []*v1alpha3.DeviceTaintRule {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha3.DeviceTaintRuleList, items []*v1alpha3.DeviceTaintRule) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resource_client.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resource_client.go
deleted file mode 100644
index 99a5e8d877..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resource_client.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha3 "k8s.io/client-go/kubernetes/typed/resource/v1alpha3"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeResourceV1alpha3 struct {
- *testing.Fake
-}
-
-func (c *FakeResourceV1alpha3) DeviceTaintRules() v1alpha3.DeviceTaintRuleInterface {
- return newFakeDeviceTaintRules(c)
-}
-
-func (c *FakeResourceV1alpha3) ResourcePoolStatusRequests() v1alpha3.ResourcePoolStatusRequestInterface {
- return newFakeResourcePoolStatusRequests(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeResourceV1alpha3) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resourcepoolstatusrequest.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resourcepoolstatusrequest.go
deleted file mode 100644
index 6196ddc1f6..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resourcepoolstatusrequest.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha3 "k8s.io/api/resource/v1alpha3"
- resourcev1alpha3 "k8s.io/client-go/applyconfigurations/resource/v1alpha3"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1alpha3 "k8s.io/client-go/kubernetes/typed/resource/v1alpha3"
-)
-
-// fakeResourcePoolStatusRequests implements ResourcePoolStatusRequestInterface
-type fakeResourcePoolStatusRequests struct {
- *gentype.FakeClientWithListAndApply[*v1alpha3.ResourcePoolStatusRequest, *v1alpha3.ResourcePoolStatusRequestList, *resourcev1alpha3.ResourcePoolStatusRequestApplyConfiguration]
- Fake *FakeResourceV1alpha3
-}
-
-func newFakeResourcePoolStatusRequests(fake *FakeResourceV1alpha3) typedresourcev1alpha3.ResourcePoolStatusRequestInterface {
- return &fakeResourcePoolStatusRequests{
- gentype.NewFakeClientWithListAndApply[*v1alpha3.ResourcePoolStatusRequest, *v1alpha3.ResourcePoolStatusRequestList, *resourcev1alpha3.ResourcePoolStatusRequestApplyConfiguration](
- fake.Fake,
- "",
- v1alpha3.SchemeGroupVersion.WithResource("resourcepoolstatusrequests"),
- v1alpha3.SchemeGroupVersion.WithKind("ResourcePoolStatusRequest"),
- func() *v1alpha3.ResourcePoolStatusRequest { return &v1alpha3.ResourcePoolStatusRequest{} },
- func() *v1alpha3.ResourcePoolStatusRequestList { return &v1alpha3.ResourcePoolStatusRequestList{} },
- func(dst, src *v1alpha3.ResourcePoolStatusRequestList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha3.ResourcePoolStatusRequestList) []*v1alpha3.ResourcePoolStatusRequest {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha3.ResourcePoolStatusRequestList, items []*v1alpha3.ResourcePoolStatusRequest) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_deviceclass.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_deviceclass.go
deleted file mode 100644
index 335629899b..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_deviceclass.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/resource/v1beta1"
- resourcev1beta1 "k8s.io/client-go/applyconfigurations/resource/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1beta1 "k8s.io/client-go/kubernetes/typed/resource/v1beta1"
-)
-
-// fakeDeviceClasses implements DeviceClassInterface
-type fakeDeviceClasses struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.DeviceClass, *v1beta1.DeviceClassList, *resourcev1beta1.DeviceClassApplyConfiguration]
- Fake *FakeResourceV1beta1
-}
-
-func newFakeDeviceClasses(fake *FakeResourceV1beta1) typedresourcev1beta1.DeviceClassInterface {
- return &fakeDeviceClasses{
- gentype.NewFakeClientWithListAndApply[*v1beta1.DeviceClass, *v1beta1.DeviceClassList, *resourcev1beta1.DeviceClassApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("deviceclasses"),
- v1beta1.SchemeGroupVersion.WithKind("DeviceClass"),
- func() *v1beta1.DeviceClass { return &v1beta1.DeviceClass{} },
- func() *v1beta1.DeviceClassList { return &v1beta1.DeviceClassList{} },
- func(dst, src *v1beta1.DeviceClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.DeviceClassList) []*v1beta1.DeviceClass { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.DeviceClassList, items []*v1beta1.DeviceClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_resource_client.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_resource_client.go
deleted file mode 100644
index 3cb54e9cea..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_resource_client.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/resource/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeResourceV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeResourceV1beta1) DeviceClasses() v1beta1.DeviceClassInterface {
- return newFakeDeviceClasses(c)
-}
-
-func (c *FakeResourceV1beta1) ResourceClaims(namespace string) v1beta1.ResourceClaimInterface {
- return newFakeResourceClaims(c, namespace)
-}
-
-func (c *FakeResourceV1beta1) ResourceClaimTemplates(namespace string) v1beta1.ResourceClaimTemplateInterface {
- return newFakeResourceClaimTemplates(c, namespace)
-}
-
-func (c *FakeResourceV1beta1) ResourceSlices() v1beta1.ResourceSliceInterface {
- return newFakeResourceSlices(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeResourceV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_resourceclaim.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_resourceclaim.go
deleted file mode 100644
index ca03121a81..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_resourceclaim.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/resource/v1beta1"
- resourcev1beta1 "k8s.io/client-go/applyconfigurations/resource/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1beta1 "k8s.io/client-go/kubernetes/typed/resource/v1beta1"
-)
-
-// fakeResourceClaims implements ResourceClaimInterface
-type fakeResourceClaims struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.ResourceClaim, *v1beta1.ResourceClaimList, *resourcev1beta1.ResourceClaimApplyConfiguration]
- Fake *FakeResourceV1beta1
-}
-
-func newFakeResourceClaims(fake *FakeResourceV1beta1, namespace string) typedresourcev1beta1.ResourceClaimInterface {
- return &fakeResourceClaims{
- gentype.NewFakeClientWithListAndApply[*v1beta1.ResourceClaim, *v1beta1.ResourceClaimList, *resourcev1beta1.ResourceClaimApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("resourceclaims"),
- v1beta1.SchemeGroupVersion.WithKind("ResourceClaim"),
- func() *v1beta1.ResourceClaim { return &v1beta1.ResourceClaim{} },
- func() *v1beta1.ResourceClaimList { return &v1beta1.ResourceClaimList{} },
- func(dst, src *v1beta1.ResourceClaimList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.ResourceClaimList) []*v1beta1.ResourceClaim {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.ResourceClaimList, items []*v1beta1.ResourceClaim) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_resourceclaimtemplate.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_resourceclaimtemplate.go
deleted file mode 100644
index 2ee43d458f..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_resourceclaimtemplate.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/resource/v1beta1"
- resourcev1beta1 "k8s.io/client-go/applyconfigurations/resource/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1beta1 "k8s.io/client-go/kubernetes/typed/resource/v1beta1"
-)
-
-// fakeResourceClaimTemplates implements ResourceClaimTemplateInterface
-type fakeResourceClaimTemplates struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.ResourceClaimTemplate, *v1beta1.ResourceClaimTemplateList, *resourcev1beta1.ResourceClaimTemplateApplyConfiguration]
- Fake *FakeResourceV1beta1
-}
-
-func newFakeResourceClaimTemplates(fake *FakeResourceV1beta1, namespace string) typedresourcev1beta1.ResourceClaimTemplateInterface {
- return &fakeResourceClaimTemplates{
- gentype.NewFakeClientWithListAndApply[*v1beta1.ResourceClaimTemplate, *v1beta1.ResourceClaimTemplateList, *resourcev1beta1.ResourceClaimTemplateApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("resourceclaimtemplates"),
- v1beta1.SchemeGroupVersion.WithKind("ResourceClaimTemplate"),
- func() *v1beta1.ResourceClaimTemplate { return &v1beta1.ResourceClaimTemplate{} },
- func() *v1beta1.ResourceClaimTemplateList { return &v1beta1.ResourceClaimTemplateList{} },
- func(dst, src *v1beta1.ResourceClaimTemplateList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.ResourceClaimTemplateList) []*v1beta1.ResourceClaimTemplate {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.ResourceClaimTemplateList, items []*v1beta1.ResourceClaimTemplate) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_resourceslice.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_resourceslice.go
deleted file mode 100644
index d6d64b7d3f..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake/fake_resourceslice.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/resource/v1beta1"
- resourcev1beta1 "k8s.io/client-go/applyconfigurations/resource/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1beta1 "k8s.io/client-go/kubernetes/typed/resource/v1beta1"
-)
-
-// fakeResourceSlices implements ResourceSliceInterface
-type fakeResourceSlices struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.ResourceSlice, *v1beta1.ResourceSliceList, *resourcev1beta1.ResourceSliceApplyConfiguration]
- Fake *FakeResourceV1beta1
-}
-
-func newFakeResourceSlices(fake *FakeResourceV1beta1) typedresourcev1beta1.ResourceSliceInterface {
- return &fakeResourceSlices{
- gentype.NewFakeClientWithListAndApply[*v1beta1.ResourceSlice, *v1beta1.ResourceSliceList, *resourcev1beta1.ResourceSliceApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("resourceslices"),
- v1beta1.SchemeGroupVersion.WithKind("ResourceSlice"),
- func() *v1beta1.ResourceSlice { return &v1beta1.ResourceSlice{} },
- func() *v1beta1.ResourceSliceList { return &v1beta1.ResourceSliceList{} },
- func(dst, src *v1beta1.ResourceSliceList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.ResourceSliceList) []*v1beta1.ResourceSlice {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.ResourceSliceList, items []*v1beta1.ResourceSlice) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_deviceclass.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_deviceclass.go
deleted file mode 100644
index 540f278ca1..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_deviceclass.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/api/resource/v1beta2"
- resourcev1beta2 "k8s.io/client-go/applyconfigurations/resource/v1beta2"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2"
-)
-
-// fakeDeviceClasses implements DeviceClassInterface
-type fakeDeviceClasses struct {
- *gentype.FakeClientWithListAndApply[*v1beta2.DeviceClass, *v1beta2.DeviceClassList, *resourcev1beta2.DeviceClassApplyConfiguration]
- Fake *FakeResourceV1beta2
-}
-
-func newFakeDeviceClasses(fake *FakeResourceV1beta2) typedresourcev1beta2.DeviceClassInterface {
- return &fakeDeviceClasses{
- gentype.NewFakeClientWithListAndApply[*v1beta2.DeviceClass, *v1beta2.DeviceClassList, *resourcev1beta2.DeviceClassApplyConfiguration](
- fake.Fake,
- "",
- v1beta2.SchemeGroupVersion.WithResource("deviceclasses"),
- v1beta2.SchemeGroupVersion.WithKind("DeviceClass"),
- func() *v1beta2.DeviceClass { return &v1beta2.DeviceClass{} },
- func() *v1beta2.DeviceClassList { return &v1beta2.DeviceClassList{} },
- func(dst, src *v1beta2.DeviceClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta2.DeviceClassList) []*v1beta2.DeviceClass { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta2.DeviceClassList, items []*v1beta2.DeviceClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_devicetaintrule.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_devicetaintrule.go
deleted file mode 100644
index 13797c6cfd..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_devicetaintrule.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/api/resource/v1beta2"
- resourcev1beta2 "k8s.io/client-go/applyconfigurations/resource/v1beta2"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2"
-)
-
-// fakeDeviceTaintRules implements DeviceTaintRuleInterface
-type fakeDeviceTaintRules struct {
- *gentype.FakeClientWithListAndApply[*v1beta2.DeviceTaintRule, *v1beta2.DeviceTaintRuleList, *resourcev1beta2.DeviceTaintRuleApplyConfiguration]
- Fake *FakeResourceV1beta2
-}
-
-func newFakeDeviceTaintRules(fake *FakeResourceV1beta2) typedresourcev1beta2.DeviceTaintRuleInterface {
- return &fakeDeviceTaintRules{
- gentype.NewFakeClientWithListAndApply[*v1beta2.DeviceTaintRule, *v1beta2.DeviceTaintRuleList, *resourcev1beta2.DeviceTaintRuleApplyConfiguration](
- fake.Fake,
- "",
- v1beta2.SchemeGroupVersion.WithResource("devicetaintrules"),
- v1beta2.SchemeGroupVersion.WithKind("DeviceTaintRule"),
- func() *v1beta2.DeviceTaintRule { return &v1beta2.DeviceTaintRule{} },
- func() *v1beta2.DeviceTaintRuleList { return &v1beta2.DeviceTaintRuleList{} },
- func(dst, src *v1beta2.DeviceTaintRuleList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta2.DeviceTaintRuleList) []*v1beta2.DeviceTaintRule {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta2.DeviceTaintRuleList, items []*v1beta2.DeviceTaintRule) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resource_client.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resource_client.go
deleted file mode 100644
index 718bdd9e0d..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resource_client.go
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeResourceV1beta2 struct {
- *testing.Fake
-}
-
-func (c *FakeResourceV1beta2) DeviceClasses() v1beta2.DeviceClassInterface {
- return newFakeDeviceClasses(c)
-}
-
-func (c *FakeResourceV1beta2) DeviceTaintRules() v1beta2.DeviceTaintRuleInterface {
- return newFakeDeviceTaintRules(c)
-}
-
-func (c *FakeResourceV1beta2) ResourceClaims(namespace string) v1beta2.ResourceClaimInterface {
- return newFakeResourceClaims(c, namespace)
-}
-
-func (c *FakeResourceV1beta2) ResourceClaimTemplates(namespace string) v1beta2.ResourceClaimTemplateInterface {
- return newFakeResourceClaimTemplates(c, namespace)
-}
-
-func (c *FakeResourceV1beta2) ResourceSlices() v1beta2.ResourceSliceInterface {
- return newFakeResourceSlices(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeResourceV1beta2) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resourceclaim.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resourceclaim.go
deleted file mode 100644
index f093917621..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resourceclaim.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/api/resource/v1beta2"
- resourcev1beta2 "k8s.io/client-go/applyconfigurations/resource/v1beta2"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2"
-)
-
-// fakeResourceClaims implements ResourceClaimInterface
-type fakeResourceClaims struct {
- *gentype.FakeClientWithListAndApply[*v1beta2.ResourceClaim, *v1beta2.ResourceClaimList, *resourcev1beta2.ResourceClaimApplyConfiguration]
- Fake *FakeResourceV1beta2
-}
-
-func newFakeResourceClaims(fake *FakeResourceV1beta2, namespace string) typedresourcev1beta2.ResourceClaimInterface {
- return &fakeResourceClaims{
- gentype.NewFakeClientWithListAndApply[*v1beta2.ResourceClaim, *v1beta2.ResourceClaimList, *resourcev1beta2.ResourceClaimApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta2.SchemeGroupVersion.WithResource("resourceclaims"),
- v1beta2.SchemeGroupVersion.WithKind("ResourceClaim"),
- func() *v1beta2.ResourceClaim { return &v1beta2.ResourceClaim{} },
- func() *v1beta2.ResourceClaimList { return &v1beta2.ResourceClaimList{} },
- func(dst, src *v1beta2.ResourceClaimList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta2.ResourceClaimList) []*v1beta2.ResourceClaim {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta2.ResourceClaimList, items []*v1beta2.ResourceClaim) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resourceclaimtemplate.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resourceclaimtemplate.go
deleted file mode 100644
index 5c4bb111d7..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resourceclaimtemplate.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/api/resource/v1beta2"
- resourcev1beta2 "k8s.io/client-go/applyconfigurations/resource/v1beta2"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2"
-)
-
-// fakeResourceClaimTemplates implements ResourceClaimTemplateInterface
-type fakeResourceClaimTemplates struct {
- *gentype.FakeClientWithListAndApply[*v1beta2.ResourceClaimTemplate, *v1beta2.ResourceClaimTemplateList, *resourcev1beta2.ResourceClaimTemplateApplyConfiguration]
- Fake *FakeResourceV1beta2
-}
-
-func newFakeResourceClaimTemplates(fake *FakeResourceV1beta2, namespace string) typedresourcev1beta2.ResourceClaimTemplateInterface {
- return &fakeResourceClaimTemplates{
- gentype.NewFakeClientWithListAndApply[*v1beta2.ResourceClaimTemplate, *v1beta2.ResourceClaimTemplateList, *resourcev1beta2.ResourceClaimTemplateApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta2.SchemeGroupVersion.WithResource("resourceclaimtemplates"),
- v1beta2.SchemeGroupVersion.WithKind("ResourceClaimTemplate"),
- func() *v1beta2.ResourceClaimTemplate { return &v1beta2.ResourceClaimTemplate{} },
- func() *v1beta2.ResourceClaimTemplateList { return &v1beta2.ResourceClaimTemplateList{} },
- func(dst, src *v1beta2.ResourceClaimTemplateList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta2.ResourceClaimTemplateList) []*v1beta2.ResourceClaimTemplate {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta2.ResourceClaimTemplateList, items []*v1beta2.ResourceClaimTemplate) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resourceslice.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resourceslice.go
deleted file mode 100644
index a53b6f81da..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resourceslice.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta2 "k8s.io/api/resource/v1beta2"
- resourcev1beta2 "k8s.io/client-go/applyconfigurations/resource/v1beta2"
- gentype "k8s.io/client-go/gentype"
- typedresourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2"
-)
-
-// fakeResourceSlices implements ResourceSliceInterface
-type fakeResourceSlices struct {
- *gentype.FakeClientWithListAndApply[*v1beta2.ResourceSlice, *v1beta2.ResourceSliceList, *resourcev1beta2.ResourceSliceApplyConfiguration]
- Fake *FakeResourceV1beta2
-}
-
-func newFakeResourceSlices(fake *FakeResourceV1beta2) typedresourcev1beta2.ResourceSliceInterface {
- return &fakeResourceSlices{
- gentype.NewFakeClientWithListAndApply[*v1beta2.ResourceSlice, *v1beta2.ResourceSliceList, *resourcev1beta2.ResourceSliceApplyConfiguration](
- fake.Fake,
- "",
- v1beta2.SchemeGroupVersion.WithResource("resourceslices"),
- v1beta2.SchemeGroupVersion.WithKind("ResourceSlice"),
- func() *v1beta2.ResourceSlice { return &v1beta2.ResourceSlice{} },
- func() *v1beta2.ResourceSliceList { return &v1beta2.ResourceSliceList{} },
- func(dst, src *v1beta2.ResourceSliceList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta2.ResourceSliceList) []*v1beta2.ResourceSlice {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta2.ResourceSliceList, items []*v1beta2.ResourceSlice) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/fake/fake_priorityclass.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/fake/fake_priorityclass.go
deleted file mode 100644
index ea8270eac6..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/fake/fake_priorityclass.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/scheduling/v1"
- schedulingv1 "k8s.io/client-go/applyconfigurations/scheduling/v1"
- gentype "k8s.io/client-go/gentype"
- typedschedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1"
-)
-
-// fakePriorityClasses implements PriorityClassInterface
-type fakePriorityClasses struct {
- *gentype.FakeClientWithListAndApply[*v1.PriorityClass, *v1.PriorityClassList, *schedulingv1.PriorityClassApplyConfiguration]
- Fake *FakeSchedulingV1
-}
-
-func newFakePriorityClasses(fake *FakeSchedulingV1) typedschedulingv1.PriorityClassInterface {
- return &fakePriorityClasses{
- gentype.NewFakeClientWithListAndApply[*v1.PriorityClass, *v1.PriorityClassList, *schedulingv1.PriorityClassApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("priorityclasses"),
- v1.SchemeGroupVersion.WithKind("PriorityClass"),
- func() *v1.PriorityClass { return &v1.PriorityClass{} },
- func() *v1.PriorityClassList { return &v1.PriorityClassList{} },
- func(dst, src *v1.PriorityClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1.PriorityClassList) []*v1.PriorityClass { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.PriorityClassList, items []*v1.PriorityClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/fake/fake_scheduling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/fake/fake_scheduling_client.go
deleted file mode 100644
index 75f903cfe7..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/fake/fake_scheduling_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/scheduling/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeSchedulingV1 struct {
- *testing.Fake
-}
-
-func (c *FakeSchedulingV1) PriorityClasses() v1.PriorityClassInterface {
- return newFakePriorityClasses(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeSchedulingV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_podgroup.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_podgroup.go
deleted file mode 100644
index 3709cf5214..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_podgroup.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha2 "k8s.io/api/scheduling/v1alpha2"
- schedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2"
- gentype "k8s.io/client-go/gentype"
- typedschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2"
-)
-
-// fakePodGroups implements PodGroupInterface
-type fakePodGroups struct {
- *gentype.FakeClientWithListAndApply[*v1alpha2.PodGroup, *v1alpha2.PodGroupList, *schedulingv1alpha2.PodGroupApplyConfiguration]
- Fake *FakeSchedulingV1alpha2
-}
-
-func newFakePodGroups(fake *FakeSchedulingV1alpha2, namespace string) typedschedulingv1alpha2.PodGroupInterface {
- return &fakePodGroups{
- gentype.NewFakeClientWithListAndApply[*v1alpha2.PodGroup, *v1alpha2.PodGroupList, *schedulingv1alpha2.PodGroupApplyConfiguration](
- fake.Fake,
- namespace,
- v1alpha2.SchemeGroupVersion.WithResource("podgroups"),
- v1alpha2.SchemeGroupVersion.WithKind("PodGroup"),
- func() *v1alpha2.PodGroup { return &v1alpha2.PodGroup{} },
- func() *v1alpha2.PodGroupList { return &v1alpha2.PodGroupList{} },
- func(dst, src *v1alpha2.PodGroupList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha2.PodGroupList) []*v1alpha2.PodGroup { return gentype.ToPointerSlice(list.Items) },
- func(list *v1alpha2.PodGroupList, items []*v1alpha2.PodGroup) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_scheduling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_scheduling_client.go
deleted file mode 100644
index 1d21b2d914..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_scheduling_client.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeSchedulingV1alpha2 struct {
- *testing.Fake
-}
-
-func (c *FakeSchedulingV1alpha2) PodGroups(namespace string) v1alpha2.PodGroupInterface {
- return newFakePodGroups(c, namespace)
-}
-
-func (c *FakeSchedulingV1alpha2) Workloads(namespace string) v1alpha2.WorkloadInterface {
- return newFakeWorkloads(c, namespace)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeSchedulingV1alpha2) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_workload.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_workload.go
deleted file mode 100644
index 29768874cf..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_workload.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha2 "k8s.io/api/scheduling/v1alpha2"
- schedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2"
- gentype "k8s.io/client-go/gentype"
- typedschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2"
-)
-
-// fakeWorkloads implements WorkloadInterface
-type fakeWorkloads struct {
- *gentype.FakeClientWithListAndApply[*v1alpha2.Workload, *v1alpha2.WorkloadList, *schedulingv1alpha2.WorkloadApplyConfiguration]
- Fake *FakeSchedulingV1alpha2
-}
-
-func newFakeWorkloads(fake *FakeSchedulingV1alpha2, namespace string) typedschedulingv1alpha2.WorkloadInterface {
- return &fakeWorkloads{
- gentype.NewFakeClientWithListAndApply[*v1alpha2.Workload, *v1alpha2.WorkloadList, *schedulingv1alpha2.WorkloadApplyConfiguration](
- fake.Fake,
- namespace,
- v1alpha2.SchemeGroupVersion.WithResource("workloads"),
- v1alpha2.SchemeGroupVersion.WithKind("Workload"),
- func() *v1alpha2.Workload { return &v1alpha2.Workload{} },
- func() *v1alpha2.WorkloadList { return &v1alpha2.WorkloadList{} },
- func(dst, src *v1alpha2.WorkloadList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha2.WorkloadList) []*v1alpha2.Workload { return gentype.ToPointerSlice(list.Items) },
- func(list *v1alpha2.WorkloadList, items []*v1alpha2.Workload) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_priorityclass.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_priorityclass.go
deleted file mode 100644
index 9a62b17f21..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_priorityclass.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/scheduling/v1beta1"
- schedulingv1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1"
-)
-
-// fakePriorityClasses implements PriorityClassInterface
-type fakePriorityClasses struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.PriorityClass, *v1beta1.PriorityClassList, *schedulingv1beta1.PriorityClassApplyConfiguration]
- Fake *FakeSchedulingV1beta1
-}
-
-func newFakePriorityClasses(fake *FakeSchedulingV1beta1) typedschedulingv1beta1.PriorityClassInterface {
- return &fakePriorityClasses{
- gentype.NewFakeClientWithListAndApply[*v1beta1.PriorityClass, *v1beta1.PriorityClassList, *schedulingv1beta1.PriorityClassApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("priorityclasses"),
- v1beta1.SchemeGroupVersion.WithKind("PriorityClass"),
- func() *v1beta1.PriorityClass { return &v1beta1.PriorityClass{} },
- func() *v1beta1.PriorityClassList { return &v1beta1.PriorityClassList{} },
- func(dst, src *v1beta1.PriorityClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.PriorityClassList) []*v1beta1.PriorityClass {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.PriorityClassList, items []*v1beta1.PriorityClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_scheduling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_scheduling_client.go
deleted file mode 100644
index f06fdab114..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake/fake_scheduling_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeSchedulingV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeSchedulingV1beta1) PriorityClasses() v1beta1.PriorityClassInterface {
- return newFakePriorityClasses(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeSchedulingV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_csidriver.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_csidriver.go
deleted file mode 100644
index 9c6a707254..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_csidriver.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/storage/v1"
- storagev1 "k8s.io/client-go/applyconfigurations/storage/v1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1"
-)
-
-// fakeCSIDrivers implements CSIDriverInterface
-type fakeCSIDrivers struct {
- *gentype.FakeClientWithListAndApply[*v1.CSIDriver, *v1.CSIDriverList, *storagev1.CSIDriverApplyConfiguration]
- Fake *FakeStorageV1
-}
-
-func newFakeCSIDrivers(fake *FakeStorageV1) typedstoragev1.CSIDriverInterface {
- return &fakeCSIDrivers{
- gentype.NewFakeClientWithListAndApply[*v1.CSIDriver, *v1.CSIDriverList, *storagev1.CSIDriverApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("csidrivers"),
- v1.SchemeGroupVersion.WithKind("CSIDriver"),
- func() *v1.CSIDriver { return &v1.CSIDriver{} },
- func() *v1.CSIDriverList { return &v1.CSIDriverList{} },
- func(dst, src *v1.CSIDriverList) { dst.ListMeta = src.ListMeta },
- func(list *v1.CSIDriverList) []*v1.CSIDriver { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.CSIDriverList, items []*v1.CSIDriver) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_csinode.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_csinode.go
deleted file mode 100644
index 2827e6dd62..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_csinode.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/storage/v1"
- storagev1 "k8s.io/client-go/applyconfigurations/storage/v1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1"
-)
-
-// fakeCSINodes implements CSINodeInterface
-type fakeCSINodes struct {
- *gentype.FakeClientWithListAndApply[*v1.CSINode, *v1.CSINodeList, *storagev1.CSINodeApplyConfiguration]
- Fake *FakeStorageV1
-}
-
-func newFakeCSINodes(fake *FakeStorageV1) typedstoragev1.CSINodeInterface {
- return &fakeCSINodes{
- gentype.NewFakeClientWithListAndApply[*v1.CSINode, *v1.CSINodeList, *storagev1.CSINodeApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("csinodes"),
- v1.SchemeGroupVersion.WithKind("CSINode"),
- func() *v1.CSINode { return &v1.CSINode{} },
- func() *v1.CSINodeList { return &v1.CSINodeList{} },
- func(dst, src *v1.CSINodeList) { dst.ListMeta = src.ListMeta },
- func(list *v1.CSINodeList) []*v1.CSINode { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.CSINodeList, items []*v1.CSINode) { list.Items = gentype.FromPointerSlice(items) },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_csistoragecapacity.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_csistoragecapacity.go
deleted file mode 100644
index ba778c250c..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_csistoragecapacity.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/storage/v1"
- storagev1 "k8s.io/client-go/applyconfigurations/storage/v1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1"
-)
-
-// fakeCSIStorageCapacities implements CSIStorageCapacityInterface
-type fakeCSIStorageCapacities struct {
- *gentype.FakeClientWithListAndApply[*v1.CSIStorageCapacity, *v1.CSIStorageCapacityList, *storagev1.CSIStorageCapacityApplyConfiguration]
- Fake *FakeStorageV1
-}
-
-func newFakeCSIStorageCapacities(fake *FakeStorageV1, namespace string) typedstoragev1.CSIStorageCapacityInterface {
- return &fakeCSIStorageCapacities{
- gentype.NewFakeClientWithListAndApply[*v1.CSIStorageCapacity, *v1.CSIStorageCapacityList, *storagev1.CSIStorageCapacityApplyConfiguration](
- fake.Fake,
- namespace,
- v1.SchemeGroupVersion.WithResource("csistoragecapacities"),
- v1.SchemeGroupVersion.WithKind("CSIStorageCapacity"),
- func() *v1.CSIStorageCapacity { return &v1.CSIStorageCapacity{} },
- func() *v1.CSIStorageCapacityList { return &v1.CSIStorageCapacityList{} },
- func(dst, src *v1.CSIStorageCapacityList) { dst.ListMeta = src.ListMeta },
- func(list *v1.CSIStorageCapacityList) []*v1.CSIStorageCapacity {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.CSIStorageCapacityList, items []*v1.CSIStorageCapacity) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_storage_client.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_storage_client.go
deleted file mode 100644
index b48ec78081..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_storage_client.go
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/client-go/kubernetes/typed/storage/v1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeStorageV1 struct {
- *testing.Fake
-}
-
-func (c *FakeStorageV1) CSIDrivers() v1.CSIDriverInterface {
- return newFakeCSIDrivers(c)
-}
-
-func (c *FakeStorageV1) CSINodes() v1.CSINodeInterface {
- return newFakeCSINodes(c)
-}
-
-func (c *FakeStorageV1) CSIStorageCapacities(namespace string) v1.CSIStorageCapacityInterface {
- return newFakeCSIStorageCapacities(c, namespace)
-}
-
-func (c *FakeStorageV1) StorageClasses() v1.StorageClassInterface {
- return newFakeStorageClasses(c)
-}
-
-func (c *FakeStorageV1) VolumeAttachments() v1.VolumeAttachmentInterface {
- return newFakeVolumeAttachments(c)
-}
-
-func (c *FakeStorageV1) VolumeAttributesClasses() v1.VolumeAttributesClassInterface {
- return newFakeVolumeAttributesClasses(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeStorageV1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_storageclass.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_storageclass.go
deleted file mode 100644
index 18cb8eba1d..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_storageclass.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/storage/v1"
- storagev1 "k8s.io/client-go/applyconfigurations/storage/v1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1"
-)
-
-// fakeStorageClasses implements StorageClassInterface
-type fakeStorageClasses struct {
- *gentype.FakeClientWithListAndApply[*v1.StorageClass, *v1.StorageClassList, *storagev1.StorageClassApplyConfiguration]
- Fake *FakeStorageV1
-}
-
-func newFakeStorageClasses(fake *FakeStorageV1) typedstoragev1.StorageClassInterface {
- return &fakeStorageClasses{
- gentype.NewFakeClientWithListAndApply[*v1.StorageClass, *v1.StorageClassList, *storagev1.StorageClassApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("storageclasses"),
- v1.SchemeGroupVersion.WithKind("StorageClass"),
- func() *v1.StorageClass { return &v1.StorageClass{} },
- func() *v1.StorageClassList { return &v1.StorageClassList{} },
- func(dst, src *v1.StorageClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1.StorageClassList) []*v1.StorageClass { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.StorageClassList, items []*v1.StorageClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_volumeattachment.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_volumeattachment.go
deleted file mode 100644
index e3bc8d8892..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_volumeattachment.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/storage/v1"
- storagev1 "k8s.io/client-go/applyconfigurations/storage/v1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1"
-)
-
-// fakeVolumeAttachments implements VolumeAttachmentInterface
-type fakeVolumeAttachments struct {
- *gentype.FakeClientWithListAndApply[*v1.VolumeAttachment, *v1.VolumeAttachmentList, *storagev1.VolumeAttachmentApplyConfiguration]
- Fake *FakeStorageV1
-}
-
-func newFakeVolumeAttachments(fake *FakeStorageV1) typedstoragev1.VolumeAttachmentInterface {
- return &fakeVolumeAttachments{
- gentype.NewFakeClientWithListAndApply[*v1.VolumeAttachment, *v1.VolumeAttachmentList, *storagev1.VolumeAttachmentApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("volumeattachments"),
- v1.SchemeGroupVersion.WithKind("VolumeAttachment"),
- func() *v1.VolumeAttachment { return &v1.VolumeAttachment{} },
- func() *v1.VolumeAttachmentList { return &v1.VolumeAttachmentList{} },
- func(dst, src *v1.VolumeAttachmentList) { dst.ListMeta = src.ListMeta },
- func(list *v1.VolumeAttachmentList) []*v1.VolumeAttachment { return gentype.ToPointerSlice(list.Items) },
- func(list *v1.VolumeAttachmentList, items []*v1.VolumeAttachment) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_volumeattributesclass.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_volumeattributesclass.go
deleted file mode 100644
index 19a28967f6..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake/fake_volumeattributesclass.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/api/storage/v1"
- storagev1 "k8s.io/client-go/applyconfigurations/storage/v1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1"
-)
-
-// fakeVolumeAttributesClasses implements VolumeAttributesClassInterface
-type fakeVolumeAttributesClasses struct {
- *gentype.FakeClientWithListAndApply[*v1.VolumeAttributesClass, *v1.VolumeAttributesClassList, *storagev1.VolumeAttributesClassApplyConfiguration]
- Fake *FakeStorageV1
-}
-
-func newFakeVolumeAttributesClasses(fake *FakeStorageV1) typedstoragev1.VolumeAttributesClassInterface {
- return &fakeVolumeAttributesClasses{
- gentype.NewFakeClientWithListAndApply[*v1.VolumeAttributesClass, *v1.VolumeAttributesClassList, *storagev1.VolumeAttributesClassApplyConfiguration](
- fake.Fake,
- "",
- v1.SchemeGroupVersion.WithResource("volumeattributesclasses"),
- v1.SchemeGroupVersion.WithKind("VolumeAttributesClass"),
- func() *v1.VolumeAttributesClass { return &v1.VolumeAttributesClass{} },
- func() *v1.VolumeAttributesClassList { return &v1.VolumeAttributesClassList{} },
- func(dst, src *v1.VolumeAttributesClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1.VolumeAttributesClassList) []*v1.VolumeAttributesClass {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1.VolumeAttributesClassList, items []*v1.VolumeAttributesClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_csistoragecapacity.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_csistoragecapacity.go
deleted file mode 100644
index 3dc5427543..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_csistoragecapacity.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/storage/v1alpha1"
- storagev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1"
-)
-
-// fakeCSIStorageCapacities implements CSIStorageCapacityInterface
-type fakeCSIStorageCapacities struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.CSIStorageCapacity, *v1alpha1.CSIStorageCapacityList, *storagev1alpha1.CSIStorageCapacityApplyConfiguration]
- Fake *FakeStorageV1alpha1
-}
-
-func newFakeCSIStorageCapacities(fake *FakeStorageV1alpha1, namespace string) typedstoragev1alpha1.CSIStorageCapacityInterface {
- return &fakeCSIStorageCapacities{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.CSIStorageCapacity, *v1alpha1.CSIStorageCapacityList, *storagev1alpha1.CSIStorageCapacityApplyConfiguration](
- fake.Fake,
- namespace,
- v1alpha1.SchemeGroupVersion.WithResource("csistoragecapacities"),
- v1alpha1.SchemeGroupVersion.WithKind("CSIStorageCapacity"),
- func() *v1alpha1.CSIStorageCapacity { return &v1alpha1.CSIStorageCapacity{} },
- func() *v1alpha1.CSIStorageCapacityList { return &v1alpha1.CSIStorageCapacityList{} },
- func(dst, src *v1alpha1.CSIStorageCapacityList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.CSIStorageCapacityList) []*v1alpha1.CSIStorageCapacity {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.CSIStorageCapacityList, items []*v1alpha1.CSIStorageCapacity) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_storage_client.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_storage_client.go
deleted file mode 100644
index b5670cbddf..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_storage_client.go
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeStorageV1alpha1 struct {
- *testing.Fake
-}
-
-func (c *FakeStorageV1alpha1) CSIStorageCapacities(namespace string) v1alpha1.CSIStorageCapacityInterface {
- return newFakeCSIStorageCapacities(c, namespace)
-}
-
-func (c *FakeStorageV1alpha1) VolumeAttachments() v1alpha1.VolumeAttachmentInterface {
- return newFakeVolumeAttachments(c)
-}
-
-func (c *FakeStorageV1alpha1) VolumeAttributesClasses() v1alpha1.VolumeAttributesClassInterface {
- return newFakeVolumeAttributesClasses(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeStorageV1alpha1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_volumeattachment.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_volumeattachment.go
deleted file mode 100644
index a4c230709c..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_volumeattachment.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/storage/v1alpha1"
- storagev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1"
-)
-
-// fakeVolumeAttachments implements VolumeAttachmentInterface
-type fakeVolumeAttachments struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.VolumeAttachment, *v1alpha1.VolumeAttachmentList, *storagev1alpha1.VolumeAttachmentApplyConfiguration]
- Fake *FakeStorageV1alpha1
-}
-
-func newFakeVolumeAttachments(fake *FakeStorageV1alpha1) typedstoragev1alpha1.VolumeAttachmentInterface {
- return &fakeVolumeAttachments{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.VolumeAttachment, *v1alpha1.VolumeAttachmentList, *storagev1alpha1.VolumeAttachmentApplyConfiguration](
- fake.Fake,
- "",
- v1alpha1.SchemeGroupVersion.WithResource("volumeattachments"),
- v1alpha1.SchemeGroupVersion.WithKind("VolumeAttachment"),
- func() *v1alpha1.VolumeAttachment { return &v1alpha1.VolumeAttachment{} },
- func() *v1alpha1.VolumeAttachmentList { return &v1alpha1.VolumeAttachmentList{} },
- func(dst, src *v1alpha1.VolumeAttachmentList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.VolumeAttachmentList) []*v1alpha1.VolumeAttachment {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.VolumeAttachmentList, items []*v1alpha1.VolumeAttachment) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_volumeattributesclass.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_volumeattributesclass.go
deleted file mode 100644
index 8fab41a73e..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake/fake_volumeattributesclass.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1alpha1 "k8s.io/api/storage/v1alpha1"
- storagev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1"
-)
-
-// fakeVolumeAttributesClasses implements VolumeAttributesClassInterface
-type fakeVolumeAttributesClasses struct {
- *gentype.FakeClientWithListAndApply[*v1alpha1.VolumeAttributesClass, *v1alpha1.VolumeAttributesClassList, *storagev1alpha1.VolumeAttributesClassApplyConfiguration]
- Fake *FakeStorageV1alpha1
-}
-
-func newFakeVolumeAttributesClasses(fake *FakeStorageV1alpha1) typedstoragev1alpha1.VolumeAttributesClassInterface {
- return &fakeVolumeAttributesClasses{
- gentype.NewFakeClientWithListAndApply[*v1alpha1.VolumeAttributesClass, *v1alpha1.VolumeAttributesClassList, *storagev1alpha1.VolumeAttributesClassApplyConfiguration](
- fake.Fake,
- "",
- v1alpha1.SchemeGroupVersion.WithResource("volumeattributesclasses"),
- v1alpha1.SchemeGroupVersion.WithKind("VolumeAttributesClass"),
- func() *v1alpha1.VolumeAttributesClass { return &v1alpha1.VolumeAttributesClass{} },
- func() *v1alpha1.VolumeAttributesClassList { return &v1alpha1.VolumeAttributesClassList{} },
- func(dst, src *v1alpha1.VolumeAttributesClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1alpha1.VolumeAttributesClassList) []*v1alpha1.VolumeAttributesClass {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1alpha1.VolumeAttributesClassList, items []*v1alpha1.VolumeAttributesClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_csidriver.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_csidriver.go
deleted file mode 100644
index e673669212..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_csidriver.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/storage/v1beta1"
- storagev1beta1 "k8s.io/client-go/applyconfigurations/storage/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
-)
-
-// fakeCSIDrivers implements CSIDriverInterface
-type fakeCSIDrivers struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.CSIDriver, *v1beta1.CSIDriverList, *storagev1beta1.CSIDriverApplyConfiguration]
- Fake *FakeStorageV1beta1
-}
-
-func newFakeCSIDrivers(fake *FakeStorageV1beta1) typedstoragev1beta1.CSIDriverInterface {
- return &fakeCSIDrivers{
- gentype.NewFakeClientWithListAndApply[*v1beta1.CSIDriver, *v1beta1.CSIDriverList, *storagev1beta1.CSIDriverApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("csidrivers"),
- v1beta1.SchemeGroupVersion.WithKind("CSIDriver"),
- func() *v1beta1.CSIDriver { return &v1beta1.CSIDriver{} },
- func() *v1beta1.CSIDriverList { return &v1beta1.CSIDriverList{} },
- func(dst, src *v1beta1.CSIDriverList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.CSIDriverList) []*v1beta1.CSIDriver { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.CSIDriverList, items []*v1beta1.CSIDriver) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_csinode.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_csinode.go
deleted file mode 100644
index f9c8570247..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_csinode.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/storage/v1beta1"
- storagev1beta1 "k8s.io/client-go/applyconfigurations/storage/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
-)
-
-// fakeCSINodes implements CSINodeInterface
-type fakeCSINodes struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.CSINode, *v1beta1.CSINodeList, *storagev1beta1.CSINodeApplyConfiguration]
- Fake *FakeStorageV1beta1
-}
-
-func newFakeCSINodes(fake *FakeStorageV1beta1) typedstoragev1beta1.CSINodeInterface {
- return &fakeCSINodes{
- gentype.NewFakeClientWithListAndApply[*v1beta1.CSINode, *v1beta1.CSINodeList, *storagev1beta1.CSINodeApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("csinodes"),
- v1beta1.SchemeGroupVersion.WithKind("CSINode"),
- func() *v1beta1.CSINode { return &v1beta1.CSINode{} },
- func() *v1beta1.CSINodeList { return &v1beta1.CSINodeList{} },
- func(dst, src *v1beta1.CSINodeList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.CSINodeList) []*v1beta1.CSINode { return gentype.ToPointerSlice(list.Items) },
- func(list *v1beta1.CSINodeList, items []*v1beta1.CSINode) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_csistoragecapacity.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_csistoragecapacity.go
deleted file mode 100644
index 9a8c2054b5..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_csistoragecapacity.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/storage/v1beta1"
- storagev1beta1 "k8s.io/client-go/applyconfigurations/storage/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
-)
-
-// fakeCSIStorageCapacities implements CSIStorageCapacityInterface
-type fakeCSIStorageCapacities struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.CSIStorageCapacity, *v1beta1.CSIStorageCapacityList, *storagev1beta1.CSIStorageCapacityApplyConfiguration]
- Fake *FakeStorageV1beta1
-}
-
-func newFakeCSIStorageCapacities(fake *FakeStorageV1beta1, namespace string) typedstoragev1beta1.CSIStorageCapacityInterface {
- return &fakeCSIStorageCapacities{
- gentype.NewFakeClientWithListAndApply[*v1beta1.CSIStorageCapacity, *v1beta1.CSIStorageCapacityList, *storagev1beta1.CSIStorageCapacityApplyConfiguration](
- fake.Fake,
- namespace,
- v1beta1.SchemeGroupVersion.WithResource("csistoragecapacities"),
- v1beta1.SchemeGroupVersion.WithKind("CSIStorageCapacity"),
- func() *v1beta1.CSIStorageCapacity { return &v1beta1.CSIStorageCapacity{} },
- func() *v1beta1.CSIStorageCapacityList { return &v1beta1.CSIStorageCapacityList{} },
- func(dst, src *v1beta1.CSIStorageCapacityList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.CSIStorageCapacityList) []*v1beta1.CSIStorageCapacity {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.CSIStorageCapacityList, items []*v1beta1.CSIStorageCapacity) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_storage_client.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_storage_client.go
deleted file mode 100644
index 8c74de727d..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_storage_client.go
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeStorageV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeStorageV1beta1) CSIDrivers() v1beta1.CSIDriverInterface {
- return newFakeCSIDrivers(c)
-}
-
-func (c *FakeStorageV1beta1) CSINodes() v1beta1.CSINodeInterface {
- return newFakeCSINodes(c)
-}
-
-func (c *FakeStorageV1beta1) CSIStorageCapacities(namespace string) v1beta1.CSIStorageCapacityInterface {
- return newFakeCSIStorageCapacities(c, namespace)
-}
-
-func (c *FakeStorageV1beta1) StorageClasses() v1beta1.StorageClassInterface {
- return newFakeStorageClasses(c)
-}
-
-func (c *FakeStorageV1beta1) VolumeAttachments() v1beta1.VolumeAttachmentInterface {
- return newFakeVolumeAttachments(c)
-}
-
-func (c *FakeStorageV1beta1) VolumeAttributesClasses() v1beta1.VolumeAttributesClassInterface {
- return newFakeVolumeAttributesClasses(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeStorageV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_storageclass.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_storageclass.go
deleted file mode 100644
index 0ce78cc747..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_storageclass.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/storage/v1beta1"
- storagev1beta1 "k8s.io/client-go/applyconfigurations/storage/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
-)
-
-// fakeStorageClasses implements StorageClassInterface
-type fakeStorageClasses struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.StorageClass, *v1beta1.StorageClassList, *storagev1beta1.StorageClassApplyConfiguration]
- Fake *FakeStorageV1beta1
-}
-
-func newFakeStorageClasses(fake *FakeStorageV1beta1) typedstoragev1beta1.StorageClassInterface {
- return &fakeStorageClasses{
- gentype.NewFakeClientWithListAndApply[*v1beta1.StorageClass, *v1beta1.StorageClassList, *storagev1beta1.StorageClassApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("storageclasses"),
- v1beta1.SchemeGroupVersion.WithKind("StorageClass"),
- func() *v1beta1.StorageClass { return &v1beta1.StorageClass{} },
- func() *v1beta1.StorageClassList { return &v1beta1.StorageClassList{} },
- func(dst, src *v1beta1.StorageClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.StorageClassList) []*v1beta1.StorageClass {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.StorageClassList, items []*v1beta1.StorageClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_volumeattachment.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_volumeattachment.go
deleted file mode 100644
index 29ac6c4c76..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_volumeattachment.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/storage/v1beta1"
- storagev1beta1 "k8s.io/client-go/applyconfigurations/storage/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
-)
-
-// fakeVolumeAttachments implements VolumeAttachmentInterface
-type fakeVolumeAttachments struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.VolumeAttachment, *v1beta1.VolumeAttachmentList, *storagev1beta1.VolumeAttachmentApplyConfiguration]
- Fake *FakeStorageV1beta1
-}
-
-func newFakeVolumeAttachments(fake *FakeStorageV1beta1) typedstoragev1beta1.VolumeAttachmentInterface {
- return &fakeVolumeAttachments{
- gentype.NewFakeClientWithListAndApply[*v1beta1.VolumeAttachment, *v1beta1.VolumeAttachmentList, *storagev1beta1.VolumeAttachmentApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("volumeattachments"),
- v1beta1.SchemeGroupVersion.WithKind("VolumeAttachment"),
- func() *v1beta1.VolumeAttachment { return &v1beta1.VolumeAttachment{} },
- func() *v1beta1.VolumeAttachmentList { return &v1beta1.VolumeAttachmentList{} },
- func(dst, src *v1beta1.VolumeAttachmentList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.VolumeAttachmentList) []*v1beta1.VolumeAttachment {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.VolumeAttachmentList, items []*v1beta1.VolumeAttachment) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_volumeattributesclass.go b/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_volumeattributesclass.go
deleted file mode 100644
index 0197e0b379..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_volumeattributesclass.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/storage/v1beta1"
- storagev1beta1 "k8s.io/client-go/applyconfigurations/storage/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedstoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
-)
-
-// fakeVolumeAttributesClasses implements VolumeAttributesClassInterface
-type fakeVolumeAttributesClasses struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.VolumeAttributesClass, *v1beta1.VolumeAttributesClassList, *storagev1beta1.VolumeAttributesClassApplyConfiguration]
- Fake *FakeStorageV1beta1
-}
-
-func newFakeVolumeAttributesClasses(fake *FakeStorageV1beta1) typedstoragev1beta1.VolumeAttributesClassInterface {
- return &fakeVolumeAttributesClasses{
- gentype.NewFakeClientWithListAndApply[*v1beta1.VolumeAttributesClass, *v1beta1.VolumeAttributesClassList, *storagev1beta1.VolumeAttributesClassApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("volumeattributesclasses"),
- v1beta1.SchemeGroupVersion.WithKind("VolumeAttributesClass"),
- func() *v1beta1.VolumeAttributesClass { return &v1beta1.VolumeAttributesClass{} },
- func() *v1beta1.VolumeAttributesClassList { return &v1beta1.VolumeAttributesClassList{} },
- func(dst, src *v1beta1.VolumeAttributesClassList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.VolumeAttributesClassList) []*v1beta1.VolumeAttributesClass {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.VolumeAttributesClassList, items []*v1beta1.VolumeAttributesClass) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1/fake/doc.go
deleted file mode 100644
index 16f4439906..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1/fake/fake_storagemigration_client.go b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1/fake/fake_storagemigration_client.go
deleted file mode 100644
index 3c87c10a0d..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1/fake/fake_storagemigration_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1"
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
-)
-
-type FakeStoragemigrationV1beta1 struct {
- *testing.Fake
-}
-
-func (c *FakeStoragemigrationV1beta1) StorageVersionMigrations() v1beta1.StorageVersionMigrationInterface {
- return newFakeStorageVersionMigrations(c)
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeStoragemigrationV1beta1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1/fake/fake_storageversionmigration.go b/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1/fake/fake_storageversionmigration.go
deleted file mode 100644
index 21fc8dc8ca..0000000000
--- a/vendor/k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1/fake/fake_storageversionmigration.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1beta1 "k8s.io/api/storagemigration/v1beta1"
- storagemigrationv1beta1 "k8s.io/client-go/applyconfigurations/storagemigration/v1beta1"
- gentype "k8s.io/client-go/gentype"
- typedstoragemigrationv1beta1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1"
-)
-
-// fakeStorageVersionMigrations implements StorageVersionMigrationInterface
-type fakeStorageVersionMigrations struct {
- *gentype.FakeClientWithListAndApply[*v1beta1.StorageVersionMigration, *v1beta1.StorageVersionMigrationList, *storagemigrationv1beta1.StorageVersionMigrationApplyConfiguration]
- Fake *FakeStoragemigrationV1beta1
-}
-
-func newFakeStorageVersionMigrations(fake *FakeStoragemigrationV1beta1) typedstoragemigrationv1beta1.StorageVersionMigrationInterface {
- return &fakeStorageVersionMigrations{
- gentype.NewFakeClientWithListAndApply[*v1beta1.StorageVersionMigration, *v1beta1.StorageVersionMigrationList, *storagemigrationv1beta1.StorageVersionMigrationApplyConfiguration](
- fake.Fake,
- "",
- v1beta1.SchemeGroupVersion.WithResource("storageversionmigrations"),
- v1beta1.SchemeGroupVersion.WithKind("StorageVersionMigration"),
- func() *v1beta1.StorageVersionMigration { return &v1beta1.StorageVersionMigration{} },
- func() *v1beta1.StorageVersionMigrationList { return &v1beta1.StorageVersionMigrationList{} },
- func(dst, src *v1beta1.StorageVersionMigrationList) { dst.ListMeta = src.ListMeta },
- func(list *v1beta1.StorageVersionMigrationList) []*v1beta1.StorageVersionMigration {
- return gentype.ToPointerSlice(list.Items)
- },
- func(list *v1beta1.StorageVersionMigrationList, items []*v1beta1.StorageVersionMigration) {
- list.Items = gentype.FromPointerSlice(items)
- },
- ),
- fake,
- }
-}
diff --git a/vendor/k8s.io/client-go/rest/fake/fake.go b/vendor/k8s.io/client-go/rest/fake/fake.go
deleted file mode 100644
index 293e096946..0000000000
--- a/vendor/k8s.io/client-go/rest/fake/fake.go
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-Copyright 2014 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// This is made a separate package and should only be imported by tests, because
-// it imports testapi
-package fake
-
-import (
- "net/http"
- "net/url"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/types"
- restclient "k8s.io/client-go/rest"
- "k8s.io/client-go/util/flowcontrol"
-)
-
-// CreateHTTPClient creates an http.Client that will invoke the provided roundTripper func
-// when a request is made.
-func CreateHTTPClient(roundTripper func(*http.Request) (*http.Response, error)) *http.Client {
- return &http.Client{
- Transport: roundTripperFunc(roundTripper),
- }
-}
-
-type roundTripperFunc func(*http.Request) (*http.Response, error)
-
-func (f roundTripperFunc) RoundTrip(req *http.Request) (*http.Response, error) {
- return f(req)
-}
-
-// RESTClient provides a fake RESTClient interface. It is used to mock network
-// interactions via a rest.Request, or to make them via the provided Client to
-// a specific server.
-type RESTClient struct {
- NegotiatedSerializer runtime.NegotiatedSerializer
- GroupVersion schema.GroupVersion
- VersionedAPIPath string
-
- // Err is returned when any request would be made to the server. If Err is set,
- // Req will not be recorded, Resp will not be returned, and Client will not be
- // invoked.
- Err error
- // Req is set to the last request that was executed (had the methods Do/DoRaw) invoked.
- Req *http.Request
- // If Client is specified, the client will be invoked instead of returning Resp if
- // Err is not set.
- Client *http.Client
- // Resp is returned to the caller after Req is recorded, unless Err or Client are set.
- Resp *http.Response
-}
-
-func (c *RESTClient) Get() *restclient.Request {
- return c.Verb("GET")
-}
-
-func (c *RESTClient) Put() *restclient.Request {
- return c.Verb("PUT")
-}
-
-func (c *RESTClient) Patch(pt types.PatchType) *restclient.Request {
- return c.Verb("PATCH").SetHeader("Content-Type", string(pt))
-}
-
-func (c *RESTClient) Post() *restclient.Request {
- return c.Verb("POST")
-}
-
-func (c *RESTClient) Delete() *restclient.Request {
- return c.Verb("DELETE")
-}
-
-func (c *RESTClient) Verb(verb string) *restclient.Request {
- return c.Request().Verb(verb)
-}
-
-func (c *RESTClient) APIVersion() schema.GroupVersion {
- return c.GroupVersion
-}
-
-func (c *RESTClient) GetRateLimiter() flowcontrol.RateLimiter {
- return nil
-}
-
-func (c *RESTClient) Request() *restclient.Request {
- config := restclient.ClientContentConfig{
- ContentType: runtime.ContentTypeJSON,
- GroupVersion: c.GroupVersion,
- Negotiator: runtime.NewClientNegotiator(c.NegotiatedSerializer, c.GroupVersion),
- }
- return restclient.NewRequestWithClient(&url.URL{Scheme: "https", Host: "localhost"}, c.VersionedAPIPath, config, CreateHTTPClient(c.do))
-}
-
-// do is invoked when a Request() created by this client is executed.
-func (c *RESTClient) do(req *http.Request) (*http.Response, error) {
- if c.Err != nil {
- return nil, c.Err
- }
- c.Req = req
- if c.Client != nil {
- return c.Client.Do(req)
- }
- return c.Resp, nil
-}
diff --git a/vendor/k8s.io/component-helpers/LICENSE b/vendor/k8s.io/component-helpers/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/vendor/k8s.io/component-helpers/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/k8s.io/component-helpers/auth/rbac/validation/policy_comparator.go b/vendor/k8s.io/component-helpers/auth/rbac/validation/policy_comparator.go
deleted file mode 100644
index 7a0268b5e9..0000000000
--- a/vendor/k8s.io/component-helpers/auth/rbac/validation/policy_comparator.go
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package validation
-
-import (
- "strings"
-
- rbacv1 "k8s.io/api/rbac/v1"
-)
-
-// Covers determines whether or not the ownerRules cover the servantRules in terms of allowed actions.
-// It returns whether or not the ownerRules cover and a list of the rules that the ownerRules do not cover.
-func Covers(ownerRules, servantRules []rbacv1.PolicyRule) (bool, []rbacv1.PolicyRule) {
- // 1. Break every servantRule into individual rule tuples: group, verb, resource, resourceName
- // 2. Compare the mini-rules against each owner rule. Because the breakdown is down to the most atomic level, we're guaranteed that each mini-servant rule will be either fully covered or not covered by a single owner rule
- // 3. Any left over mini-rules means that we are not covered and we have a nice list of them.
- // TODO: it might be nice to collapse the list down into something more human readable
-
- subrules := []rbacv1.PolicyRule{}
- for _, servantRule := range servantRules {
- subrules = append(subrules, BreakdownRule(servantRule)...)
- }
-
- uncoveredRules := []rbacv1.PolicyRule{}
- for _, subrule := range subrules {
- covered := false
- for _, ownerRule := range ownerRules {
- if ruleCovers(ownerRule, subrule) {
- covered = true
- break
- }
- }
-
- if !covered {
- uncoveredRules = append(uncoveredRules, subrule)
- }
- }
-
- return (len(uncoveredRules) == 0), uncoveredRules
-}
-
-// BreadownRule takes a rule and builds an equivalent list of rules that each have at most one verb, one
-// resource, and one resource name
-func BreakdownRule(rule rbacv1.PolicyRule) []rbacv1.PolicyRule {
- subrules := []rbacv1.PolicyRule{}
- for _, group := range rule.APIGroups {
- for _, resource := range rule.Resources {
- for _, verb := range rule.Verbs {
- if len(rule.ResourceNames) > 0 {
- for _, resourceName := range rule.ResourceNames {
- subrules = append(subrules, rbacv1.PolicyRule{APIGroups: []string{group}, Resources: []string{resource}, Verbs: []string{verb}, ResourceNames: []string{resourceName}})
- }
-
- } else {
- subrules = append(subrules, rbacv1.PolicyRule{APIGroups: []string{group}, Resources: []string{resource}, Verbs: []string{verb}})
- }
-
- }
- }
- }
-
- // Non-resource URLs are unique because they only combine with verbs.
- for _, nonResourceURL := range rule.NonResourceURLs {
- for _, verb := range rule.Verbs {
- subrules = append(subrules, rbacv1.PolicyRule{NonResourceURLs: []string{nonResourceURL}, Verbs: []string{verb}})
- }
- }
-
- return subrules
-}
-
-func has(set []string, ele string) bool {
- for _, s := range set {
- if s == ele {
- return true
- }
- }
- return false
-}
-
-func hasAll(set, contains []string) bool {
- owning := make(map[string]struct{}, len(set))
- for _, ele := range set {
- owning[ele] = struct{}{}
- }
- for _, ele := range contains {
- if _, ok := owning[ele]; !ok {
- return false
- }
- }
- return true
-}
-
-func resourceCoversAll(setResources, coversResources []string) bool {
- // if we have a star or an exact match on all resources, then we match
- if has(setResources, rbacv1.ResourceAll) || hasAll(setResources, coversResources) {
- return true
- }
-
- for _, path := range coversResources {
- // if we have an exact match, then we match.
- if has(setResources, path) {
- continue
- }
- // if we're not a subresource, then we definitely don't match. fail.
- if !strings.Contains(path, "/") {
- return false
- }
- tokens := strings.SplitN(path, "/", 2)
- resourceToCheck := "*/" + tokens[1]
- if !has(setResources, resourceToCheck) {
- return false
- }
- }
-
- return true
-}
-
-func nonResourceURLsCoversAll(set, covers []string) bool {
- for _, path := range covers {
- covered := false
- for _, owner := range set {
- if nonResourceURLCovers(owner, path) {
- covered = true
- break
- }
- }
- if !covered {
- return false
- }
- }
- return true
-}
-
-func nonResourceURLCovers(ownerPath, subPath string) bool {
- if ownerPath == subPath {
- return true
- }
- return strings.HasSuffix(ownerPath, "*") && strings.HasPrefix(subPath, strings.TrimRight(ownerPath, "*"))
-}
-
-// ruleCovers determines whether the ownerRule (which may have multiple verbs, resources, and resourceNames) covers
-// the subrule (which may only contain at most one verb, resource, and resourceName)
-func ruleCovers(ownerRule, subRule rbacv1.PolicyRule) bool {
- verbMatches := has(ownerRule.Verbs, rbacv1.VerbAll) || hasAll(ownerRule.Verbs, subRule.Verbs)
- groupMatches := has(ownerRule.APIGroups, rbacv1.APIGroupAll) || hasAll(ownerRule.APIGroups, subRule.APIGroups)
- resourceMatches := resourceCoversAll(ownerRule.Resources, subRule.Resources)
- nonResourceURLMatches := nonResourceURLsCoversAll(ownerRule.NonResourceURLs, subRule.NonResourceURLs)
-
- resourceNameMatches := false
-
- if len(subRule.ResourceNames) == 0 {
- resourceNameMatches = (len(ownerRule.ResourceNames) == 0)
- } else {
- resourceNameMatches = (len(ownerRule.ResourceNames) == 0) || hasAll(ownerRule.ResourceNames, subRule.ResourceNames)
- }
-
- return verbMatches && groupMatches && resourceMatches && resourceNameMatches && nonResourceURLMatches
-}
diff --git a/vendor/k8s.io/kubernetes/LICENSE b/vendor/k8s.io/kubernetes/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/vendor/k8s.io/kubernetes/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/OWNERS b/vendor/k8s.io/kubernetes/pkg/apis/rbac/OWNERS
deleted file mode 100644
index 2fa50ca5bd..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/OWNERS
+++ /dev/null
@@ -1,8 +0,0 @@
-# See the OWNERS docs at https://go.k8s.io/owners
-
-# approval on api packages bubbles to api-approvers
-reviewers:
- - sig-auth-authorizers-approvers
- - sig-auth-authorizers-reviewers
-labels:
- - sig/auth
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/doc.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/doc.go
deleted file mode 100644
index 77ad4908d4..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// +k8s:deepcopy-gen=package
-// +groupName=rbac.authorization.k8s.io
-
-package rbac
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/helpers.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/helpers.go
deleted file mode 100644
index 00aa4cae17..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/helpers.go
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package rbac
-
-import (
- "fmt"
- "strings"
-
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/sets"
-)
-
-// ResourceMatches returns the result of the rule.Resources matching.
-func ResourceMatches(rule *PolicyRule, combinedRequestedResource, requestedSubresource string) bool {
- for _, ruleResource := range rule.Resources {
- // if everything is allowed, we match
- if ruleResource == ResourceAll {
- return true
- }
- // if we have an exact match, we match
- if ruleResource == combinedRequestedResource {
- return true
- }
-
- // We can also match a */subresource.
- // if there isn't a subresource, then continue
- if len(requestedSubresource) == 0 {
- continue
- }
- // if the rule isn't in the format */subresource, then we don't match, continue
- if len(ruleResource) == len(requestedSubresource)+2 &&
- strings.HasPrefix(ruleResource, "*/") &&
- strings.HasSuffix(ruleResource, requestedSubresource) {
- return true
-
- }
- }
-
- return false
-}
-
-// SubjectsStrings returns users, groups, serviceaccounts, unknown for display purposes.
-func SubjectsStrings(subjects []Subject) ([]string, []string, []string, []string) {
- users := []string{}
- groups := []string{}
- sas := []string{}
- others := []string{}
-
- for _, subject := range subjects {
- switch subject.Kind {
- case ServiceAccountKind:
- sas = append(sas, fmt.Sprintf("%s/%s", subject.Namespace, subject.Name))
-
- case UserKind:
- users = append(users, subject.Name)
-
- case GroupKind:
- groups = append(groups, subject.Name)
-
- default:
- others = append(others, fmt.Sprintf("%s/%s/%s", subject.Kind, subject.Namespace, subject.Name))
- }
- }
-
- return users, groups, sas, others
-}
-
-func (r PolicyRule) String() string {
- return "PolicyRule" + r.CompactString()
-}
-
-// CompactString exposes a compact string representation for use in escalation error messages
-func (r PolicyRule) CompactString() string {
- formatStringParts := []string{}
- formatArgs := []interface{}{}
- if len(r.APIGroups) > 0 {
- formatStringParts = append(formatStringParts, "APIGroups:%q")
- formatArgs = append(formatArgs, r.APIGroups)
- }
- if len(r.Resources) > 0 {
- formatStringParts = append(formatStringParts, "Resources:%q")
- formatArgs = append(formatArgs, r.Resources)
- }
- if len(r.NonResourceURLs) > 0 {
- formatStringParts = append(formatStringParts, "NonResourceURLs:%q")
- formatArgs = append(formatArgs, r.NonResourceURLs)
- }
- if len(r.ResourceNames) > 0 {
- formatStringParts = append(formatStringParts, "ResourceNames:%q")
- formatArgs = append(formatArgs, r.ResourceNames)
- }
- if len(r.Verbs) > 0 {
- formatStringParts = append(formatStringParts, "Verbs:%q")
- formatArgs = append(formatArgs, r.Verbs)
- }
- formatString := "{" + strings.Join(formatStringParts, ", ") + "}"
- return fmt.Sprintf(formatString, formatArgs...)
-}
-
-// PolicyRuleBuilder let's us attach methods. A no-no for API types.
-// We use it to construct rules in code. It's more compact than trying to write them
-// out in a literal and allows us to perform some basic checking during construction
-// +k8s:deepcopy-gen=false
-type PolicyRuleBuilder struct {
- PolicyRule PolicyRule
-}
-
-// NewRule returns new PolicyRule made by input verbs.
-func NewRule(verbs ...string) *PolicyRuleBuilder {
- return &PolicyRuleBuilder{
- PolicyRule: PolicyRule{Verbs: sets.NewString(verbs...).List()},
- }
-}
-
-// Groups combines the PolicyRule.APIGroups and input groups.
-func (r *PolicyRuleBuilder) Groups(groups ...string) *PolicyRuleBuilder {
- r.PolicyRule.APIGroups = combine(r.PolicyRule.APIGroups, groups)
- return r
-}
-
-// Resources combines the PolicyRule.Rule and input resources.
-func (r *PolicyRuleBuilder) Resources(resources ...string) *PolicyRuleBuilder {
- r.PolicyRule.Resources = combine(r.PolicyRule.Resources, resources)
- return r
-}
-
-// Names combines the PolicyRule.ResourceNames and input names.
-func (r *PolicyRuleBuilder) Names(names ...string) *PolicyRuleBuilder {
- r.PolicyRule.ResourceNames = combine(r.PolicyRule.ResourceNames, names)
- return r
-}
-
-// URLs combines the PolicyRule.NonResourceURLs and input urls.
-func (r *PolicyRuleBuilder) URLs(urls ...string) *PolicyRuleBuilder {
- r.PolicyRule.NonResourceURLs = combine(r.PolicyRule.NonResourceURLs, urls)
- return r
-}
-
-// RuleOrDie calls the binding method and panics if there is an error.
-func (r *PolicyRuleBuilder) RuleOrDie() PolicyRule {
- ret, err := r.Rule()
- if err != nil {
- panic(err)
- }
- return ret
-}
-
-func combine(s1, s2 []string) []string {
- s := sets.NewString(s1...)
- s.Insert(s2...)
- return s.List()
-}
-
-// Rule returns PolicyRule and error.
-func (r *PolicyRuleBuilder) Rule() (PolicyRule, error) {
- if len(r.PolicyRule.Verbs) == 0 {
- return PolicyRule{}, fmt.Errorf("verbs are required: %#v", r.PolicyRule)
- }
-
- switch {
- case len(r.PolicyRule.NonResourceURLs) > 0:
- if len(r.PolicyRule.APIGroups) != 0 || len(r.PolicyRule.Resources) != 0 || len(r.PolicyRule.ResourceNames) != 0 {
- return PolicyRule{}, fmt.Errorf("non-resource rule may not have apiGroups, resources, or resourceNames: %#v", r.PolicyRule)
- }
- case len(r.PolicyRule.Resources) > 0:
- // resource rule may not have nonResourceURLs
-
- if len(r.PolicyRule.APIGroups) == 0 {
- // this a common bug
- return PolicyRule{}, fmt.Errorf("resource rule must have apiGroups: %#v", r.PolicyRule)
- }
- // if resource names are set, then the verb must not be list, watch, create, or deletecollection
- // since verbs are largely opaque, we don't want to accidentally prevent things like "impersonate", so
- // we will backlist common mistakes, not whitelist acceptable options.
- if len(r.PolicyRule.ResourceNames) != 0 {
- illegalVerbs := []string{}
- for _, verb := range r.PolicyRule.Verbs {
- switch verb {
- case "list", "watch", "create", "deletecollection":
- illegalVerbs = append(illegalVerbs, verb)
- }
- }
- if len(illegalVerbs) > 0 {
- return PolicyRule{}, fmt.Errorf("verbs %v do not have names available: %#v", illegalVerbs, r.PolicyRule)
- }
- }
-
- default:
- return PolicyRule{}, fmt.Errorf("a rule must have either nonResourceURLs or resources: %#v", r.PolicyRule)
- }
-
- return r.PolicyRule, nil
-}
-
-// ClusterRoleBindingBuilder let's us attach methods. A no-no for API types.
-// We use it to construct bindings in code. It's more compact than trying to write them
-// out in a literal.
-// +k8s:deepcopy-gen=false
-type ClusterRoleBindingBuilder struct {
- ClusterRoleBinding ClusterRoleBinding
-}
-
-// NewClusterBinding creates a ClusterRoleBinding builder that can be used
-// to define the subjects of a cluster role binding. At least one of
-// the `Groups`, `Users` or `SAs` method must be called before
-// calling the `Binding*` methods.
-func NewClusterBinding(clusterRoleName string) *ClusterRoleBindingBuilder {
- return &ClusterRoleBindingBuilder{
- ClusterRoleBinding: ClusterRoleBinding{
- ObjectMeta: metav1.ObjectMeta{Name: clusterRoleName},
- RoleRef: RoleRef{
- APIGroup: GroupName,
- Kind: "ClusterRole",
- Name: clusterRoleName,
- },
- },
- }
-}
-
-// Groups adds the specified groups as the subjects of the ClusterRoleBinding.
-func (r *ClusterRoleBindingBuilder) Groups(groups ...string) *ClusterRoleBindingBuilder {
- for _, group := range groups {
- r.ClusterRoleBinding.Subjects = append(r.ClusterRoleBinding.Subjects, Subject{Kind: GroupKind, APIGroup: GroupName, Name: group})
- }
- return r
-}
-
-// Users adds the specified users as the subjects of the ClusterRoleBinding.
-func (r *ClusterRoleBindingBuilder) Users(users ...string) *ClusterRoleBindingBuilder {
- for _, user := range users {
- r.ClusterRoleBinding.Subjects = append(r.ClusterRoleBinding.Subjects, Subject{Kind: UserKind, APIGroup: GroupName, Name: user})
- }
- return r
-}
-
-// SAs adds the specified sas as the subjects of the ClusterRoleBinding.
-func (r *ClusterRoleBindingBuilder) SAs(namespace string, serviceAccountNames ...string) *ClusterRoleBindingBuilder {
- for _, saName := range serviceAccountNames {
- r.ClusterRoleBinding.Subjects = append(r.ClusterRoleBinding.Subjects, Subject{Kind: ServiceAccountKind, Namespace: namespace, Name: saName})
- }
- return r
-}
-
-// BindingOrDie calls the binding method and panics if there is an error.
-func (r *ClusterRoleBindingBuilder) BindingOrDie() ClusterRoleBinding {
- ret, err := r.Binding()
- if err != nil {
- panic(err)
- }
- return ret
-}
-
-// Binding builds and returns the ClusterRoleBinding API object from the builder
-// object.
-func (r *ClusterRoleBindingBuilder) Binding() (ClusterRoleBinding, error) {
- if len(r.ClusterRoleBinding.Subjects) == 0 {
- return ClusterRoleBinding{}, fmt.Errorf("subjects are required: %#v", r.ClusterRoleBinding)
- }
-
- return r.ClusterRoleBinding, nil
-}
-
-// RoleBindingBuilder let's us attach methods. It is similar to
-// ClusterRoleBindingBuilder above.
-// +k8s:deepcopy-gen=false
-type RoleBindingBuilder struct {
- RoleBinding RoleBinding
-}
-
-// NewRoleBinding creates a RoleBinding builder that can be used
-// to define the subjects of a role binding. At least one of
-// the `Groups`, `Users` or `SAs` method must be called before
-// calling the `Binding*` methods.
-func NewRoleBinding(roleName, namespace string) *RoleBindingBuilder {
- return &RoleBindingBuilder{
- RoleBinding: RoleBinding{
- ObjectMeta: metav1.ObjectMeta{
- Name: roleName,
- Namespace: namespace,
- },
- RoleRef: RoleRef{
- APIGroup: GroupName,
- Kind: "Role",
- Name: roleName,
- },
- },
- }
-}
-
-// NewRoleBindingForClusterRole creates a RoleBinding builder that can be used
-// to define the subjects of a cluster role binding. At least one of
-// the `Groups`, `Users` or `SAs` method must be called before
-// calling the `Binding*` methods.
-func NewRoleBindingForClusterRole(roleName, namespace string) *RoleBindingBuilder {
- return &RoleBindingBuilder{
- RoleBinding: RoleBinding{
- ObjectMeta: metav1.ObjectMeta{
- Name: roleName,
- Namespace: namespace,
- },
- RoleRef: RoleRef{
- APIGroup: GroupName,
- Kind: "ClusterRole",
- Name: roleName,
- },
- },
- }
-}
-
-// Groups adds the specified groups as the subjects of the RoleBinding.
-func (r *RoleBindingBuilder) Groups(groups ...string) *RoleBindingBuilder {
- for _, group := range groups {
- r.RoleBinding.Subjects = append(r.RoleBinding.Subjects, Subject{Kind: GroupKind, APIGroup: GroupName, Name: group})
- }
- return r
-}
-
-// Users adds the specified users as the subjects of the RoleBinding.
-func (r *RoleBindingBuilder) Users(users ...string) *RoleBindingBuilder {
- for _, user := range users {
- r.RoleBinding.Subjects = append(r.RoleBinding.Subjects, Subject{Kind: UserKind, APIGroup: GroupName, Name: user})
- }
- return r
-}
-
-// SAs adds the specified service accounts as the subjects of the
-// RoleBinding.
-func (r *RoleBindingBuilder) SAs(namespace string, serviceAccountNames ...string) *RoleBindingBuilder {
- for _, saName := range serviceAccountNames {
- r.RoleBinding.Subjects = append(r.RoleBinding.Subjects, Subject{Kind: ServiceAccountKind, Namespace: namespace, Name: saName})
- }
- return r
-}
-
-// BindingOrDie calls the binding method and panics if there is an error.
-func (r *RoleBindingBuilder) BindingOrDie() RoleBinding {
- ret, err := r.Binding()
- if err != nil {
- panic(err)
- }
- return ret
-}
-
-// Binding builds and returns the RoleBinding API object from the builder
-// object.
-func (r *RoleBindingBuilder) Binding() (RoleBinding, error) {
- if len(r.RoleBinding.Subjects) == 0 {
- return RoleBinding{}, fmt.Errorf("subjects are required: %#v", r.RoleBinding)
- }
-
- return r.RoleBinding, nil
-}
-
-// SortableRuleSlice is the slice of PolicyRule.
-type SortableRuleSlice []PolicyRule
-
-func (s SortableRuleSlice) Len() int { return len(s) }
-func (s SortableRuleSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-func (s SortableRuleSlice) Less(i, j int) bool {
- return strings.Compare(s[i].String(), s[j].String()) < 0
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/register.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/register.go
deleted file mode 100644
index 48f5f6e742..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/register.go
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package rbac
-
-import (
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-// GroupName is the name of this API group.
-const GroupName = "rbac.authorization.k8s.io"
-
-// SchemeGroupVersion is group version used to register these objects
-var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
-
-// Kind takes an unqualified kind and returns a Group qualified GroupKind
-func Kind(kind string) schema.GroupKind {
- return SchemeGroupVersion.WithKind(kind).GroupKind()
-}
-
-// Resource takes an unqualified resource and returns a Group qualified GroupResource
-func Resource(resource string) schema.GroupResource {
- return SchemeGroupVersion.WithResource(resource).GroupResource()
-}
-
-// SchemeBuilder is a function that calls Register for you.
-var (
- SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
- AddToScheme = SchemeBuilder.AddToScheme
-)
-
-// Adds the list of known types to the given scheme.
-func addKnownTypes(scheme *runtime.Scheme) error {
- scheme.AddKnownTypes(SchemeGroupVersion,
- &Role{},
- &RoleBinding{},
- &RoleBindingList{},
- &RoleList{},
-
- &ClusterRole{},
- &ClusterRoleBinding{},
- &ClusterRoleBindingList{},
- &ClusterRoleList{},
- )
- return nil
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/types.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/types.go
deleted file mode 100644
index 357e8d8bc6..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/types.go
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package rbac
-
-import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-// Authorization is calculated against
-// 1. evaluation of ClusterRoleBindings - short circuit on match
-// 2. evaluation of RoleBindings in the namespace requested - short circuit on match
-// 3. deny by default
-
-// APIGroupAll and these consts are default values for rbac authorization.
-const (
- APIGroupAll = "*"
- ResourceAll = "*"
- VerbAll = "*"
- NonResourceAll = "*"
-
- GroupKind = "Group"
- ServiceAccountKind = "ServiceAccount"
- UserKind = "User"
-
- // AutoUpdateAnnotationKey is the name of an annotation which prevents reconciliation if set to "false"
- AutoUpdateAnnotationKey = "rbac.authorization.kubernetes.io/autoupdate"
-)
-
-// PolicyRule holds information that describes a policy rule, but does not contain information
-// about who the rule applies to or which namespace the rule applies to.
-type PolicyRule struct {
- // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs.
- Verbs []string
-
- // APIGroups is the name of the APIGroup that contains the resources.
- // If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups.
- APIGroups []string
- // Resources is a list of resources this rule applies to. '*' represents all resources in the specified apiGroups.
- // '*/foo' represents the subresource 'foo' for all resources in the specified apiGroups.
- Resources []string
- // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.
- ResourceNames []string
-
- // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path
- // If an action is not a resource API request, then the URL is split on '/' and is checked against the NonResourceURLs to look for a match.
- // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding.
- // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both.
- NonResourceURLs []string
-}
-
-// Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference,
-// or a value for non-objects such as user and group names.
-type Subject struct {
- // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount".
- // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
- Kind string
- // APIGroup holds the API group of the referenced subject.
- // Defaults to "" for ServiceAccount subjects.
- // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
- APIGroup string
- // Name of the object being referenced.
- Name string
- // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty
- // the Authorizer should report an error.
- Namespace string
-}
-
-// RoleRef contains information that points to the role being used
-type RoleRef struct {
- // APIGroup is the group for the resource being referenced
- APIGroup string
- // Kind is the type of resource being referenced
- Kind string
- // Name is the name of resource being referenced
- Name string
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.
-type Role struct {
- metav1.TypeMeta
- // Standard object's metadata.
- metav1.ObjectMeta
-
- // Rules holds all the PolicyRules for this Role
- Rules []PolicyRule
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace.
-// It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given
-// namespace only have effect in that namespace.
-type RoleBinding struct {
- metav1.TypeMeta
- metav1.ObjectMeta
-
- // Subjects holds references to the objects the role applies to.
- Subjects []Subject
-
- // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace.
- // If the RoleRef cannot be resolved, the Authorizer must return an error.
- // This field is immutable.
- RoleRef RoleRef
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// RoleBindingList is a collection of RoleBindings
-type RoleBindingList struct {
- metav1.TypeMeta
- // Standard object's metadata.
- metav1.ListMeta
-
- // Items is a list of roleBindings
- Items []RoleBinding
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// RoleList is a collection of Roles
-type RoleList struct {
- metav1.TypeMeta
- // Standard object's metadata.
- metav1.ListMeta
-
- // Items is a list of roles
- Items []Role
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.
-type ClusterRole struct {
- metav1.TypeMeta
- // Standard object's metadata.
- metav1.ObjectMeta
-
- // Rules holds all the PolicyRules for this ClusterRole
- Rules []PolicyRule
-
- // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole.
- // If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be
- // stomped by the controller.
- AggregationRule *AggregationRule
-}
-
-// AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole
-type AggregationRule struct {
- // ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules.
- // If any of the selectors match, then the ClusterRole's permissions will be added
- ClusterRoleSelectors []metav1.LabelSelector
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace,
-// and adds who information via Subject.
-type ClusterRoleBinding struct {
- metav1.TypeMeta
- // Standard object's metadata.
- metav1.ObjectMeta
-
- // Subjects holds references to the objects the role applies to.
- Subjects []Subject
-
- // RoleRef can only reference a ClusterRole in the global namespace.
- // If the RoleRef cannot be resolved, the Authorizer must return an error.
- // This field is immutable.
- RoleRef RoleRef
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// ClusterRoleBindingList is a collection of ClusterRoleBindings
-type ClusterRoleBindingList struct {
- metav1.TypeMeta
- // Standard object's metadata.
- metav1.ListMeta
-
- // Items is a list of ClusterRoleBindings
- Items []ClusterRoleBinding
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// ClusterRoleList is a collection of ClusterRoles
-type ClusterRoleList struct {
- metav1.TypeMeta
- // Standard object's metadata.
- metav1.ListMeta
-
- // Items is a list of ClusterRoles
- Items []ClusterRole
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/defaults.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/defaults.go
deleted file mode 100644
index 7d285a8574..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/defaults.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- rbacv1 "k8s.io/api/rbac/v1"
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-func addDefaultingFuncs(scheme *runtime.Scheme) error {
- return RegisterDefaults(scheme)
-}
-
-func SetDefaults_ClusterRoleBinding(obj *rbacv1.ClusterRoleBinding) {
- if len(obj.RoleRef.APIGroup) == 0 {
- obj.RoleRef.APIGroup = GroupName
- }
-}
-func SetDefaults_RoleBinding(obj *rbacv1.RoleBinding) {
- if len(obj.RoleRef.APIGroup) == 0 {
- obj.RoleRef.APIGroup = GroupName
- }
-}
-func SetDefaults_Subject(obj *rbacv1.Subject) {
- if len(obj.APIGroup) == 0 {
- switch obj.Kind {
- case rbacv1.ServiceAccountKind:
- obj.APIGroup = ""
- case rbacv1.UserKind:
- obj.APIGroup = GroupName
- case rbacv1.GroupKind:
- obj.APIGroup = GroupName
- }
- }
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/doc.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/doc.go
deleted file mode 100644
index 73977b4234..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/doc.go
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/rbac
-// +k8s:conversion-gen-external-types=k8s.io/api/rbac/v1
-// +k8s:defaulter-gen=TypeMeta
-// +k8s:defaulter-gen-input=k8s.io/api/rbac/v1
-// +k8s:deepcopy-gen=package
-// +k8s:validation-gen=TypeMeta
-// +k8s:validation-gen-input=k8s.io/api/rbac/v1
-
-// +groupName=rbac.authorization.k8s.io
-
-package v1
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/evaluation_helpers.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/evaluation_helpers.go
deleted file mode 100644
index 5f5edaff13..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/evaluation_helpers.go
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "fmt"
- "strings"
-
- rbacv1 "k8s.io/api/rbac/v1"
-)
-
-func VerbMatches(rule *rbacv1.PolicyRule, requestedVerb string) bool {
- for _, ruleVerb := range rule.Verbs {
- if ruleVerb == rbacv1.VerbAll {
- return true
- }
- if ruleVerb == requestedVerb {
- return true
- }
- }
-
- return false
-}
-
-func APIGroupMatches(rule *rbacv1.PolicyRule, requestedGroup string) bool {
- for _, ruleGroup := range rule.APIGroups {
- if ruleGroup == rbacv1.APIGroupAll {
- return true
- }
- if ruleGroup == requestedGroup {
- return true
- }
- }
-
- return false
-}
-
-func ResourceMatches(rule *rbacv1.PolicyRule, combinedRequestedResource, requestedSubresource string) bool {
- for _, ruleResource := range rule.Resources {
- // if everything is allowed, we match
- if ruleResource == rbacv1.ResourceAll {
- return true
- }
- // if we have an exact match, we match
- if ruleResource == combinedRequestedResource {
- return true
- }
-
- // We can also match a */subresource.
- // if there isn't a subresource, then continue
- if len(requestedSubresource) == 0 {
- continue
- }
- // if the rule isn't in the format */subresource, then we don't match, continue
- if len(ruleResource) == len(requestedSubresource)+2 &&
- strings.HasPrefix(ruleResource, "*/") &&
- strings.HasSuffix(ruleResource, requestedSubresource) {
- return true
-
- }
- }
-
- return false
-}
-
-func ResourceNameMatches(rule *rbacv1.PolicyRule, requestedName string) bool {
- if len(rule.ResourceNames) == 0 {
- return true
- }
-
- for _, ruleName := range rule.ResourceNames {
- if ruleName == requestedName {
- return true
- }
- }
-
- return false
-}
-
-func NonResourceURLMatches(rule *rbacv1.PolicyRule, requestedURL string) bool {
- for _, ruleURL := range rule.NonResourceURLs {
- if ruleURL == rbacv1.NonResourceAll {
- return true
- }
- if ruleURL == requestedURL {
- return true
- }
- if strings.HasSuffix(ruleURL, "*") && strings.HasPrefix(requestedURL, strings.TrimRight(ruleURL, "*")) {
- return true
- }
- }
-
- return false
-}
-
-// CompactString exposes a compact string representation for use in escalation error messages
-func CompactString(r rbacv1.PolicyRule) string {
- formatStringParts := []string{}
- formatArgs := []interface{}{}
- if len(r.APIGroups) > 0 {
- formatStringParts = append(formatStringParts, "APIGroups:%q")
- formatArgs = append(formatArgs, r.APIGroups)
- }
- if len(r.Resources) > 0 {
- formatStringParts = append(formatStringParts, "Resources:%q")
- formatArgs = append(formatArgs, r.Resources)
- }
- if len(r.NonResourceURLs) > 0 {
- formatStringParts = append(formatStringParts, "NonResourceURLs:%q")
- formatArgs = append(formatArgs, r.NonResourceURLs)
- }
- if len(r.ResourceNames) > 0 {
- formatStringParts = append(formatStringParts, "ResourceNames:%q")
- formatArgs = append(formatArgs, r.ResourceNames)
- }
- if len(r.Verbs) > 0 {
- formatStringParts = append(formatStringParts, "Verbs:%q")
- formatArgs = append(formatArgs, r.Verbs)
- }
- formatString := "{" + strings.Join(formatStringParts, ", ") + "}"
- return fmt.Sprintf(formatString, formatArgs...)
-}
-
-type SortableRuleSlice []rbacv1.PolicyRule
-
-func (s SortableRuleSlice) Len() int { return len(s) }
-func (s SortableRuleSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-func (s SortableRuleSlice) Less(i, j int) bool {
- return strings.Compare(s[i].String(), s[j].String()) < 0
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/helpers.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/helpers.go
deleted file mode 100644
index d30e33a65a..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/helpers.go
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "fmt"
-
- rbacv1 "k8s.io/api/rbac/v1"
-
- "sort"
-
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/sets"
-)
-
-// +k8s:deepcopy-gen=false
-
-// PolicyRuleBuilder let's us attach methods. A no-no for API types.
-// We use it to construct rules in code. It's more compact than trying to write them
-// out in a literal and allows us to perform some basic checking during construction
-type PolicyRuleBuilder struct {
- PolicyRule rbacv1.PolicyRule `protobuf:"bytes,1,opt,name=policyRule"`
-}
-
-func NewRule(verbs ...string) *PolicyRuleBuilder {
- return &PolicyRuleBuilder{
- PolicyRule: rbacv1.PolicyRule{Verbs: sets.NewString(verbs...).List()},
- }
-}
-
-func (r *PolicyRuleBuilder) Groups(groups ...string) *PolicyRuleBuilder {
- r.PolicyRule.APIGroups = combine(r.PolicyRule.APIGroups, groups)
- return r
-}
-
-func (r *PolicyRuleBuilder) Resources(resources ...string) *PolicyRuleBuilder {
- r.PolicyRule.Resources = combine(r.PolicyRule.Resources, resources)
- return r
-}
-
-func (r *PolicyRuleBuilder) Names(names ...string) *PolicyRuleBuilder {
- r.PolicyRule.ResourceNames = combine(r.PolicyRule.ResourceNames, names)
- return r
-}
-
-func (r *PolicyRuleBuilder) URLs(urls ...string) *PolicyRuleBuilder {
- r.PolicyRule.NonResourceURLs = combine(r.PolicyRule.NonResourceURLs, urls)
- return r
-}
-
-func combine(s1, s2 []string) []string {
- s := sets.NewString(s1...)
- s.Insert(s2...)
- return s.List()
-}
-
-func (r *PolicyRuleBuilder) RuleOrDie() rbacv1.PolicyRule {
- ret, err := r.Rule()
- if err != nil {
- panic(err)
- }
- return ret
-}
-
-func (r *PolicyRuleBuilder) Rule() (rbacv1.PolicyRule, error) {
- if len(r.PolicyRule.Verbs) == 0 {
- return rbacv1.PolicyRule{}, fmt.Errorf("verbs are required: %#v", r.PolicyRule)
- }
-
- switch {
- case len(r.PolicyRule.NonResourceURLs) > 0:
- if len(r.PolicyRule.APIGroups) != 0 || len(r.PolicyRule.Resources) != 0 || len(r.PolicyRule.ResourceNames) != 0 {
- return rbacv1.PolicyRule{}, fmt.Errorf("non-resource rule may not have apiGroups, resources, or resourceNames: %#v", r.PolicyRule)
- }
- case len(r.PolicyRule.Resources) > 0:
- if len(r.PolicyRule.NonResourceURLs) != 0 {
- return rbacv1.PolicyRule{}, fmt.Errorf("resource rule may not have nonResourceURLs: %#v", r.PolicyRule)
- }
- if len(r.PolicyRule.APIGroups) == 0 {
- // this a common bug
- return rbacv1.PolicyRule{}, fmt.Errorf("resource rule must have apiGroups: %#v", r.PolicyRule)
- }
- default:
- return rbacv1.PolicyRule{}, fmt.Errorf("a rule must have either nonResourceURLs or resources: %#v", r.PolicyRule)
- }
-
- sort.Strings(r.PolicyRule.Resources)
- sort.Strings(r.PolicyRule.ResourceNames)
- sort.Strings(r.PolicyRule.APIGroups)
- sort.Strings(r.PolicyRule.NonResourceURLs)
- sort.Strings(r.PolicyRule.Verbs)
- return r.PolicyRule, nil
-}
-
-// +k8s:deepcopy-gen=false
-
-// ClusterRoleBindingBuilder let's us attach methods. A no-no for API types.
-// We use it to construct bindings in code. It's more compact than trying to write them
-// out in a literal.
-type ClusterRoleBindingBuilder struct {
- ClusterRoleBinding rbacv1.ClusterRoleBinding `protobuf:"bytes,1,opt,name=clusterRoleBinding"`
-}
-
-func NewClusterBinding(clusterRoleName string) *ClusterRoleBindingBuilder {
- return &ClusterRoleBindingBuilder{
- ClusterRoleBinding: rbacv1.ClusterRoleBinding{
- ObjectMeta: metav1.ObjectMeta{Name: clusterRoleName},
- RoleRef: rbacv1.RoleRef{
- APIGroup: GroupName,
- Kind: "ClusterRole",
- Name: clusterRoleName,
- },
- },
- }
-}
-
-func (r *ClusterRoleBindingBuilder) Groups(groups ...string) *ClusterRoleBindingBuilder {
- for _, group := range groups {
- r.ClusterRoleBinding.Subjects = append(r.ClusterRoleBinding.Subjects, rbacv1.Subject{APIGroup: rbacv1.GroupName, Kind: rbacv1.GroupKind, Name: group})
- }
- return r
-}
-
-func (r *ClusterRoleBindingBuilder) Users(users ...string) *ClusterRoleBindingBuilder {
- for _, user := range users {
- r.ClusterRoleBinding.Subjects = append(r.ClusterRoleBinding.Subjects, rbacv1.Subject{APIGroup: rbacv1.GroupName, Kind: rbacv1.UserKind, Name: user})
- }
- return r
-}
-
-func (r *ClusterRoleBindingBuilder) SAs(namespace string, serviceAccountNames ...string) *ClusterRoleBindingBuilder {
- for _, saName := range serviceAccountNames {
- r.ClusterRoleBinding.Subjects = append(r.ClusterRoleBinding.Subjects, rbacv1.Subject{Kind: rbacv1.ServiceAccountKind, Namespace: namespace, Name: saName})
- }
- return r
-}
-
-func (r *ClusterRoleBindingBuilder) BindingOrDie() rbacv1.ClusterRoleBinding {
- ret, err := r.Binding()
- if err != nil {
- panic(err)
- }
- return ret
-}
-
-func (r *ClusterRoleBindingBuilder) Binding() (rbacv1.ClusterRoleBinding, error) {
- if len(r.ClusterRoleBinding.Subjects) == 0 {
- return rbacv1.ClusterRoleBinding{}, fmt.Errorf("subjects are required: %#v", r.ClusterRoleBinding)
- }
-
- return r.ClusterRoleBinding, nil
-}
-
-// +k8s:deepcopy-gen=false
-
-// RoleBindingBuilder let's us attach methods. It is similar to
-// ClusterRoleBindingBuilder above.
-type RoleBindingBuilder struct {
- RoleBinding rbacv1.RoleBinding
-}
-
-// NewRoleBinding creates a RoleBinding builder that can be used
-// to define the subjects of a role binding. At least one of
-// the `Groups`, `Users` or `SAs` method must be called before
-// calling the `Binding*` methods.
-func NewRoleBinding(roleName, namespace string) *RoleBindingBuilder {
- return &RoleBindingBuilder{
- RoleBinding: rbacv1.RoleBinding{
- ObjectMeta: metav1.ObjectMeta{
- Name: roleName,
- Namespace: namespace,
- },
- RoleRef: rbacv1.RoleRef{
- APIGroup: GroupName,
- Kind: "Role",
- Name: roleName,
- },
- },
- }
-}
-
-// Groups adds the specified groups as the subjects of the RoleBinding.
-func (r *RoleBindingBuilder) Groups(groups ...string) *RoleBindingBuilder {
- for _, group := range groups {
- r.RoleBinding.Subjects = append(r.RoleBinding.Subjects, rbacv1.Subject{Kind: rbacv1.GroupKind, APIGroup: GroupName, Name: group})
- }
- return r
-}
-
-// Users adds the specified users as the subjects of the RoleBinding.
-func (r *RoleBindingBuilder) Users(users ...string) *RoleBindingBuilder {
- for _, user := range users {
- r.RoleBinding.Subjects = append(r.RoleBinding.Subjects, rbacv1.Subject{Kind: rbacv1.UserKind, APIGroup: GroupName, Name: user})
- }
- return r
-}
-
-// SAs adds the specified service accounts as the subjects of the
-// RoleBinding.
-func (r *RoleBindingBuilder) SAs(namespace string, serviceAccountNames ...string) *RoleBindingBuilder {
- for _, saName := range serviceAccountNames {
- r.RoleBinding.Subjects = append(r.RoleBinding.Subjects, rbacv1.Subject{Kind: rbacv1.ServiceAccountKind, Namespace: namespace, Name: saName})
- }
- return r
-}
-
-// BindingOrDie calls the binding method and panics if there is an error.
-func (r *RoleBindingBuilder) BindingOrDie() rbacv1.RoleBinding {
- ret, err := r.Binding()
- if err != nil {
- panic(err)
- }
- return ret
-}
-
-// Binding builds and returns the RoleBinding API object from the builder
-// object.
-func (r *RoleBindingBuilder) Binding() (rbacv1.RoleBinding, error) {
- if len(r.RoleBinding.Subjects) == 0 {
- return rbacv1.RoleBinding{}, fmt.Errorf("subjects are required: %#v", r.RoleBinding)
- }
-
- return r.RoleBinding, nil
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/register.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/register.go
deleted file mode 100644
index ae138c8883..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/register.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- rbacv1 "k8s.io/api/rbac/v1"
- "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-const GroupName = "rbac.authorization.k8s.io"
-
-// SchemeGroupVersion is group version used to register these objects
-var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
-
-// Resource takes an unqualified resource and returns a Group qualified GroupResource
-func Resource(resource string) schema.GroupResource {
- return SchemeGroupVersion.WithResource(resource).GroupResource()
-}
-
-var (
- localSchemeBuilder = &rbacv1.SchemeBuilder
- AddToScheme = localSchemeBuilder.AddToScheme
-)
-
-func init() {
- // We only register manually written functions here. The registration of the
- // generated functions takes place in the generated files. The separation
- // makes the code compile even when the generated files are missing.
- localSchemeBuilder.Register(addDefaultingFuncs)
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/zz_generated.conversion.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/zz_generated.conversion.go
deleted file mode 100644
index 54db06c983..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/zz_generated.conversion.go
+++ /dev/null
@@ -1,450 +0,0 @@
-//go:build !ignore_autogenerated
-// +build !ignore_autogenerated
-
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by conversion-gen. DO NOT EDIT.
-
-package v1
-
-import (
- unsafe "unsafe"
-
- rbacv1 "k8s.io/api/rbac/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- conversion "k8s.io/apimachinery/pkg/conversion"
- runtime "k8s.io/apimachinery/pkg/runtime"
- rbac "k8s.io/kubernetes/pkg/apis/rbac"
-)
-
-func init() {
- localSchemeBuilder.Register(RegisterConversions)
-}
-
-// RegisterConversions adds conversion functions to the given scheme.
-// Public to allow building arbitrary schemes.
-func RegisterConversions(s *runtime.Scheme) error {
- if err := s.AddGeneratedConversionFunc((*rbacv1.AggregationRule)(nil), (*rbac.AggregationRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1_AggregationRule_To_rbac_AggregationRule(a.(*rbacv1.AggregationRule), b.(*rbac.AggregationRule), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbac.AggregationRule)(nil), (*rbacv1.AggregationRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_rbac_AggregationRule_To_v1_AggregationRule(a.(*rbac.AggregationRule), b.(*rbacv1.AggregationRule), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbacv1.ClusterRole)(nil), (*rbac.ClusterRole)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1_ClusterRole_To_rbac_ClusterRole(a.(*rbacv1.ClusterRole), b.(*rbac.ClusterRole), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbac.ClusterRole)(nil), (*rbacv1.ClusterRole)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_rbac_ClusterRole_To_v1_ClusterRole(a.(*rbac.ClusterRole), b.(*rbacv1.ClusterRole), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbacv1.ClusterRoleBinding)(nil), (*rbac.ClusterRoleBinding)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1_ClusterRoleBinding_To_rbac_ClusterRoleBinding(a.(*rbacv1.ClusterRoleBinding), b.(*rbac.ClusterRoleBinding), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbac.ClusterRoleBinding)(nil), (*rbacv1.ClusterRoleBinding)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_rbac_ClusterRoleBinding_To_v1_ClusterRoleBinding(a.(*rbac.ClusterRoleBinding), b.(*rbacv1.ClusterRoleBinding), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbacv1.ClusterRoleBindingList)(nil), (*rbac.ClusterRoleBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1_ClusterRoleBindingList_To_rbac_ClusterRoleBindingList(a.(*rbacv1.ClusterRoleBindingList), b.(*rbac.ClusterRoleBindingList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbac.ClusterRoleBindingList)(nil), (*rbacv1.ClusterRoleBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_rbac_ClusterRoleBindingList_To_v1_ClusterRoleBindingList(a.(*rbac.ClusterRoleBindingList), b.(*rbacv1.ClusterRoleBindingList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbacv1.ClusterRoleList)(nil), (*rbac.ClusterRoleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1_ClusterRoleList_To_rbac_ClusterRoleList(a.(*rbacv1.ClusterRoleList), b.(*rbac.ClusterRoleList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbac.ClusterRoleList)(nil), (*rbacv1.ClusterRoleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_rbac_ClusterRoleList_To_v1_ClusterRoleList(a.(*rbac.ClusterRoleList), b.(*rbacv1.ClusterRoleList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbacv1.PolicyRule)(nil), (*rbac.PolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1_PolicyRule_To_rbac_PolicyRule(a.(*rbacv1.PolicyRule), b.(*rbac.PolicyRule), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbac.PolicyRule)(nil), (*rbacv1.PolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_rbac_PolicyRule_To_v1_PolicyRule(a.(*rbac.PolicyRule), b.(*rbacv1.PolicyRule), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbacv1.Role)(nil), (*rbac.Role)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1_Role_To_rbac_Role(a.(*rbacv1.Role), b.(*rbac.Role), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbac.Role)(nil), (*rbacv1.Role)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_rbac_Role_To_v1_Role(a.(*rbac.Role), b.(*rbacv1.Role), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbacv1.RoleBinding)(nil), (*rbac.RoleBinding)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1_RoleBinding_To_rbac_RoleBinding(a.(*rbacv1.RoleBinding), b.(*rbac.RoleBinding), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbac.RoleBinding)(nil), (*rbacv1.RoleBinding)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_rbac_RoleBinding_To_v1_RoleBinding(a.(*rbac.RoleBinding), b.(*rbacv1.RoleBinding), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbacv1.RoleBindingList)(nil), (*rbac.RoleBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1_RoleBindingList_To_rbac_RoleBindingList(a.(*rbacv1.RoleBindingList), b.(*rbac.RoleBindingList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbac.RoleBindingList)(nil), (*rbacv1.RoleBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_rbac_RoleBindingList_To_v1_RoleBindingList(a.(*rbac.RoleBindingList), b.(*rbacv1.RoleBindingList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbacv1.RoleList)(nil), (*rbac.RoleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1_RoleList_To_rbac_RoleList(a.(*rbacv1.RoleList), b.(*rbac.RoleList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbac.RoleList)(nil), (*rbacv1.RoleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_rbac_RoleList_To_v1_RoleList(a.(*rbac.RoleList), b.(*rbacv1.RoleList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbacv1.RoleRef)(nil), (*rbac.RoleRef)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1_RoleRef_To_rbac_RoleRef(a.(*rbacv1.RoleRef), b.(*rbac.RoleRef), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbac.RoleRef)(nil), (*rbacv1.RoleRef)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_rbac_RoleRef_To_v1_RoleRef(a.(*rbac.RoleRef), b.(*rbacv1.RoleRef), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbacv1.Subject)(nil), (*rbac.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1_Subject_To_rbac_Subject(a.(*rbacv1.Subject), b.(*rbac.Subject), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*rbac.Subject)(nil), (*rbacv1.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_rbac_Subject_To_v1_Subject(a.(*rbac.Subject), b.(*rbacv1.Subject), scope)
- }); err != nil {
- return err
- }
- return nil
-}
-
-func autoConvert_v1_AggregationRule_To_rbac_AggregationRule(in *rbacv1.AggregationRule, out *rbac.AggregationRule, s conversion.Scope) error {
- out.ClusterRoleSelectors = *(*[]metav1.LabelSelector)(unsafe.Pointer(&in.ClusterRoleSelectors))
- return nil
-}
-
-// Convert_v1_AggregationRule_To_rbac_AggregationRule is an autogenerated conversion function.
-func Convert_v1_AggregationRule_To_rbac_AggregationRule(in *rbacv1.AggregationRule, out *rbac.AggregationRule, s conversion.Scope) error {
- return autoConvert_v1_AggregationRule_To_rbac_AggregationRule(in, out, s)
-}
-
-func autoConvert_rbac_AggregationRule_To_v1_AggregationRule(in *rbac.AggregationRule, out *rbacv1.AggregationRule, s conversion.Scope) error {
- out.ClusterRoleSelectors = *(*[]metav1.LabelSelector)(unsafe.Pointer(&in.ClusterRoleSelectors))
- return nil
-}
-
-// Convert_rbac_AggregationRule_To_v1_AggregationRule is an autogenerated conversion function.
-func Convert_rbac_AggregationRule_To_v1_AggregationRule(in *rbac.AggregationRule, out *rbacv1.AggregationRule, s conversion.Scope) error {
- return autoConvert_rbac_AggregationRule_To_v1_AggregationRule(in, out, s)
-}
-
-func autoConvert_v1_ClusterRole_To_rbac_ClusterRole(in *rbacv1.ClusterRole, out *rbac.ClusterRole, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- out.Rules = *(*[]rbac.PolicyRule)(unsafe.Pointer(&in.Rules))
- out.AggregationRule = (*rbac.AggregationRule)(unsafe.Pointer(in.AggregationRule))
- return nil
-}
-
-// Convert_v1_ClusterRole_To_rbac_ClusterRole is an autogenerated conversion function.
-func Convert_v1_ClusterRole_To_rbac_ClusterRole(in *rbacv1.ClusterRole, out *rbac.ClusterRole, s conversion.Scope) error {
- return autoConvert_v1_ClusterRole_To_rbac_ClusterRole(in, out, s)
-}
-
-func autoConvert_rbac_ClusterRole_To_v1_ClusterRole(in *rbac.ClusterRole, out *rbacv1.ClusterRole, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- out.Rules = *(*[]rbacv1.PolicyRule)(unsafe.Pointer(&in.Rules))
- out.AggregationRule = (*rbacv1.AggregationRule)(unsafe.Pointer(in.AggregationRule))
- return nil
-}
-
-// Convert_rbac_ClusterRole_To_v1_ClusterRole is an autogenerated conversion function.
-func Convert_rbac_ClusterRole_To_v1_ClusterRole(in *rbac.ClusterRole, out *rbacv1.ClusterRole, s conversion.Scope) error {
- return autoConvert_rbac_ClusterRole_To_v1_ClusterRole(in, out, s)
-}
-
-func autoConvert_v1_ClusterRoleBinding_To_rbac_ClusterRoleBinding(in *rbacv1.ClusterRoleBinding, out *rbac.ClusterRoleBinding, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- out.Subjects = *(*[]rbac.Subject)(unsafe.Pointer(&in.Subjects))
- if err := Convert_v1_RoleRef_To_rbac_RoleRef(&in.RoleRef, &out.RoleRef, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_v1_ClusterRoleBinding_To_rbac_ClusterRoleBinding is an autogenerated conversion function.
-func Convert_v1_ClusterRoleBinding_To_rbac_ClusterRoleBinding(in *rbacv1.ClusterRoleBinding, out *rbac.ClusterRoleBinding, s conversion.Scope) error {
- return autoConvert_v1_ClusterRoleBinding_To_rbac_ClusterRoleBinding(in, out, s)
-}
-
-func autoConvert_rbac_ClusterRoleBinding_To_v1_ClusterRoleBinding(in *rbac.ClusterRoleBinding, out *rbacv1.ClusterRoleBinding, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- out.Subjects = *(*[]rbacv1.Subject)(unsafe.Pointer(&in.Subjects))
- if err := Convert_rbac_RoleRef_To_v1_RoleRef(&in.RoleRef, &out.RoleRef, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_rbac_ClusterRoleBinding_To_v1_ClusterRoleBinding is an autogenerated conversion function.
-func Convert_rbac_ClusterRoleBinding_To_v1_ClusterRoleBinding(in *rbac.ClusterRoleBinding, out *rbacv1.ClusterRoleBinding, s conversion.Scope) error {
- return autoConvert_rbac_ClusterRoleBinding_To_v1_ClusterRoleBinding(in, out, s)
-}
-
-func autoConvert_v1_ClusterRoleBindingList_To_rbac_ClusterRoleBindingList(in *rbacv1.ClusterRoleBindingList, out *rbac.ClusterRoleBindingList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]rbac.ClusterRoleBinding)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_v1_ClusterRoleBindingList_To_rbac_ClusterRoleBindingList is an autogenerated conversion function.
-func Convert_v1_ClusterRoleBindingList_To_rbac_ClusterRoleBindingList(in *rbacv1.ClusterRoleBindingList, out *rbac.ClusterRoleBindingList, s conversion.Scope) error {
- return autoConvert_v1_ClusterRoleBindingList_To_rbac_ClusterRoleBindingList(in, out, s)
-}
-
-func autoConvert_rbac_ClusterRoleBindingList_To_v1_ClusterRoleBindingList(in *rbac.ClusterRoleBindingList, out *rbacv1.ClusterRoleBindingList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]rbacv1.ClusterRoleBinding)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_rbac_ClusterRoleBindingList_To_v1_ClusterRoleBindingList is an autogenerated conversion function.
-func Convert_rbac_ClusterRoleBindingList_To_v1_ClusterRoleBindingList(in *rbac.ClusterRoleBindingList, out *rbacv1.ClusterRoleBindingList, s conversion.Scope) error {
- return autoConvert_rbac_ClusterRoleBindingList_To_v1_ClusterRoleBindingList(in, out, s)
-}
-
-func autoConvert_v1_ClusterRoleList_To_rbac_ClusterRoleList(in *rbacv1.ClusterRoleList, out *rbac.ClusterRoleList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]rbac.ClusterRole)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_v1_ClusterRoleList_To_rbac_ClusterRoleList is an autogenerated conversion function.
-func Convert_v1_ClusterRoleList_To_rbac_ClusterRoleList(in *rbacv1.ClusterRoleList, out *rbac.ClusterRoleList, s conversion.Scope) error {
- return autoConvert_v1_ClusterRoleList_To_rbac_ClusterRoleList(in, out, s)
-}
-
-func autoConvert_rbac_ClusterRoleList_To_v1_ClusterRoleList(in *rbac.ClusterRoleList, out *rbacv1.ClusterRoleList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]rbacv1.ClusterRole)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_rbac_ClusterRoleList_To_v1_ClusterRoleList is an autogenerated conversion function.
-func Convert_rbac_ClusterRoleList_To_v1_ClusterRoleList(in *rbac.ClusterRoleList, out *rbacv1.ClusterRoleList, s conversion.Scope) error {
- return autoConvert_rbac_ClusterRoleList_To_v1_ClusterRoleList(in, out, s)
-}
-
-func autoConvert_v1_PolicyRule_To_rbac_PolicyRule(in *rbacv1.PolicyRule, out *rbac.PolicyRule, s conversion.Scope) error {
- out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
- out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups))
- out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
- out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames))
- out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs))
- return nil
-}
-
-// Convert_v1_PolicyRule_To_rbac_PolicyRule is an autogenerated conversion function.
-func Convert_v1_PolicyRule_To_rbac_PolicyRule(in *rbacv1.PolicyRule, out *rbac.PolicyRule, s conversion.Scope) error {
- return autoConvert_v1_PolicyRule_To_rbac_PolicyRule(in, out, s)
-}
-
-func autoConvert_rbac_PolicyRule_To_v1_PolicyRule(in *rbac.PolicyRule, out *rbacv1.PolicyRule, s conversion.Scope) error {
- out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
- out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups))
- out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
- out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames))
- out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs))
- return nil
-}
-
-// Convert_rbac_PolicyRule_To_v1_PolicyRule is an autogenerated conversion function.
-func Convert_rbac_PolicyRule_To_v1_PolicyRule(in *rbac.PolicyRule, out *rbacv1.PolicyRule, s conversion.Scope) error {
- return autoConvert_rbac_PolicyRule_To_v1_PolicyRule(in, out, s)
-}
-
-func autoConvert_v1_Role_To_rbac_Role(in *rbacv1.Role, out *rbac.Role, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- out.Rules = *(*[]rbac.PolicyRule)(unsafe.Pointer(&in.Rules))
- return nil
-}
-
-// Convert_v1_Role_To_rbac_Role is an autogenerated conversion function.
-func Convert_v1_Role_To_rbac_Role(in *rbacv1.Role, out *rbac.Role, s conversion.Scope) error {
- return autoConvert_v1_Role_To_rbac_Role(in, out, s)
-}
-
-func autoConvert_rbac_Role_To_v1_Role(in *rbac.Role, out *rbacv1.Role, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- out.Rules = *(*[]rbacv1.PolicyRule)(unsafe.Pointer(&in.Rules))
- return nil
-}
-
-// Convert_rbac_Role_To_v1_Role is an autogenerated conversion function.
-func Convert_rbac_Role_To_v1_Role(in *rbac.Role, out *rbacv1.Role, s conversion.Scope) error {
- return autoConvert_rbac_Role_To_v1_Role(in, out, s)
-}
-
-func autoConvert_v1_RoleBinding_To_rbac_RoleBinding(in *rbacv1.RoleBinding, out *rbac.RoleBinding, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- out.Subjects = *(*[]rbac.Subject)(unsafe.Pointer(&in.Subjects))
- if err := Convert_v1_RoleRef_To_rbac_RoleRef(&in.RoleRef, &out.RoleRef, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_v1_RoleBinding_To_rbac_RoleBinding is an autogenerated conversion function.
-func Convert_v1_RoleBinding_To_rbac_RoleBinding(in *rbacv1.RoleBinding, out *rbac.RoleBinding, s conversion.Scope) error {
- return autoConvert_v1_RoleBinding_To_rbac_RoleBinding(in, out, s)
-}
-
-func autoConvert_rbac_RoleBinding_To_v1_RoleBinding(in *rbac.RoleBinding, out *rbacv1.RoleBinding, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- out.Subjects = *(*[]rbacv1.Subject)(unsafe.Pointer(&in.Subjects))
- if err := Convert_rbac_RoleRef_To_v1_RoleRef(&in.RoleRef, &out.RoleRef, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_rbac_RoleBinding_To_v1_RoleBinding is an autogenerated conversion function.
-func Convert_rbac_RoleBinding_To_v1_RoleBinding(in *rbac.RoleBinding, out *rbacv1.RoleBinding, s conversion.Scope) error {
- return autoConvert_rbac_RoleBinding_To_v1_RoleBinding(in, out, s)
-}
-
-func autoConvert_v1_RoleBindingList_To_rbac_RoleBindingList(in *rbacv1.RoleBindingList, out *rbac.RoleBindingList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]rbac.RoleBinding)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_v1_RoleBindingList_To_rbac_RoleBindingList is an autogenerated conversion function.
-func Convert_v1_RoleBindingList_To_rbac_RoleBindingList(in *rbacv1.RoleBindingList, out *rbac.RoleBindingList, s conversion.Scope) error {
- return autoConvert_v1_RoleBindingList_To_rbac_RoleBindingList(in, out, s)
-}
-
-func autoConvert_rbac_RoleBindingList_To_v1_RoleBindingList(in *rbac.RoleBindingList, out *rbacv1.RoleBindingList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]rbacv1.RoleBinding)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_rbac_RoleBindingList_To_v1_RoleBindingList is an autogenerated conversion function.
-func Convert_rbac_RoleBindingList_To_v1_RoleBindingList(in *rbac.RoleBindingList, out *rbacv1.RoleBindingList, s conversion.Scope) error {
- return autoConvert_rbac_RoleBindingList_To_v1_RoleBindingList(in, out, s)
-}
-
-func autoConvert_v1_RoleList_To_rbac_RoleList(in *rbacv1.RoleList, out *rbac.RoleList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]rbac.Role)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_v1_RoleList_To_rbac_RoleList is an autogenerated conversion function.
-func Convert_v1_RoleList_To_rbac_RoleList(in *rbacv1.RoleList, out *rbac.RoleList, s conversion.Scope) error {
- return autoConvert_v1_RoleList_To_rbac_RoleList(in, out, s)
-}
-
-func autoConvert_rbac_RoleList_To_v1_RoleList(in *rbac.RoleList, out *rbacv1.RoleList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]rbacv1.Role)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_rbac_RoleList_To_v1_RoleList is an autogenerated conversion function.
-func Convert_rbac_RoleList_To_v1_RoleList(in *rbac.RoleList, out *rbacv1.RoleList, s conversion.Scope) error {
- return autoConvert_rbac_RoleList_To_v1_RoleList(in, out, s)
-}
-
-func autoConvert_v1_RoleRef_To_rbac_RoleRef(in *rbacv1.RoleRef, out *rbac.RoleRef, s conversion.Scope) error {
- out.APIGroup = in.APIGroup
- out.Kind = in.Kind
- out.Name = in.Name
- return nil
-}
-
-// Convert_v1_RoleRef_To_rbac_RoleRef is an autogenerated conversion function.
-func Convert_v1_RoleRef_To_rbac_RoleRef(in *rbacv1.RoleRef, out *rbac.RoleRef, s conversion.Scope) error {
- return autoConvert_v1_RoleRef_To_rbac_RoleRef(in, out, s)
-}
-
-func autoConvert_rbac_RoleRef_To_v1_RoleRef(in *rbac.RoleRef, out *rbacv1.RoleRef, s conversion.Scope) error {
- out.APIGroup = in.APIGroup
- out.Kind = in.Kind
- out.Name = in.Name
- return nil
-}
-
-// Convert_rbac_RoleRef_To_v1_RoleRef is an autogenerated conversion function.
-func Convert_rbac_RoleRef_To_v1_RoleRef(in *rbac.RoleRef, out *rbacv1.RoleRef, s conversion.Scope) error {
- return autoConvert_rbac_RoleRef_To_v1_RoleRef(in, out, s)
-}
-
-func autoConvert_v1_Subject_To_rbac_Subject(in *rbacv1.Subject, out *rbac.Subject, s conversion.Scope) error {
- out.Kind = in.Kind
- out.APIGroup = in.APIGroup
- out.Name = in.Name
- out.Namespace = in.Namespace
- return nil
-}
-
-// Convert_v1_Subject_To_rbac_Subject is an autogenerated conversion function.
-func Convert_v1_Subject_To_rbac_Subject(in *rbacv1.Subject, out *rbac.Subject, s conversion.Scope) error {
- return autoConvert_v1_Subject_To_rbac_Subject(in, out, s)
-}
-
-func autoConvert_rbac_Subject_To_v1_Subject(in *rbac.Subject, out *rbacv1.Subject, s conversion.Scope) error {
- out.Kind = in.Kind
- out.APIGroup = in.APIGroup
- out.Name = in.Name
- out.Namespace = in.Namespace
- return nil
-}
-
-// Convert_rbac_Subject_To_v1_Subject is an autogenerated conversion function.
-func Convert_rbac_Subject_To_v1_Subject(in *rbac.Subject, out *rbacv1.Subject, s conversion.Scope) error {
- return autoConvert_rbac_Subject_To_v1_Subject(in, out, s)
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/zz_generated.deepcopy.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/zz_generated.deepcopy.go
deleted file mode 100644
index a4ff45d659..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/zz_generated.deepcopy.go
+++ /dev/null
@@ -1,44 +0,0 @@
-//go:build !ignore_autogenerated
-// +build !ignore_autogenerated
-
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by deepcopy-gen. DO NOT EDIT.
-
-package v1
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in SortableRuleSlice) DeepCopyInto(out *SortableRuleSlice) {
- {
- in := &in
- *out = make(SortableRuleSlice, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- return
- }
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SortableRuleSlice.
-func (in SortableRuleSlice) DeepCopy() SortableRuleSlice {
- if in == nil {
- return nil
- }
- out := new(SortableRuleSlice)
- in.DeepCopyInto(out)
- return *out
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/zz_generated.defaults.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/zz_generated.defaults.go
deleted file mode 100644
index 734e76f3e7..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/zz_generated.defaults.go
+++ /dev/null
@@ -1,68 +0,0 @@
-//go:build !ignore_autogenerated
-// +build !ignore_autogenerated
-
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by defaulter-gen. DO NOT EDIT.
-
-package v1
-
-import (
- rbacv1 "k8s.io/api/rbac/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
-)
-
-// RegisterDefaults adds defaulters functions to the given scheme.
-// Public to allow building arbitrary schemes.
-// All generated defaulters are covering - they call all nested defaulters.
-func RegisterDefaults(scheme *runtime.Scheme) error {
- scheme.AddTypeDefaultingFunc(&rbacv1.ClusterRoleBinding{}, func(obj interface{}) { SetObjectDefaults_ClusterRoleBinding(obj.(*rbacv1.ClusterRoleBinding)) })
- scheme.AddTypeDefaultingFunc(&rbacv1.ClusterRoleBindingList{}, func(obj interface{}) { SetObjectDefaults_ClusterRoleBindingList(obj.(*rbacv1.ClusterRoleBindingList)) })
- scheme.AddTypeDefaultingFunc(&rbacv1.RoleBinding{}, func(obj interface{}) { SetObjectDefaults_RoleBinding(obj.(*rbacv1.RoleBinding)) })
- scheme.AddTypeDefaultingFunc(&rbacv1.RoleBindingList{}, func(obj interface{}) { SetObjectDefaults_RoleBindingList(obj.(*rbacv1.RoleBindingList)) })
- return nil
-}
-
-func SetObjectDefaults_ClusterRoleBinding(in *rbacv1.ClusterRoleBinding) {
- SetDefaults_ClusterRoleBinding(in)
- for i := range in.Subjects {
- a := &in.Subjects[i]
- SetDefaults_Subject(a)
- }
-}
-
-func SetObjectDefaults_ClusterRoleBindingList(in *rbacv1.ClusterRoleBindingList) {
- for i := range in.Items {
- a := &in.Items[i]
- SetObjectDefaults_ClusterRoleBinding(a)
- }
-}
-
-func SetObjectDefaults_RoleBinding(in *rbacv1.RoleBinding) {
- SetDefaults_RoleBinding(in)
- for i := range in.Subjects {
- a := &in.Subjects[i]
- SetDefaults_Subject(a)
- }
-}
-
-func SetObjectDefaults_RoleBindingList(in *rbacv1.RoleBindingList) {
- for i := range in.Items {
- a := &in.Items[i]
- SetObjectDefaults_RoleBinding(a)
- }
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/zz_generated.validations.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/zz_generated.validations.go
deleted file mode 100644
index 9cb1971123..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/zz_generated.validations.go
+++ /dev/null
@@ -1,302 +0,0 @@
-//go:build !ignore_autogenerated
-// +build !ignore_autogenerated
-
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by validation-gen. DO NOT EDIT.
-
-package v1
-
-import (
- context "context"
- fmt "fmt"
-
- rbacv1 "k8s.io/api/rbac/v1"
- equality "k8s.io/apimachinery/pkg/api/equality"
- operation "k8s.io/apimachinery/pkg/api/operation"
- safe "k8s.io/apimachinery/pkg/api/safe"
- validate "k8s.io/apimachinery/pkg/api/validate"
- runtime "k8s.io/apimachinery/pkg/runtime"
- field "k8s.io/apimachinery/pkg/util/validation/field"
-)
-
-func init() { localSchemeBuilder.Register(RegisterValidations) }
-
-// RegisterValidations adds validation functions to the given scheme.
-// Public to allow building arbitrary schemes.
-func RegisterValidations(scheme *runtime.Scheme) error {
- // type ClusterRole
- scheme.AddValidationFunc((*rbacv1.ClusterRole)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList {
- switch op.Request.SubresourcePath() {
- case "/":
- return Validate_ClusterRole(ctx, op, nil /* fldPath */, obj.(*rbacv1.ClusterRole), safe.Cast[*rbacv1.ClusterRole](oldObj))
- }
- return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))}
- })
- // type ClusterRoleBinding
- scheme.AddValidationFunc((*rbacv1.ClusterRoleBinding)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList {
- switch op.Request.SubresourcePath() {
- case "/":
- return Validate_ClusterRoleBinding(ctx, op, nil /* fldPath */, obj.(*rbacv1.ClusterRoleBinding), safe.Cast[*rbacv1.ClusterRoleBinding](oldObj))
- }
- return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))}
- })
- // type Role
- scheme.AddValidationFunc((*rbacv1.Role)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList {
- switch op.Request.SubresourcePath() {
- case "/":
- return Validate_Role(ctx, op, nil /* fldPath */, obj.(*rbacv1.Role), safe.Cast[*rbacv1.Role](oldObj))
- }
- return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))}
- })
- // type RoleBinding
- scheme.AddValidationFunc((*rbacv1.RoleBinding)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList {
- switch op.Request.SubresourcePath() {
- case "/":
- return Validate_RoleBinding(ctx, op, nil /* fldPath */, obj.(*rbacv1.RoleBinding), safe.Cast[*rbacv1.RoleBinding](oldObj))
- }
- return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))}
- })
- return nil
-}
-
-// Validate_ClusterRole validates an instance of ClusterRole according
-// to declarative validation rules in the API schema.
-func Validate_ClusterRole(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *rbacv1.ClusterRole) (errs field.ErrorList) {
- // field rbacv1.ClusterRole.TypeMeta has no validation
- // field rbacv1.ClusterRole.ObjectMeta has no validation
-
- // field rbacv1.ClusterRole.Rules
- errs = append(errs,
- func(fldPath *field.Path, obj, oldObj []rbacv1.PolicyRule, oldValueCorrelated bool) (errs field.ErrorList) {
- // don't revalidate unchanged data
- if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) {
- return nil
- }
- // call field-attached validations
- earlyReturn := false
- if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 {
- earlyReturn = true
- }
- if earlyReturn {
- return // do not proceed
- }
- // iterate the list and call the type's validation function
- errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_PolicyRule)...)
- return
- }(fldPath.Child("rules"), obj.Rules, safe.Field(oldObj, func(oldObj *rbacv1.ClusterRole) []rbacv1.PolicyRule { return oldObj.Rules }), oldObj != nil)...)
-
- // field rbacv1.ClusterRole.AggregationRule has no validation
- return errs
-}
-
-// Validate_ClusterRoleBinding validates an instance of ClusterRoleBinding according
-// to declarative validation rules in the API schema.
-func Validate_ClusterRoleBinding(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *rbacv1.ClusterRoleBinding) (errs field.ErrorList) {
- // field rbacv1.ClusterRoleBinding.TypeMeta has no validation
- // field rbacv1.ClusterRoleBinding.ObjectMeta has no validation
-
- // field rbacv1.ClusterRoleBinding.Subjects
- errs = append(errs,
- func(fldPath *field.Path, obj, oldObj []rbacv1.Subject, oldValueCorrelated bool) (errs field.ErrorList) {
- // don't revalidate unchanged data
- if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) {
- return nil
- }
- // call field-attached validations
- earlyReturn := false
- if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 {
- earlyReturn = true
- }
- if earlyReturn {
- return // do not proceed
- }
- // iterate the list and call the type's validation function
- errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_Subject)...)
- return
- }(fldPath.Child("subjects"), obj.Subjects, safe.Field(oldObj, func(oldObj *rbacv1.ClusterRoleBinding) []rbacv1.Subject { return oldObj.Subjects }), oldObj != nil)...)
-
- // field rbacv1.ClusterRoleBinding.RoleRef
- errs = append(errs,
- func(fldPath *field.Path, obj, oldObj *rbacv1.RoleRef, oldValueCorrelated bool) (errs field.ErrorList) {
- // don't revalidate unchanged data
- if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) {
- return nil
- }
- // call the type's validation function
- errs = append(errs, Validate_RoleRef(ctx, op, fldPath, obj, oldObj)...)
- return
- }(fldPath.Child("roleRef"), &obj.RoleRef, safe.Field(oldObj, func(oldObj *rbacv1.ClusterRoleBinding) *rbacv1.RoleRef { return &oldObj.RoleRef }), oldObj != nil)...)
-
- return errs
-}
-
-// Validate_PolicyRule validates an instance of PolicyRule according
-// to declarative validation rules in the API schema.
-func Validate_PolicyRule(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *rbacv1.PolicyRule) (errs field.ErrorList) {
- // field rbacv1.PolicyRule.Verbs
- errs = append(errs,
- func(fldPath *field.Path, obj, oldObj []string, oldValueCorrelated bool) (errs field.ErrorList) {
- // don't revalidate unchanged data
- if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) {
- return nil
- }
- // call field-attached validations
- earlyReturn := false
- if e := validate.RequiredSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 {
- errs = append(errs, e...)
- earlyReturn = true
- }
- if earlyReturn {
- return // do not proceed
- }
- return
- }(fldPath.Child("verbs"), obj.Verbs, safe.Field(oldObj, func(oldObj *rbacv1.PolicyRule) []string { return oldObj.Verbs }), oldObj != nil)...)
-
- // field rbacv1.PolicyRule.APIGroups has no validation
- // field rbacv1.PolicyRule.Resources has no validation
- // field rbacv1.PolicyRule.ResourceNames has no validation
- // field rbacv1.PolicyRule.NonResourceURLs has no validation
- return errs
-}
-
-// Validate_Role validates an instance of Role according
-// to declarative validation rules in the API schema.
-func Validate_Role(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *rbacv1.Role) (errs field.ErrorList) {
- // field rbacv1.Role.TypeMeta has no validation
- // field rbacv1.Role.ObjectMeta has no validation
-
- // field rbacv1.Role.Rules
- errs = append(errs,
- func(fldPath *field.Path, obj, oldObj []rbacv1.PolicyRule, oldValueCorrelated bool) (errs field.ErrorList) {
- // don't revalidate unchanged data
- if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) {
- return nil
- }
- // call field-attached validations
- earlyReturn := false
- if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 {
- earlyReturn = true
- }
- if earlyReturn {
- return // do not proceed
- }
- // iterate the list and call the type's validation function
- errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_PolicyRule)...)
- return
- }(fldPath.Child("rules"), obj.Rules, safe.Field(oldObj, func(oldObj *rbacv1.Role) []rbacv1.PolicyRule { return oldObj.Rules }), oldObj != nil)...)
-
- return errs
-}
-
-// Validate_RoleBinding validates an instance of RoleBinding according
-// to declarative validation rules in the API schema.
-func Validate_RoleBinding(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *rbacv1.RoleBinding) (errs field.ErrorList) {
- // field rbacv1.RoleBinding.TypeMeta has no validation
- // field rbacv1.RoleBinding.ObjectMeta has no validation
-
- // field rbacv1.RoleBinding.Subjects
- errs = append(errs,
- func(fldPath *field.Path, obj, oldObj []rbacv1.Subject, oldValueCorrelated bool) (errs field.ErrorList) {
- // don't revalidate unchanged data
- if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) {
- return nil
- }
- // call field-attached validations
- earlyReturn := false
- if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 {
- earlyReturn = true
- }
- if earlyReturn {
- return // do not proceed
- }
- // iterate the list and call the type's validation function
- errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_Subject)...)
- return
- }(fldPath.Child("subjects"), obj.Subjects, safe.Field(oldObj, func(oldObj *rbacv1.RoleBinding) []rbacv1.Subject { return oldObj.Subjects }), oldObj != nil)...)
-
- // field rbacv1.RoleBinding.RoleRef
- errs = append(errs,
- func(fldPath *field.Path, obj, oldObj *rbacv1.RoleRef, oldValueCorrelated bool) (errs field.ErrorList) {
- // don't revalidate unchanged data
- if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) {
- return nil
- }
- // call the type's validation function
- errs = append(errs, Validate_RoleRef(ctx, op, fldPath, obj, oldObj)...)
- return
- }(fldPath.Child("roleRef"), &obj.RoleRef, safe.Field(oldObj, func(oldObj *rbacv1.RoleBinding) *rbacv1.RoleRef { return &oldObj.RoleRef }), oldObj != nil)...)
-
- return errs
-}
-
-// Validate_RoleRef validates an instance of RoleRef according
-// to declarative validation rules in the API schema.
-func Validate_RoleRef(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *rbacv1.RoleRef) (errs field.ErrorList) {
- // field rbacv1.RoleRef.APIGroup has no validation
- // field rbacv1.RoleRef.Kind has no validation
-
- // field rbacv1.RoleRef.Name
- errs = append(errs,
- func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) {
- // don't revalidate unchanged data
- if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) {
- return nil
- }
- // call field-attached validations
- earlyReturn := false
- if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 {
- errs = append(errs, e...)
- earlyReturn = true
- }
- if earlyReturn {
- return // do not proceed
- }
- return
- }(fldPath.Child("name"), &obj.Name, safe.Field(oldObj, func(oldObj *rbacv1.RoleRef) *string { return &oldObj.Name }), oldObj != nil)...)
-
- return errs
-}
-
-// Validate_Subject validates an instance of Subject according
-// to declarative validation rules in the API schema.
-func Validate_Subject(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *rbacv1.Subject) (errs field.ErrorList) {
- // field rbacv1.Subject.Kind has no validation
- // field rbacv1.Subject.APIGroup has no validation
-
- // field rbacv1.Subject.Name
- errs = append(errs,
- func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) {
- // don't revalidate unchanged data
- if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) {
- return nil
- }
- // call field-attached validations
- earlyReturn := false
- if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 {
- errs = append(errs, e...)
- earlyReturn = true
- }
- if earlyReturn {
- return // do not proceed
- }
- return
- }(fldPath.Child("name"), &obj.Name, safe.Field(oldObj, func(oldObj *rbacv1.Subject) *string { return &oldObj.Name }), oldObj != nil)...)
-
- // field rbacv1.Subject.Namespace has no validation
- return errs
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/zz_generated.deepcopy.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/zz_generated.deepcopy.go
deleted file mode 100644
index 0f7023a2db..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/zz_generated.deepcopy.go
+++ /dev/null
@@ -1,412 +0,0 @@
-//go:build !ignore_autogenerated
-// +build !ignore_autogenerated
-
-/*
-Copyright The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by deepcopy-gen. DO NOT EDIT.
-
-package rbac
-
-import (
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
-)
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AggregationRule) DeepCopyInto(out *AggregationRule) {
- *out = *in
- if in.ClusterRoleSelectors != nil {
- in, out := &in.ClusterRoleSelectors, &out.ClusterRoleSelectors
- *out = make([]v1.LabelSelector, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AggregationRule.
-func (in *AggregationRule) DeepCopy() *AggregationRule {
- if in == nil {
- return nil
- }
- out := new(AggregationRule)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *ClusterRole) DeepCopyInto(out *ClusterRole) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- if in.Rules != nil {
- in, out := &in.Rules, &out.Rules
- *out = make([]PolicyRule, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- if in.AggregationRule != nil {
- in, out := &in.AggregationRule, &out.AggregationRule
- *out = new(AggregationRule)
- (*in).DeepCopyInto(*out)
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRole.
-func (in *ClusterRole) DeepCopy() *ClusterRole {
- if in == nil {
- return nil
- }
- out := new(ClusterRole)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *ClusterRole) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *ClusterRoleBinding) DeepCopyInto(out *ClusterRoleBinding) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- if in.Subjects != nil {
- in, out := &in.Subjects, &out.Subjects
- *out = make([]Subject, len(*in))
- copy(*out, *in)
- }
- out.RoleRef = in.RoleRef
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRoleBinding.
-func (in *ClusterRoleBinding) DeepCopy() *ClusterRoleBinding {
- if in == nil {
- return nil
- }
- out := new(ClusterRoleBinding)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *ClusterRoleBinding) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *ClusterRoleBindingList) DeepCopyInto(out *ClusterRoleBindingList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]ClusterRoleBinding, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRoleBindingList.
-func (in *ClusterRoleBindingList) DeepCopy() *ClusterRoleBindingList {
- if in == nil {
- return nil
- }
- out := new(ClusterRoleBindingList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *ClusterRoleBindingList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *ClusterRoleList) DeepCopyInto(out *ClusterRoleList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]ClusterRole, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRoleList.
-func (in *ClusterRoleList) DeepCopy() *ClusterRoleList {
- if in == nil {
- return nil
- }
- out := new(ClusterRoleList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *ClusterRoleList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *PolicyRule) DeepCopyInto(out *PolicyRule) {
- *out = *in
- if in.Verbs != nil {
- in, out := &in.Verbs, &out.Verbs
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.APIGroups != nil {
- in, out := &in.APIGroups, &out.APIGroups
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.Resources != nil {
- in, out := &in.Resources, &out.Resources
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.ResourceNames != nil {
- in, out := &in.ResourceNames, &out.ResourceNames
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.NonResourceURLs != nil {
- in, out := &in.NonResourceURLs, &out.NonResourceURLs
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyRule.
-func (in *PolicyRule) DeepCopy() *PolicyRule {
- if in == nil {
- return nil
- }
- out := new(PolicyRule)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *Role) DeepCopyInto(out *Role) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- if in.Rules != nil {
- in, out := &in.Rules, &out.Rules
- *out = make([]PolicyRule, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Role.
-func (in *Role) DeepCopy() *Role {
- if in == nil {
- return nil
- }
- out := new(Role)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *Role) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *RoleBinding) DeepCopyInto(out *RoleBinding) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- if in.Subjects != nil {
- in, out := &in.Subjects, &out.Subjects
- *out = make([]Subject, len(*in))
- copy(*out, *in)
- }
- out.RoleRef = in.RoleRef
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleBinding.
-func (in *RoleBinding) DeepCopy() *RoleBinding {
- if in == nil {
- return nil
- }
- out := new(RoleBinding)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *RoleBinding) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *RoleBindingList) DeepCopyInto(out *RoleBindingList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]RoleBinding, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleBindingList.
-func (in *RoleBindingList) DeepCopy() *RoleBindingList {
- if in == nil {
- return nil
- }
- out := new(RoleBindingList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *RoleBindingList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *RoleList) DeepCopyInto(out *RoleList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]Role, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleList.
-func (in *RoleList) DeepCopy() *RoleList {
- if in == nil {
- return nil
- }
- out := new(RoleList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *RoleList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *RoleRef) DeepCopyInto(out *RoleRef) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleRef.
-func (in *RoleRef) DeepCopy() *RoleRef {
- if in == nil {
- return nil
- }
- out := new(RoleRef)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in SortableRuleSlice) DeepCopyInto(out *SortableRuleSlice) {
- {
- in := &in
- *out = make(SortableRuleSlice, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- return
- }
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SortableRuleSlice.
-func (in SortableRuleSlice) DeepCopy() SortableRuleSlice {
- if in == nil {
- return nil
- }
- out := new(SortableRuleSlice)
- in.DeepCopyInto(out)
- return *out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *Subject) DeepCopyInto(out *Subject) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subject.
-func (in *Subject) DeepCopy() *Subject {
- if in == nil {
- return nil
- }
- out := new(Subject)
- in.DeepCopyInto(out)
- return out
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/registry/rbac/OWNERS b/vendor/k8s.io/kubernetes/pkg/registry/rbac/OWNERS
deleted file mode 100644
index 55d3fb23c0..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/registry/rbac/OWNERS
+++ /dev/null
@@ -1,8 +0,0 @@
-# See the OWNERS docs at https://go.k8s.io/owners
-
-approvers:
- - sig-auth-authorizers-approvers
-reviewers:
- - sig-auth-authorizers-reviewers
-labels:
- - sig/auth
diff --git a/vendor/k8s.io/kubernetes/pkg/registry/rbac/escalation_check.go b/vendor/k8s.io/kubernetes/pkg/registry/rbac/escalation_check.go
deleted file mode 100644
index 252c3e4e41..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/registry/rbac/escalation_check.go
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package rbac
-
-import (
- "context"
- "fmt"
-
- "k8s.io/apimachinery/pkg/runtime/schema"
- utilruntime "k8s.io/apimachinery/pkg/util/runtime"
- "k8s.io/apiserver/pkg/authentication/user"
- "k8s.io/apiserver/pkg/authorization/authorizer"
- genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
- "k8s.io/kubernetes/pkg/apis/rbac"
-)
-
-// EscalationAllowed checks if the user associated with the context is a superuser
-func EscalationAllowed(ctx context.Context) bool {
- u, ok := genericapirequest.UserFrom(ctx)
- if !ok {
- return false
- }
-
- // system:masters is special because the API server uses it for privileged loopback connections
- // therefore we know that a member of system:masters can always do anything
- for _, group := range u.GetGroups() {
- if group == user.SystemPrivilegedGroup {
- return true
- }
- }
-
- return false
-}
-
-var roleResources = map[schema.GroupResource]bool{
- rbac.SchemeGroupVersion.WithResource("clusterroles").GroupResource(): true,
- rbac.SchemeGroupVersion.WithResource("roles").GroupResource(): true,
-}
-
-// RoleEscalationAuthorized checks if the user associated with the context is explicitly authorized to escalate the role resource associated with the context
-func RoleEscalationAuthorized(ctx context.Context, a authorizer.Authorizer) bool {
- if a == nil {
- return false
- }
-
- user, ok := genericapirequest.UserFrom(ctx)
- if !ok {
- return false
- }
-
- requestInfo, ok := genericapirequest.RequestInfoFrom(ctx)
- if !ok {
- return false
- }
-
- if !requestInfo.IsResourceRequest {
- return false
- }
-
- requestResource := schema.GroupResource{Group: requestInfo.APIGroup, Resource: requestInfo.Resource}
- if !roleResources[requestResource] {
- return false
- }
-
- attrs := authorizer.AttributesRecord{
- User: user,
- Verb: "escalate",
- APIGroup: requestInfo.APIGroup,
- APIVersion: "*",
- Resource: requestInfo.Resource,
- Name: requestInfo.Name,
- Namespace: requestInfo.Namespace,
- ResourceRequest: true,
- }
-
- decision, _, err := a.Authorize(ctx, attrs)
- if err != nil {
- utilruntime.HandleError(fmt.Errorf(
- "error authorizing user %#v to escalate %#v named %q in namespace %q: %v",
- user, requestResource, requestInfo.Name, requestInfo.Namespace, err,
- ))
- }
- return decision == authorizer.DecisionAllow
-}
-
-// BindingAuthorized returns true if the user associated with the context is explicitly authorized to bind the specified roleRef
-func BindingAuthorized(ctx context.Context, roleRef rbac.RoleRef, bindingNamespace string, a authorizer.Authorizer) bool {
- if a == nil {
- return false
- }
-
- user, ok := genericapirequest.UserFrom(ctx)
- if !ok {
- return false
- }
-
- attrs := authorizer.AttributesRecord{
- User: user,
- Verb: "bind",
- // check against the namespace where the binding is being created (or the empty namespace for clusterrolebindings).
- // this allows delegation to bind particular clusterroles in rolebindings within particular namespaces,
- // and to authorize binding a clusterrole across all namespaces in a clusterrolebinding.
- Namespace: bindingNamespace,
- ResourceRequest: true,
- }
-
- // This occurs after defaulting and conversion, so values pulled from the roleRef won't change
- // Invalid APIGroup or Name values will fail validation
- switch roleRef.Kind {
- case "ClusterRole":
- attrs.APIGroup = roleRef.APIGroup
- attrs.APIVersion = "*"
- attrs.Resource = "clusterroles"
- attrs.Name = roleRef.Name
- case "Role":
- attrs.APIGroup = roleRef.APIGroup
- attrs.APIVersion = "*"
- attrs.Resource = "roles"
- attrs.Name = roleRef.Name
- default:
- return false
- }
-
- decision, _, err := a.Authorize(ctx, attrs)
- if err != nil {
- utilruntime.HandleError(fmt.Errorf(
- "error authorizing user %#v to bind %#v in namespace %s: %v",
- user, roleRef, bindingNamespace, err,
- ))
- }
- return decision == authorizer.DecisionAllow
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/registry/rbac/helpers.go b/vendor/k8s.io/kubernetes/pkg/registry/rbac/helpers.go
deleted file mode 100644
index 76f7e7eee8..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/registry/rbac/helpers.go
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package rbac
-
-import (
- "reflect"
-
- "k8s.io/apimachinery/pkg/api/meta"
- "k8s.io/apimachinery/pkg/conversion"
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-// IsOnlyMutatingGCFields checks finalizers and ownerrefs which GC manipulates
-// and indicates that only those fields are changing
-func IsOnlyMutatingGCFields(obj, old runtime.Object, equalities conversion.Equalities) bool {
- if old == nil || reflect.ValueOf(old).IsNil() {
- return false
- }
-
- // make a copy of the newObj so that we can stomp for comparison
- copied := obj.DeepCopyObject()
- copiedMeta, err := meta.Accessor(copied)
- if err != nil {
- return false
- }
- oldMeta, err := meta.Accessor(old)
- if err != nil {
- return false
- }
- copiedMeta.SetOwnerReferences(oldMeta.GetOwnerReferences())
- copiedMeta.SetFinalizers(oldMeta.GetFinalizers())
- copiedMeta.SetSelfLink(oldMeta.GetSelfLink())
- copiedMeta.SetManagedFields(oldMeta.GetManagedFields())
-
- return equalities.DeepEqual(copied, old)
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/internal_version_adapter.go b/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/internal_version_adapter.go
deleted file mode 100644
index bfb57242df..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/internal_version_adapter.go
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-Copyright 2018 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package validation
-
-import (
- "context"
-
- rbacv1 "k8s.io/api/rbac/v1"
- "k8s.io/kubernetes/pkg/apis/rbac"
- rbacv1helpers "k8s.io/kubernetes/pkg/apis/rbac/v1"
-)
-
-func ConfirmNoEscalationInternal(ctx context.Context, ruleResolver AuthorizationRuleResolver, inRules []rbac.PolicyRule) error {
- rules := []rbacv1.PolicyRule{}
- for i := range inRules {
- v1Rule := rbacv1.PolicyRule{}
- err := rbacv1helpers.Convert_rbac_PolicyRule_To_v1_PolicyRule(&inRules[i], &v1Rule, nil)
- if err != nil {
- return err
- }
- rules = append(rules, v1Rule)
- }
-
- return ConfirmNoEscalation(ctx, ruleResolver, rules)
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/policy_compact.go b/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/policy_compact.go
deleted file mode 100644
index 182657b1ca..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/policy_compact.go
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package validation
-
-import (
- "reflect"
-
- rbacv1 "k8s.io/api/rbac/v1"
-)
-
-type simpleResource struct {
- Group string
- Resource string
- ResourceNameExist bool
- ResourceName string
-}
-
-// CompactRules combines rules that contain a single APIGroup/Resource, differ only by verb, and contain no other attributes.
-// this is a fast check, and works well with the decomposed "missing rules" list from a Covers check.
-func CompactRules(rules []rbacv1.PolicyRule) ([]rbacv1.PolicyRule, error) {
- compacted := make([]rbacv1.PolicyRule, 0, len(rules))
-
- simpleRules := map[simpleResource]*rbacv1.PolicyRule{}
- for _, rule := range rules {
- if resource, isSimple := isSimpleResourceRule(&rule); isSimple {
- if existingRule, ok := simpleRules[resource]; ok {
- // Add the new verbs to the existing simple resource rule
- if existingRule.Verbs == nil {
- existingRule.Verbs = []string{}
- }
- existingRule.Verbs = append(existingRule.Verbs, rule.Verbs...)
- } else {
- // Copy the rule to accumulate matching simple resource rules into
- simpleRules[resource] = rule.DeepCopy()
- }
- } else {
- compacted = append(compacted, rule)
- }
- }
-
- // Once we've consolidated the simple resource rules, add them to the compacted list
- for _, simpleRule := range simpleRules {
- compacted = append(compacted, *simpleRule)
- }
-
- return compacted, nil
-}
-
-// isSimpleResourceRule returns true if the given rule contains verbs, a single resource, a single API group, at most one Resource Name, and no other values
-func isSimpleResourceRule(rule *rbacv1.PolicyRule) (simpleResource, bool) {
- resource := simpleResource{}
-
- // If we have "complex" rule attributes, return early without allocations or expensive comparisons
- if len(rule.ResourceNames) > 1 || len(rule.NonResourceURLs) > 0 {
- return resource, false
- }
- // If we have multiple api groups or resources, return early
- if len(rule.APIGroups) != 1 || len(rule.Resources) != 1 {
- return resource, false
- }
-
- // Test if this rule only contains APIGroups/Resources/Verbs/ResourceNames
- simpleRule := &rbacv1.PolicyRule{APIGroups: rule.APIGroups, Resources: rule.Resources, Verbs: rule.Verbs, ResourceNames: rule.ResourceNames}
- if !reflect.DeepEqual(simpleRule, rule) {
- return resource, false
- }
-
- if len(rule.ResourceNames) == 0 {
- resource = simpleResource{Group: rule.APIGroups[0], Resource: rule.Resources[0], ResourceNameExist: false}
- } else {
- resource = simpleResource{Group: rule.APIGroups[0], Resource: rule.Resources[0], ResourceNameExist: true, ResourceName: rule.ResourceNames[0]}
- }
-
- return resource, true
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/rule.go b/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/rule.go
deleted file mode 100644
index 5322c7419f..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/rule.go
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package validation
-
-import (
- "context"
- "errors"
- "fmt"
- "strings"
-
- "k8s.io/klog/v2"
-
- rbacv1 "k8s.io/api/rbac/v1"
- utilerrors "k8s.io/apimachinery/pkg/util/errors"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/apiserver/pkg/authentication/serviceaccount"
- "k8s.io/apiserver/pkg/authentication/user"
- genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
- "k8s.io/component-helpers/auth/rbac/validation"
- rbacv1helpers "k8s.io/kubernetes/pkg/apis/rbac/v1"
-)
-
-type AuthorizationRuleResolver interface {
- // GetRoleReferenceRules attempts to resolve the role reference of a RoleBinding or ClusterRoleBinding. The passed namespace should be the namespace
- // of the role binding, the empty string if a cluster role binding.
- GetRoleReferenceRules(ctx context.Context, roleRef rbacv1.RoleRef, namespace string) ([]rbacv1.PolicyRule, error)
-
- // RulesFor returns the list of rules that apply to a given user in a given namespace and error. If an error is returned, the slice of
- // PolicyRules may not be complete, but it contains all retrievable rules. This is done because policy rules are purely additive and policy determinations
- // can be made on the basis of those rules that are found.
- RulesFor(ctx context.Context, user user.Info, namespace string) ([]rbacv1.PolicyRule, error)
-
- // VisitRulesFor invokes visitor() with each rule that applies to a given user in a given namespace, and each error encountered resolving those rules.
- // If visitor() returns false, visiting is short-circuited.
- VisitRulesFor(ctx context.Context, user user.Info, namespace string, visitor func(source fmt.Stringer, rule *rbacv1.PolicyRule, err error) bool)
-}
-
-// ConfirmNoEscalation determines if the roles for a given user in a given namespace encompass the provided role.
-func ConfirmNoEscalation(ctx context.Context, ruleResolver AuthorizationRuleResolver, rules []rbacv1.PolicyRule) error {
- ruleResolutionErrors := []error{}
-
- user, ok := genericapirequest.UserFrom(ctx)
- if !ok {
- return fmt.Errorf("no user on context")
- }
- namespace, _ := genericapirequest.NamespaceFrom(ctx)
-
- ownerRules, err := ruleResolver.RulesFor(ctx, user, namespace)
- if err != nil {
- // As per AuthorizationRuleResolver contract, this may return a non fatal error with an incomplete list of policies. Log the error and continue.
- klog.V(1).Infof("non-fatal error getting local rules for %v: %v", user, err)
- ruleResolutionErrors = append(ruleResolutionErrors, err)
- }
-
- ownerRightsCover, missingRights := validation.Covers(ownerRules, rules)
- if !ownerRightsCover {
- compactMissingRights := missingRights
- if compact, err := CompactRules(missingRights); err == nil {
- compactMissingRights = compact
- }
-
- missingDescriptions := sets.NewString()
- for _, missing := range compactMissingRights {
- missingDescriptions.Insert(rbacv1helpers.CompactString(missing))
- }
-
- msg := fmt.Sprintf("user %q (groups=%q) is attempting to grant RBAC permissions not currently held:\n%s", user.GetName(), user.GetGroups(), strings.Join(missingDescriptions.List(), "\n"))
- if len(ruleResolutionErrors) > 0 {
- msg = msg + fmt.Sprintf("; resolution errors: %v", ruleResolutionErrors)
- }
-
- return errors.New(msg)
- }
- return nil
-}
-
-type DefaultRuleResolver struct {
- roleGetter RoleGetter
- roleBindingLister RoleBindingLister
- clusterRoleGetter ClusterRoleGetter
- clusterRoleBindingLister ClusterRoleBindingLister
-}
-
-func NewDefaultRuleResolver(roleGetter RoleGetter, roleBindingLister RoleBindingLister, clusterRoleGetter ClusterRoleGetter, clusterRoleBindingLister ClusterRoleBindingLister) *DefaultRuleResolver {
- return &DefaultRuleResolver{roleGetter, roleBindingLister, clusterRoleGetter, clusterRoleBindingLister}
-}
-
-type RoleGetter interface {
- GetRole(ctx context.Context, namespace, name string) (*rbacv1.Role, error)
-}
-
-type RoleBindingLister interface {
- ListRoleBindings(ctx context.Context, namespace string) ([]*rbacv1.RoleBinding, error)
-}
-
-type ClusterRoleGetter interface {
- GetClusterRole(ctx context.Context, name string) (*rbacv1.ClusterRole, error)
-}
-
-type ClusterRoleBindingLister interface {
- ListClusterRoleBindings(ctx context.Context) ([]*rbacv1.ClusterRoleBinding, error)
-}
-
-func (r *DefaultRuleResolver) RulesFor(ctx context.Context, user user.Info, namespace string) ([]rbacv1.PolicyRule, error) {
- visitor := &ruleAccumulator{}
- r.VisitRulesFor(ctx, user, namespace, visitor.visit)
- return visitor.rules, utilerrors.NewAggregate(visitor.errors)
-}
-
-type ruleAccumulator struct {
- rules []rbacv1.PolicyRule
- errors []error
-}
-
-func (r *ruleAccumulator) visit(source fmt.Stringer, rule *rbacv1.PolicyRule, err error) bool {
- if rule != nil {
- r.rules = append(r.rules, *rule)
- }
- if err != nil {
- r.errors = append(r.errors, err)
- }
- return true
-}
-
-func describeSubject(s *rbacv1.Subject, bindingNamespace string) string {
- switch s.Kind {
- case rbacv1.ServiceAccountKind:
- if len(s.Namespace) > 0 {
- return fmt.Sprintf("%s %q", s.Kind, s.Name+"/"+s.Namespace)
- }
- return fmt.Sprintf("%s %q", s.Kind, s.Name+"/"+bindingNamespace)
- default:
- return fmt.Sprintf("%s %q", s.Kind, s.Name)
- }
-}
-
-type clusterRoleBindingDescriber struct {
- binding *rbacv1.ClusterRoleBinding
- subject *rbacv1.Subject
-}
-
-func (d *clusterRoleBindingDescriber) String() string {
- return fmt.Sprintf("ClusterRoleBinding %q of %s %q to %s",
- d.binding.Name,
- d.binding.RoleRef.Kind,
- d.binding.RoleRef.Name,
- describeSubject(d.subject, ""),
- )
-}
-
-type roleBindingDescriber struct {
- binding *rbacv1.RoleBinding
- subject *rbacv1.Subject
-}
-
-func (d *roleBindingDescriber) String() string {
- return fmt.Sprintf("RoleBinding %q of %s %q to %s",
- d.binding.Name+"/"+d.binding.Namespace,
- d.binding.RoleRef.Kind,
- d.binding.RoleRef.Name,
- describeSubject(d.subject, d.binding.Namespace),
- )
-}
-
-func (r *DefaultRuleResolver) VisitRulesFor(ctx context.Context, user user.Info, namespace string, visitor func(source fmt.Stringer, rule *rbacv1.PolicyRule, err error) bool) {
- if clusterRoleBindings, err := r.clusterRoleBindingLister.ListClusterRoleBindings(ctx); err != nil {
- if !visitor(nil, nil, err) {
- return
- }
- } else {
- sourceDescriber := &clusterRoleBindingDescriber{}
- for _, clusterRoleBinding := range clusterRoleBindings {
- subjectIndex, applies := appliesTo(user, clusterRoleBinding.Subjects, "")
- if !applies {
- continue
- }
- rules, err := r.GetRoleReferenceRules(ctx, clusterRoleBinding.RoleRef, "")
- if err != nil {
- if !visitor(nil, nil, err) {
- return
- }
- continue
- }
- sourceDescriber.binding = clusterRoleBinding
- sourceDescriber.subject = &clusterRoleBinding.Subjects[subjectIndex]
- for i := range rules {
- if !visitor(sourceDescriber, &rules[i], nil) {
- return
- }
- }
- }
- }
-
- if len(namespace) > 0 {
- if roleBindings, err := r.roleBindingLister.ListRoleBindings(ctx, namespace); err != nil {
- if !visitor(nil, nil, err) {
- return
- }
- } else {
- sourceDescriber := &roleBindingDescriber{}
- for _, roleBinding := range roleBindings {
- subjectIndex, applies := appliesTo(user, roleBinding.Subjects, namespace)
- if !applies {
- continue
- }
- rules, err := r.GetRoleReferenceRules(ctx, roleBinding.RoleRef, namespace)
- if err != nil {
- if !visitor(nil, nil, err) {
- return
- }
- continue
- }
- sourceDescriber.binding = roleBinding
- sourceDescriber.subject = &roleBinding.Subjects[subjectIndex]
- for i := range rules {
- if !visitor(sourceDescriber, &rules[i], nil) {
- return
- }
- }
- }
- }
- }
-}
-
-// GetRoleReferenceRules attempts to resolve the RoleBinding or ClusterRoleBinding.
-func (r *DefaultRuleResolver) GetRoleReferenceRules(ctx context.Context, roleRef rbacv1.RoleRef, bindingNamespace string) ([]rbacv1.PolicyRule, error) {
- switch roleRef.Kind {
- case "Role":
- role, err := r.roleGetter.GetRole(ctx, bindingNamespace, roleRef.Name)
- if err != nil {
- return nil, err
- }
- return role.Rules, nil
-
- case "ClusterRole":
- clusterRole, err := r.clusterRoleGetter.GetClusterRole(ctx, roleRef.Name)
- if err != nil {
- return nil, err
- }
- return clusterRole.Rules, nil
-
- default:
- return nil, fmt.Errorf("unsupported role reference kind: %q", roleRef.Kind)
- }
-}
-
-// appliesTo returns whether any of the bindingSubjects applies to the specified subject,
-// and if true, the index of the first subject that applies
-func appliesTo(user user.Info, bindingSubjects []rbacv1.Subject, namespace string) (int, bool) {
- for i, bindingSubject := range bindingSubjects {
- if appliesToUser(user, bindingSubject, namespace) {
- return i, true
- }
- }
- return 0, false
-}
-
-func has(set []string, ele string) bool {
- for _, s := range set {
- if s == ele {
- return true
- }
- }
- return false
-}
-
-func appliesToUser(user user.Info, subject rbacv1.Subject, namespace string) bool {
- switch subject.Kind {
- case rbacv1.UserKind:
- return user.GetName() == subject.Name
-
- case rbacv1.GroupKind:
- return has(user.GetGroups(), subject.Name)
-
- case rbacv1.ServiceAccountKind:
- // default the namespace to namespace we're working in if its available. This allows rolebindings that reference
- // SAs in th local namespace to avoid having to qualify them.
- saNamespace := namespace
- if len(subject.Namespace) > 0 {
- saNamespace = subject.Namespace
- }
- if len(saNamespace) == 0 {
- return false
- }
- // use a more efficient comparison for RBAC checking
- return serviceaccount.MatchesUsername(saNamespace, subject.Name, user.GetName())
- default:
- return false
- }
-}
-
-// NewTestRuleResolver returns a rule resolver from lists of role objects.
-func NewTestRuleResolver(roles []*rbacv1.Role, roleBindings []*rbacv1.RoleBinding, clusterRoles []*rbacv1.ClusterRole, clusterRoleBindings []*rbacv1.ClusterRoleBinding) (AuthorizationRuleResolver, *StaticRoles) {
- r := StaticRoles{
- roles: roles,
- roleBindings: roleBindings,
- clusterRoles: clusterRoles,
- clusterRoleBindings: clusterRoleBindings,
- }
- return newMockRuleResolver(&r), &r
-}
-
-func newMockRuleResolver(r *StaticRoles) AuthorizationRuleResolver {
- return NewDefaultRuleResolver(r, r, r, r)
-}
-
-// StaticRoles is a rule resolver that resolves from lists of role objects.
-type StaticRoles struct {
- roles []*rbacv1.Role
- roleBindings []*rbacv1.RoleBinding
- clusterRoles []*rbacv1.ClusterRole
- clusterRoleBindings []*rbacv1.ClusterRoleBinding
-}
-
-func (r *StaticRoles) GetRole(ctx context.Context, namespace, name string) (*rbacv1.Role, error) {
- if len(namespace) == 0 {
- return nil, errors.New("must provide namespace when getting role")
- }
- for _, role := range r.roles {
- if role.Namespace == namespace && role.Name == name {
- return role, nil
- }
- }
- return nil, errors.New("role not found")
-}
-
-func (r *StaticRoles) GetClusterRole(ctx context.Context, name string) (*rbacv1.ClusterRole, error) {
- for _, clusterRole := range r.clusterRoles {
- if clusterRole.Name == name {
- return clusterRole, nil
- }
- }
- return nil, errors.New("clusterrole not found")
-}
-
-func (r *StaticRoles) ListRoleBindings(ctx context.Context, namespace string) ([]*rbacv1.RoleBinding, error) {
- if len(namespace) == 0 {
- return nil, errors.New("must provide namespace when listing role bindings")
- }
-
- roleBindingList := []*rbacv1.RoleBinding{}
- for _, roleBinding := range r.roleBindings {
- if roleBinding.Namespace != namespace {
- continue
- }
- // TODO(ericchiang): need to implement label selectors?
- roleBindingList = append(roleBindingList, roleBinding)
- }
- return roleBindingList, nil
-}
-
-func (r *StaticRoles) ListClusterRoleBindings(ctx context.Context) ([]*rbacv1.ClusterRoleBinding, error) {
- return r.clusterRoleBindings, nil
-}
diff --git a/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/rbac.go b/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/rbac.go
deleted file mode 100644
index 27f5946dd8..0000000000
--- a/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/rbac.go
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package rbac implements the authorizer.Authorizer interface using roles base access control.
-package rbac
-
-import (
- "bytes"
- "context"
- "fmt"
-
- "k8s.io/klog/v2"
-
- rbacv1 "k8s.io/api/rbac/v1"
- "k8s.io/apimachinery/pkg/labels"
- utilerrors "k8s.io/apimachinery/pkg/util/errors"
- "k8s.io/apiserver/pkg/authentication/user"
- "k8s.io/apiserver/pkg/authorization/authorizer"
- rbaclisters "k8s.io/client-go/listers/rbac/v1"
- rbacv1helpers "k8s.io/kubernetes/pkg/apis/rbac/v1"
- rbacregistryvalidation "k8s.io/kubernetes/pkg/registry/rbac/validation"
-)
-
-type RequestToRuleMapper interface {
- // RulesFor returns all known PolicyRules and any errors that happened while locating those rules.
- // Any rule returned is still valid, since rules are deny by default. If you can pass with the rules
- // supplied, you do not have to fail the request. If you cannot, you should indicate the error along
- // with your denial.
- RulesFor(ctx context.Context, subject user.Info, namespace string) ([]rbacv1.PolicyRule, error)
-
- // VisitRulesFor invokes visitor() with each rule that applies to a given user in a given namespace,
- // and each error encountered resolving those rules. Rule may be nil if err is non-nil.
- // If visitor() returns false, visiting is short-circuited.
- VisitRulesFor(ctx context.Context, user user.Info, namespace string, visitor func(source fmt.Stringer, rule *rbacv1.PolicyRule, err error) bool)
-}
-
-type RBACAuthorizer struct {
- authorizationRuleResolver RequestToRuleMapper
-}
-
-// authorizingVisitor short-circuits once allowed, and collects any resolution errors encountered
-type authorizingVisitor struct {
- requestAttributes authorizer.Attributes
-
- allowed bool
- reason string
- errors []error
-}
-
-func (v *authorizingVisitor) visit(source fmt.Stringer, rule *rbacv1.PolicyRule, err error) bool {
- if rule != nil && RuleAllows(v.requestAttributes, rule) {
- v.allowed = true
- v.reason = fmt.Sprintf("RBAC: allowed by %s", source.String())
- return false
- }
- if err != nil {
- v.errors = append(v.errors, err)
- }
- return true
-}
-
-func (r *RBACAuthorizer) Authorize(ctx context.Context, requestAttributes authorizer.Attributes) (authorizer.Decision, string, error) {
- ruleCheckingVisitor := &authorizingVisitor{requestAttributes: requestAttributes}
-
- r.authorizationRuleResolver.VisitRulesFor(ctx, requestAttributes.GetUser(), requestAttributes.GetNamespace(), ruleCheckingVisitor.visit)
- if ruleCheckingVisitor.allowed {
- return authorizer.DecisionAllow, ruleCheckingVisitor.reason, nil
- }
-
- // Build a detailed log of the denial.
- // Make the whole block conditional so we don't do a lot of string-building we won't use.
- if klogV := klog.V(5); klogV.Enabled() {
- var operation string
- if requestAttributes.IsResourceRequest() {
- b := &bytes.Buffer{}
- b.WriteString(`"`)
- b.WriteString(requestAttributes.GetVerb())
- b.WriteString(`" resource "`)
- b.WriteString(requestAttributes.GetResource())
- if len(requestAttributes.GetAPIGroup()) > 0 {
- b.WriteString(`.`)
- b.WriteString(requestAttributes.GetAPIGroup())
- }
- if len(requestAttributes.GetSubresource()) > 0 {
- b.WriteString(`/`)
- b.WriteString(requestAttributes.GetSubresource())
- }
- b.WriteString(`"`)
- if len(requestAttributes.GetName()) > 0 {
- b.WriteString(` named "`)
- b.WriteString(requestAttributes.GetName())
- b.WriteString(`"`)
- }
- operation = b.String()
- } else {
- operation = fmt.Sprintf("%q nonResourceURL %q", requestAttributes.GetVerb(), requestAttributes.GetPath())
- }
-
- var scope string
- if ns := requestAttributes.GetNamespace(); len(ns) > 0 {
- scope = fmt.Sprintf("in namespace %q", ns)
- } else {
- scope = "cluster-wide"
- }
-
- klogV.Infof("RBAC: no rules authorize user %q with groups %q to %s %s", requestAttributes.GetUser().GetName(), requestAttributes.GetUser().GetGroups(), operation, scope)
- }
-
- reason := ""
- if len(ruleCheckingVisitor.errors) > 0 {
- reason = fmt.Sprintf("RBAC: %v", utilerrors.NewAggregate(ruleCheckingVisitor.errors))
- }
- return authorizer.DecisionNoOpinion, reason, nil
-}
-
-func (r *RBACAuthorizer) RulesFor(ctx context.Context, user user.Info, namespace string) ([]authorizer.ResourceRuleInfo, []authorizer.NonResourceRuleInfo, bool, error) {
- var (
- resourceRules []authorizer.ResourceRuleInfo
- nonResourceRules []authorizer.NonResourceRuleInfo
- )
-
- policyRules, err := r.authorizationRuleResolver.RulesFor(ctx, user, namespace)
- for _, policyRule := range policyRules {
- if len(policyRule.Resources) > 0 {
- r := authorizer.DefaultResourceRuleInfo{
- Verbs: policyRule.Verbs,
- APIGroups: policyRule.APIGroups,
- Resources: policyRule.Resources,
- ResourceNames: policyRule.ResourceNames,
- }
- var resourceRule authorizer.ResourceRuleInfo = &r
- resourceRules = append(resourceRules, resourceRule)
- }
- if len(policyRule.NonResourceURLs) > 0 {
- r := authorizer.DefaultNonResourceRuleInfo{
- Verbs: policyRule.Verbs,
- NonResourceURLs: policyRule.NonResourceURLs,
- }
- var nonResourceRule authorizer.NonResourceRuleInfo = &r
- nonResourceRules = append(nonResourceRules, nonResourceRule)
- }
- }
- return resourceRules, nonResourceRules, false, err
-}
-
-func New(roles rbacregistryvalidation.RoleGetter, roleBindings rbacregistryvalidation.RoleBindingLister, clusterRoles rbacregistryvalidation.ClusterRoleGetter, clusterRoleBindings rbacregistryvalidation.ClusterRoleBindingLister) *RBACAuthorizer {
- authorizer := &RBACAuthorizer{
- authorizationRuleResolver: rbacregistryvalidation.NewDefaultRuleResolver(
- roles, roleBindings, clusterRoles, clusterRoleBindings,
- ),
- }
- return authorizer
-}
-
-func RulesAllow(requestAttributes authorizer.Attributes, rules ...rbacv1.PolicyRule) bool {
- for i := range rules {
- if RuleAllows(requestAttributes, &rules[i]) {
- return true
- }
- }
-
- return false
-}
-
-func RuleAllows(requestAttributes authorizer.Attributes, rule *rbacv1.PolicyRule) bool {
- if requestAttributes.IsResourceRequest() {
- combinedResource := requestAttributes.GetResource()
- if len(requestAttributes.GetSubresource()) > 0 {
- combinedResource = requestAttributes.GetResource() + "/" + requestAttributes.GetSubresource()
- }
-
- return rbacv1helpers.VerbMatches(rule, requestAttributes.GetVerb()) &&
- rbacv1helpers.APIGroupMatches(rule, requestAttributes.GetAPIGroup()) &&
- rbacv1helpers.ResourceMatches(rule, combinedResource, requestAttributes.GetSubresource()) &&
- rbacv1helpers.ResourceNameMatches(rule, requestAttributes.GetName())
- }
-
- return rbacv1helpers.VerbMatches(rule, requestAttributes.GetVerb()) &&
- rbacv1helpers.NonResourceURLMatches(rule, requestAttributes.GetPath())
-}
-
-type RoleGetter struct {
- Lister rbaclisters.RoleLister
-}
-
-func (g *RoleGetter) GetRole(ctx context.Context, namespace, name string) (*rbacv1.Role, error) {
- return g.Lister.Roles(namespace).Get(name)
-}
-
-type RoleBindingLister struct {
- Lister rbaclisters.RoleBindingLister
-}
-
-func (l *RoleBindingLister) ListRoleBindings(ctx context.Context, namespace string) ([]*rbacv1.RoleBinding, error) {
- return l.Lister.RoleBindings(namespace).List(labels.Everything())
-}
-
-type ClusterRoleGetter struct {
- Lister rbaclisters.ClusterRoleLister
-}
-
-func (g *ClusterRoleGetter) GetClusterRole(ctx context.Context, name string) (*rbacv1.ClusterRole, error) {
- return g.Lister.Get(name)
-}
-
-type ClusterRoleBindingLister struct {
- Lister rbaclisters.ClusterRoleBindingLister
-}
-
-func (l *ClusterRoleBindingLister) ListClusterRoleBindings(ctx context.Context) ([]*rbacv1.ClusterRoleBinding, error) {
- return l.Lister.List(labels.Everything())
-}
diff --git a/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/subject_locator.go b/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/subject_locator.go
deleted file mode 100644
index c4947de6a0..0000000000
--- a/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/subject_locator.go
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package rbac implements the authorizer.Authorizer interface using roles base access control.
-package rbac
-
-import (
- "context"
-
- rbacv1 "k8s.io/api/rbac/v1"
- utilerrors "k8s.io/apimachinery/pkg/util/errors"
- "k8s.io/apiserver/pkg/authentication/user"
- "k8s.io/apiserver/pkg/authorization/authorizer"
- rbacregistryvalidation "k8s.io/kubernetes/pkg/registry/rbac/validation"
-)
-
-type RoleToRuleMapper interface {
- // GetRoleReferenceRules attempts to resolve the role reference of a RoleBinding or ClusterRoleBinding. The passed namespace should be the namespace
- // of the role binding, the empty string if a cluster role binding.
- GetRoleReferenceRules(ctx context.Context, roleRef rbacv1.RoleRef, namespace string) ([]rbacv1.PolicyRule, error)
-}
-
-type SubjectLocator interface {
- AllowedSubjects(ctx context.Context, attributes authorizer.Attributes) ([]rbacv1.Subject, error)
-}
-
-var _ = SubjectLocator(&SubjectAccessEvaluator{})
-
-type SubjectAccessEvaluator struct {
- superUser string
-
- roleBindingLister rbacregistryvalidation.RoleBindingLister
- clusterRoleBindingLister rbacregistryvalidation.ClusterRoleBindingLister
- roleToRuleMapper RoleToRuleMapper
-}
-
-func NewSubjectAccessEvaluator(roles rbacregistryvalidation.RoleGetter, roleBindings rbacregistryvalidation.RoleBindingLister, clusterRoles rbacregistryvalidation.ClusterRoleGetter, clusterRoleBindings rbacregistryvalidation.ClusterRoleBindingLister, superUser string) *SubjectAccessEvaluator {
- subjectLocator := &SubjectAccessEvaluator{
- superUser: superUser,
- roleBindingLister: roleBindings,
- clusterRoleBindingLister: clusterRoleBindings,
- roleToRuleMapper: rbacregistryvalidation.NewDefaultRuleResolver(
- roles, roleBindings, clusterRoles, clusterRoleBindings,
- ),
- }
- return subjectLocator
-}
-
-// AllowedSubjects returns the subjects that can perform an action and any errors encountered while computing the list.
-// It is possible to have both subjects and errors returned if some rolebindings couldn't be resolved, but others could be.
-func (r *SubjectAccessEvaluator) AllowedSubjects(ctx context.Context, requestAttributes authorizer.Attributes) ([]rbacv1.Subject, error) {
- subjects := []rbacv1.Subject{{Kind: rbacv1.GroupKind, APIGroup: rbacv1.GroupName, Name: user.SystemPrivilegedGroup}}
- if len(r.superUser) > 0 {
- subjects = append(subjects, rbacv1.Subject{Kind: rbacv1.UserKind, APIGroup: rbacv1.GroupName, Name: r.superUser})
- }
- errorlist := []error{}
-
- if clusterRoleBindings, err := r.clusterRoleBindingLister.ListClusterRoleBindings(ctx); err != nil {
- errorlist = append(errorlist, err)
-
- } else {
- for _, clusterRoleBinding := range clusterRoleBindings {
- rules, err := r.roleToRuleMapper.GetRoleReferenceRules(ctx, clusterRoleBinding.RoleRef, "")
- if err != nil {
- // if we have an error, just keep track of it and keep processing. Since rules are additive,
- // missing a reference is bad, but we can continue with other rolebindings and still have a list
- // that does not contain any invalid values
- errorlist = append(errorlist, err)
- }
- if RulesAllow(requestAttributes, rules...) {
- subjects = append(subjects, clusterRoleBinding.Subjects...)
- }
- }
- }
-
- if namespace := requestAttributes.GetNamespace(); len(namespace) > 0 {
- if roleBindings, err := r.roleBindingLister.ListRoleBindings(ctx, namespace); err != nil {
- errorlist = append(errorlist, err)
-
- } else {
- for _, roleBinding := range roleBindings {
- rules, err := r.roleToRuleMapper.GetRoleReferenceRules(ctx, roleBinding.RoleRef, namespace)
- if err != nil {
- // if we have an error, just keep track of it and keep processing. Since rules are additive,
- // missing a reference is bad, but we can continue with other rolebindings and still have a list
- // that does not contain any invalid values
- errorlist = append(errorlist, err)
- }
- if RulesAllow(requestAttributes, rules...) {
- subjects = append(subjects, roleBinding.Subjects...)
- }
- }
- }
- }
-
- dedupedSubjects := []rbacv1.Subject{}
- for _, subject := range subjects {
- found := false
- for _, curr := range dedupedSubjects {
- if curr == subject {
- found = true
- break
- }
- }
-
- if !found {
- dedupedSubjects = append(dedupedSubjects, subject)
- }
- }
-
- return subjects, utilerrors.NewAggregate(errorlist)
-}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index a3d8bcf8fe..eead72ed7a 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -798,14 +798,10 @@ github.com/spf13/pflag
# github.com/stefanberger/go-pkcs11uri v0.0.0-20230803200340-78284954bff6
## explicit; go 1.19
github.com/stefanberger/go-pkcs11uri
-# github.com/stretchr/objx v0.5.3
-## explicit; go 1.20
-github.com/stretchr/objx
# github.com/stretchr/testify v1.11.1
## explicit; go 1.17
github.com/stretchr/testify/assert
github.com/stretchr/testify/assert/yaml
-github.com/stretchr/testify/mock
github.com/stretchr/testify/require
# github.com/ulikunitz/xz v0.5.15
## explicit; go 1.12
@@ -994,6 +990,9 @@ go.podman.io/storage/pkg/reexec
go.podman.io/storage/pkg/regexp
go.podman.io/storage/pkg/system
go.podman.io/storage/pkg/unshare
+# go.uber.org/mock v0.6.0
+## explicit; go 1.23.0
+go.uber.org/mock/gomock
# go.yaml.in/yaml/v2 v2.4.4
## explicit; go 1.15
go.yaml.in/yaml/v2
@@ -1572,11 +1571,7 @@ k8s.io/client-go/applyconfigurations/storagemigration/v1beta1
k8s.io/client-go/discovery
k8s.io/client-go/discovery/cached/disk
k8s.io/client-go/discovery/cached/memory
-k8s.io/client-go/discovery/fake
k8s.io/client-go/dynamic
-k8s.io/client-go/dynamic/dynamicinformer
-k8s.io/client-go/dynamic/dynamiclister
-k8s.io/client-go/dynamic/fake
k8s.io/client-go/features
k8s.io/client-go/gentype
k8s.io/client-go/informers
@@ -1650,114 +1645,60 @@ k8s.io/client-go/informers/storage/v1beta1
k8s.io/client-go/informers/storagemigration
k8s.io/client-go/informers/storagemigration/v1beta1
k8s.io/client-go/kubernetes
-k8s.io/client-go/kubernetes/fake
k8s.io/client-go/kubernetes/scheme
k8s.io/client-go/kubernetes/typed/admissionregistration/v1
-k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake
k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1
-k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake
k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1
-k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake
k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1
-k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/fake
k8s.io/client-go/kubernetes/typed/apps/v1
-k8s.io/client-go/kubernetes/typed/apps/v1/fake
k8s.io/client-go/kubernetes/typed/apps/v1beta1
-k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake
k8s.io/client-go/kubernetes/typed/apps/v1beta2
-k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake
k8s.io/client-go/kubernetes/typed/authentication/v1
-k8s.io/client-go/kubernetes/typed/authentication/v1/fake
k8s.io/client-go/kubernetes/typed/authentication/v1alpha1
-k8s.io/client-go/kubernetes/typed/authentication/v1alpha1/fake
k8s.io/client-go/kubernetes/typed/authentication/v1beta1
-k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake
k8s.io/client-go/kubernetes/typed/authorization/v1
-k8s.io/client-go/kubernetes/typed/authorization/v1/fake
k8s.io/client-go/kubernetes/typed/authorization/v1beta1
-k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake
k8s.io/client-go/kubernetes/typed/autoscaling/v1
-k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake
k8s.io/client-go/kubernetes/typed/autoscaling/v2
-k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake
k8s.io/client-go/kubernetes/typed/batch/v1
-k8s.io/client-go/kubernetes/typed/batch/v1/fake
k8s.io/client-go/kubernetes/typed/batch/v1beta1
-k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake
k8s.io/client-go/kubernetes/typed/certificates/v1
-k8s.io/client-go/kubernetes/typed/certificates/v1/fake
k8s.io/client-go/kubernetes/typed/certificates/v1alpha1
-k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake
k8s.io/client-go/kubernetes/typed/certificates/v1beta1
-k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake
k8s.io/client-go/kubernetes/typed/coordination/v1
-k8s.io/client-go/kubernetes/typed/coordination/v1/fake
k8s.io/client-go/kubernetes/typed/coordination/v1alpha2
-k8s.io/client-go/kubernetes/typed/coordination/v1alpha2/fake
k8s.io/client-go/kubernetes/typed/coordination/v1beta1
-k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake
k8s.io/client-go/kubernetes/typed/core/v1
-k8s.io/client-go/kubernetes/typed/core/v1/fake
k8s.io/client-go/kubernetes/typed/discovery/v1
-k8s.io/client-go/kubernetes/typed/discovery/v1/fake
k8s.io/client-go/kubernetes/typed/discovery/v1beta1
-k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake
k8s.io/client-go/kubernetes/typed/events/v1
-k8s.io/client-go/kubernetes/typed/events/v1/fake
k8s.io/client-go/kubernetes/typed/events/v1beta1
-k8s.io/client-go/kubernetes/typed/events/v1beta1/fake
k8s.io/client-go/kubernetes/typed/extensions/v1beta1
-k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake
k8s.io/client-go/kubernetes/typed/flowcontrol/v1
-k8s.io/client-go/kubernetes/typed/flowcontrol/v1/fake
k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1
-k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake
k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2
-k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/fake
k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3
-k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3/fake
k8s.io/client-go/kubernetes/typed/networking/v1
-k8s.io/client-go/kubernetes/typed/networking/v1/fake
k8s.io/client-go/kubernetes/typed/networking/v1beta1
-k8s.io/client-go/kubernetes/typed/networking/v1beta1/fake
k8s.io/client-go/kubernetes/typed/node/v1
-k8s.io/client-go/kubernetes/typed/node/v1/fake
k8s.io/client-go/kubernetes/typed/node/v1alpha1
-k8s.io/client-go/kubernetes/typed/node/v1alpha1/fake
k8s.io/client-go/kubernetes/typed/node/v1beta1
-k8s.io/client-go/kubernetes/typed/node/v1beta1/fake
k8s.io/client-go/kubernetes/typed/policy/v1
-k8s.io/client-go/kubernetes/typed/policy/v1/fake
k8s.io/client-go/kubernetes/typed/policy/v1beta1
-k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake
k8s.io/client-go/kubernetes/typed/rbac/v1
-k8s.io/client-go/kubernetes/typed/rbac/v1/fake
k8s.io/client-go/kubernetes/typed/rbac/v1alpha1
-k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake
k8s.io/client-go/kubernetes/typed/rbac/v1beta1
-k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake
k8s.io/client-go/kubernetes/typed/resource/v1
-k8s.io/client-go/kubernetes/typed/resource/v1/fake
k8s.io/client-go/kubernetes/typed/resource/v1alpha3
-k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake
k8s.io/client-go/kubernetes/typed/resource/v1beta1
-k8s.io/client-go/kubernetes/typed/resource/v1beta1/fake
k8s.io/client-go/kubernetes/typed/resource/v1beta2
-k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake
k8s.io/client-go/kubernetes/typed/scheduling/v1
-k8s.io/client-go/kubernetes/typed/scheduling/v1/fake
k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2
-k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake
k8s.io/client-go/kubernetes/typed/scheduling/v1beta1
-k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake
k8s.io/client-go/kubernetes/typed/storage/v1
-k8s.io/client-go/kubernetes/typed/storage/v1/fake
k8s.io/client-go/kubernetes/typed/storage/v1alpha1
-k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake
k8s.io/client-go/kubernetes/typed/storage/v1beta1
-k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake
k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1
-k8s.io/client-go/kubernetes/typed/storagemigration/v1beta1/fake
k8s.io/client-go/listers
k8s.io/client-go/listers/admissionregistration/v1
k8s.io/client-go/listers/admissionregistration/v1alpha1
@@ -1823,7 +1764,6 @@ k8s.io/client-go/plugin/pkg/client/auth/exec
k8s.io/client-go/plugin/pkg/client/auth/gcp
k8s.io/client-go/plugin/pkg/client/auth/oidc
k8s.io/client-go/rest
-k8s.io/client-go/rest/fake
k8s.io/client-go/rest/watch
k8s.io/client-go/restmapper
k8s.io/client-go/scale
@@ -1886,11 +1826,6 @@ k8s.io/component-base/tracing
k8s.io/component-base/tracing/api/v1
k8s.io/component-base/version
k8s.io/component-base/zpages/features
-# k8s.io/component-helpers v0.36.1 => k8s.io/component-helpers v0.36.1
-## explicit; go 1.26.0
-k8s.io/component-helpers/auth/rbac/validation
-# k8s.io/controller-manager v0.33.2 => k8s.io/controller-manager v0.36.1
-## explicit; go 1.26.0
# k8s.io/klog/v2 v2.140.0
## explicit; go 1.21
k8s.io/klog/v2
@@ -1930,13 +1865,6 @@ k8s.io/kubectl/pkg/util/openapi
k8s.io/kubectl/pkg/util/templates
k8s.io/kubectl/pkg/util/term
k8s.io/kubectl/pkg/validation
-# k8s.io/kubernetes v1.36.1 => k8s.io/kubernetes v1.36.1
-## explicit; go 1.26.0
-k8s.io/kubernetes/pkg/apis/rbac
-k8s.io/kubernetes/pkg/apis/rbac/v1
-k8s.io/kubernetes/pkg/registry/rbac
-k8s.io/kubernetes/pkg/registry/rbac/validation
-k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac
# k8s.io/streaming v0.36.1 => k8s.io/streaming v0.36.1
## explicit; go 1.26.0
k8s.io/streaming/pkg/httpstream
@@ -2194,29 +2122,8 @@ sigs.k8s.io/yaml/kyaml
# k8s.io/apiserver => k8s.io/apiserver v0.36.1
# k8s.io/cli-runtime => k8s.io/cli-runtime v0.36.1
# k8s.io/client-go => k8s.io/client-go v0.36.1
-# k8s.io/cloud-provider => k8s.io/cloud-provider v0.36.1
-# k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.36.1
-# k8s.io/code-generator => k8s.io/code-generator v0.36.1
# k8s.io/component-base => k8s.io/component-base v0.36.1
# k8s.io/component-helpers => k8s.io/component-helpers v0.36.1
# k8s.io/controller-manager => k8s.io/controller-manager v0.36.1
-# k8s.io/cri-api => k8s.io/cri-api v0.36.1
-# k8s.io/cri-client => k8s.io/cri-client v0.36.1
-# k8s.io/cri-streaming => k8s.io/cri-streaming v0.36.1
-# k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.36.1
-# k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.36.1
-# k8s.io/endpointslice => k8s.io/endpointslice v0.36.1
-# k8s.io/externaljwt => k8s.io/externaljwt v0.36.1
-# k8s.io/kms => k8s.io/kms v0.36.1
-# k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.36.1
-# k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.36.1
-# k8s.io/kube-proxy => k8s.io/kube-proxy v0.36.1
-# k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.36.1
# k8s.io/kubectl => k8s.io/kubectl v0.36.1
-# k8s.io/kubelet => k8s.io/kubelet v0.36.1
-# k8s.io/kubernetes => k8s.io/kubernetes v1.36.1
-# k8s.io/metrics => k8s.io/metrics v0.36.1
-# k8s.io/mount-utils => k8s.io/mount-utils v0.36.1
-# k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.36.1
-# k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.36.1
# k8s.io/streaming => k8s.io/streaming v0.36.1