diff --git a/Makefile b/Makefile index 054060cce64..e17b1f839ef 100644 --- a/Makefile +++ b/Makefile @@ -160,7 +160,6 @@ test-e2e-ci: ## Run the end-to-end tests (used in the CI)` .PHONY: test-book test-book: ## Run the cronjob tutorial's unit tests to make sure we don't break it cd ./docs/book/src/cronjob-tutorial/testdata/project && make test - cd ./docs/book/src/component-config-tutorial/testdata/project && make test cd ./docs/book/src/multiversion-tutorial/testdata/project && make test .PHONY: test-license diff --git a/docs/book/src/SUMMARY.md b/docs/book/src/SUMMARY.md index 4806de043f9..d4495ce7700 100644 --- a/docs/book/src/SUMMARY.md +++ b/docs/book/src/SUMMARY.md @@ -45,17 +45,6 @@ - [Deployment and Testing](./multiversion-tutorial/deployment.md) -- [Tutorial: Component Config](./component-config-tutorial/tutorial.md) - - - [Changing things up](./component-config-tutorial/api-changes.md) - - [Defining your Config](./component-config-tutorial/define-config.md) - - - [Using a custom type](./component-config-tutorial/custom-type.md) - - - [Adding a new Config Type](./component-config-tutorial/config-type.md) - - [Updating main](./component-config-tutorial/updating-main.md) - - [Defining your Custom Config](./component-config-tutorial/define-custom-config.md) - --- - [Migrations](./migrations.md) diff --git a/docs/book/src/component-config-tutorial/api-changes.md b/docs/book/src/component-config-tutorial/api-changes.md deleted file mode 100644 index cc01863346d..00000000000 --- a/docs/book/src/component-config-tutorial/api-changes.md +++ /dev/null @@ -1,148 +0,0 @@ -# Changing things up - - - -This tutorial will show you how to create a custom configuration file for your -project by modifying a project generated with the `--component-config` flag -passed to the `init` command. The full tutorial's source can be found -[here][tutorial-source]. Make sure you've gone through the [installation -steps](/quick-start.md#installation) before continuing. - -## New project: - -```bash -# we'll use a domain of tutorial.kubebuilder.io, -# so all API groups will be .tutorial.kubebuilder.io. -kubebuilder init --domain tutorial.kubebuilder.io --component-config -``` - -## Setting up an existing project - -If you've previously generated a project we can add support for parsing the -config file by making the following changes to `main.go`. - -First, add a new `flag` to specify the path that the component config file -should be loaded from. - -```go -var configFile string -flag.StringVar(&configFile, "config", "", - "The controller will load its initial configuration from this file. "+ - "Omit this flag to use the default configuration values. "+ - "Command-line flags override configuration from this file.") -``` - -Now, we can setup the `Options` struct and check if the `configFile` is set, -this allows backwards compatibility, if it's set we'll then use the `AndFrom` -function on `Options` to parse and populate the `Options` from the config. - - -```go -var err error -options := ctrl.Options{Scheme: scheme} -if configFile != "" { - options, err = options.AndFrom(ctrl.ConfigFile().AtPath(configFile)) - if err != nil { - setupLog.Error(err, "unable to load the config file") - os.Exit(1) - } -} -``` - - - -Lastly, we'll change the `NewManager` call to use the `options` variable we -defined above. - -```go -mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), options) -``` - -With that out of the way, we can get on to defining our new config! - -[tutorial-source]: https://github.com/kubernetes-sigs/kubebuilder/tree/master/docs/book/src/component-config-tutorial/testdata/project - -Create the file `/config/manager/controller_manager_config.yaml` with the following content: - -```yaml -apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 -kind: ControllerManagerConfig -health: - healthProbeBindAddress: :8081 -metrics: - bindAddress: 127.0.0.1:8080 -webhook: - port: 9443 -leaderElection: - leaderElect: true - resourceName: ecaf1259.tutorial.kubebuilder.io -# leaderElectionReleaseOnCancel defines if the leader should step down volume -# when the Manager ends. This requires the binary to immediately end when the -# Manager is stopped, otherwise, this setting is unsafe. Setting this significantly -# speeds up voluntary leader transitions as the new leader don't have to wait -# LeaseDuration time first. -# In the default scaffold provided, the program ends immediately after -# the manager stops, so would be fine to enable this option. However, -# if you are doing or is intended to do any operation such as perform cleanups -# after the manager stops then its usage might be unsafe. -# leaderElectionReleaseOnCancel: true -``` - -Update the file `/config/manager/kustomization.yaml` by adding at the bottom the following content: - -```yaml -generatorOptions: - disableNameSuffixHash: true - -configMapGenerator: -- name: manager-config - files: - - controller_manager_config.yaml -``` - -Update the file `default/kustomization.yaml` by adding under the [`patchesStrategicMerge:` key](https://kubectl.docs.kubernetes.io/references/kustomize/builtins/#_patchesstrategicmerge_) the following patch: - -```yaml -patchesStrategicMerge: -# Mount the controller config file for loading manager configurations -# through a ComponentConfig type -- manager_config_patch.yaml -``` - -Update the file `default/manager_config_patch.yaml` by adding under the `spec:` key the following patch: - -```yaml -spec: - template: - spec: - containers: - - name: manager - args: - - "--config=controller_manager_config.yaml" - volumeMounts: - - name: manager-config - mountPath: /controller_manager_config.yaml - subPath: controller_manager_config.yaml - volumes: - - name: manager-config - configMap: - name: manager-config -``` diff --git a/docs/book/src/component-config-tutorial/config-type.md b/docs/book/src/component-config-tutorial/config-type.md deleted file mode 100644 index 518f360ed81..00000000000 --- a/docs/book/src/component-config-tutorial/config-type.md +++ /dev/null @@ -1,39 +0,0 @@ -# Adding a new Config Type - - - -To scaffold out a new config Kind, we can use `kubebuilder create api`. - -```bash -kubebuilder create api --group config --version v2 --kind ProjectConfig --resource --controller=false --make=false -``` - -Then, run `make build` to implement the interface for your API type, which would generate the file `zz_generated.deepcopy.go`. - - - -This will create a new type file in `api/config/v2/` for the `ProjectConfig` -kind. We'll need to change this file to embed the -[v1alpha1.ControllerManagerConfigurationSpec](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/config/v1alpha1/#ControllerManagerConfigurationSpec) - -{{#literatego ./testdata/projectconfig_types.go}} - -Lastly, we'll change the `main.go` to reference this type for parsing the file. diff --git a/docs/book/src/component-config-tutorial/custom-type.md b/docs/book/src/component-config-tutorial/custom-type.md deleted file mode 100644 index a147b4f96a8..00000000000 --- a/docs/book/src/component-config-tutorial/custom-type.md +++ /dev/null @@ -1,31 +0,0 @@ -# Using a Custom Type - - - - - -If your project needs to accept additional non-controller runtime specific -configurations, e.g. `ClusterName`, `Region` or anything serializable into -`yaml` you can do this by using `kubebuilder` to create a new type and then -updating your `main.go` to setup the new type for parsing. - -The rest of this tutorial will walk through implementing a custom component -config type. \ No newline at end of file diff --git a/docs/book/src/component-config-tutorial/define-config.md b/docs/book/src/component-config-tutorial/define-config.md deleted file mode 100644 index c337954d9b3..00000000000 --- a/docs/book/src/component-config-tutorial/define-config.md +++ /dev/null @@ -1,24 +0,0 @@ -# Defining your Config - - - -Now that you have a component config base project we need to customize the -values that are passed into the controller, to do this we can take a look at -`config/manager/controller_manager_config.yaml`. - -{{#literatego ./testdata/controller_manager_config.yaml}} - -To see all the available fields you can look at the `v1alpha` Controller -Runtime config [ControllerManagerConfiguration][configtype] - -[configtype]: https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/config/v1alpha1#ControllerManagerConfigurationSpec \ No newline at end of file diff --git a/docs/book/src/component-config-tutorial/define-custom-config.md b/docs/book/src/component-config-tutorial/define-custom-config.md deleted file mode 100644 index 13a65f2f4c5..00000000000 --- a/docs/book/src/component-config-tutorial/define-custom-config.md +++ /dev/null @@ -1,23 +0,0 @@ -# Defining your Custom Config - - - -Now that you have a custom component config we change the -`config/manager/controller_manager_config.yaml` to use the new GVK you defined. - -{{#literatego ./testdata/project/config/manager/controller_manager_config.yaml}} - -This type uses the new `ProjectConfig` kind under the GVK -`config.tutorial.kubebuilder.io/v2`, with these custom configs we can add any -`yaml` serializable fields that your controller needs and begin to reduce the -reliance on `flags` to configure your project. \ No newline at end of file diff --git a/docs/book/src/component-config-tutorial/testdata/controller_manager_config.yaml b/docs/book/src/component-config-tutorial/testdata/controller_manager_config.yaml deleted file mode 100644 index cb5e0786bd3..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/controller_manager_config.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 -kind: ControllerManagerConfig -metrics: - bindAddress: 127.0.0.1:8080 -webhook: - port: 9443 -leaderElection: - leaderElect: true - resourceName: 80807133.tutorial.kubebuilder.io diff --git a/docs/book/src/component-config-tutorial/testdata/project/.dockerignore b/docs/book/src/component-config-tutorial/testdata/project/.dockerignore deleted file mode 100644 index a3aab7af70c..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file -# Ignore build and test binaries. -bin/ diff --git a/docs/book/src/component-config-tutorial/testdata/project/.gitignore b/docs/book/src/component-config-tutorial/testdata/project/.gitignore deleted file mode 100644 index ada68ff086c..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib -bin/* -Dockerfile.cross - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Go workspace file -go.work - -# Kubernetes Generated files - skip generated files, except for vendored files -!vendor/**/zz_generated.* - -# editor and IDE paraphernalia -.idea -.vscode -*.swp -*.swo -*~ diff --git a/docs/book/src/component-config-tutorial/testdata/project/.golangci.yml b/docs/book/src/component-config-tutorial/testdata/project/.golangci.yml deleted file mode 100644 index aed8644d11e..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/.golangci.yml +++ /dev/null @@ -1,40 +0,0 @@ -run: - deadline: 5m - allow-parallel-runners: true - -issues: - # don't skip warning about doc comments - # don't exclude the default set of lint - exclude-use-default: false - # restore some of the defaults - # (fill in the rest as needed) - exclude-rules: - - path: "api/*" - linters: - - lll - - path: "internal/*" - linters: - - dupl - - lll -linters: - disable-all: true - enable: - - dupl - - errcheck - - exportloopref - - goconst - - gocyclo - - gofmt - - goimports - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - prealloc - - staticcheck - - typecheck - - unconvert - - unparam - - unused diff --git a/docs/book/src/component-config-tutorial/testdata/project/Dockerfile b/docs/book/src/component-config-tutorial/testdata/project/Dockerfile deleted file mode 100644 index aca26f92295..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# Build the manager binary -FROM golang:1.21 AS builder -ARG TARGETOS -ARG TARGETARCH - -WORKDIR /workspace -# Copy the Go Modules manifests -COPY go.mod go.mod -COPY go.sum go.sum -# cache deps before building and copying source so that we don't need to re-download as much -# and so that source changes don't invalidate our downloaded layer -RUN go mod download - -# Copy the go source -COPY cmd/main.go cmd/main.go -COPY api/ api/ -COPY internal/controller/ internal/controller/ - -# Build -# the GOARCH has not a default value to allow the binary be built according to the host where the command -# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO -# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore, -# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. -RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go - -# Use distroless as minimal base image to package the manager binary -# Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot -WORKDIR / -COPY --from=builder /workspace/manager . -USER 65532:65532 - -ENTRYPOINT ["/manager"] diff --git a/docs/book/src/component-config-tutorial/testdata/project/PROJECT b/docs/book/src/component-config-tutorial/testdata/project/PROJECT deleted file mode 100644 index cd75b7877e6..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/PROJECT +++ /dev/null @@ -1,20 +0,0 @@ -# Code generated by tool. DO NOT EDIT. -# This file is used to track the info used to scaffold your project -# and allow the plugins properly work. -# More info: https://book.kubebuilder.io/reference/project-config.html -componentConfig: true -domain: tutorial.kubebuilder.io -layout: -- go.kubebuilder.io/v4 -projectName: project -repo: tutorial.kubebuilder.io/project -resources: -- api: - crdVersion: v1 - namespaced: true - domain: tutorial.kubebuilder.io - group: config - kind: ProjectConfig - path: tutorial.kubebuilder.io/project/api/v2 - version: v2 -version: "3" diff --git a/docs/book/src/component-config-tutorial/testdata/project/README.md b/docs/book/src/component-config-tutorial/testdata/project/README.md deleted file mode 100644 index a1c7ff7c3b3..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/README.md +++ /dev/null @@ -1,114 +0,0 @@ -# project -// TODO(user): Add simple overview of use/purpose - -## Description -// TODO(user): An in-depth paragraph about your project and overview of use - -## Getting Started - -### Prerequisites -- go version v1.21.0+ -- docker version 17.03+. -- kubectl version v1.11.3+. -- Access to a Kubernetes v1.11.3+ cluster. - -### To Deploy on the cluster -**Build and push your image to the location specified by `IMG`:** - -```sh -make docker-build docker-push IMG=/project:tag -``` - -**NOTE:** This image ought to be published in the personal registry you specified. -And it is required to have access to pull the image from the working environment. -Make sure you have the proper permission to the registry if the above commands don’t work. - -**Install the CRDs into the cluster:** - -```sh -make install -``` - -**Deploy the Manager to the cluster with the image specified by `IMG`:** - -```sh -make deploy IMG=/project:tag -``` - -> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin -privileges or be logged in as admin. - -**Create instances of your solution** -You can apply the samples (examples) from the config/sample: - -```sh -kubectl apply -k config/samples/ -``` - ->**NOTE**: Ensure that the samples has default values to test it out. - -### To Uninstall -**Delete the instances (CRs) from the cluster:** - -```sh -kubectl delete -k config/samples/ -``` - -**Delete the APIs(CRDs) from the cluster:** - -```sh -make uninstall -``` - -**UnDeploy the controller from the cluster:** - -```sh -make undeploy -``` - -## Project Distribution - -Following are the steps to build the installer and distribute this project to users. - -1. Build the installer for the image built and published in the registry: - -```sh -make build-installer IMG=/project:tag -``` - -NOTE: The makefile target mentioned above generates an 'install.yaml' -file in the dist directory. This file contains all the resources built -with Kustomize, which are necessary to install this project without -its dependencies. - -2. Using the installer - -Users can just run kubectl apply -f to install the project, i.e.: - -```sh -kubectl apply -f https://raw.githubusercontent.com//project//dist/install.yaml -``` - -## Contributing -// TODO(user): Add detailed information on how you would like others to contribute to this project - -**NOTE:** Run `make help` for more information on all potential `make` targets - -More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html) - -## License - -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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/docs/book/src/component-config-tutorial/testdata/project/api/v2/groupversion_info.go b/docs/book/src/component-config-tutorial/testdata/project/api/v2/groupversion_info.go deleted file mode 100644 index 0efc6df7993..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/api/v2/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 v2 contains API Schema definitions for the config v2 API group -// +kubebuilder:object:generate=true -// +groupName=config.tutorial.kubebuilder.io -package v2 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "config.tutorial.kubebuilder.io", Version: "v2"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/docs/book/src/component-config-tutorial/testdata/project/api/v2/projectconfig_types.go b/docs/book/src/component-config-tutorial/testdata/project/api/v2/projectconfig_types.go deleted file mode 100644 index 230f06d521b..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/api/v2/projectconfig_types.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 v2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - cfg "sigs.k8s.io/controller-runtime/pkg/config/v1alpha1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// ProjectConfigSpec defines the desired state of ProjectConfig -type ProjectConfigSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Foo is an example field of ProjectConfig. Edit projectconfig_types.go to remove/update - Foo string `json:"foo,omitempty"` -} - -// ProjectConfigStatus defines the observed state of ProjectConfig -type ProjectConfigStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file -} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status - -// ProjectConfig is the Schema for the projectconfigs API -type ProjectConfig struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ProjectConfigSpec `json:"spec,omitempty"` - Status ProjectConfigStatus `json:"status,omitempty"` - // ControllerManagerConfigurationSpec returns the configurations for controllers - cfg.ControllerManagerConfigurationSpec `json:",inline"` - - ClusterName string `json:"clusterName,omitempty"` -} - -//+kubebuilder:object:root=true - -// ProjectConfigList contains a list of ProjectConfig -type ProjectConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ProjectConfig `json:"items"` -} - -func init() { - SchemeBuilder.Register(&ProjectConfig{}, &ProjectConfigList{}) -} diff --git a/docs/book/src/component-config-tutorial/testdata/project/api/v2/zz_generated.deepcopy.go b/docs/book/src/component-config-tutorial/testdata/project/api/v2/zz_generated.deepcopy.go deleted file mode 100644 index 50259cae651..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/api/v2/zz_generated.deepcopy.go +++ /dev/null @@ -1,115 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS 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. DO NOT EDIT. - -package v2 - -import ( - 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 *ProjectConfig) DeepCopyInto(out *ProjectConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status - in.ControllerManagerConfigurationSpec.DeepCopyInto(&out.ControllerManagerConfigurationSpec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectConfig. -func (in *ProjectConfig) DeepCopy() *ProjectConfig { - if in == nil { - return nil - } - out := new(ProjectConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ProjectConfig) 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 *ProjectConfigList) DeepCopyInto(out *ProjectConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ProjectConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectConfigList. -func (in *ProjectConfigList) DeepCopy() *ProjectConfigList { - if in == nil { - return nil - } - out := new(ProjectConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ProjectConfigList) 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 *ProjectConfigSpec) DeepCopyInto(out *ProjectConfigSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectConfigSpec. -func (in *ProjectConfigSpec) DeepCopy() *ProjectConfigSpec { - if in == nil { - return nil - } - out := new(ProjectConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ProjectConfigStatus) DeepCopyInto(out *ProjectConfigStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectConfigStatus. -func (in *ProjectConfigStatus) DeepCopy() *ProjectConfigStatus { - if in == nil { - return nil - } - out := new(ProjectConfigStatus) - in.DeepCopyInto(out) - return out -} diff --git a/docs/book/src/component-config-tutorial/testdata/project/cmd/main.go b/docs/book/src/component-config-tutorial/testdata/project/cmd/main.go deleted file mode 100644 index 271dd39d46c..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/cmd/main.go +++ /dev/null @@ -1,97 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 main - -import ( - "flag" - "os" - - // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) - // to ensure that exec-entrypoint and run can make use of them. - _ "k8s.io/client-go/plugin/pkg/client/auth" - - "k8s.io/apimachinery/pkg/runtime" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - clientgoscheme "k8s.io/client-go/kubernetes/scheme" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/healthz" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - - configv2 "tutorial.kubebuilder.io/project/api/v2" - //+kubebuilder:scaffold:imports -) - -var ( - scheme = runtime.NewScheme() - setupLog = ctrl.Log.WithName("setup") -) - -func init() { - utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - - utilruntime.Must(configv2.AddToScheme(scheme)) - //+kubebuilder:scaffold:scheme -} - -func main() { - var configFile string - flag.StringVar(&configFile, "config", "", - "The controller will load its initial configuration from this file. "+ - "Omit this flag to use the default configuration values. "+ - "Command-line flags override configuration from this file.") - opts := zap.Options{ - Development: true, - } - opts.BindFlags(flag.CommandLine) - flag.Parse() - - ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) - - var err error - ctrlConfig := configv2.ProjectConfig{} - options := ctrl.Options{Scheme: scheme} - if configFile != "" { - options, err = options.AndFrom(ctrl.ConfigFile().AtPath(configFile).OfKind(&ctrlConfig)) - if err != nil { - setupLog.Error(err, "unable to load the config file") - os.Exit(1) - } - } - - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), options) - if err != nil { - setupLog.Error(err, "unable to start manager") - os.Exit(1) - } - - //+kubebuilder:scaffold:builder - - if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { - setupLog.Error(err, "unable to set up health check") - os.Exit(1) - } - if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil { - setupLog.Error(err, "unable to set up ready check") - os.Exit(1) - } - - setupLog.Info("starting manager") - if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil { - setupLog.Error(err, "problem running manager") - os.Exit(1) - } -} diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/crd/bases/config.tutorial.kubebuilder.io_projectconfigs.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/crd/bases/config.tutorial.kubebuilder.io_projectconfigs.yaml deleted file mode 100644 index ec857ee1398..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/crd/bases/config.tutorial.kubebuilder.io_projectconfigs.yaml +++ /dev/null @@ -1,218 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.14.0 - name: projectconfigs.config.tutorial.kubebuilder.io -spec: - group: config.tutorial.kubebuilder.io - names: - kind: ProjectConfig - listKind: ProjectConfigList - plural: projectconfigs - singular: projectconfig - scope: Namespaced - versions: - - name: v2 - schema: - openAPIV3Schema: - description: ProjectConfig is the Schema for the projectconfigs API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - cacheNamespace: - description: |- - CacheNamespace if specified restricts the manager's cache to watch objects in - the desired namespace Defaults to all namespaces - - - Note: If a namespace is specified, controllers can still Watch for a - cluster-scoped resource (e.g Node). For namespaced resources the cache - will only hold objects from the desired namespace. - type: string - clusterName: - type: string - controller: - description: |- - Controller contains global configuration options for controllers - registered within this manager. - properties: - cacheSyncTimeout: - description: |- - CacheSyncTimeout refers to the time limit set to wait for syncing caches. - Defaults to 2 minutes if not set. - format: int64 - type: integer - groupKindConcurrency: - additionalProperties: - type: integer - description: |- - GroupKindConcurrency is a map from a Kind to the number of concurrent reconciliation - allowed for that controller. - - - When a controller is registered within this manager using the builder utilities, - users have to specify the type the controller reconciles in the For(...) call. - If the object's kind passed matches one of the keys in this map, the concurrency - for that controller is set to the number specified. - - - The key is expected to be consistent in form with GroupKind.String(), - e.g. ReplicaSet in apps group (regardless of version) would be `ReplicaSet.apps`. - type: object - recoverPanic: - description: RecoverPanic indicates if panics should be recovered. - type: boolean - type: object - gracefulShutDown: - description: |- - GracefulShutdownTimeout is the duration given to runnable to stop before the manager actually returns on stop. - To disable graceful shutdown, set to time.Duration(0) - To use graceful shutdown without timeout, set to a negative duration, e.G. time.Duration(-1) - The graceful shutdown is skipped for safety reasons in case the leader election lease is lost. - type: string - health: - description: Health contains the controller health configuration - properties: - healthProbeBindAddress: - description: |- - HealthProbeBindAddress is the TCP address that the controller should bind to - for serving health probes - It can be set to "0" or "" to disable serving the health probe. - type: string - livenessEndpointName: - description: LivenessEndpointName, defaults to "healthz" - type: string - readinessEndpointName: - description: ReadinessEndpointName, defaults to "readyz" - type: string - type: object - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - leaderElection: - description: |- - LeaderElection is the LeaderElection config to be used when configuring - the manager.Manager leader election - properties: - leaderElect: - description: |- - leaderElect enables a leader election client to gain leadership - before executing the main loop. Enable this when running replicated - components for high availability. - type: boolean - leaseDuration: - description: |- - leaseDuration is the duration that non-leader candidates will wait - after observing a leadership renewal until attempting to acquire - leadership of a led but unrenewed leader slot. This is effectively the - maximum duration that a leader can be stopped before it is replaced - by another candidate. This is only applicable if leader election is - enabled. - type: string - renewDeadline: - description: |- - renewDeadline is the interval between attempts by the acting master to - renew a leadership slot before it stops leading. This must be less - than or equal to the lease duration. This is only applicable if leader - election is enabled. - type: string - resourceLock: - description: |- - resourceLock indicates the resource object type that will be used to lock - during leader election cycles. - type: string - resourceName: - description: |- - resourceName indicates the name of resource object that will be used to lock - during leader election cycles. - type: string - resourceNamespace: - description: |- - resourceName indicates the namespace of resource object that will be used to lock - during leader election cycles. - type: string - retryPeriod: - description: |- - retryPeriod is the duration the clients should wait between attempting - acquisition and renewal of a leadership. This is only applicable if - leader election is enabled. - type: string - required: - - leaderElect - - leaseDuration - - renewDeadline - - resourceLock - - resourceName - - resourceNamespace - - retryPeriod - type: object - metadata: - type: object - metrics: - description: Metrics contains the controller metrics configuration - properties: - bindAddress: - description: |- - BindAddress is the TCP address that the controller should bind to - for serving prometheus metrics. - It can be set to "0" to disable the metrics serving. - type: string - type: object - spec: - description: ProjectConfigSpec defines the desired state of ProjectConfig - properties: - foo: - description: Foo is an example field of ProjectConfig. Edit projectconfig_types.go - to remove/update - type: string - type: object - status: - description: ProjectConfigStatus defines the observed state of ProjectConfig - type: object - syncPeriod: - description: |- - SyncPeriod determines the minimum frequency at which watched resources are - reconciled. A lower period will correct entropy more quickly, but reduce - responsiveness to change if there are many watched resources. Change this - value only if you know what you are doing. Defaults to 10 hours if unset. - there will a 10 percent jitter between the SyncPeriod of all controllers - so that all controllers will not send list requests simultaneously. - type: string - webhook: - description: Webhook contains the controllers webhook configuration - properties: - certDir: - description: |- - CertDir is the directory that contains the server key and certificate. - if not set, webhook server would look up the server key and certificate in - {TempDir}/k8s-webhook-server/serving-certs. The server key and certificate - must be named tls.key and tls.crt, respectively. - type: string - host: - description: |- - Host is the hostname that the webhook server binds to. - It is used to set webhook.Server.Host. - type: string - port: - description: |- - Port is the port that the webhook server serves at. - It is used to set webhook.Server.Port. - type: integer - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/crd/kustomizeconfig.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/crd/kustomizeconfig.yaml deleted file mode 100644 index ec5c150a9df..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/crd/kustomizeconfig.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# This file is for teaching kustomize how to substitute name and namespace reference in CRD -nameReference: -- kind: Service - version: v1 - fieldSpecs: - - kind: CustomResourceDefinition - version: v1 - group: apiextensions.k8s.io - path: spec/conversion/webhook/clientConfig/service/name - -namespace: -- kind: CustomResourceDefinition - version: v1 - group: apiextensions.k8s.io - path: spec/conversion/webhook/clientConfig/service/namespace - create: false - -varReference: -- path: metadata/annotations diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/default/kustomization.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/default/kustomization.yaml deleted file mode 100644 index e0e588792cf..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/default/kustomization.yaml +++ /dev/null @@ -1,146 +0,0 @@ -# Adds namespace to all resources. -namespace: project-system - -# Value of this field is prepended to the -# names of all resources, e.g. a deployment named -# "wordpress" becomes "alices-wordpress". -# Note that it should also match with the prefix (text before '-') of the namespace -# field above. -namePrefix: project- - -# Labels to add to all resources and selectors. -#labels: -#- includeSelectors: true -# pairs: -# someName: someValue - -resources: -- ../crd -- ../rbac -- ../manager -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in -# crd/kustomization.yaml -#- ../webhook -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required. -#- ../certmanager -# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'. -#- ../prometheus - -patches: -# Protect the /metrics endpoint by putting it behind auth. -# If you want your controller-manager to expose the /metrics -# endpoint w/o any authn/z, please comment the following line. -- path: manager_auth_proxy_patch.yaml - -# Mount the controller config file for loading manager configurations -# through a ComponentConfig type -- path: manager_config_patch.yaml - -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in -# crd/kustomization.yaml -#- path: manager_webhook_patch.yaml - -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. -# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks. -# 'CERTMANAGER' needs to be enabled to use ca injection -#- path: webhookcainjection_patch.yaml - -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix. -# Uncomment the following replacements to add the cert-manager CA injection annotations -#replacements: -# - source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -# fieldPath: .metadata.namespace # namespace of the certificate CR -# targets: -# - select: -# kind: ValidatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 0 -# create: true -# - select: -# kind: MutatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 0 -# create: true -# - select: -# kind: CustomResourceDefinition -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 0 -# create: true -# - source: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -# fieldPath: .metadata.name -# targets: -# - select: -# kind: ValidatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 1 -# create: true -# - select: -# kind: MutatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 1 -# create: true -# - select: -# kind: CustomResourceDefinition -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 1 -# create: true -# - source: # Add cert-manager annotation to the webhook Service -# kind: Service -# version: v1 -# name: webhook-service -# fieldPath: .metadata.name # namespace of the service -# targets: -# - select: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# fieldPaths: -# - .spec.dnsNames.0 -# - .spec.dnsNames.1 -# options: -# delimiter: '.' -# index: 0 -# create: true -# - source: -# kind: Service -# version: v1 -# name: webhook-service -# fieldPath: .metadata.namespace # namespace of the service -# targets: -# - select: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# fieldPaths: -# - .spec.dnsNames.0 -# - .spec.dnsNames.1 -# options: -# delimiter: '.' -# index: 1 -# create: true diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/default/manager_config_patch.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/default/manager_config_patch.yaml deleted file mode 100644 index 6c400155cfb..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/default/manager_config_patch.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: controller-manager - namespace: system -spec: - template: - spec: - containers: - - name: manager - args: - - "--config=controller_manager_config.yaml" - volumeMounts: - - name: manager-config - mountPath: /controller_manager_config.yaml - subPath: controller_manager_config.yaml - volumes: - - name: manager-config - configMap: - name: manager-config diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/manager/controller_manager_config.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/manager/controller_manager_config.yaml deleted file mode 100644 index 1391a7ad490..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/manager/controller_manager_config.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 -kind: ControllerManagerConfig -metadata: - labels: - app.kubernetes.io/name: controllermanagerconfig - app.kubernetes.io/instance: controller-manager-configuration - app.kubernetes.io/component: manager - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize -health: - healthProbeBindAddress: :8081 -metrics: - bindAddress: 127.0.0.1:8080 -webhook: - port: 9443 -leaderElection: - leaderElect: true - resourceName: 80807133.tutorial.kubebuilder.io -clusterName: example-test diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/manager/kustomization.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/manager/kustomization.yaml deleted file mode 100644 index 2bcd3eeaa94..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/manager/kustomization.yaml +++ /dev/null @@ -1,10 +0,0 @@ -resources: -- manager.yaml - -generatorOptions: - disableNameSuffixHash: true - -configMapGenerator: -- name: manager-config - files: - - controller_manager_config.yaml diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/manager/manager.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/manager/manager.yaml deleted file mode 100644 index 7d415421f9f..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/manager/manager.yaml +++ /dev/null @@ -1,100 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - labels: - control-plane: controller-manager - app.kubernetes.io/name: namespace - app.kubernetes.io/instance: system - app.kubernetes.io/component: manager - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize - name: system ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: controller-manager - namespace: system - labels: - control-plane: controller-manager - app.kubernetes.io/name: deployment - app.kubernetes.io/instance: controller-manager - app.kubernetes.io/component: manager - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize -spec: - selector: - matchLabels: - control-plane: controller-manager - replicas: 1 - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: manager - labels: - control-plane: controller-manager - spec: - # TODO(user): Uncomment the following code to configure the nodeAffinity expression - # according to the platforms which are supported by your solution. - # It is considered best practice to support multiple architectures. You can - # build your manager image using the makefile target docker-buildx. - # affinity: - # nodeAffinity: - # requiredDuringSchedulingIgnoredDuringExecution: - # nodeSelectorTerms: - # - matchExpressions: - # - key: kubernetes.io/arch - # operator: In - # values: - # - amd64 - # - arm64 - # - ppc64le - # - s390x - # - key: kubernetes.io/os - # operator: In - # values: - # - linux - securityContext: - runAsNonRoot: true - # TODO(user): For common cases that do not require escalating privileges - # it is recommended to ensure that all your Pods/Containers are restrictive. - # More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted - # Please uncomment the following code if your project does NOT have to work on old Kubernetes - # versions < 1.19 or on vendors versions which do NOT support this field by default (i.e. Openshift < 4.11 ). - # seccompProfile: - # type: RuntimeDefault - containers: - - command: - - /manager - image: controller:latest - name: manager - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - "ALL" - livenessProbe: - httpGet: - path: /healthz - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 20 - readinessProbe: - httpGet: - path: /readyz - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 - # TODO(user): Configure the resources accordingly based on the project requirements. - # More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 10m - memory: 64Mi - serviceAccountName: controller-manager - terminationGracePeriodSeconds: 10 diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/prometheus/kustomization.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/prometheus/kustomization.yaml deleted file mode 100644 index ed137168a1d..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/prometheus/kustomization.yaml +++ /dev/null @@ -1,2 +0,0 @@ -resources: -- monitor.yaml diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/prometheus/monitor.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/prometheus/monitor.yaml deleted file mode 100644 index d67c6106f87..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/prometheus/monitor.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# Prometheus Monitor Service (Metrics) -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - labels: - control-plane: controller-manager - app.kubernetes.io/name: servicemonitor - app.kubernetes.io/instance: controller-manager-metrics-monitor - app.kubernetes.io/component: metrics - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize - name: controller-manager-metrics-monitor - namespace: system -spec: - endpoints: - - path: /metrics - port: https - scheme: https - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token - tlsConfig: - insecureSkipVerify: true - selector: - matchLabels: - control-plane: controller-manager diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/auth_proxy_client_clusterrole.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/rbac/auth_proxy_client_clusterrole.yaml deleted file mode 100644 index 500386b28f0..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/auth_proxy_client_clusterrole.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: clusterrole - app.kubernetes.io/instance: metrics-reader - app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize - name: metrics-reader -rules: -- nonResourceURLs: - - "/metrics" - verbs: - - get diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/auth_proxy_role.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/rbac/auth_proxy_role.yaml deleted file mode 100644 index 85e39513cc1..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/auth_proxy_role.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: clusterrole - app.kubernetes.io/instance: proxy-role - app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize - name: proxy-role -rules: -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/auth_proxy_role_binding.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/rbac/auth_proxy_role_binding.yaml deleted file mode 100644 index 8b5ff114fa1..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/auth_proxy_role_binding.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - app.kubernetes.io/name: clusterrolebinding - app.kubernetes.io/instance: proxy-rolebinding - app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize - name: proxy-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: proxy-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/auth_proxy_service.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/rbac/auth_proxy_service.yaml deleted file mode 100644 index f40b3d2c0bd..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/auth_proxy_service.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - control-plane: controller-manager - app.kubernetes.io/name: service - app.kubernetes.io/instance: controller-manager-metrics-service - app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize - name: controller-manager-metrics-service - namespace: system -spec: - ports: - - name: https - port: 8443 - protocol: TCP - targetPort: https - selector: - control-plane: controller-manager diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/leader_election_role.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/rbac/leader_election_role.yaml deleted file mode 100644 index 1488e1ce2fc..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/leader_election_role.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# permissions to do leader election. -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - labels: - app.kubernetes.io/name: role - app.kubernetes.io/instance: leader-election-role - app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize - name: leader-election-role -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 diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/leader_election_role_binding.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/rbac/leader_election_role_binding.yaml deleted file mode 100644 index e54e64cda0b..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/leader_election_role_binding.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - app.kubernetes.io/name: rolebinding - app.kubernetes.io/instance: leader-election-rolebinding - app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize - name: leader-election-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: leader-election-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/projectconfig_editor_role.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/rbac/projectconfig_editor_role.yaml deleted file mode 100644 index 55f1a364ea8..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/projectconfig_editor_role.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# permissions for end users to edit projectconfigs. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: clusterrole - app.kubernetes.io/instance: projectconfig-editor-role - app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize - name: projectconfig-editor-role -rules: -- apiGroups: - - config.tutorial.kubebuilder.io - resources: - - projectconfigs - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - config.tutorial.kubebuilder.io - resources: - - projectconfigs/status - verbs: - - get diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/projectconfig_viewer_role.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/rbac/projectconfig_viewer_role.yaml deleted file mode 100644 index 2c010b4fb24..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/projectconfig_viewer_role.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# permissions for end users to view projectconfigs. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: clusterrole - app.kubernetes.io/instance: projectconfig-viewer-role - app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize - name: projectconfig-viewer-role -rules: -- apiGroups: - - config.tutorial.kubebuilder.io - resources: - - projectconfigs - verbs: - - get - - list - - watch -- apiGroups: - - config.tutorial.kubebuilder.io - resources: - - projectconfigs/status - verbs: - - get diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/role.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/rbac/role.yaml deleted file mode 100644 index 9f0ce00dd55..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/role.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/name: clusterrole - app.kubernetes.io/instance: manager-role - app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize - name: manager-role -rules: -- apiGroups: [""] - resources: ["pods"] - verbs: ["get", "list", "watch"] diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/role_binding.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/rbac/role_binding.yaml deleted file mode 100644 index b8189618ab9..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/role_binding.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - app.kubernetes.io/name: clusterrolebinding - app.kubernetes.io/instance: manager-rolebinding - app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: project - app.kubernetes.io/part-of: project - app.kubernetes.io/managed-by: kustomize - name: manager-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: manager-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/service_account.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/rbac/service_account.yaml deleted file mode 100644 index 7733e7fc663..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/rbac/service_account.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - app.kubernetes.io/name: project - app.kubernetes.io/managed-by: kustomize - name: controller-manager - namespace: system diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/samples/config_v2_projectconfig.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/samples/config_v2_projectconfig.yaml deleted file mode 100644 index 4f38be2fc64..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/samples/config_v2_projectconfig.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: config.tutorial.kubebuilder.io/v2 -kind: ProjectConfig -metadata: - labels: - app.kubernetes.io/name: project - app.kubernetes.io/managed-by: kustomize - name: projectconfig-sample -spec: - # TODO(user): Add fields here diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/samples/kustomization.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/samples/kustomization.yaml deleted file mode 100644 index efa08b7bdbd..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/config/samples/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -## Append samples of your project ## -resources: -- config_v2_projectconfig.yaml -#+kubebuilder:scaffold:manifestskustomizesamples diff --git a/docs/book/src/component-config-tutorial/testdata/project/go.mod b/docs/book/src/component-config-tutorial/testdata/project/go.mod deleted file mode 100644 index 57a4550da77..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/go.mod +++ /dev/null @@ -1,73 +0,0 @@ -module tutorial.kubebuilder.io/project - -go 1.21 - -require ( - github.com/onsi/ginkgo/v2 v2.14.0 - github.com/onsi/gomega v1.30.0 - k8s.io/apimachinery v0.29.0 - k8s.io/client-go v0.29.0 - sigs.k8s.io/controller-runtime v0.17.2 -) - -require ( - github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch/v5 v5.8.0 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect - github.com/go-logr/zapr v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.3 // indirect - github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/go-cmp v0.6.0 // indirect - github.com/google/gofuzz v1.2.0 // indirect - github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/imdario/mergo v0.3.6 // indirect - github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/mailru/easyjson v0.7.7 // indirect - github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.18.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.45.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.26.0 // indirect - golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect - golang.org/x/net v0.19.0 // indirect - golang.org/x/oauth2 v0.12.0 // indirect - golang.org/x/sys v0.16.0 // indirect - golang.org/x/term v0.15.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.16.1 // indirect - gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.31.0 // indirect - gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/api v0.29.0 // indirect - k8s.io/apiextensions-apiserver v0.29.0 // indirect - k8s.io/component-base v0.29.0 // indirect - k8s.io/klog/v2 v2.110.1 // indirect - k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect - k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect - sigs.k8s.io/yaml v1.4.0 // indirect -) diff --git a/docs/book/src/component-config-tutorial/testdata/project/go.sum b/docs/book/src/component-config-tutorial/testdata/project/go.sum deleted file mode 100644 index 6963f895813..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/go.sum +++ /dev/null @@ -1,205 +0,0 @@ -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= -github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= -github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch/v5 v5.8.0 h1:lRj6N9Nci7MvzrXuX6HFzU8XjmhPiXPlsKEy1u0KQro= -github.com/evanphx/json-patch/v5 v5.8.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= -github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= -github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= -github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.14.0 h1:vSmGj2Z5YPb9JwCWT6z6ihcUvDhuXLc3sJiqd3jMKAY= -github.com/onsi/ginkgo/v2 v2.14.0/go.mod h1:JkUdW7JkN0V6rFvsHcJ478egV3XH9NxpD27Hal/PhZw= -github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= -github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= -github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= -github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -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/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.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= -go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= -golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= -golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= -golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= -gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.29.0 h1:NiCdQMY1QOp1H8lfRyeEf8eOwV6+0xA6XEE44ohDX2A= -k8s.io/api v0.29.0/go.mod h1:sdVmXoz2Bo/cb77Pxi71IPTSErEW32xa4aXwKH7gfBA= -k8s.io/apiextensions-apiserver v0.29.0 h1:0VuspFG7Hj+SxyF/Z/2T0uFbI5gb5LRgEyUVE3Q4lV0= -k8s.io/apiextensions-apiserver v0.29.0/go.mod h1:TKmpy3bTS0mr9pylH0nOt/QzQRrW7/h7yLdRForMZwc= -k8s.io/apimachinery v0.29.0 h1:+ACVktwyicPz0oc6MTMLwa2Pw3ouLAfAon1wPLtG48o= -k8s.io/apimachinery v0.29.0/go.mod h1:eVBxQ/cwiJxH58eK/jd/vAk4mrxmVlnpBH5J2GbMeis= -k8s.io/client-go v0.29.0 h1:KmlDtFcrdUzOYrBhXHgKw5ycWzc3ryPX5mQe0SkG3y8= -k8s.io/client-go v0.29.0/go.mod h1:yLkXH4HKMAywcrD82KMSmfYg2DlE8mepPR4JGSo5n38= -k8s.io/component-base v0.29.0 h1:T7rjd5wvLnPBV1vC4zWd/iWRbV8Mdxs+nGaoaFzGw3s= -k8s.io/component-base v0.29.0/go.mod h1:sADonFTQ9Zc9yFLghpDpmNXEdHyQmFIGbiuZbqAXQ1M= -k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= -k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0= -sigs.k8s.io/controller-runtime v0.17.2/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= -sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= -sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/docs/book/src/component-config-tutorial/testdata/project/hack/boilerplate.go.txt b/docs/book/src/component-config-tutorial/testdata/project/hack/boilerplate.go.txt deleted file mode 100644 index 0d32012672a..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/project/hack/boilerplate.go.txt +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright 2024 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ \ No newline at end of file diff --git a/docs/book/src/component-config-tutorial/testdata/projectconfig_types.go b/docs/book/src/component-config-tutorial/testdata/projectconfig_types.go deleted file mode 100644 index 6a4eb9bf503..00000000000 --- a/docs/book/src/component-config-tutorial/testdata/projectconfig_types.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2020 The Kubernetes authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// +kubebuilder:docs-gen:collapse=Apache License - -/* -We start out simply enough: we import the `config/v1alpha1` API group, which is -exposed through ControllerRuntime. -*/ -package v2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - cfg "sigs.k8s.io/controller-runtime/pkg/config/v1alpha1" -) - -// +kubebuilder:object:root=true - -/* -Next, we'll remove the default `ProjectConfigSpec` and `ProjectConfigList` then -we'll embed `cfg.ControllerManagerConfigurationSpec` in `ProjectConfig`. -*/ - -// ProjectConfig is the Schema for the projectconfigs API -type ProjectConfig struct { - metav1.TypeMeta `json:",inline"` - - // ControllerManagerConfigurationSpec returns the configurations for controllers - cfg.ControllerManagerConfigurationSpec `json:",inline"` - - ClusterName string `json:"clusterName,omitempty"` -} - -/* -If you haven't, you'll also need to remove the `ProjectConfigList` from the -`SchemeBuilder.Register`. -*/ -func init() { - SchemeBuilder.Register(&ProjectConfig{}) -} diff --git a/docs/book/src/component-config-tutorial/tutorial.md b/docs/book/src/component-config-tutorial/tutorial.md deleted file mode 100644 index b388f653c41..00000000000 --- a/docs/book/src/component-config-tutorial/tutorial.md +++ /dev/null @@ -1,47 +0,0 @@ -# Tutorial: ComponentConfig - - - -Nearly every project that is built for Kubernetes will eventually need to -support passing in additional configurations into the controller. These could -be to enable better logging, turn on/off specific feature gates, set the sync -period, or a myriad of other controls. Previously this was commonly done using -cli `flags` that your `main.go` would parse to make them accessible within your -program. While this _works_ it's not a future forward design and the Kubernetes -community has been migrating the core components away from this and toward -using versioned config files, referred to as "component configs". - -The rest of this tutorial will show you how to configure your kubebuilder -project with the component config type then moves on to implementing a custom -type so that you can extend this capability. - - - - -## Resources - -* [Versioned Component Configuration File Design](https://github.com/kubernetes/community/blob/master/archive/wg-component-standard/component-config/README.md) - -* [Config v1alpha1 Go Docs](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/config/v1alpha1/) diff --git a/docs/book/src/component-config-tutorial/updating-main.md b/docs/book/src/component-config-tutorial/updating-main.md deleted file mode 100644 index 64518b1f0ac..00000000000 --- a/docs/book/src/component-config-tutorial/updating-main.md +++ /dev/null @@ -1,56 +0,0 @@ -# Updating main - - - -Once you have defined your new custom component config type we need to make -sure our new config type has been imported and the types are registered with -the scheme. _If you used `kubebuilder create api` this should have been -automated._ - -```go -import ( - // ... other imports - configv2 "tutorial.kubebuilder.io/project/apis/config/v2" - // +kubebuilder:scaffold:imports -) -``` -With the package imported we can confirm the types have been added. - -```go -func init() { - // ... other scheme registrations - utilruntime.Must(configv2.AddToScheme(scheme)) - // +kubebuilder:scaffold:scheme -} -``` - -Lastly, we need to change the options parsing in -`main.go` to use this new type. To do this we'll chain `OfKind` onto -`ctrl.ConfigFile()` and pass in a pointer to the config kind. - -```go -var err error -ctrlConfig := configv2.ProjectConfig{} -options := ctrl.Options{Scheme: scheme} -if configFile != "" { - options, err = options.AndFrom(ctrl.ConfigFile().AtPath(configFile).OfKind(&ctrlConfig)) - if err != nil { - setupLog.Error(err, "unable to load the config file") - os.Exit(1) - } -} -``` - -Now if you need to use the `.clusterName` field we defined in our custom kind -you can call `ctrlConfig.ClusterName` which will be populated from the config -file supplied. \ No newline at end of file diff --git a/docs/book/src/migration/legacy/v2vsv3.md b/docs/book/src/migration/legacy/v2vsv3.md deleted file mode 100644 index ff6f891500c..00000000000 --- a/docs/book/src/migration/legacy/v2vsv3.md +++ /dev/null @@ -1,108 +0,0 @@ -# Kubebuilder v2 vs v3 (Legacy Kubebuilder v2.0.0+ layout to 3.0.0+) - -This document covers all breaking changes when migrating from v2 to v3. - -The details of all changes (breaking or otherwise) can be found in -[controller-runtime][controller-runtime], -[controller-tools][controller-tools] -and [kb-releases][kb-releases] release notes. - -## Common changes - -v3 projects use Go modules and request Go 1.18+. Dep is no longer supported for dependency management. - -## Kubebuilder - -- Preliminary support for plugins was added. For more info see the [Extensible CLI and Scaffolding Plugins: phase 1][plugins-phase1-design-doc], - the [Extensible CLI and Scaffolding Plugins: phase 1.5][plugins-phase1-design-doc-1.5] and the [Extensible CLI and Scaffolding Plugins - Phase 2][plugins-phase2-design-doc] - design docs. Also, you can check the [Plugins section][plugins-section]. - -- The `PROJECT` file now has a new layout. It stores more information about what resources are in use, to better enable plugins to make useful decisions when scaffolding. - - Furthermore, the PROJECT file itself is now versioned: the `version` field corresponds to the version of the PROJECT file itself, while the `layout` field indicates the scaffolding & primary plugin version in use. - -- The version of the image `gcr.io/kubebuilder/kube-rbac-proxy`, which is an optional component enabled by default to secure the request made against the manager, was updated from `0.5.0` to `0.11.0` to address security concerns. The details of all changes can be found in [kube-rbac-proxy][kube-rbac-proxy]. - -## TL;DR of the New `go/v3` Plugin - -***More details on this can be found at [here][kb-releases], but for the highlights, check below*** - - - -- Scaffolded/Generated API version changes: - * Use `apiextensions/v1` for generated CRDs (`apiextensions/v1beta1` was deprecated in Kubernetes `1.16`) - * Use `admissionregistration.k8s.io/v1` for generated webhooks (`admissionregistration.k8s.io/v1beta1` was deprecated in Kubernetes `1.16`) - * Use `cert-manager.io/v1` for the certificate manager when webhooks are used (`cert-manager.io/v1alpha2` was deprecated in `Cert-Manager 0.14`. More info: [CertManager v1.0 docs][cert-manager-docs]) - -- Code changes: - * The manager flags `--metrics-addr` and `enable-leader-election` now are named `--metrics-bind-address` and `--leader-elect` to be more aligned with core Kubernetes Components. More info: [#1839][issue-1893] - * Liveness and Readiness probes are now added by default using [`healthz.Ping`][healthz-ping]. - * A new option to create the projects using ComponentConfig is introduced. For more info see its [enhancement proposal][enhancement proposal] and the [Component config tutorial][component-config-tutorial] - * Manager manifests now use `SecurityContext` to address security concerns. More info: [#1637][issue-1637] -- Misc: - * Support for [controller-tools][controller-tools] `v0.9.0` (for `go/v2` it is `v0.3.0` and previously it was `v0.2.5`) - * Support for [controller-runtime][controller-runtime] `v0.12.1` (for `go/v2` it is `v0.6.4` and previously it was `v0.5.0`) - * Support for [kustomize][kustomize] `v3.8.7` (for `go/v2` it is `v3.5.4` and previously it was `v3.1.0`) - * Required Envtest binaries are automatically downloaded - * The minimum Go version is now `1.18` (previously it was `1.13`). - - - -## Migrating to Kubebuilder v3 - -So you want to upgrade your scaffolding to use the latest and greatest features then, follow up the following guide which will cover the steps in the most straightforward way to allow you to upgrade your project to get all latest changes and improvements. - - - -- [Migration Guide v2 to V3][migration-guide-v2-to-v3] **(Recommended)** - -### By updating the files manually - -So you want to use the latest version of Kubebuilder CLI without changing your scaffolding then, check the following guide which will describe the manually steps required for you to upgrade only your PROJECT version and starts to use the plugins versions. - -This way is more complex, susceptible to errors, and success cannot be assured. Also, by following these steps you will not get the improvements and bug fixes in the default generated project files. - -You will check that you can still using the previous layout by using the `go/v2` plugin which will not upgrade the [controller-runtime][controller-runtime] and [controller-tools][controller-tools] to the latest version used with `go/v3` becuase of its breaking changes. By checking this guide you know also how to manually change the files to use the `go/v3` plugin and its dependencies versions. - -- [Migrating to Kubebuilder v3 by updating the files manually][manually-upgrade] - -[plugins-phase1-design-doc]: https://github.com/kubernetes-sigs/kubebuilder/blob/master/designs/extensible-cli-and-scaffolding-plugins-phase-1.md -[plugins-phase1-design-doc-1.5]: https://github.com/kubernetes-sigs/kubebuilder/blob/master/designs/extensible-cli-and-scaffolding-plugins-phase-1-5.md -[plugins-phase2-design-doc]: https://github.com/kubernetes-sigs/kubebuilder/blob/master/designs/extensible-cli-and-scaffolding-plugins-phase-2.md -[plugins-section]: ./../../plugins/plugins.md -[manually-upgrade]: manually_migration_guide_v2_v3.md -[component-config-tutorial]: ../../component-config-tutorial/tutorial.md -[issue-1893]: https://github.com/kubernetes-sigs/kubebuilder/issues/1839 -[migration-guide-v2-to-v3]: migration_guide_v2tov3.md -[healthz-ping]: https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/healthz#CheckHandler -[controller-runtime]: https://github.com/kubernetes-sigs/controller-runtime/releases -[controller-tools]: https://github.com/kubernetes-sigs/controller-tools/releases -[kustomize]: https://github.com/kubernetes-sigs/kustomize/releases -[issue-1637]: https://github.com/kubernetes-sigs/kubebuilder/issues/1637 -[enhancement proposal]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/wgs -[cert-manager-docs]: https://cert-manager.io/docs/installation/upgrading/ -[kb-releases]: https://github.com/kubernetes-sigs/kubebuilder/releases -[kube-rbac-proxy]: https://github.com/brancz/kube-rbac-proxy/releases -[basic-project-doc]: ../../cronjob-tutorial/basic-project.md -[kustomize]: https://github.com/kubernetes-sigs/kustomize \ No newline at end of file diff --git a/docs/book/src/plugins/testing-plugins.md b/docs/book/src/plugins/testing-plugins.md index 904039e9859..0758146f1e3 100644 --- a/docs/book/src/plugins/testing-plugins.md +++ b/docs/book/src/plugins/testing-plugins.md @@ -52,7 +52,6 @@ Following is a general workflow to create a sample by the plugin `go/v3`: (`kbc` "--project-version", "3", "--domain", kbc.Domain, "--fetch-deps=false", - "--component-config=true", ) ExpectWithOffset(1, err).NotTo(HaveOccurred()) ``` diff --git a/hack/docs/generate.sh b/hack/docs/generate.sh index b51b7811cbb..5ff7b1c916f 100755 --- a/hack/docs/generate.sh +++ b/hack/docs/generate.sh @@ -19,7 +19,6 @@ source "$(dirname "$0")/../../test/common.sh" build_kb # ensure that destroy succeed -chmod -R +w docs/book/src/component-config-tutorial/testdata/project/ chmod -R +w docs/book/src/cronjob-tutorial/testdata/project/ docs_gen_directory="$(dirname "$0")/../../hack/docs/generate_samples.go" diff --git a/hack/docs/generate_samples.go b/hack/docs/generate_samples.go index 39d1c6c04d0..720a5b9f947 100644 --- a/hack/docs/generate_samples.go +++ b/hack/docs/generate_samples.go @@ -19,7 +19,6 @@ package main import ( log "github.com/sirupsen/logrus" - componentconfig "sigs.k8s.io/kubebuilder/v3/hack/docs/internal/component-config-tutorial" cronjob "sigs.k8s.io/kubebuilder/v3/hack/docs/internal/cronjob-tutorial" gettingstarted "sigs.k8s.io/kubebuilder/v3/hack/docs/internal/getting-started" ) @@ -39,9 +38,8 @@ func main() { // TODO: Generate multiversion-tutorial tutorials := map[string]generator{ - "component-config": UpdateComponentConfigTutorial, - "cronjob": UpdateCronjobTutorial, - "getting-started": UpdateGettingStarted, + "cronjob": UpdateCronjobTutorial, + "getting-started": UpdateGettingStarted, } log.SetFormatter(&log.TextFormatter{DisableTimestamp: true}) @@ -60,12 +58,6 @@ func updateTutorial(generator tutorial_generator) { generator.CodeGen() } -func UpdateComponentConfigTutorial() { - samplePath := "docs/book/src/component-config-tutorial/testdata/project/" - sp := componentconfig.NewSample(KubebuilderBinName, samplePath) - updateTutorial(&sp) -} - func UpdateCronjobTutorial() { samplePath := "docs/book/src/cronjob-tutorial/testdata/project/" sp := cronjob.NewSample(KubebuilderBinName, samplePath) diff --git a/pkg/config/interface.go b/pkg/config/interface.go index e7659e80a15..8d14d8d3d34 100644 --- a/pkg/config/interface.go +++ b/pkg/config/interface.go @@ -62,16 +62,6 @@ type Config interface { // ClearMultiGroup disables multi-group. ClearMultiGroup() error - // IsComponentConfig checks if component config is enabled. - // This method was introduced in project version 3. - IsComponentConfig() bool - // SetComponentConfig enables component config. - // This method was introduced in project version 3. - SetComponentConfig() error - // ClearComponentConfig disables component config. - // This method was introduced in project version 3. - ClearComponentConfig() error - /* Resources */ // ResourcesLength returns the number of tracked resources. diff --git a/pkg/config/v2/config.go b/pkg/config/v2/config.go index f00e5fa643d..09e61e35e27 100644 --- a/pkg/config/v2/config.go +++ b/pkg/config/v2/config.go @@ -123,27 +123,6 @@ func (c *cfg) ClearMultiGroup() error { return nil } -// IsComponentConfig implements config.Config -func (c cfg) IsComponentConfig() bool { - return false -} - -// SetComponentConfig implements config.Config -func (c *cfg) SetComponentConfig() error { - return config.UnsupportedFieldError{ - Version: Version, - Field: "component config", - } -} - -// ClearComponentConfig implements config.Config -func (c *cfg) ClearComponentConfig() error { - return config.UnsupportedFieldError{ - Version: Version, - Field: "component config", - } -} - // ResourcesLength implements config.Config func (c cfg) ResourcesLength() int { return len(c.Gvks) diff --git a/pkg/config/v2/config_test.go b/pkg/config/v2/config_test.go index d9cf965a50d..7222a421438 100644 --- a/pkg/config/v2/config_test.go +++ b/pkg/config/v2/config_test.go @@ -122,20 +122,6 @@ var _ = Describe("cfg", func() { }) }) - Context("Component config", func() { - It("IsComponentConfig should return false", func() { - Expect(c.IsComponentConfig()).To(BeFalse()) - }) - - It("SetComponentConfig should fail to enable component config support", func() { - Expect(c.SetComponentConfig()).NotTo(Succeed()) - }) - - It("ClearComponentConfig should fail to disable component config support", func() { - Expect(c.ClearComponentConfig()).NotTo(Succeed()) - }) - }) - Context("Resources", func() { res := resource.Resource{ GVK: resource.GVK{ diff --git a/pkg/config/v3/config.go b/pkg/config/v3/config.go index 58f2eda3d47..77c416a5a7d 100644 --- a/pkg/config/v3/config.go +++ b/pkg/config/v3/config.go @@ -63,8 +63,7 @@ type Cfg struct { PluginChain stringSlice `json:"layout,omitempty"` // Boolean fields - MultiGroup bool `json:"multigroup,omitempty"` - ComponentConfig bool `json:"componentConfig,omitempty"` + MultiGroup bool `json:"multigroup,omitempty"` // Resources Resources []resource.Resource `json:"resources,omitempty"` @@ -154,23 +153,6 @@ func (c *Cfg) ClearMultiGroup() error { return nil } -// IsComponentConfig implements config.Config -func (c Cfg) IsComponentConfig() bool { - return c.ComponentConfig -} - -// SetComponentConfig implements config.Config -func (c *Cfg) SetComponentConfig() error { - c.ComponentConfig = true - return nil -} - -// ClearComponentConfig implements config.Config -func (c *Cfg) ClearComponentConfig() error { - c.ComponentConfig = false - return nil -} - // ResourcesLength implements config.Config func (c Cfg) ResourcesLength() int { return len(c.Resources) diff --git a/pkg/config/v3/config_test.go b/pkg/config/v3/config_test.go index e3cc7859534..6de6f3b1d7a 100644 --- a/pkg/config/v3/config_test.go +++ b/pkg/config/v3/config_test.go @@ -136,28 +136,6 @@ var _ = Describe("Cfg", func() { }) }) - Context("Component config", func() { - It("IsComponentConfig should return false if not set", func() { - Expect(c.IsComponentConfig()).To(BeFalse()) - }) - - It("IsComponentConfig should return true if set", func() { - c.ComponentConfig = true - Expect(c.IsComponentConfig()).To(BeTrue()) - }) - - It("SetComponentConfig should fail to enable component config support", func() { - Expect(c.SetComponentConfig()).To(Succeed()) - Expect(c.ComponentConfig).To(BeTrue()) - }) - - It("ClearComponentConfig should fail to disable component config support", func() { - c.ComponentConfig = false - Expect(c.ClearComponentConfig()).To(Succeed()) - Expect(c.ComponentConfig).To(BeFalse()) - }) - }) - Context("Resources", func() { var ( res = resource.Resource{ @@ -465,13 +443,12 @@ var _ = Describe("Cfg", func() { PluginChain: pluginChain, } c2 = Cfg{ - Version: Version, - Domain: otherDomain, - Repository: otherRepo, - Name: otherName, - PluginChain: otherPluginChain, - MultiGroup: true, - ComponentConfig: true, + Version: Version, + Domain: otherDomain, + Repository: otherRepo, + Name: otherName, + PluginChain: otherPluginChain, + MultiGroup: true, Resources: []resource.Resource{ { GVK: resource.GVK{ @@ -544,8 +521,7 @@ projectName: ProjectName repo: myrepo version: "3" ` - s2 = `componentConfig: true -domain: other.domain + s2 = `domain: other.domain layout: - go.kubebuilder.io/v3 multigroup: true @@ -612,7 +588,6 @@ version: "3" Expect(unmarshalled.Name).To(Equal(c.Name)) Expect(unmarshalled.PluginChain).To(Equal(c.PluginChain)) Expect(unmarshalled.MultiGroup).To(Equal(c.MultiGroup)) - Expect(unmarshalled.ComponentConfig).To(Equal(c.ComponentConfig)) Expect(unmarshalled.Resources).To(Equal(c.Resources)) Expect(unmarshalled.Plugins).To(HaveLen(len(c.Plugins))) // TODO: fully test Plugins field and not on its length diff --git a/pkg/machinery/injector.go b/pkg/machinery/injector.go index cbce1a05cfc..9fedfa13fc8 100644 --- a/pkg/machinery/injector.go +++ b/pkg/machinery/injector.go @@ -49,9 +49,6 @@ func (i injector) injectInto(builder Builder) { if builderWithMultiGroup, hasMultiGroup := builder.(HasMultiGroup); hasMultiGroup { builderWithMultiGroup.InjectMultiGroup(i.config.IsMultiGroup()) } - if builderWithComponentConfig, hasComponentConfig := builder.(HasComponentConfig); hasComponentConfig { - builderWithComponentConfig.InjectComponentConfig(i.config.IsComponentConfig()) - } } // Inject boilerplate if builderWithBoilerplate, hasBoilerplate := builder.(HasBoilerplate); hasBoilerplate { diff --git a/pkg/machinery/injector_test.go b/pkg/machinery/injector_test.go index c834f76d40a..47b6cbe00c4 100644 --- a/pkg/machinery/injector_test.go +++ b/pkg/machinery/injector_test.go @@ -76,15 +76,6 @@ func (t *templateWithMultiGroup) InjectMultiGroup(multiGroup bool) { t.multiGroup = multiGroup } -type templateWithComponentConfig struct { - templateBase - componentConfig bool -} - -func (t *templateWithComponentConfig) InjectComponentConfig(componentConfig bool) { - t.componentConfig = componentConfig -} - type templateWithBoilerplate struct { templateBase boilerplate string @@ -219,31 +210,6 @@ var _ = Describe("injector", func() { Expect(template.multiGroup).To(BeTrue()) }) }) - - Context("Component config", func() { - var template *templateWithComponentConfig - - BeforeEach(func() { - template = &templateWithComponentConfig{templateBase: tmp} - }) - - It("should not inject anything if the config is nil", func() { - injector{}.injectInto(template) - Expect(template.componentConfig).To(BeFalse()) - }) - - It("should not set the flag if the config doesn't have the component config flag set", func() { - injector{config: c}.injectInto(template) - Expect(template.componentConfig).To(BeFalse()) - }) - - It("should set the flag if the config has the component config flag set", func() { - Expect(c.SetComponentConfig()).To(Succeed()) - - injector{config: c}.injectInto(template) - Expect(template.componentConfig).To(BeTrue()) - }) - }) }) Context("Boilerplate", func() { diff --git a/pkg/machinery/interfaces.go b/pkg/machinery/interfaces.go index cf28d9c8fb6..56597579804 100644 --- a/pkg/machinery/interfaces.go +++ b/pkg/machinery/interfaces.go @@ -83,20 +83,6 @@ type HasMultiGroup interface { InjectMultiGroup(bool) } -// Deprecated: The ComponentConfig has been deprecated in the Controller-Runtime since its version 0.15.0. -// Fur further information see: https://github.com/kubernetes-sigs/controller-runtime/issues/895 -// Moreover, it has undergone breaking changes and is no longer functioning as intended. -// As a result, Kubebuilder, which heavily relies on the Controller Runtime, has also deprecated this feature, -// no longer guaranteeing its functionality from version 3.11.0 onwards. -// -// Please, be aware that it will force Kubebuilder remove this option soon in future release. -// -// HasComponentConfig allows the component-config flag to be used on a template -type HasComponentConfig interface { - // InjectComponentConfig sets the template component-config flag - InjectComponentConfig(bool) -} - // HasBoilerplate allows a boilerplate to be used on a template type HasBoilerplate interface { // InjectBoilerplate sets the template boilerplate diff --git a/pkg/machinery/mixins.go b/pkg/machinery/mixins.go index a4045f56e52..cd1339a2f4b 100644 --- a/pkg/machinery/mixins.go +++ b/pkg/machinery/mixins.go @@ -129,25 +129,6 @@ func (m *MultiGroupMixin) InjectMultiGroup(flag bool) { m.MultiGroup = flag } -// Deprecated: The ComponentConfig has been deprecated in the Controller-Runtime since its version 0.15.0. -// Fur further information see: https://github.com/kubernetes-sigs/controller-runtime/issues/895 -// Moreover, it has undergone breaking changes and is no longer functioning as intended. -// As a result, Kubebuilder, which heavily relies on the Controller Runtime, has also deprecated this feature, -// no longer guaranteeing its functionality from version 3.11.0 onwards. -// -// Please, be aware that it will force Kubebuilder remove this option soon in future release. -// -// ComponentConfigMixin provides templates with a injectable component-config flag field -type ComponentConfigMixin struct { - // ComponentConfig is the component-config flag - ComponentConfig bool -} - -// InjectComponentConfig implements HasComponentConfig -func (m *ComponentConfigMixin) InjectComponentConfig(flag bool) { - m.ComponentConfig = flag -} - // BoilerplateMixin provides templates with a injectable boilerplate field type BoilerplateMixin struct { // Boilerplate is the contents of a Boilerplate go header file diff --git a/pkg/machinery/mixins_test.go b/pkg/machinery/mixins_test.go index a5af0f0b466..fa46497318c 100644 --- a/pkg/machinery/mixins_test.go +++ b/pkg/machinery/mixins_test.go @@ -31,7 +31,6 @@ type mockTemplate struct { RepositoryMixin ProjectNameMixin MultiGroupMixin - ComponentConfigMixin BoilerplateMixin ResourceMixin } @@ -147,17 +146,6 @@ var _ = Describe("MultiGroupMixin", func() { }) }) -var _ = Describe("ComponentConfigMixin", func() { - tmp := mockTemplate{} - - Context("InjectComponentConfig", func() { - It("should inject the provided component config flag", func() { - tmp.InjectComponentConfig(true) - Expect(tmp.ComponentConfig).To(BeTrue()) - }) - }) -}) - var _ = Describe("BoilerplateMixin", func() { const boilerplate = "Copyright" diff --git a/pkg/plugins/common/kustomize/v1/init.go b/pkg/plugins/common/kustomize/v1/init.go index 825d32e1583..251a7561374 100644 --- a/pkg/plugins/common/kustomize/v1/init.go +++ b/pkg/plugins/common/kustomize/v1/init.go @@ -45,9 +45,8 @@ type initSubcommand struct { config config.Config // config options - domain string - name string - componentConfig bool + domain string + name string } func (p *initSubcommand) UpdateMetadata(cliMeta plugin.CLIMetadata, subcmdMeta *plugin.SubcommandMetadata) { @@ -73,8 +72,6 @@ More info: https://github.com/kubernetes-sigs/kustomize/issues/4612. func (p *initSubcommand) BindFlags(fs *pflag.FlagSet) { fs.StringVar(&p.domain, "domain", "my.domain", "domain for groups") fs.StringVar(&p.name, "project-name", "", "name of this project") - fs.BoolVar(&p.componentConfig, "component-config", false, - "create a versioned ComponentConfig file, may be 'true' or 'false'") } func (p *initSubcommand) InjectConfig(c config.Config) error { @@ -100,12 +97,6 @@ func (p *initSubcommand) InjectConfig(c config.Config) error { return err } - if p.componentConfig { - if err := p.config.SetComponentConfig(); err != nil { - return err - } - } - return nil } diff --git a/pkg/plugins/common/kustomize/v1/scaffolds/init.go b/pkg/plugins/common/kustomize/v1/scaffolds/init.go index c4c0227fcc5..2a160fc1480 100644 --- a/pkg/plugins/common/kustomize/v1/scaffolds/init.go +++ b/pkg/plugins/common/kustomize/v1/scaffolds/init.go @@ -81,9 +81,5 @@ func (s *initScaffolder) Scaffold() error { &prometheus.Monitor{}, } - if s.config.IsComponentConfig() { - templates = append(templates, &manager.ControllerManagerConfig{}) - } - return scaffold.Execute(templates...) } diff --git a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/kdefault/kustomization.go b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/kdefault/kustomization.go index dac2814a2e8..d27fd978e01 100644 --- a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/kdefault/kustomization.go +++ b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/kdefault/kustomization.go @@ -28,7 +28,6 @@ var _ machinery.Template = &Kustomization{} type Kustomization struct { machinery.TemplateMixin machinery.ProjectNameMixin - machinery.ComponentConfigMixin } // SetTemplateDefaults implements file.Template @@ -76,11 +75,6 @@ patchesStrategicMerge: # endpoint w/o any authn/z, please comment the following line. - manager_auth_proxy_patch.yaml -{{ if .ComponentConfig }} -# Mount the controller config file for loading manager configurations -# through a ComponentConfig type -- manager_config_patch.yaml{{ end }} - # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in # crd/kustomization.yaml #- manager_webhook_patch.yaml diff --git a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/kdefault/manager_auth_proxy_patch.go b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/kdefault/manager_auth_proxy_patch.go index 4e28d35772b..921499e214e 100644 --- a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/kdefault/manager_auth_proxy_patch.go +++ b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/kdefault/manager_auth_proxy_patch.go @@ -27,7 +27,6 @@ var _ machinery.Template = &ManagerAuthProxyPatch{} // ManagerAuthProxyPatch scaffolds a file that defines the patch that enables prometheus metrics for the manager type ManagerAuthProxyPatch struct { machinery.TemplateMixin - machinery.ComponentConfigMixin } // SetTemplateDefaults implements file.Template @@ -77,11 +76,9 @@ spec: requests: cpu: 5m memory: 64Mi -{{- if not .ComponentConfig }} - name: manager args: - "--health-probe-bind-address=:8081" - "--metrics-bind-address=127.0.0.1:8080" - "--leader-elect" -{{- end }} ` diff --git a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/kdefault/manager_config_patch.go b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/kdefault/manager_config_patch.go index bf7fce47d95..34395fdffc6 100644 --- a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/kdefault/manager_config_patch.go +++ b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/kdefault/manager_config_patch.go @@ -27,7 +27,6 @@ var _ machinery.Template = &ManagerConfigPatch{} // ManagerConfigPatch scaffolds a ManagerConfigPatch for a Resource type ManagerConfigPatch struct { machinery.TemplateMixin - machinery.ComponentConfigMixin } // SetTemplateDefaults implements input.Template @@ -51,16 +50,4 @@ spec: spec: containers: - name: manager -{{- if .ComponentConfig }} - args: - - "--config=controller_manager_config.yaml" - volumeMounts: - - name: manager-config - mountPath: /controller_manager_config.yaml - subPath: controller_manager_config.yaml - volumes: - - name: manager-config - configMap: - name: manager-config -{{- end }} ` diff --git a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/manager/config.go b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/manager/config.go index 0a471835d65..e200440fe5d 100644 --- a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/manager/config.go +++ b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/manager/config.go @@ -27,7 +27,6 @@ var _ machinery.Template = &Config{} // Config scaffolds a file that defines the namespace and the manager deployment type Config struct { machinery.TemplateMixin - machinery.ComponentConfigMixin machinery.ProjectNameMixin // Image is controller manager image name @@ -115,10 +114,8 @@ spec: containers: - command: - /manager -{{- if not .ComponentConfig }} args: - --leader-elect -{{- end }} image: {{ .Image }} name: manager securityContext: diff --git a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/manager/controller_manager_config.go b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/manager/controller_manager_config.go deleted file mode 100644 index 31735256005..00000000000 --- a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/manager/controller_manager_config.go +++ /dev/null @@ -1,77 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 manager - -import ( - "path/filepath" - - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &ControllerManagerConfig{} - -// ControllerManagerConfig scaffolds the config file in config/manager folder. -type ControllerManagerConfig struct { - machinery.TemplateMixin - machinery.DomainMixin - machinery.RepositoryMixin - machinery.ProjectNameMixin -} - -// SetTemplateDefaults implements input.Template -func (f *ControllerManagerConfig) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = filepath.Join("config", "manager", "controller_manager_config.yaml") - } - - f.TemplateBody = controllerManagerConfigTemplate - - f.IfExistsAction = machinery.Error - - return nil -} - -const controllerManagerConfigTemplate = `apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 -kind: ControllerManagerConfig -metadata: - labels: - app.kubernetes.io/name: controllermanagerconfig - app.kubernetes.io/instance: controller-manager-configuration - app.kubernetes.io/component: manager - app.kubernetes.io/created-by: {{ .ProjectName }} - app.kubernetes.io/part-of: {{ .ProjectName }} - app.kubernetes.io/managed-by: kustomize -health: - healthProbeBindAddress: :8081 -metrics: - bindAddress: 127.0.0.1:8080 -webhook: - port: 9443 -leaderElection: - leaderElect: true - resourceName: {{ hashFNV .Repo }}.{{ .Domain }} -# leaderElectionReleaseOnCancel defines if the leader should step down volume -# when the Manager ends. This requires the binary to immediately end when the -# Manager is stopped, otherwise, this setting is unsafe. Setting this significantly -# speeds up voluntary leader transitions as the new leader don't have to wait -# LeaseDuration time first. -# In the default scaffold provided, the program ends immediately after -# the manager stops, so would be fine to enable this option. However, -# if you are doing or is intended to do any operation such as perform cleanups -# after the manager stops then its usage might be unsafe. -# leaderElectionReleaseOnCancel: true -` diff --git a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/manager/kustomization.go b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/manager/kustomization.go index 1faa0750c30..dcc5157905f 100644 --- a/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/manager/kustomization.go +++ b/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/manager/kustomization.go @@ -27,7 +27,6 @@ var _ machinery.Template = &Kustomization{} // Kustomization scaffolds a file that defines the kustomization scheme for the manager folder type Kustomization struct { machinery.TemplateMixin - machinery.ComponentConfigMixin } // SetTemplateDefaults implements file.Template @@ -45,15 +44,4 @@ func (f *Kustomization) SetTemplateDefaults() error { const kustomizeManagerTemplate = `resources: - manager.yaml - -{{- if .ComponentConfig }} - -generatorOptions: - disableNameSuffixHash: true - -configMapGenerator: -- name: manager-config - files: - - controller_manager_config.yaml -{{- end }} ` diff --git a/pkg/plugins/common/kustomize/v2/init.go b/pkg/plugins/common/kustomize/v2/init.go index fbe022ce016..297fb36e37a 100644 --- a/pkg/plugins/common/kustomize/v2/init.go +++ b/pkg/plugins/common/kustomize/v2/init.go @@ -37,9 +37,8 @@ type initSubcommand struct { config config.Config // config options - domain string - name string - componentConfig bool + domain string + name string } func (p *initSubcommand) UpdateMetadata(cliMeta plugin.CLIMetadata, subcmdMeta *plugin.SubcommandMetadata) { @@ -60,13 +59,6 @@ NOTE: This plugin requires kustomize version v5 and kubectl >= 1.22. func (p *initSubcommand) BindFlags(fs *pflag.FlagSet) { fs.StringVar(&p.domain, "domain", "my.domain", "domain for groups") fs.StringVar(&p.name, "project-name", "", "name of this project") - fs.BoolVar(&p.componentConfig, "component-config", false, - "create a versioned ComponentConfig file, may be 'true' or 'false'") - _ = fs.MarkDeprecated("component-config", "the ComponentConfig has been deprecated in the "+ - "Controller-Runtime since its version 0.15.0. Moreover, it has undergone breaking changes and is no longer "+ - "functioning as intended. As a result, this tool, which heavily relies on the Controller Runtime, "+ - "has also deprecated this feature, no longer guaranteeing its functionality from version 3.11.0 onwards. "+ - "You can find additional details on https://github.com/kubernetes-sigs/controller-runtime/issues/895.") } func (p *initSubcommand) InjectConfig(c config.Config) error { @@ -92,12 +84,6 @@ func (p *initSubcommand) InjectConfig(c config.Config) error { return err } - if p.componentConfig { - if err := p.config.SetComponentConfig(); err != nil { - return err - } - } - return nil } diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/init.go b/pkg/plugins/common/kustomize/v2/scaffolds/init.go index baea4bb55c6..30038a67a9c 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/init.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/init.go @@ -84,9 +84,5 @@ func (s *initScaffolder) Scaffold() error { &prometheus.Monitor{}, } - if s.config.IsComponentConfig() { - templates = append(templates, &manager.ControllerManagerConfig{}) - } - return scaffold.Execute(templates...) } diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/kustomization.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/kustomization.go index 319bcf1a6b3..9711f6d2045 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/kustomization.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/kustomization.go @@ -28,7 +28,6 @@ var _ machinery.Template = &Kustomization{} type Kustomization struct { machinery.TemplateMixin machinery.ProjectNameMixin - machinery.ComponentConfigMixin } // SetTemplateDefaults implements file.Template @@ -78,13 +77,6 @@ patches: # endpoint w/o any authn/z, please comment the following line. - path: manager_auth_proxy_patch.yaml -{{ if .ComponentConfig -}} -# Mount the controller config file for loading manager configurations -# through a ComponentConfig type -- path: manager_config_patch.yaml - -{{ end -}} - # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in # crd/kustomization.yaml #- path: manager_webhook_patch.yaml diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/manager_auth_proxy_patch.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/manager_auth_proxy_patch.go index d8d57261952..f8967a487df 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/manager_auth_proxy_patch.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/manager_auth_proxy_patch.go @@ -27,7 +27,6 @@ var _ machinery.Template = &ManagerAuthProxyPatch{} // ManagerAuthProxyPatch scaffolds a file that defines the patch that enables prometheus metrics for the manager type ManagerAuthProxyPatch struct { machinery.TemplateMixin - machinery.ComponentConfigMixin } // SetTemplateDefaults implements file.Template @@ -77,11 +76,9 @@ spec: requests: cpu: 5m memory: 64Mi -{{- if not .ComponentConfig }} - name: manager args: - "--health-probe-bind-address=:8081" - "--metrics-bind-address=127.0.0.1:8080" - "--leader-elect" -{{- end }} ` diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/manager_config_patch.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/manager_config_patch.go index bf7fce47d95..34395fdffc6 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/manager_config_patch.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/manager_config_patch.go @@ -27,7 +27,6 @@ var _ machinery.Template = &ManagerConfigPatch{} // ManagerConfigPatch scaffolds a ManagerConfigPatch for a Resource type ManagerConfigPatch struct { machinery.TemplateMixin - machinery.ComponentConfigMixin } // SetTemplateDefaults implements input.Template @@ -51,16 +50,4 @@ spec: spec: containers: - name: manager -{{- if .ComponentConfig }} - args: - - "--config=controller_manager_config.yaml" - volumeMounts: - - name: manager-config - mountPath: /controller_manager_config.yaml - subPath: controller_manager_config.yaml - volumes: - - name: manager-config - configMap: - name: manager-config -{{- end }} ` diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/config.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/config.go index 07a7e723cf9..b9af5f9424c 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/config.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/config.go @@ -27,7 +27,6 @@ var _ machinery.Template = &Config{} // Config scaffolds a file that defines the namespace and the manager deployment type Config struct { machinery.TemplateMixin - machinery.ComponentConfigMixin machinery.ProjectNameMixin // Image is controller manager image name @@ -115,10 +114,8 @@ spec: containers: - command: - /manager -{{- if not .ComponentConfig }} args: - --leader-elect -{{- end }} image: {{ .Image }} name: manager securityContext: diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/controller_manager_config.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/controller_manager_config.go deleted file mode 100644 index 31735256005..00000000000 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/controller_manager_config.go +++ /dev/null @@ -1,77 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT 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 manager - -import ( - "path/filepath" - - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &ControllerManagerConfig{} - -// ControllerManagerConfig scaffolds the config file in config/manager folder. -type ControllerManagerConfig struct { - machinery.TemplateMixin - machinery.DomainMixin - machinery.RepositoryMixin - machinery.ProjectNameMixin -} - -// SetTemplateDefaults implements input.Template -func (f *ControllerManagerConfig) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = filepath.Join("config", "manager", "controller_manager_config.yaml") - } - - f.TemplateBody = controllerManagerConfigTemplate - - f.IfExistsAction = machinery.Error - - return nil -} - -const controllerManagerConfigTemplate = `apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 -kind: ControllerManagerConfig -metadata: - labels: - app.kubernetes.io/name: controllermanagerconfig - app.kubernetes.io/instance: controller-manager-configuration - app.kubernetes.io/component: manager - app.kubernetes.io/created-by: {{ .ProjectName }} - app.kubernetes.io/part-of: {{ .ProjectName }} - app.kubernetes.io/managed-by: kustomize -health: - healthProbeBindAddress: :8081 -metrics: - bindAddress: 127.0.0.1:8080 -webhook: - port: 9443 -leaderElection: - leaderElect: true - resourceName: {{ hashFNV .Repo }}.{{ .Domain }} -# leaderElectionReleaseOnCancel defines if the leader should step down volume -# when the Manager ends. This requires the binary to immediately end when the -# Manager is stopped, otherwise, this setting is unsafe. Setting this significantly -# speeds up voluntary leader transitions as the new leader don't have to wait -# LeaseDuration time first. -# In the default scaffold provided, the program ends immediately after -# the manager stops, so would be fine to enable this option. However, -# if you are doing or is intended to do any operation such as perform cleanups -# after the manager stops then its usage might be unsafe. -# leaderElectionReleaseOnCancel: true -` diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/kustomization.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/kustomization.go index 1faa0750c30..dcc5157905f 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/kustomization.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/manager/kustomization.go @@ -27,7 +27,6 @@ var _ machinery.Template = &Kustomization{} // Kustomization scaffolds a file that defines the kustomization scheme for the manager folder type Kustomization struct { machinery.TemplateMixin - machinery.ComponentConfigMixin } // SetTemplateDefaults implements file.Template @@ -45,15 +44,4 @@ func (f *Kustomization) SetTemplateDefaults() error { const kustomizeManagerTemplate = `resources: - manager.yaml - -{{- if .ComponentConfig }} - -generatorOptions: - disableNameSuffixHash: true - -configMapGenerator: -- name: manager-config - files: - - controller_manager_config.yaml -{{- end }} ` diff --git a/pkg/plugins/golang/v3/scaffolds/internal/templates/main.go b/pkg/plugins/golang/v3/scaffolds/internal/templates/main.go index 496fbfbd43f..8960a280504 100644 --- a/pkg/plugins/golang/v3/scaffolds/internal/templates/main.go +++ b/pkg/plugins/golang/v3/scaffolds/internal/templates/main.go @@ -33,7 +33,6 @@ type Main struct { machinery.BoilerplateMixin machinery.DomainMixin machinery.RepositoryMixin - machinery.ComponentConfigMixin } // SetTemplateDefaults implements file.Template @@ -215,7 +214,6 @@ func init() { } func main() { -{{- if not .ComponentConfig }} var metricsAddr string var enableLeaderElection bool var probeAddr string @@ -227,13 +225,6 @@ func main() { "Enabling this will ensure there is only one active controller manager.") flag.BoolVar(&enableHTTP2, "enable-http2", false, "If set, HTTP/2 will be enabled for the metrics and webhook servers") -{{- else }} - var configFile string - flag.StringVar(&configFile, "config", "", - "The controller will load its initial configuration from this file. " + - "Omit this flag to use the default configuration values. " + - "Command-line flags override configuration from this file.") -{{- end }} opts := zap.Options{ Development: true, } @@ -242,7 +233,6 @@ func main() { ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) -{{ if not .ComponentConfig }} // if the enable-http2 flag is false (the default), http/2 should be disabled // due to its vulnerabilities. More specifically, disabling http/2 will // prevent from being vulnerable to the HTTP/2 Stream Cancellation and @@ -281,19 +271,6 @@ func main() { // after the manager stops then its usage might be unsafe. // LeaderElectionReleaseOnCancel: true, }) -{{- else }} - var err error - options := ctrl.Options{Scheme: scheme} - if configFile != "" { - options, err = options.AndFrom(ctrl.ConfigFile().AtPath(configFile)) - if err != nil { - setupLog.Error(err, "unable to load the config file") - os.Exit(1) - } - } - - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), options) -{{- end }} if err != nil { setupLog.Error(err, "unable to start manager") os.Exit(1) diff --git a/pkg/plugins/golang/v3/scaffolds/internal/templates/makefile.go b/pkg/plugins/golang/v3/scaffolds/internal/templates/makefile.go index 6b5d7dfc477..114c3e2a300 100644 --- a/pkg/plugins/golang/v3/scaffolds/internal/templates/makefile.go +++ b/pkg/plugins/golang/v3/scaffolds/internal/templates/makefile.go @@ -25,7 +25,6 @@ var _ machinery.Template = &Makefile{} // Makefile scaffolds a file that defines project management CLI commands type Makefile struct { machinery.TemplateMixin - machinery.ComponentConfigMixin machinery.ProjectNameMixin // Image is controller manager image name diff --git a/pkg/plugins/golang/v4/scaffolds/internal/templates/main.go b/pkg/plugins/golang/v4/scaffolds/internal/templates/main.go index a5b99189678..006aee98b93 100644 --- a/pkg/plugins/golang/v4/scaffolds/internal/templates/main.go +++ b/pkg/plugins/golang/v4/scaffolds/internal/templates/main.go @@ -33,7 +33,6 @@ type Main struct { machinery.BoilerplateMixin machinery.DomainMixin machinery.RepositoryMixin - machinery.ComponentConfigMixin } // SetTemplateDefaults implements file.Template @@ -218,7 +217,6 @@ func init() { } func main() { -{{- if not .ComponentConfig }} var metricsAddr string var enableLeaderElection bool var probeAddr string @@ -233,13 +231,6 @@ func main() { "If set the metrics endpoint is served securely") flag.BoolVar(&enableHTTP2, "enable-http2", false, "If set, HTTP/2 will be enabled for the metrics and webhook servers") -{{- else }} - var configFile string - flag.StringVar(&configFile, "config", "", - "The controller will load its initial configuration from this file. " + - "Omit this flag to use the default configuration values. " + - "Command-line flags override configuration from this file.") -{{- end }} opts := zap.Options{ Development: true, } @@ -248,7 +239,6 @@ func main() { ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) -{{ if not .ComponentConfig }} // if the enable-http2 flag is false (the default), http/2 should be disabled // due to its vulnerabilities. More specifically, disabling http/2 will // prevent from being vulnerable to the HTTP/2 Stream Cancellation and @@ -292,19 +282,6 @@ func main() { // after the manager stops then its usage might be unsafe. // LeaderElectionReleaseOnCancel: true, }) -{{- else }} - var err error - options := ctrl.Options{Scheme: scheme} - if configFile != "" { - options, err = options.AndFrom(ctrl.ConfigFile().AtPath(configFile)) - if err != nil { - setupLog.Error(err, "unable to load the config file") - os.Exit(1) - } - } - - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), options) -{{- end }} if err != nil { setupLog.Error(err, "unable to start manager") os.Exit(1) diff --git a/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go b/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go index f041315e048..d2eb76cf7a4 100644 --- a/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go +++ b/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go @@ -25,7 +25,6 @@ var _ machinery.Template = &Makefile{} // Makefile scaffolds a file that defines project management CLI commands type Makefile struct { machinery.TemplateMixin - machinery.ComponentConfigMixin machinery.ProjectNameMixin // Image is controller manager image name diff --git a/testdata/project-v3/config/default/kustomization.yaml b/testdata/project-v3/config/default/kustomization.yaml index 9f11a640f62..f8b3884950b 100644 --- a/testdata/project-v3/config/default/kustomization.yaml +++ b/testdata/project-v3/config/default/kustomization.yaml @@ -30,8 +30,6 @@ patchesStrategicMerge: # endpoint w/o any authn/z, please comment the following line. - manager_auth_proxy_patch.yaml - - # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in # crd/kustomization.yaml #- manager_webhook_patch.yaml