diff --git a/docs/book/src/component-config-tutorial/api-changes.md b/docs/book/src/component-config-tutorial/api-changes.md
index e65d6100b3..edd39223ed 100644
--- a/docs/book/src/component-config-tutorial/api-changes.md
+++ b/docs/book/src/component-config-tutorial/api-changes.md
@@ -1,5 +1,17 @@
# Changing things up
+
+Component Config is deprecated
+
+The ComponentConfig has been deprecated in the Controller-Runtime since its version 0.15.0. [More info](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. You can find additional details on this issue [here](https://github.com/kubernetes-sigs/controller-runtime/issues/2370).
+
+Please, be aware that it will force Kubebuilder remove this option soon in future release.
+
+
+
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
diff --git a/docs/book/src/component-config-tutorial/config-type.md b/docs/book/src/component-config-tutorial/config-type.md
index d8d42925de..518f360ed8 100644
--- a/docs/book/src/component-config-tutorial/config-type.md
+++ b/docs/book/src/component-config-tutorial/config-type.md
@@ -1,5 +1,17 @@
# Adding a new Config Type
+
+Component Config is deprecated
+
+The ComponentConfig has been deprecated in the Controller-Runtime since its version 0.15.0. [More info](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. You can find additional details on this issue [here](https://github.com/kubernetes-sigs/controller-runtime/issues/2370).
+
+Please, be aware that it will force Kubebuilder remove this option soon in future release.
+
+
+
To scaffold out a new config Kind, we can use `kubebuilder create api`.
```bash
diff --git a/docs/book/src/component-config-tutorial/custom-type.md b/docs/book/src/component-config-tutorial/custom-type.md
index 76dfeda43d..55910168e4 100644
--- a/docs/book/src/component-config-tutorial/custom-type.md
+++ b/docs/book/src/component-config-tutorial/custom-type.md
@@ -1,5 +1,17 @@
# Using a Custom Type
+
+Component Config is deprecated
+
+The ComponentConfig has been deprecated in the Controller-Runtime since its version 0.15.0. [More info](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. You can find additional details on this issue [here](https://github.com/kubernetes-sigs/controller-runtime/issues/2370).
+
+Please, be aware that it will force Kubebuilder remove this option soon in future release.
+
+
+
Built-in vs Custom Type
diff --git a/docs/book/src/component-config-tutorial/define-config.md b/docs/book/src/component-config-tutorial/define-config.md
index d745f43fce..aad23970c0 100644
--- a/docs/book/src/component-config-tutorial/define-config.md
+++ b/docs/book/src/component-config-tutorial/define-config.md
@@ -1,5 +1,17 @@
# Defining your Config
+
+Component Config is deprecated
+
+The ComponentConfig has been deprecated in the Controller-Runtime since its version 0.15.0. [More info](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. You can find additional details on this issue [here](https://github.com/kubernetes-sigs/controller-runtime/issues/2370).
+
+Please, be aware that it will force Kubebuilder remove this option soon in future release.
+
+
+
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`.
diff --git a/docs/book/src/component-config-tutorial/define-custom-config.md b/docs/book/src/component-config-tutorial/define-custom-config.md
index fcd3e3f049..454b45b3c6 100644
--- a/docs/book/src/component-config-tutorial/define-custom-config.md
+++ b/docs/book/src/component-config-tutorial/define-custom-config.md
@@ -1,5 +1,17 @@
# Defining your Custom Config
+
+Component Config is deprecated
+
+The ComponentConfig has been deprecated in the Controller-Runtime since its version 0.15.0. [More info](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. You can find additional details on this issue [here](https://github.com/kubernetes-sigs/controller-runtime/issues/2370).
+
+Please, be aware that it will force Kubebuilder remove this option soon in future release.
+
+
+
Now that you have a custom component config we change the
`config/manager/controller_manager_config.yaml` to use the new GVK you defined.
diff --git a/docs/book/src/component-config-tutorial/tutorial.md b/docs/book/src/component-config-tutorial/tutorial.md
index ffe7a5ef3b..16ab274967 100644
--- a/docs/book/src/component-config-tutorial/tutorial.md
+++ b/docs/book/src/component-config-tutorial/tutorial.md
@@ -1,5 +1,17 @@
# Tutorial: ComponentConfig
+
+Component Config is deprecated
+
+The ComponentConfig has been deprecated in the Controller-Runtime since its version 0.15.0. [More info](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. You can find additional details on this issue [here](https://github.com/kubernetes-sigs/controller-runtime/issues/2370).
+
+Please, be aware that it will force Kubebuilder remove this option soon in future release.
+
+
+
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
diff --git a/docs/book/src/component-config-tutorial/updating-main.md b/docs/book/src/component-config-tutorial/updating-main.md
index 56a6772e8f..64518b1f0a 100644
--- a/docs/book/src/component-config-tutorial/updating-main.md
+++ b/docs/book/src/component-config-tutorial/updating-main.md
@@ -1,5 +1,17 @@
# Updating main
+
+Component Config is deprecated
+
+The ComponentConfig has been deprecated in the Controller-Runtime since its version 0.15.0. [More info](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. You can find additional details on this issue [here](https://github.com/kubernetes-sigs/controller-runtime/issues/2370).
+
+Please, be aware that it will force Kubebuilder remove this option soon in future release.
+
+
+
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
diff --git a/test/e2e/v4/generate_test.go b/test/e2e/v4/generate_test.go
index c439751420..fb2deba624 100644
--- a/test/e2e/v4/generate_test.go
+++ b/test/e2e/v4/generate_test.go
@@ -203,177 +203,6 @@ Count int `+"`"+`json:"count,omitempty"`+"`"+`
}
}
-// GenerateV4 implements a go/v4(-alpha) plugin project defined by a TestContext.
-func GenerateV4ComponentConfig(kbc *utils.TestContext) {
- var err error
-
- By("initializing a project")
- err = kbc.Init(
- "--plugins", "go/v4",
- "--project-version", "3",
- "--domain", kbc.Domain,
- "--component-config=true",
- )
- ExpectWithOffset(1, err).NotTo(HaveOccurred())
-
- By("creating API definition")
- err = kbc.CreateAPI(
- "--group", kbc.Group,
- "--version", kbc.Version,
- "--kind", kbc.Kind,
- "--namespaced",
- "--resource",
- "--controller",
- "--make=false",
- )
- ExpectWithOffset(1, err).NotTo(HaveOccurred())
-
- By("implementing the API")
- ExpectWithOffset(1, pluginutil.InsertCode(
- filepath.Join(kbc.Dir, "api", kbc.Version, fmt.Sprintf("%s_types.go", strings.ToLower(kbc.Kind))),
- fmt.Sprintf(`type %sSpec struct {
-`, kbc.Kind),
- ` // +optional
-Count int `+"`"+`json:"count,omitempty"`+"`"+`
-`)).Should(Succeed())
-
- By("scaffolding mutating and validating webhooks")
- err = kbc.CreateWebhook(
- "--group", kbc.Group,
- "--version", kbc.Version,
- "--kind", kbc.Kind,
- "--defaulting",
- "--programmatic-validation",
- )
- ExpectWithOffset(1, err).NotTo(HaveOccurred())
-
- By("implementing the mutating and validating webhooks")
- err = pluginutil.ImplementWebhooks(filepath.Join(
- kbc.Dir, "api", kbc.Version,
- fmt.Sprintf("%s_webhook.go", strings.ToLower(kbc.Kind))))
- ExpectWithOffset(1, err).NotTo(HaveOccurred())
-
- By("uncomment kustomization.yaml to enable webhook and ca injection")
- ExpectWithOffset(1, pluginutil.UncommentCode(
- filepath.Join(kbc.Dir, "config", "default", "kustomization.yaml"),
- "#- ../webhook", "#")).To(Succeed())
- ExpectWithOffset(1, pluginutil.UncommentCode(
- filepath.Join(kbc.Dir, "config", "default", "kustomization.yaml"),
- "#- ../certmanager", "#")).To(Succeed())
- ExpectWithOffset(1, pluginutil.UncommentCode(
- filepath.Join(kbc.Dir, "config", "default", "kustomization.yaml"),
- "#- ../prometheus", "#")).To(Succeed())
- ExpectWithOffset(1, pluginutil.UncommentCode(
- filepath.Join(kbc.Dir, "config", "default", "kustomization.yaml"),
- "#- manager_webhook_patch.yaml", "#")).To(Succeed())
- ExpectWithOffset(1, pluginutil.UncommentCode(
- filepath.Join(kbc.Dir, "config", "default", "kustomization.yaml"),
- "#- webhookcainjection_patch.yaml", "#")).To(Succeed())
- ExpectWithOffset(1, pluginutil.UncommentCode(filepath.Join(kbc.Dir, "config", "default", "kustomization.yaml"),
- `#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`, "#")).To(Succeed())
-
- if kbc.IsRestricted {
- By("uncomment kustomize files to ensure that pods are restricted")
- uncommentPodStandards(kbc)
- }
-}
-
func uncommentPodStandards(kbc *utils.TestContext) {
configManager := filepath.Join(kbc.Dir, "config", "manager", "manager.yaml")
diff --git a/test/e2e/v4/plugin_cluster_test.go b/test/e2e/v4/plugin_cluster_test.go
index 8366e7e104..3f7b7b4980 100644
--- a/test/e2e/v4/plugin_cluster_test.go
+++ b/test/e2e/v4/plugin_cluster_test.go
@@ -87,13 +87,6 @@ var _ = Describe("kubebuilder", func() {
GenerateV4(kbc)
Run(kbc)
})
-
- It("should generate a runnable project"+
- " with restricted pods and with --component-config field enabled", func() {
- kbc.IsRestricted = true
- GenerateV4ComponentConfig(kbc)
- Run(kbc)
- })
})
})
diff --git a/test/testdata/generate.sh b/test/testdata/generate.sh
index 3f680afe02..a145caece1 100755
--- a/test/testdata/generate.sh
+++ b/test/testdata/generate.sh
@@ -136,6 +136,5 @@ scaffold_test_project project-v3 --plugins="go/v3"
scaffold_test_project project-v4 --plugins="go/v4"
scaffold_test_project project-v4-multigroup --plugins="go/v4"
scaffold_test_project project-v4-declarative-v1 --plugins="go/v4,declarative"
-scaffold_test_project project-v4-config --component-config --plugins="go/v4"
scaffold_test_project project-v4-with-deploy-image --plugins="go/v4"
scaffold_test_project project-v4-with-grafana --plugins="go/v4"
diff --git a/test/testdata/test.sh b/test/testdata/test.sh
index 7b7f44fb74..e4a534693f 100755
--- a/test/testdata/test.sh
+++ b/test/testdata/test.sh
@@ -34,6 +34,5 @@ build_kb
test_project project-v4
test_project project-v4-multigroup
test_project project-v4-declarative-v1
-test_project project-v4-config
test_project project-v4-with-deploy-image
test_project project-v4-with-grafana
diff --git a/testdata/project-v4-config/.dockerignore b/testdata/project-v4-config/.dockerignore
deleted file mode 100644
index a3aab7af70..0000000000
--- a/testdata/project-v4-config/.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/testdata/project-v4-config/.gitignore b/testdata/project-v4-config/.gitignore
deleted file mode 100644
index 3827d42179..0000000000
--- a/testdata/project-v4-config/.gitignore
+++ /dev/null
@@ -1,25 +0,0 @@
-
-# Binaries for programs and plugins
-*.exe
-*.exe~
-*.dll
-*.so
-*.dylib
-bin/*
-Dockerfile.cross
-
-# Test binary, build with `go test -c`
-*.test
-
-# Output of the go coverage tool, specifically when used with LiteIDE
-*.out
-
-# Kubernetes Generated files - skip generated files, except for vendored files
-
-!vendor/**/zz_generated.*
-
-# editor and IDE paraphernalia
-.idea
-*.swp
-*.swo
-*~
diff --git a/testdata/project-v4-config/Dockerfile b/testdata/project-v4-config/Dockerfile
deleted file mode 100644
index c389c0981a..0000000000
--- a/testdata/project-v4-config/Dockerfile
+++ /dev/null
@@ -1,33 +0,0 @@
-# Build the manager binary
-FROM golang:1.20 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/testdata/project-v4-config/Makefile b/testdata/project-v4-config/Makefile
deleted file mode 100644
index 6060390879..0000000000
--- a/testdata/project-v4-config/Makefile
+++ /dev/null
@@ -1,163 +0,0 @@
-
-# Image URL to use all building/pushing image targets
-IMG ?= controller:latest
-# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
-ENVTEST_K8S_VERSION = 1.27.1
-
-# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
-ifeq (,$(shell go env GOBIN))
-GOBIN=$(shell go env GOPATH)/bin
-else
-GOBIN=$(shell go env GOBIN)
-endif
-
-# CONTAINER_TOOL defines the container tool to be used for building images.
-# Be aware that the target commands are only tested with Docker which is
-# scaffolded by default. However, you might want to replace it to use other
-# tools. (i.e. podman)
-CONTAINER_TOOL ?= docker
-
-# Setting SHELL to bash allows bash commands to be executed by recipes.
-# Options are set to exit when a recipe line exits non-zero or a piped command fails.
-SHELL = /usr/bin/env bash -o pipefail
-.SHELLFLAGS = -ec
-
-.PHONY: all
-all: build
-
-##@ General
-
-# The help target prints out all targets with their descriptions organized
-# beneath their categories. The categories are represented by '##@' and the
-# target descriptions by '##'. The awk commands is responsible for reading the
-# entire set of makefiles included in this invocation, looking for lines of the
-# file as xyz: ## something, and then pretty-format the target and help. Then,
-# if there's a line with ##@ something, that gets pretty-printed as a category.
-# More info on the usage of ANSI control characters for terminal formatting:
-# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
-# More info on the awk command:
-# http://linuxcommand.org/lc3_adv_awk.php
-
-.PHONY: help
-help: ## Display this help.
- @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
-
-##@ Development
-
-.PHONY: manifests
-manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
- $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
-
-.PHONY: generate
-generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
- $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
-
-.PHONY: fmt
-fmt: ## Run go fmt against code.
- go fmt ./...
-
-.PHONY: vet
-vet: ## Run go vet against code.
- go vet ./...
-
-.PHONY: test
-test: manifests generate fmt vet envtest ## Run tests.
- KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
-
-##@ Build
-
-.PHONY: build
-build: manifests generate fmt vet ## Build manager binary.
- go build -o bin/manager cmd/main.go
-
-.PHONY: run
-run: manifests generate fmt vet ## Run a controller from your host.
- go run ./cmd/main.go
-
-# If you wish built the manager image targeting other platforms you can use the --platform flag.
-# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
-# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
-.PHONY: docker-build
-docker-build: test ## Build docker image with the manager.
- $(CONTAINER_TOOL) build -t ${IMG} .
-
-.PHONY: docker-push
-docker-push: ## Push docker image with the manager.
- $(CONTAINER_TOOL) push ${IMG}
-
-# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
-# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
-# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
-# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
-# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=> then the export will fail)
-# To properly provided solutions that supports more than one platform you should use this option.
-PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
-.PHONY: docker-buildx
-docker-buildx: test ## Build and push docker image for the manager for cross-platform support
- # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
- sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- - $(CONTAINER_TOOL) buildx create --name project-v3-builder
- $(CONTAINER_TOOL) buildx use project-v3-builder
- - $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
- - $(CONTAINER_TOOL) buildx rm project-v3-builder
- rm Dockerfile.cross
-
-##@ Deployment
-
-ifndef ignore-not-found
- ignore-not-found = false
-endif
-
-.PHONY: install
-install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
- $(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -
-
-.PHONY: uninstall
-uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
- $(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
-
-.PHONY: deploy
-deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
- cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
- $(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
-
-.PHONY: undeploy
-undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
- $(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
-
-##@ Build Dependencies
-
-## Location to install dependencies to
-LOCALBIN ?= $(shell pwd)/bin
-$(LOCALBIN):
- mkdir -p $(LOCALBIN)
-
-## Tool Binaries
-KUBECTL ?= kubectl
-KUSTOMIZE ?= $(LOCALBIN)/kustomize
-CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
-ENVTEST ?= $(LOCALBIN)/setup-envtest
-
-## Tool Versions
-KUSTOMIZE_VERSION ?= v5.0.1
-CONTROLLER_TOOLS_VERSION ?= v0.12.0
-
-.PHONY: kustomize
-kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
-$(KUSTOMIZE): $(LOCALBIN)
- @if test -x $(LOCALBIN)/kustomize && ! $(LOCALBIN)/kustomize version | grep -q $(KUSTOMIZE_VERSION); then \
- echo "$(LOCALBIN)/kustomize version is not expected $(KUSTOMIZE_VERSION). Removing it before installing."; \
- rm -rf $(LOCALBIN)/kustomize; \
- fi
- test -s $(LOCALBIN)/kustomize || GOBIN=$(LOCALBIN) GO111MODULE=on go install sigs.k8s.io/kustomize/kustomize/v5@$(KUSTOMIZE_VERSION)
-
-.PHONY: controller-gen
-controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
-$(CONTROLLER_GEN): $(LOCALBIN)
- test -s $(LOCALBIN)/controller-gen && $(LOCALBIN)/controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION) || \
- GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
-
-.PHONY: envtest
-envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
-$(ENVTEST): $(LOCALBIN)
- test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
diff --git a/testdata/project-v4-config/PROJECT b/testdata/project-v4-config/PROJECT
deleted file mode 100644
index fcd404dbfa..0000000000
--- a/testdata/project-v4-config/PROJECT
+++ /dev/null
@@ -1,53 +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: testproject.org
-layout:
-- go.kubebuilder.io/v4
-projectName: project-v4-config
-repo: sigs.k8s.io/kubebuilder/testdata/project-v4-config
-resources:
-- api:
- crdVersion: v1
- namespaced: true
- controller: true
- domain: testproject.org
- group: crew
- kind: Captain
- path: sigs.k8s.io/kubebuilder/testdata/project-v4-config/api/v1
- version: v1
- webhooks:
- defaulting: true
- validation: true
- webhookVersion: v1
-- api:
- crdVersion: v1
- namespaced: true
- controller: true
- domain: testproject.org
- group: crew
- kind: FirstMate
- path: sigs.k8s.io/kubebuilder/testdata/project-v4-config/api/v1
- version: v1
- webhooks:
- conversion: true
- webhookVersion: v1
-- api:
- crdVersion: v1
- controller: true
- domain: testproject.org
- group: crew
- kind: Admiral
- path: sigs.k8s.io/kubebuilder/testdata/project-v4-config/api/v1
- version: v1
- webhooks:
- defaulting: true
- webhookVersion: v1
-- controller: true
- domain: testproject.org
- group: crew
- kind: Laker
- version: v1
-version: "3"
diff --git a/testdata/project-v4-config/README.md b/testdata/project-v4-config/README.md
deleted file mode 100644
index 9487c83f6c..0000000000
--- a/testdata/project-v4-config/README.md
+++ /dev/null
@@ -1,94 +0,0 @@
-# project-v4-config
-// TODO(user): Add simple overview of use/purpose
-
-## Description
-// TODO(user): An in-depth paragraph about your project and overview of use
-
-## Getting Started
-You’ll need a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster.
-**Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).
-
-### Running on the cluster
-1. Install Instances of Custom Resources:
-
-```sh
-kubectl apply -f config/samples/
-```
-
-2. Build and push your image to the location specified by `IMG`:
-
-```sh
-make docker-build docker-push IMG=/project-v4-config:tag
-```
-
-3. Deploy the controller to the cluster with the image specified by `IMG`:
-
-```sh
-make deploy IMG=/project-v4-config:tag
-```
-
-### Uninstall CRDs
-To delete the CRDs from the cluster:
-
-```sh
-make uninstall
-```
-
-### Undeploy controller
-UnDeploy the controller from the cluster:
-
-```sh
-make undeploy
-```
-
-## Contributing
-// TODO(user): Add detailed information on how you would like others to contribute to this project
-
-### How it works
-This project aims to follow the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/).
-
-It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/),
-which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster.
-
-### Test It Out
-1. Install the CRDs into the cluster:
-
-```sh
-make install
-```
-
-2. Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):
-
-```sh
-make run
-```
-
-**NOTE:** You can also run this in one step by running: `make install run`
-
-### Modifying the API definitions
-If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
-
-```sh
-make manifests
-```
-
-**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 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT 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/testdata/project-v4-config/api/v1/admiral_types.go b/testdata/project-v4-config/api/v1/admiral_types.go
deleted file mode 100644
index 5da3995844..0000000000
--- a/testdata/project-v4-config/api/v1/admiral_types.go
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-// 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.
-
-// AdmiralSpec defines the desired state of Admiral
-type AdmiralSpec 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 Admiral. Edit admiral_types.go to remove/update
- Foo string `json:"foo,omitempty"`
-}
-
-// AdmiralStatus defines the observed state of Admiral
-type AdmiralStatus 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
-//+kubebuilder:resource:scope=Cluster
-
-// Admiral is the Schema for the admirals API
-type Admiral struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ObjectMeta `json:"metadata,omitempty"`
-
- Spec AdmiralSpec `json:"spec,omitempty"`
- Status AdmiralStatus `json:"status,omitempty"`
-}
-
-//+kubebuilder:object:root=true
-
-// AdmiralList contains a list of Admiral
-type AdmiralList struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ListMeta `json:"metadata,omitempty"`
- Items []Admiral `json:"items"`
-}
-
-func init() {
- SchemeBuilder.Register(&Admiral{}, &AdmiralList{})
-}
diff --git a/testdata/project-v4-config/api/v1/admiral_webhook.go b/testdata/project-v4-config/api/v1/admiral_webhook.go
deleted file mode 100644
index 55f4496384..0000000000
--- a/testdata/project-v4-config/api/v1/admiral_webhook.go
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- ctrl "sigs.k8s.io/controller-runtime"
- logf "sigs.k8s.io/controller-runtime/pkg/log"
- "sigs.k8s.io/controller-runtime/pkg/webhook"
-)
-
-// log is for logging in this package.
-var admirallog = logf.Log.WithName("admiral-resource")
-
-func (r *Admiral) SetupWebhookWithManager(mgr ctrl.Manager) error {
- return ctrl.NewWebhookManagedBy(mgr).
- For(r).
- Complete()
-}
-
-// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
-
-//+kubebuilder:webhook:path=/mutate-crew-testproject-org-v1-admiral,mutating=true,failurePolicy=fail,sideEffects=None,groups=crew.testproject.org,resources=admirals,verbs=create;update,versions=v1,name=madmiral.kb.io,admissionReviewVersions=v1
-
-var _ webhook.Defaulter = &Admiral{}
-
-// Default implements webhook.Defaulter so a webhook will be registered for the type
-func (r *Admiral) Default() {
- admirallog.Info("default", "name", r.Name)
-
- // TODO(user): fill in your defaulting logic.
-}
diff --git a/testdata/project-v4-config/api/v1/captain_types.go b/testdata/project-v4-config/api/v1/captain_types.go
deleted file mode 100644
index 6eafa937b5..0000000000
--- a/testdata/project-v4-config/api/v1/captain_types.go
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-// 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.
-
-// CaptainSpec defines the desired state of Captain
-type CaptainSpec 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 Captain. Edit captain_types.go to remove/update
- Foo string `json:"foo,omitempty"`
-}
-
-// CaptainStatus defines the observed state of Captain
-type CaptainStatus 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
-
-// Captain is the Schema for the captains API
-type Captain struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ObjectMeta `json:"metadata,omitempty"`
-
- Spec CaptainSpec `json:"spec,omitempty"`
- Status CaptainStatus `json:"status,omitempty"`
-}
-
-//+kubebuilder:object:root=true
-
-// CaptainList contains a list of Captain
-type CaptainList struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ListMeta `json:"metadata,omitempty"`
- Items []Captain `json:"items"`
-}
-
-func init() {
- SchemeBuilder.Register(&Captain{}, &CaptainList{})
-}
diff --git a/testdata/project-v4-config/api/v1/captain_webhook.go b/testdata/project-v4-config/api/v1/captain_webhook.go
deleted file mode 100644
index 1c8837b5e9..0000000000
--- a/testdata/project-v4-config/api/v1/captain_webhook.go
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "k8s.io/apimachinery/pkg/runtime"
- ctrl "sigs.k8s.io/controller-runtime"
- logf "sigs.k8s.io/controller-runtime/pkg/log"
- "sigs.k8s.io/controller-runtime/pkg/webhook"
-)
-
-// log is for logging in this package.
-var captainlog = logf.Log.WithName("captain-resource")
-
-func (r *Captain) SetupWebhookWithManager(mgr ctrl.Manager) error {
- return ctrl.NewWebhookManagedBy(mgr).
- For(r).
- Complete()
-}
-
-// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
-
-//+kubebuilder:webhook:path=/mutate-crew-testproject-org-v1-captain,mutating=true,failurePolicy=fail,sideEffects=None,groups=crew.testproject.org,resources=captains,verbs=create;update,versions=v1,name=mcaptain.kb.io,admissionReviewVersions=v1
-
-var _ webhook.Defaulter = &Captain{}
-
-// Default implements webhook.Defaulter so a webhook will be registered for the type
-func (r *Captain) Default() {
- captainlog.Info("default", "name", r.Name)
-
- // TODO(user): fill in your defaulting logic.
-}
-
-// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
-//+kubebuilder:webhook:path=/validate-crew-testproject-org-v1-captain,mutating=false,failurePolicy=fail,sideEffects=None,groups=crew.testproject.org,resources=captains,verbs=create;update,versions=v1,name=vcaptain.kb.io,admissionReviewVersions=v1
-
-var _ webhook.Validator = &Captain{}
-
-// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
-func (r *Captain) ValidateCreate() error {
- captainlog.Info("validate create", "name", r.Name)
-
- // TODO(user): fill in your validation logic upon object creation.
- return nil
-}
-
-// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
-func (r *Captain) ValidateUpdate(old runtime.Object) error {
- captainlog.Info("validate update", "name", r.Name)
-
- // TODO(user): fill in your validation logic upon object update.
- return nil
-}
-
-// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
-func (r *Captain) ValidateDelete() error {
- captainlog.Info("validate delete", "name", r.Name)
-
- // TODO(user): fill in your validation logic upon object deletion.
- return nil
-}
diff --git a/testdata/project-v4-config/api/v1/firstmate_types.go b/testdata/project-v4-config/api/v1/firstmate_types.go
deleted file mode 100644
index 59bcaf1e8e..0000000000
--- a/testdata/project-v4-config/api/v1/firstmate_types.go
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-// 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.
-
-// FirstMateSpec defines the desired state of FirstMate
-type FirstMateSpec 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 FirstMate. Edit firstmate_types.go to remove/update
- Foo string `json:"foo,omitempty"`
-}
-
-// FirstMateStatus defines the observed state of FirstMate
-type FirstMateStatus 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
-
-// FirstMate is the Schema for the firstmates API
-type FirstMate struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ObjectMeta `json:"metadata,omitempty"`
-
- Spec FirstMateSpec `json:"spec,omitempty"`
- Status FirstMateStatus `json:"status,omitempty"`
-}
-
-//+kubebuilder:object:root=true
-
-// FirstMateList contains a list of FirstMate
-type FirstMateList struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ListMeta `json:"metadata,omitempty"`
- Items []FirstMate `json:"items"`
-}
-
-func init() {
- SchemeBuilder.Register(&FirstMate{}, &FirstMateList{})
-}
diff --git a/testdata/project-v4-config/api/v1/firstmate_webhook.go b/testdata/project-v4-config/api/v1/firstmate_webhook.go
deleted file mode 100644
index 941a86ed45..0000000000
--- a/testdata/project-v4-config/api/v1/firstmate_webhook.go
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- ctrl "sigs.k8s.io/controller-runtime"
- logf "sigs.k8s.io/controller-runtime/pkg/log"
-)
-
-// log is for logging in this package.
-var firstmatelog = logf.Log.WithName("firstmate-resource")
-
-func (r *FirstMate) SetupWebhookWithManager(mgr ctrl.Manager) error {
- return ctrl.NewWebhookManagedBy(mgr).
- For(r).
- Complete()
-}
-
-// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
diff --git a/testdata/project-v4-config/api/v1/groupversion_info.go b/testdata/project-v4-config/api/v1/groupversion_info.go
deleted file mode 100644
index fe267f232c..0000000000
--- a/testdata/project-v4-config/api/v1/groupversion_info.go
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package v1 contains API Schema definitions for the crew v1 API group
-// +kubebuilder:object:generate=true
-// +groupName=crew.testproject.org
-package v1
-
-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: "crew.testproject.org", Version: "v1"}
-
- // 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/testdata/project-v4-config/api/v1/webhook_suite_test.go b/testdata/project-v4-config/api/v1/webhook_suite_test.go
deleted file mode 100644
index 674dbd7526..0000000000
--- a/testdata/project-v4-config/api/v1/webhook_suite_test.go
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package v1
-
-import (
- "context"
- "crypto/tls"
- "fmt"
- "net"
- "path/filepath"
- "testing"
- "time"
-
- . "github.com/onsi/ginkgo/v2"
- . "github.com/onsi/gomega"
-
- admissionv1 "k8s.io/api/admission/v1"
- //+kubebuilder:scaffold:imports
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/client-go/rest"
- ctrl "sigs.k8s.io/controller-runtime"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/envtest"
- logf "sigs.k8s.io/controller-runtime/pkg/log"
- "sigs.k8s.io/controller-runtime/pkg/log/zap"
-)
-
-// These tests use Ginkgo (BDD-style Go testing framework). Refer to
-// http://onsi.github.io/ginkgo/ to learn more about Ginkgo.
-
-var cfg *rest.Config
-var k8sClient client.Client
-var testEnv *envtest.Environment
-var ctx context.Context
-var cancel context.CancelFunc
-
-func TestAPIs(t *testing.T) {
- RegisterFailHandler(Fail)
-
- RunSpecs(t, "Webhook Suite")
-}
-
-var _ = BeforeSuite(func() {
- logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
-
- ctx, cancel = context.WithCancel(context.TODO())
-
- By("bootstrapping test environment")
- testEnv = &envtest.Environment{
- CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
- ErrorIfCRDPathMissing: false,
- WebhookInstallOptions: envtest.WebhookInstallOptions{
- Paths: []string{filepath.Join("..", "..", "config", "webhook")},
- },
- }
-
- var err error
- // cfg is defined in this file globally.
- cfg, err = testEnv.Start()
- Expect(err).NotTo(HaveOccurred())
- Expect(cfg).NotTo(BeNil())
-
- scheme := runtime.NewScheme()
- err = AddToScheme(scheme)
- Expect(err).NotTo(HaveOccurred())
-
- err = admissionv1.AddToScheme(scheme)
- Expect(err).NotTo(HaveOccurred())
-
- //+kubebuilder:scaffold:scheme
-
- k8sClient, err = client.New(cfg, client.Options{Scheme: scheme})
- Expect(err).NotTo(HaveOccurred())
- Expect(k8sClient).NotTo(BeNil())
-
- // start webhook server using Manager
- webhookInstallOptions := &testEnv.WebhookInstallOptions
- mgr, err := ctrl.NewManager(cfg, ctrl.Options{
- Scheme: scheme,
- Host: webhookInstallOptions.LocalServingHost,
- Port: webhookInstallOptions.LocalServingPort,
- CertDir: webhookInstallOptions.LocalServingCertDir,
- LeaderElection: false,
- MetricsBindAddress: "0",
- })
- Expect(err).NotTo(HaveOccurred())
-
- err = (&Captain{}).SetupWebhookWithManager(mgr)
- Expect(err).NotTo(HaveOccurred())
-
- err = (&Admiral{}).SetupWebhookWithManager(mgr)
- Expect(err).NotTo(HaveOccurred())
-
- //+kubebuilder:scaffold:webhook
-
- go func() {
- defer GinkgoRecover()
- err = mgr.Start(ctx)
- Expect(err).NotTo(HaveOccurred())
- }()
-
- // wait for the webhook server to get ready
- dialer := &net.Dialer{Timeout: time.Second}
- addrPort := fmt.Sprintf("%s:%d", webhookInstallOptions.LocalServingHost, webhookInstallOptions.LocalServingPort)
- Eventually(func() error {
- conn, err := tls.DialWithDialer(dialer, "tcp", addrPort, &tls.Config{InsecureSkipVerify: true})
- if err != nil {
- return err
- }
- conn.Close()
- return nil
- }).Should(Succeed())
-
-})
-
-var _ = AfterSuite(func() {
- cancel()
- By("tearing down the test environment")
- err := testEnv.Stop()
- Expect(err).NotTo(HaveOccurred())
-})
diff --git a/testdata/project-v4-config/api/v1/zz_generated.deepcopy.go b/testdata/project-v4-config/api/v1/zz_generated.deepcopy.go
deleted file mode 100644
index 3b442b7416..0000000000
--- a/testdata/project-v4-config/api/v1/zz_generated.deepcopy.go
+++ /dev/null
@@ -1,293 +0,0 @@
-//go:build !ignore_autogenerated
-// +build !ignore_autogenerated
-
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS 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 v1
-
-import (
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *Admiral) DeepCopyInto(out *Admiral) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.Spec = in.Spec
- out.Status = in.Status
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Admiral.
-func (in *Admiral) DeepCopy() *Admiral {
- if in == nil {
- return nil
- }
- out := new(Admiral)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *Admiral) 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 *AdmiralList) DeepCopyInto(out *AdmiralList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]Admiral, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmiralList.
-func (in *AdmiralList) DeepCopy() *AdmiralList {
- if in == nil {
- return nil
- }
- out := new(AdmiralList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AdmiralList) 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 *AdmiralSpec) DeepCopyInto(out *AdmiralSpec) {
- *out = *in
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmiralSpec.
-func (in *AdmiralSpec) DeepCopy() *AdmiralSpec {
- if in == nil {
- return nil
- }
- out := new(AdmiralSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AdmiralStatus) DeepCopyInto(out *AdmiralStatus) {
- *out = *in
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmiralStatus.
-func (in *AdmiralStatus) DeepCopy() *AdmiralStatus {
- if in == nil {
- return nil
- }
- out := new(AdmiralStatus)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *Captain) DeepCopyInto(out *Captain) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.Spec = in.Spec
- out.Status = in.Status
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Captain.
-func (in *Captain) DeepCopy() *Captain {
- if in == nil {
- return nil
- }
- out := new(Captain)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *Captain) 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 *CaptainList) DeepCopyInto(out *CaptainList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]Captain, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CaptainList.
-func (in *CaptainList) DeepCopy() *CaptainList {
- if in == nil {
- return nil
- }
- out := new(CaptainList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *CaptainList) 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 *CaptainSpec) DeepCopyInto(out *CaptainSpec) {
- *out = *in
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CaptainSpec.
-func (in *CaptainSpec) DeepCopy() *CaptainSpec {
- if in == nil {
- return nil
- }
- out := new(CaptainSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *CaptainStatus) DeepCopyInto(out *CaptainStatus) {
- *out = *in
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CaptainStatus.
-func (in *CaptainStatus) DeepCopy() *CaptainStatus {
- if in == nil {
- return nil
- }
- out := new(CaptainStatus)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *FirstMate) DeepCopyInto(out *FirstMate) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.Spec = in.Spec
- out.Status = in.Status
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirstMate.
-func (in *FirstMate) DeepCopy() *FirstMate {
- if in == nil {
- return nil
- }
- out := new(FirstMate)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *FirstMate) 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 *FirstMateList) DeepCopyInto(out *FirstMateList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]FirstMate, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirstMateList.
-func (in *FirstMateList) DeepCopy() *FirstMateList {
- if in == nil {
- return nil
- }
- out := new(FirstMateList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *FirstMateList) 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 *FirstMateSpec) DeepCopyInto(out *FirstMateSpec) {
- *out = *in
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirstMateSpec.
-func (in *FirstMateSpec) DeepCopy() *FirstMateSpec {
- if in == nil {
- return nil
- }
- out := new(FirstMateSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *FirstMateStatus) DeepCopyInto(out *FirstMateStatus) {
- *out = *in
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirstMateStatus.
-func (in *FirstMateStatus) DeepCopy() *FirstMateStatus {
- if in == nil {
- return nil
- }
- out := new(FirstMateStatus)
- in.DeepCopyInto(out)
- return out
-}
diff --git a/testdata/project-v4-config/cmd/main.go b/testdata/project-v4-config/cmd/main.go
deleted file mode 100644
index ba319663fa..0000000000
--- a/testdata/project-v4-config/cmd/main.go
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT 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"
-
- crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-config/api/v1"
- "sigs.k8s.io/kubebuilder/testdata/project-v4-config/internal/controller"
- //+kubebuilder:scaffold:imports
-)
-
-var (
- scheme = runtime.NewScheme()
- setupLog = ctrl.Log.WithName("setup")
-)
-
-func init() {
- utilruntime.Must(clientgoscheme.AddToScheme(scheme))
-
- utilruntime.Must(crewv1.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
- 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)
- if err != nil {
- setupLog.Error(err, "unable to start manager")
- os.Exit(1)
- }
-
- if err = (&controller.CaptainReconciler{
- Client: mgr.GetClient(),
- Scheme: mgr.GetScheme(),
- }).SetupWithManager(mgr); err != nil {
- setupLog.Error(err, "unable to create controller", "controller", "Captain")
- os.Exit(1)
- }
- if err = (&crewv1.Captain{}).SetupWebhookWithManager(mgr); err != nil {
- setupLog.Error(err, "unable to create webhook", "webhook", "Captain")
- os.Exit(1)
- }
- if err = (&controller.FirstMateReconciler{
- Client: mgr.GetClient(),
- Scheme: mgr.GetScheme(),
- }).SetupWithManager(mgr); err != nil {
- setupLog.Error(err, "unable to create controller", "controller", "FirstMate")
- os.Exit(1)
- }
- if err = (&crewv1.FirstMate{}).SetupWebhookWithManager(mgr); err != nil {
- setupLog.Error(err, "unable to create webhook", "webhook", "FirstMate")
- os.Exit(1)
- }
- if err = (&controller.AdmiralReconciler{
- Client: mgr.GetClient(),
- Scheme: mgr.GetScheme(),
- }).SetupWithManager(mgr); err != nil {
- setupLog.Error(err, "unable to create controller", "controller", "Admiral")
- os.Exit(1)
- }
- if err = (&crewv1.Admiral{}).SetupWebhookWithManager(mgr); err != nil {
- setupLog.Error(err, "unable to create webhook", "webhook", "Admiral")
- os.Exit(1)
- }
- if err = (&controller.LakerReconciler{
- Client: mgr.GetClient(),
- Scheme: mgr.GetScheme(),
- }).SetupWithManager(mgr); err != nil {
- setupLog.Error(err, "unable to create controller", "controller", "Laker")
- 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/testdata/project-v4-config/config/certmanager/certificate.yaml b/testdata/project-v4-config/config/certmanager/certificate.yaml
deleted file mode 100644
index beca5b4372..0000000000
--- a/testdata/project-v4-config/config/certmanager/certificate.yaml
+++ /dev/null
@@ -1,39 +0,0 @@
-# The following manifests contain a self-signed issuer CR and a certificate CR.
-# More document can be found at https://docs.cert-manager.io
-# WARNING: Targets CertManager v1.0. Check https://cert-manager.io/docs/installation/upgrading/ for breaking changes.
-apiVersion: cert-manager.io/v1
-kind: Issuer
-metadata:
- labels:
- app.kubernetes.io/name: certificate
- app.kubernetes.io/instance: serving-cert
- app.kubernetes.io/component: certificate
- app.kubernetes.io/created-by: project-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: selfsigned-issuer
- namespace: system
-spec:
- selfSigned: {}
----
-apiVersion: cert-manager.io/v1
-kind: Certificate
-metadata:
- labels:
- app.kubernetes.io/name: certificate
- app.kubernetes.io/instance: serving-cert
- app.kubernetes.io/component: certificate
- app.kubernetes.io/created-by: project-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
- namespace: system
-spec:
- # SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize
- dnsNames:
- - SERVICE_NAME.SERVICE_NAMESPACE.svc
- - SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local
- issuerRef:
- kind: Issuer
- name: selfsigned-issuer
- secretName: webhook-server-cert # this secret will not be prefixed, since it's not managed by kustomize
diff --git a/testdata/project-v4-config/config/certmanager/kustomization.yaml b/testdata/project-v4-config/config/certmanager/kustomization.yaml
deleted file mode 100644
index bebea5a595..0000000000
--- a/testdata/project-v4-config/config/certmanager/kustomization.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-resources:
-- certificate.yaml
-
-configurations:
-- kustomizeconfig.yaml
diff --git a/testdata/project-v4-config/config/certmanager/kustomizeconfig.yaml b/testdata/project-v4-config/config/certmanager/kustomizeconfig.yaml
deleted file mode 100644
index cf6f89e889..0000000000
--- a/testdata/project-v4-config/config/certmanager/kustomizeconfig.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-# This configuration is for teaching kustomize how to update name ref substitution
-nameReference:
-- kind: Issuer
- group: cert-manager.io
- fieldSpecs:
- - kind: Certificate
- group: cert-manager.io
- path: spec/issuerRef/name
diff --git a/testdata/project-v4-config/config/crd/bases/crew.testproject.org_admirals.yaml b/testdata/project-v4-config/config/crd/bases/crew.testproject.org_admirals.yaml
deleted file mode 100644
index 6653d9a91b..0000000000
--- a/testdata/project-v4-config/config/crd/bases/crew.testproject.org_admirals.yaml
+++ /dev/null
@@ -1,49 +0,0 @@
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- controller-gen.kubebuilder.io/version: v0.12.0
- name: admirals.crew.testproject.org
-spec:
- group: crew.testproject.org
- names:
- kind: Admiral
- listKind: AdmiralList
- plural: admirals
- singular: admiral
- scope: Cluster
- versions:
- - name: v1
- schema:
- openAPIV3Schema:
- description: Admiral is the Schema for the admirals 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
- 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
- metadata:
- type: object
- spec:
- description: AdmiralSpec defines the desired state of Admiral
- properties:
- foo:
- description: Foo is an example field of Admiral. Edit admiral_types.go
- to remove/update
- type: string
- type: object
- status:
- description: AdmiralStatus defines the observed state of Admiral
- type: object
- type: object
- served: true
- storage: true
- subresources:
- status: {}
diff --git a/testdata/project-v4-config/config/crd/bases/crew.testproject.org_captains.yaml b/testdata/project-v4-config/config/crd/bases/crew.testproject.org_captains.yaml
deleted file mode 100644
index e62224bc2c..0000000000
--- a/testdata/project-v4-config/config/crd/bases/crew.testproject.org_captains.yaml
+++ /dev/null
@@ -1,49 +0,0 @@
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- controller-gen.kubebuilder.io/version: v0.12.0
- name: captains.crew.testproject.org
-spec:
- group: crew.testproject.org
- names:
- kind: Captain
- listKind: CaptainList
- plural: captains
- singular: captain
- scope: Namespaced
- versions:
- - name: v1
- schema:
- openAPIV3Schema:
- description: Captain is the Schema for the captains 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
- 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
- metadata:
- type: object
- spec:
- description: CaptainSpec defines the desired state of Captain
- properties:
- foo:
- description: Foo is an example field of Captain. Edit captain_types.go
- to remove/update
- type: string
- type: object
- status:
- description: CaptainStatus defines the observed state of Captain
- type: object
- type: object
- served: true
- storage: true
- subresources:
- status: {}
diff --git a/testdata/project-v4-config/config/crd/bases/crew.testproject.org_firstmates.yaml b/testdata/project-v4-config/config/crd/bases/crew.testproject.org_firstmates.yaml
deleted file mode 100644
index 846ef6d9b7..0000000000
--- a/testdata/project-v4-config/config/crd/bases/crew.testproject.org_firstmates.yaml
+++ /dev/null
@@ -1,49 +0,0 @@
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- controller-gen.kubebuilder.io/version: v0.12.0
- name: firstmates.crew.testproject.org
-spec:
- group: crew.testproject.org
- names:
- kind: FirstMate
- listKind: FirstMateList
- plural: firstmates
- singular: firstmate
- scope: Namespaced
- versions:
- - name: v1
- schema:
- openAPIV3Schema:
- description: FirstMate is the Schema for the firstmates 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
- 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
- metadata:
- type: object
- spec:
- description: FirstMateSpec defines the desired state of FirstMate
- properties:
- foo:
- description: Foo is an example field of FirstMate. Edit firstmate_types.go
- to remove/update
- type: string
- type: object
- status:
- description: FirstMateStatus defines the observed state of FirstMate
- type: object
- type: object
- served: true
- storage: true
- subresources:
- status: {}
diff --git a/testdata/project-v4-config/config/crd/kustomization.yaml b/testdata/project-v4-config/config/crd/kustomization.yaml
deleted file mode 100644
index bf4c93a811..0000000000
--- a/testdata/project-v4-config/config/crd/kustomization.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-# This kustomization.yaml is not intended to be run by itself,
-# since it depends on service name and namespace that are out of this kustomize package.
-# It should be run by config/default
-resources:
-- bases/crew.testproject.org_captains.yaml
-- bases/crew.testproject.org_firstmates.yaml
-- bases/crew.testproject.org_admirals.yaml
-#+kubebuilder:scaffold:crdkustomizeresource
-
-patches:
-# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
-# patches here are for enabling the conversion webhook for each CRD
-#- patches/webhook_in_captains.yaml
-#- patches/webhook_in_firstmates.yaml
-#- patches/webhook_in_admirals.yaml
-#+kubebuilder:scaffold:crdkustomizewebhookpatch
-
-# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
-# patches here are for enabling the CA injection for each CRD
-#- patches/cainjection_in_captains.yaml
-#- patches/cainjection_in_firstmates.yaml
-#- patches/cainjection_in_admirals.yaml
-#+kubebuilder:scaffold:crdkustomizecainjectionpatch
-
-# the following config is for teaching kustomize how to do kustomization for CRDs.
-configurations:
-- kustomizeconfig.yaml
diff --git a/testdata/project-v4-config/config/crd/kustomizeconfig.yaml b/testdata/project-v4-config/config/crd/kustomizeconfig.yaml
deleted file mode 100644
index ec5c150a9d..0000000000
--- a/testdata/project-v4-config/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/testdata/project-v4-config/config/crd/patches/cainjection_in_admirals.yaml b/testdata/project-v4-config/config/crd/patches/cainjection_in_admirals.yaml
deleted file mode 100644
index 49bfa257d3..0000000000
--- a/testdata/project-v4-config/config/crd/patches/cainjection_in_admirals.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-# The following patch adds a directive for certmanager to inject CA into the CRD
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
- name: admirals.crew.testproject.org
diff --git a/testdata/project-v4-config/config/crd/patches/cainjection_in_captains.yaml b/testdata/project-v4-config/config/crd/patches/cainjection_in_captains.yaml
deleted file mode 100644
index fba0c3ed6f..0000000000
--- a/testdata/project-v4-config/config/crd/patches/cainjection_in_captains.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-# The following patch adds a directive for certmanager to inject CA into the CRD
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
- name: captains.crew.testproject.org
diff --git a/testdata/project-v4-config/config/crd/patches/cainjection_in_firstmates.yaml b/testdata/project-v4-config/config/crd/patches/cainjection_in_firstmates.yaml
deleted file mode 100644
index 69292458eb..0000000000
--- a/testdata/project-v4-config/config/crd/patches/cainjection_in_firstmates.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-# The following patch adds a directive for certmanager to inject CA into the CRD
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
- name: firstmates.crew.testproject.org
diff --git a/testdata/project-v4-config/config/crd/patches/webhook_in_admirals.yaml b/testdata/project-v4-config/config/crd/patches/webhook_in_admirals.yaml
deleted file mode 100644
index 0ce2808578..0000000000
--- a/testdata/project-v4-config/config/crd/patches/webhook_in_admirals.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-# The following patch enables a conversion webhook for the CRD
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- name: admirals.crew.testproject.org
-spec:
- conversion:
- strategy: Webhook
- webhook:
- clientConfig:
- service:
- namespace: system
- name: webhook-service
- path: /convert
- conversionReviewVersions:
- - v1
diff --git a/testdata/project-v4-config/config/crd/patches/webhook_in_captains.yaml b/testdata/project-v4-config/config/crd/patches/webhook_in_captains.yaml
deleted file mode 100644
index f73ae2e8ab..0000000000
--- a/testdata/project-v4-config/config/crd/patches/webhook_in_captains.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-# The following patch enables a conversion webhook for the CRD
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- name: captains.crew.testproject.org
-spec:
- conversion:
- strategy: Webhook
- webhook:
- clientConfig:
- service:
- namespace: system
- name: webhook-service
- path: /convert
- conversionReviewVersions:
- - v1
diff --git a/testdata/project-v4-config/config/crd/patches/webhook_in_firstmates.yaml b/testdata/project-v4-config/config/crd/patches/webhook_in_firstmates.yaml
deleted file mode 100644
index 76ee5acedb..0000000000
--- a/testdata/project-v4-config/config/crd/patches/webhook_in_firstmates.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-# The following patch enables a conversion webhook for the CRD
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- name: firstmates.crew.testproject.org
-spec:
- conversion:
- strategy: Webhook
- webhook:
- clientConfig:
- service:
- namespace: system
- name: webhook-service
- path: /convert
- conversionReviewVersions:
- - v1
diff --git a/testdata/project-v4-config/config/default/kustomization.yaml b/testdata/project-v4-config/config/default/kustomization.yaml
deleted file mode 100644
index 6ff4eea996..0000000000
--- a/testdata/project-v4-config/config/default/kustomization.yaml
+++ /dev/null
@@ -1,147 +0,0 @@
-# Adds namespace to all resources.
-namespace: project-v4-config-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-v4-config-
-
-# 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
-
-patchesStrategicMerge:
-# 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.
-- manager_auth_proxy_patch.yaml
-
-
-# Mount the controller config file for loading manager configurations
-# through a ComponentConfig type
-- manager_config_patch.yaml
-
-# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
-# crd/kustomization.yaml
-#- 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
-#- 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/testdata/project-v4-config/config/default/manager_auth_proxy_patch.yaml b/testdata/project-v4-config/config/default/manager_auth_proxy_patch.yaml
deleted file mode 100644
index 18fa56fc4e..0000000000
--- a/testdata/project-v4-config/config/default/manager_auth_proxy_patch.yaml
+++ /dev/null
@@ -1,34 +0,0 @@
-# This patch inject a sidecar container which is a HTTP proxy for the
-# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: controller-manager
- namespace: system
-spec:
- template:
- spec:
- containers:
- - name: kube-rbac-proxy
- securityContext:
- allowPrivilegeEscalation: false
- capabilities:
- drop:
- - "ALL"
- image: gcr.io/kubebuilder/kube-rbac-proxy:v0.14.1
- args:
- - "--secure-listen-address=0.0.0.0:8443"
- - "--upstream=http://127.0.0.1:8080/"
- - "--logtostderr=true"
- - "--v=0"
- ports:
- - containerPort: 8443
- protocol: TCP
- name: https
- resources:
- limits:
- cpu: 500m
- memory: 128Mi
- requests:
- cpu: 5m
- memory: 64Mi
diff --git a/testdata/project-v4-config/config/default/manager_config_patch.yaml b/testdata/project-v4-config/config/default/manager_config_patch.yaml
deleted file mode 100644
index 6c400155cf..0000000000
--- a/testdata/project-v4-config/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/testdata/project-v4-config/config/default/manager_webhook_patch.yaml b/testdata/project-v4-config/config/default/manager_webhook_patch.yaml
deleted file mode 100644
index 738de350b7..0000000000
--- a/testdata/project-v4-config/config/default/manager_webhook_patch.yaml
+++ /dev/null
@@ -1,23 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: controller-manager
- namespace: system
-spec:
- template:
- spec:
- containers:
- - name: manager
- ports:
- - containerPort: 9443
- name: webhook-server
- protocol: TCP
- volumeMounts:
- - mountPath: /tmp/k8s-webhook-server/serving-certs
- name: cert
- readOnly: true
- volumes:
- - name: cert
- secret:
- defaultMode: 420
- secretName: webhook-server-cert
diff --git a/testdata/project-v4-config/config/default/webhookcainjection_patch.yaml b/testdata/project-v4-config/config/default/webhookcainjection_patch.yaml
deleted file mode 100644
index 605b115fe5..0000000000
--- a/testdata/project-v4-config/config/default/webhookcainjection_patch.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-# This patch add annotation to admission webhook config and
-# CERTIFICATE_NAMESPACE and CERTIFICATE_NAME will be substituted by kustomize
-apiVersion: admissionregistration.k8s.io/v1
-kind: MutatingWebhookConfiguration
-metadata:
- labels:
- app.kubernetes.io/name: mutatingwebhookconfiguration
- app.kubernetes.io/instance: mutating-webhook-configuration
- app.kubernetes.io/component: webhook
- app.kubernetes.io/created-by: project-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: mutating-webhook-configuration
- annotations:
- cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
----
-apiVersion: admissionregistration.k8s.io/v1
-kind: ValidatingWebhookConfiguration
-metadata:
- labels:
- app.kubernetes.io/name: validatingwebhookconfiguration
- app.kubernetes.io/instance: validating-webhook-configuration
- app.kubernetes.io/component: webhook
- app.kubernetes.io/created-by: project-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: validating-webhook-configuration
- annotations:
- cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
diff --git a/testdata/project-v4-config/config/manager/controller_manager_config.yaml b/testdata/project-v4-config/config/manager/controller_manager_config.yaml
deleted file mode 100644
index 85b321f5c2..0000000000
--- a/testdata/project-v4-config/config/manager/controller_manager_config.yaml
+++ /dev/null
@@ -1,29 +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-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
-health:
- healthProbeBindAddress: :8081
-metrics:
- bindAddress: 127.0.0.1:8080
-webhook:
- port: 9443
-leaderElection:
- leaderElect: true
- resourceName: 89f7a333.testproject.org
-# 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/testdata/project-v4-config/config/manager/kustomization.yaml b/testdata/project-v4-config/config/manager/kustomization.yaml
deleted file mode 100644
index 2bcd3eeaa9..0000000000
--- a/testdata/project-v4-config/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/testdata/project-v4-config/config/manager/manager.yaml b/testdata/project-v4-config/config/manager/manager.yaml
deleted file mode 100644
index 562550f9e6..0000000000
--- a/testdata/project-v4-config/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-v4-config
- app.kubernetes.io/part-of: project-v4-config
- 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-v4-config
- app.kubernetes.io/part-of: project-v4-config
- 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/testdata/project-v4-config/config/prometheus/kustomization.yaml b/testdata/project-v4-config/config/prometheus/kustomization.yaml
deleted file mode 100644
index ed137168a1..0000000000
--- a/testdata/project-v4-config/config/prometheus/kustomization.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-resources:
-- monitor.yaml
diff --git a/testdata/project-v4-config/config/prometheus/monitor.yaml b/testdata/project-v4-config/config/prometheus/monitor.yaml
deleted file mode 100644
index f6e7a3de4c..0000000000
--- a/testdata/project-v4-config/config/prometheus/monitor.yaml
+++ /dev/null
@@ -1,26 +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-v4-config
- app.kubernetes.io/part-of: project-v4-config
- 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/testdata/project-v4-config/config/rbac/admiral_editor_role.yaml b/testdata/project-v4-config/config/rbac/admiral_editor_role.yaml
deleted file mode 100644
index 0b9c12d0a0..0000000000
--- a/testdata/project-v4-config/config/rbac/admiral_editor_role.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-# permissions for end users to edit admirals.
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- labels:
- app.kubernetes.io/name: clusterrole
- app.kubernetes.io/instance: admiral-editor-role
- app.kubernetes.io/component: rbac
- app.kubernetes.io/created-by: project-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: admiral-editor-role
-rules:
-- apiGroups:
- - crew.testproject.org
- resources:
- - admirals
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
-- apiGroups:
- - crew.testproject.org
- resources:
- - admirals/status
- verbs:
- - get
diff --git a/testdata/project-v4-config/config/rbac/admiral_viewer_role.yaml b/testdata/project-v4-config/config/rbac/admiral_viewer_role.yaml
deleted file mode 100644
index 34df9015f3..0000000000
--- a/testdata/project-v4-config/config/rbac/admiral_viewer_role.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-# permissions for end users to view admirals.
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- labels:
- app.kubernetes.io/name: clusterrole
- app.kubernetes.io/instance: admiral-viewer-role
- app.kubernetes.io/component: rbac
- app.kubernetes.io/created-by: project-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: admiral-viewer-role
-rules:
-- apiGroups:
- - crew.testproject.org
- resources:
- - admirals
- verbs:
- - get
- - list
- - watch
-- apiGroups:
- - crew.testproject.org
- resources:
- - admirals/status
- verbs:
- - get
diff --git a/testdata/project-v4-config/config/rbac/auth_proxy_client_clusterrole.yaml b/testdata/project-v4-config/config/rbac/auth_proxy_client_clusterrole.yaml
deleted file mode 100644
index f2a6a3823b..0000000000
--- a/testdata/project-v4-config/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-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: metrics-reader
-rules:
-- nonResourceURLs:
- - "/metrics"
- verbs:
- - get
diff --git a/testdata/project-v4-config/config/rbac/auth_proxy_role.yaml b/testdata/project-v4-config/config/rbac/auth_proxy_role.yaml
deleted file mode 100644
index 8029746463..0000000000
--- a/testdata/project-v4-config/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-v4-config
- app.kubernetes.io/part-of: project-v4-config
- 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/testdata/project-v4-config/config/rbac/auth_proxy_role_binding.yaml b/testdata/project-v4-config/config/rbac/auth_proxy_role_binding.yaml
deleted file mode 100644
index 5eba3d464e..0000000000
--- a/testdata/project-v4-config/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-v4-config
- app.kubernetes.io/part-of: project-v4-config
- 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/testdata/project-v4-config/config/rbac/auth_proxy_service.yaml b/testdata/project-v4-config/config/rbac/auth_proxy_service.yaml
deleted file mode 100644
index f14908f660..0000000000
--- a/testdata/project-v4-config/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-v4-config
- app.kubernetes.io/part-of: project-v4-config
- 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/testdata/project-v4-config/config/rbac/captain_editor_role.yaml b/testdata/project-v4-config/config/rbac/captain_editor_role.yaml
deleted file mode 100644
index 282c5a57da..0000000000
--- a/testdata/project-v4-config/config/rbac/captain_editor_role.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-# permissions for end users to edit captains.
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- labels:
- app.kubernetes.io/name: clusterrole
- app.kubernetes.io/instance: captain-editor-role
- app.kubernetes.io/component: rbac
- app.kubernetes.io/created-by: project-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: captain-editor-role
-rules:
-- apiGroups:
- - crew.testproject.org
- resources:
- - captains
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
-- apiGroups:
- - crew.testproject.org
- resources:
- - captains/status
- verbs:
- - get
diff --git a/testdata/project-v4-config/config/rbac/captain_viewer_role.yaml b/testdata/project-v4-config/config/rbac/captain_viewer_role.yaml
deleted file mode 100644
index 9dd3e538a6..0000000000
--- a/testdata/project-v4-config/config/rbac/captain_viewer_role.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-# permissions for end users to view captains.
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- labels:
- app.kubernetes.io/name: clusterrole
- app.kubernetes.io/instance: captain-viewer-role
- app.kubernetes.io/component: rbac
- app.kubernetes.io/created-by: project-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: captain-viewer-role
-rules:
-- apiGroups:
- - crew.testproject.org
- resources:
- - captains
- verbs:
- - get
- - list
- - watch
-- apiGroups:
- - crew.testproject.org
- resources:
- - captains/status
- verbs:
- - get
diff --git a/testdata/project-v4-config/config/rbac/firstmate_editor_role.yaml b/testdata/project-v4-config/config/rbac/firstmate_editor_role.yaml
deleted file mode 100644
index 3caf7ea4fa..0000000000
--- a/testdata/project-v4-config/config/rbac/firstmate_editor_role.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-# permissions for end users to edit firstmates.
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- labels:
- app.kubernetes.io/name: clusterrole
- app.kubernetes.io/instance: firstmate-editor-role
- app.kubernetes.io/component: rbac
- app.kubernetes.io/created-by: project-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: firstmate-editor-role
-rules:
-- apiGroups:
- - crew.testproject.org
- resources:
- - firstmates
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
-- apiGroups:
- - crew.testproject.org
- resources:
- - firstmates/status
- verbs:
- - get
diff --git a/testdata/project-v4-config/config/rbac/firstmate_viewer_role.yaml b/testdata/project-v4-config/config/rbac/firstmate_viewer_role.yaml
deleted file mode 100644
index ae9bad7d05..0000000000
--- a/testdata/project-v4-config/config/rbac/firstmate_viewer_role.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-# permissions for end users to view firstmates.
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- labels:
- app.kubernetes.io/name: clusterrole
- app.kubernetes.io/instance: firstmate-viewer-role
- app.kubernetes.io/component: rbac
- app.kubernetes.io/created-by: project-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: firstmate-viewer-role
-rules:
-- apiGroups:
- - crew.testproject.org
- resources:
- - firstmates
- verbs:
- - get
- - list
- - watch
-- apiGroups:
- - crew.testproject.org
- resources:
- - firstmates/status
- verbs:
- - get
diff --git a/testdata/project-v4-config/config/rbac/kustomization.yaml b/testdata/project-v4-config/config/rbac/kustomization.yaml
deleted file mode 100644
index 731832a6ac..0000000000
--- a/testdata/project-v4-config/config/rbac/kustomization.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-resources:
-# All RBAC will be applied under this service account in
-# the deployment namespace. You may comment out this resource
-# if your manager will use a service account that exists at
-# runtime. Be sure to update RoleBinding and ClusterRoleBinding
-# subjects if changing service account names.
-- service_account.yaml
-- role.yaml
-- role_binding.yaml
-- leader_election_role.yaml
-- leader_election_role_binding.yaml
-# Comment the following 4 lines if you want to disable
-# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
-# which protects your /metrics endpoint.
-- auth_proxy_service.yaml
-- auth_proxy_role.yaml
-- auth_proxy_role_binding.yaml
-- auth_proxy_client_clusterrole.yaml
diff --git a/testdata/project-v4-config/config/rbac/leader_election_role.yaml b/testdata/project-v4-config/config/rbac/leader_election_role.yaml
deleted file mode 100644
index 8cac2ff5cd..0000000000
--- a/testdata/project-v4-config/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-v4-config
- app.kubernetes.io/part-of: project-v4-config
- 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/testdata/project-v4-config/config/rbac/leader_election_role_binding.yaml b/testdata/project-v4-config/config/rbac/leader_election_role_binding.yaml
deleted file mode 100644
index 9704e4326b..0000000000
--- a/testdata/project-v4-config/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-v4-config
- app.kubernetes.io/part-of: project-v4-config
- 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/testdata/project-v4-config/config/rbac/role.yaml b/testdata/project-v4-config/config/rbac/role.yaml
deleted file mode 100644
index b14ec8f7b0..0000000000
--- a/testdata/project-v4-config/config/rbac/role.yaml
+++ /dev/null
@@ -1,110 +0,0 @@
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: manager-role
-rules:
-- apiGroups:
- - crew.testproject.org
- resources:
- - admirals
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
-- apiGroups:
- - crew.testproject.org
- resources:
- - admirals/finalizers
- verbs:
- - update
-- apiGroups:
- - crew.testproject.org
- resources:
- - admirals/status
- verbs:
- - get
- - patch
- - update
-- apiGroups:
- - crew.testproject.org
- resources:
- - captains
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
-- apiGroups:
- - crew.testproject.org
- resources:
- - captains/finalizers
- verbs:
- - update
-- apiGroups:
- - crew.testproject.org
- resources:
- - captains/status
- verbs:
- - get
- - patch
- - update
-- apiGroups:
- - crew.testproject.org
- resources:
- - firstmates
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
-- apiGroups:
- - crew.testproject.org
- resources:
- - firstmates/finalizers
- verbs:
- - update
-- apiGroups:
- - crew.testproject.org
- resources:
- - firstmates/status
- verbs:
- - get
- - patch
- - update
-- apiGroups:
- - crew.testproject.org
- resources:
- - lakers
- verbs:
- - create
- - delete
- - get
- - list
- - patch
- - update
- - watch
-- apiGroups:
- - crew.testproject.org
- resources:
- - lakers/finalizers
- verbs:
- - update
-- apiGroups:
- - crew.testproject.org
- resources:
- - lakers/status
- verbs:
- - get
- - patch
- - update
diff --git a/testdata/project-v4-config/config/rbac/role_binding.yaml b/testdata/project-v4-config/config/rbac/role_binding.yaml
deleted file mode 100644
index fe71a39860..0000000000
--- a/testdata/project-v4-config/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-v4-config
- app.kubernetes.io/part-of: project-v4-config
- 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/testdata/project-v4-config/config/rbac/service_account.yaml b/testdata/project-v4-config/config/rbac/service_account.yaml
deleted file mode 100644
index 03da5daabf..0000000000
--- a/testdata/project-v4-config/config/rbac/service_account.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: v1
-kind: ServiceAccount
-metadata:
- labels:
- app.kubernetes.io/name: serviceaccount
- app.kubernetes.io/instance: controller-manager-sa
- app.kubernetes.io/component: rbac
- app.kubernetes.io/created-by: project-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: controller-manager
- namespace: system
diff --git a/testdata/project-v4-config/config/samples/crew_v1_admiral.yaml b/testdata/project-v4-config/config/samples/crew_v1_admiral.yaml
deleted file mode 100644
index 79952b4a06..0000000000
--- a/testdata/project-v4-config/config/samples/crew_v1_admiral.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: crew.testproject.org/v1
-kind: Admiral
-metadata:
- labels:
- app.kubernetes.io/name: admiral
- app.kubernetes.io/instance: admiral-sample
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- app.kubernetes.io/created-by: project-v4-config
- name: admiral-sample
-spec:
- # TODO(user): Add fields here
diff --git a/testdata/project-v4-config/config/samples/crew_v1_captain.yaml b/testdata/project-v4-config/config/samples/crew_v1_captain.yaml
deleted file mode 100644
index 02cabaae00..0000000000
--- a/testdata/project-v4-config/config/samples/crew_v1_captain.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: crew.testproject.org/v1
-kind: Captain
-metadata:
- labels:
- app.kubernetes.io/name: captain
- app.kubernetes.io/instance: captain-sample
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- app.kubernetes.io/created-by: project-v4-config
- name: captain-sample
-spec:
- # TODO(user): Add fields here
diff --git a/testdata/project-v4-config/config/samples/crew_v1_firstmate.yaml b/testdata/project-v4-config/config/samples/crew_v1_firstmate.yaml
deleted file mode 100644
index a798d2b59f..0000000000
--- a/testdata/project-v4-config/config/samples/crew_v1_firstmate.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: crew.testproject.org/v1
-kind: FirstMate
-metadata:
- labels:
- app.kubernetes.io/name: firstmate
- app.kubernetes.io/instance: firstmate-sample
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- app.kubernetes.io/created-by: project-v4-config
- name: firstmate-sample
-spec:
- # TODO(user): Add fields here
diff --git a/testdata/project-v4-config/config/samples/kustomization.yaml b/testdata/project-v4-config/config/samples/kustomization.yaml
deleted file mode 100644
index b5cf9e60f5..0000000000
--- a/testdata/project-v4-config/config/samples/kustomization.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-## Append samples of your project ##
-resources:
-- crew_v1_captain.yaml
-- crew_v1_firstmate.yaml
-- crew_v1_admiral.yaml
-#+kubebuilder:scaffold:manifestskustomizesamples
diff --git a/testdata/project-v4-config/config/webhook/kustomization.yaml b/testdata/project-v4-config/config/webhook/kustomization.yaml
deleted file mode 100644
index 9cf26134e4..0000000000
--- a/testdata/project-v4-config/config/webhook/kustomization.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-resources:
-- manifests.yaml
-- service.yaml
-
-configurations:
-- kustomizeconfig.yaml
diff --git a/testdata/project-v4-config/config/webhook/kustomizeconfig.yaml b/testdata/project-v4-config/config/webhook/kustomizeconfig.yaml
deleted file mode 100644
index 206316e54f..0000000000
--- a/testdata/project-v4-config/config/webhook/kustomizeconfig.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-# the following config is for teaching kustomize where to look at when substituting nameReference.
-# It requires kustomize v2.1.0 or newer to work properly.
-nameReference:
-- kind: Service
- version: v1
- fieldSpecs:
- - kind: MutatingWebhookConfiguration
- group: admissionregistration.k8s.io
- path: webhooks/clientConfig/service/name
- - kind: ValidatingWebhookConfiguration
- group: admissionregistration.k8s.io
- path: webhooks/clientConfig/service/name
-
-namespace:
-- kind: MutatingWebhookConfiguration
- group: admissionregistration.k8s.io
- path: webhooks/clientConfig/service/namespace
- create: true
-- kind: ValidatingWebhookConfiguration
- group: admissionregistration.k8s.io
- path: webhooks/clientConfig/service/namespace
- create: true
diff --git a/testdata/project-v4-config/config/webhook/manifests.yaml b/testdata/project-v4-config/config/webhook/manifests.yaml
deleted file mode 100644
index 6b1995a569..0000000000
--- a/testdata/project-v4-config/config/webhook/manifests.yaml
+++ /dev/null
@@ -1,72 +0,0 @@
----
-apiVersion: admissionregistration.k8s.io/v1
-kind: MutatingWebhookConfiguration
-metadata:
- name: mutating-webhook-configuration
-webhooks:
-- admissionReviewVersions:
- - v1
- clientConfig:
- service:
- name: webhook-service
- namespace: system
- path: /mutate-crew-testproject-org-v1-admiral
- failurePolicy: Fail
- name: madmiral.kb.io
- rules:
- - apiGroups:
- - crew.testproject.org
- apiVersions:
- - v1
- operations:
- - CREATE
- - UPDATE
- resources:
- - admirals
- sideEffects: None
-- admissionReviewVersions:
- - v1
- clientConfig:
- service:
- name: webhook-service
- namespace: system
- path: /mutate-crew-testproject-org-v1-captain
- failurePolicy: Fail
- name: mcaptain.kb.io
- rules:
- - apiGroups:
- - crew.testproject.org
- apiVersions:
- - v1
- operations:
- - CREATE
- - UPDATE
- resources:
- - captains
- sideEffects: None
----
-apiVersion: admissionregistration.k8s.io/v1
-kind: ValidatingWebhookConfiguration
-metadata:
- name: validating-webhook-configuration
-webhooks:
-- admissionReviewVersions:
- - v1
- clientConfig:
- service:
- name: webhook-service
- namespace: system
- path: /validate-crew-testproject-org-v1-captain
- failurePolicy: Fail
- name: vcaptain.kb.io
- rules:
- - apiGroups:
- - crew.testproject.org
- apiVersions:
- - v1
- operations:
- - CREATE
- - UPDATE
- resources:
- - captains
- sideEffects: None
diff --git a/testdata/project-v4-config/config/webhook/service.yaml b/testdata/project-v4-config/config/webhook/service.yaml
deleted file mode 100644
index 6151196274..0000000000
--- a/testdata/project-v4-config/config/webhook/service.yaml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-apiVersion: v1
-kind: Service
-metadata:
- labels:
- app.kubernetes.io/name: service
- app.kubernetes.io/instance: webhook-service
- app.kubernetes.io/component: webhook
- app.kubernetes.io/created-by: project-v4-config
- app.kubernetes.io/part-of: project-v4-config
- app.kubernetes.io/managed-by: kustomize
- name: webhook-service
- namespace: system
-spec:
- ports:
- - port: 443
- protocol: TCP
- targetPort: 9443
- selector:
- control-plane: controller-manager
diff --git a/testdata/project-v4-config/go.mod b/testdata/project-v4-config/go.mod
deleted file mode 100644
index 1a1c45aa54..0000000000
--- a/testdata/project-v4-config/go.mod
+++ /dev/null
@@ -1,70 +0,0 @@
-module sigs.k8s.io/kubebuilder/testdata/project-v4-config
-
-go 1.20
-
-require (
- github.com/onsi/ginkgo/v2 v2.6.0
- github.com/onsi/gomega v1.24.1
- k8s.io/api v0.26.1
- k8s.io/apimachinery v0.26.1
- k8s.io/client-go v0.26.1
- sigs.k8s.io/controller-runtime v0.14.4
-)
-
-require (
- github.com/beorn7/perks v1.0.1 // indirect
- github.com/cespare/xxhash/v2 v2.1.2 // indirect
- github.com/davecgh/go-spew v1.1.1 // indirect
- github.com/emicklei/go-restful/v3 v3.9.0 // indirect
- github.com/evanphx/json-patch/v5 v5.6.0 // indirect
- github.com/fsnotify/fsnotify v1.6.0 // indirect
- github.com/go-logr/logr v1.2.3 // indirect
- github.com/go-logr/zapr v1.2.3 // indirect
- github.com/go-openapi/jsonpointer v0.19.5 // indirect
- github.com/go-openapi/jsonreference v0.20.0 // indirect
- github.com/go-openapi/swag v0.19.14 // indirect
- github.com/gogo/protobuf v1.3.2 // indirect
- github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
- github.com/golang/protobuf v1.5.2 // indirect
- github.com/google/gnostic v0.5.7-v3refs // indirect
- github.com/google/go-cmp v0.5.9 // indirect
- github.com/google/gofuzz v1.1.0 // indirect
- github.com/google/uuid v1.1.2 // 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.6 // indirect
- github.com/matttproud/golang_protobuf_extensions v1.0.2 // 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.14.0 // indirect
- github.com/prometheus/client_model v0.3.0 // indirect
- github.com/prometheus/common v0.37.0 // indirect
- github.com/prometheus/procfs v0.8.0 // indirect
- github.com/spf13/pflag v1.0.5 // indirect
- go.uber.org/atomic v1.7.0 // indirect
- go.uber.org/multierr v1.6.0 // indirect
- go.uber.org/zap v1.24.0 // indirect
- golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 // indirect
- golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
- golang.org/x/sys v0.3.0 // indirect
- golang.org/x/term v0.3.0 // indirect
- golang.org/x/text v0.5.0 // indirect
- golang.org/x/time v0.3.0 // indirect
- gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
- google.golang.org/appengine v1.6.7 // indirect
- google.golang.org/protobuf v1.28.1 // indirect
- gopkg.in/inf.v0 v0.9.1 // indirect
- gopkg.in/yaml.v2 v2.4.0 // indirect
- gopkg.in/yaml.v3 v3.0.1 // indirect
- k8s.io/apiextensions-apiserver v0.26.1 // indirect
- k8s.io/component-base v0.26.1 // indirect
- k8s.io/klog/v2 v2.80.1 // indirect
- k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
- k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 // indirect
- sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
- sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
- sigs.k8s.io/yaml v1.3.0 // indirect
-)
diff --git a/testdata/project-v4-config/hack/boilerplate.go.txt b/testdata/project-v4-config/hack/boilerplate.go.txt
deleted file mode 100644
index 8c36d12450..0000000000
--- a/testdata/project-v4-config/hack/boilerplate.go.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT 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/testdata/project-v4-config/internal/controller/admiral_controller.go b/testdata/project-v4-config/internal/controller/admiral_controller.go
deleted file mode 100644
index 7e2d8675f7..0000000000
--- a/testdata/project-v4-config/internal/controller/admiral_controller.go
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT 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 controller
-
-import (
- "context"
-
- "k8s.io/apimachinery/pkg/runtime"
- ctrl "sigs.k8s.io/controller-runtime"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/log"
-
- crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-config/api/v1"
-)
-
-// AdmiralReconciler reconciles a Admiral object
-type AdmiralReconciler struct {
- client.Client
- Scheme *runtime.Scheme
-}
-
-//+kubebuilder:rbac:groups=crew.testproject.org,resources=admirals,verbs=get;list;watch;create;update;patch;delete
-//+kubebuilder:rbac:groups=crew.testproject.org,resources=admirals/status,verbs=get;update;patch
-//+kubebuilder:rbac:groups=crew.testproject.org,resources=admirals/finalizers,verbs=update
-
-// Reconcile is part of the main kubernetes reconciliation loop which aims to
-// move the current state of the cluster closer to the desired state.
-// TODO(user): Modify the Reconcile function to compare the state specified by
-// the Admiral object against the actual cluster state, and then
-// perform operations to make the cluster state reflect the state specified by
-// the user.
-//
-// For more details, check Reconcile and its Result here:
-// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.4/pkg/reconcile
-func (r *AdmiralReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
- _ = log.FromContext(ctx)
-
- // TODO(user): your logic here
-
- return ctrl.Result{}, nil
-}
-
-// SetupWithManager sets up the controller with the Manager.
-func (r *AdmiralReconciler) SetupWithManager(mgr ctrl.Manager) error {
- return ctrl.NewControllerManagedBy(mgr).
- For(&crewv1.Admiral{}).
- Complete(r)
-}
diff --git a/testdata/project-v4-config/internal/controller/captain_controller.go b/testdata/project-v4-config/internal/controller/captain_controller.go
deleted file mode 100644
index 5329d3795d..0000000000
--- a/testdata/project-v4-config/internal/controller/captain_controller.go
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT 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 controller
-
-import (
- "context"
-
- "k8s.io/apimachinery/pkg/runtime"
- ctrl "sigs.k8s.io/controller-runtime"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/log"
-
- crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-config/api/v1"
-)
-
-// CaptainReconciler reconciles a Captain object
-type CaptainReconciler struct {
- client.Client
- Scheme *runtime.Scheme
-}
-
-//+kubebuilder:rbac:groups=crew.testproject.org,resources=captains,verbs=get;list;watch;create;update;patch;delete
-//+kubebuilder:rbac:groups=crew.testproject.org,resources=captains/status,verbs=get;update;patch
-//+kubebuilder:rbac:groups=crew.testproject.org,resources=captains/finalizers,verbs=update
-
-// Reconcile is part of the main kubernetes reconciliation loop which aims to
-// move the current state of the cluster closer to the desired state.
-// TODO(user): Modify the Reconcile function to compare the state specified by
-// the Captain object against the actual cluster state, and then
-// perform operations to make the cluster state reflect the state specified by
-// the user.
-//
-// For more details, check Reconcile and its Result here:
-// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.4/pkg/reconcile
-func (r *CaptainReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
- _ = log.FromContext(ctx)
-
- // TODO(user): your logic here
-
- return ctrl.Result{}, nil
-}
-
-// SetupWithManager sets up the controller with the Manager.
-func (r *CaptainReconciler) SetupWithManager(mgr ctrl.Manager) error {
- return ctrl.NewControllerManagedBy(mgr).
- For(&crewv1.Captain{}).
- Complete(r)
-}
diff --git a/testdata/project-v4-config/internal/controller/firstmate_controller.go b/testdata/project-v4-config/internal/controller/firstmate_controller.go
deleted file mode 100644
index 4fb787768e..0000000000
--- a/testdata/project-v4-config/internal/controller/firstmate_controller.go
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT 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 controller
-
-import (
- "context"
-
- "k8s.io/apimachinery/pkg/runtime"
- ctrl "sigs.k8s.io/controller-runtime"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/log"
-
- crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-config/api/v1"
-)
-
-// FirstMateReconciler reconciles a FirstMate object
-type FirstMateReconciler struct {
- client.Client
- Scheme *runtime.Scheme
-}
-
-//+kubebuilder:rbac:groups=crew.testproject.org,resources=firstmates,verbs=get;list;watch;create;update;patch;delete
-//+kubebuilder:rbac:groups=crew.testproject.org,resources=firstmates/status,verbs=get;update;patch
-//+kubebuilder:rbac:groups=crew.testproject.org,resources=firstmates/finalizers,verbs=update
-
-// Reconcile is part of the main kubernetes reconciliation loop which aims to
-// move the current state of the cluster closer to the desired state.
-// TODO(user): Modify the Reconcile function to compare the state specified by
-// the FirstMate object against the actual cluster state, and then
-// perform operations to make the cluster state reflect the state specified by
-// the user.
-//
-// For more details, check Reconcile and its Result here:
-// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.4/pkg/reconcile
-func (r *FirstMateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
- _ = log.FromContext(ctx)
-
- // TODO(user): your logic here
-
- return ctrl.Result{}, nil
-}
-
-// SetupWithManager sets up the controller with the Manager.
-func (r *FirstMateReconciler) SetupWithManager(mgr ctrl.Manager) error {
- return ctrl.NewControllerManagedBy(mgr).
- For(&crewv1.FirstMate{}).
- Complete(r)
-}
diff --git a/testdata/project-v4-config/internal/controller/laker_controller.go b/testdata/project-v4-config/internal/controller/laker_controller.go
deleted file mode 100644
index 86b009cc0b..0000000000
--- a/testdata/project-v4-config/internal/controller/laker_controller.go
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT 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 controller
-
-import (
- "context"
-
- "k8s.io/apimachinery/pkg/runtime"
- ctrl "sigs.k8s.io/controller-runtime"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/log"
-)
-
-// LakerReconciler reconciles a Laker object
-type LakerReconciler struct {
- client.Client
- Scheme *runtime.Scheme
-}
-
-//+kubebuilder:rbac:groups=crew.testproject.org,resources=lakers,verbs=get;list;watch;create;update;patch;delete
-//+kubebuilder:rbac:groups=crew.testproject.org,resources=lakers/status,verbs=get;update;patch
-//+kubebuilder:rbac:groups=crew.testproject.org,resources=lakers/finalizers,verbs=update
-
-// Reconcile is part of the main kubernetes reconciliation loop which aims to
-// move the current state of the cluster closer to the desired state.
-// TODO(user): Modify the Reconcile function to compare the state specified by
-// the Laker object against the actual cluster state, and then
-// perform operations to make the cluster state reflect the state specified by
-// the user.
-//
-// For more details, check Reconcile and its Result here:
-// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.4/pkg/reconcile
-func (r *LakerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
- _ = log.FromContext(ctx)
-
- // TODO(user): your logic here
-
- return ctrl.Result{}, nil
-}
-
-// SetupWithManager sets up the controller with the Manager.
-func (r *LakerReconciler) SetupWithManager(mgr ctrl.Manager) error {
- return ctrl.NewControllerManagedBy(mgr).
- // Uncomment the following line adding a pointer to an instance of the controlled resource as an argument
- // For().
- Complete(r)
-}
diff --git a/testdata/project-v4-config/internal/controller/suite_test.go b/testdata/project-v4-config/internal/controller/suite_test.go
deleted file mode 100644
index aeb5bc608e..0000000000
--- a/testdata/project-v4-config/internal/controller/suite_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-Copyright 2023 The Kubernetes authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT 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 controller
-
-import (
- "path/filepath"
- "testing"
-
- . "github.com/onsi/ginkgo/v2"
- . "github.com/onsi/gomega"
-
- "k8s.io/client-go/kubernetes/scheme"
- "k8s.io/client-go/rest"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/envtest"
- logf "sigs.k8s.io/controller-runtime/pkg/log"
- "sigs.k8s.io/controller-runtime/pkg/log/zap"
-
- crewv1 "sigs.k8s.io/kubebuilder/testdata/project-v4-config/api/v1"
- //+kubebuilder:scaffold:imports
-)
-
-// These tests use Ginkgo (BDD-style Go testing framework). Refer to
-// http://onsi.github.io/ginkgo/ to learn more about Ginkgo.
-
-var cfg *rest.Config
-var k8sClient client.Client
-var testEnv *envtest.Environment
-
-func TestControllers(t *testing.T) {
- RegisterFailHandler(Fail)
-
- RunSpecs(t, "Controller Suite")
-}
-
-var _ = BeforeSuite(func() {
- logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
-
- By("bootstrapping test environment")
- testEnv = &envtest.Environment{
- CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
- ErrorIfCRDPathMissing: true,
- }
-
- var err error
- // cfg is defined in this file globally.
- cfg, err = testEnv.Start()
- Expect(err).NotTo(HaveOccurred())
- Expect(cfg).NotTo(BeNil())
-
- err = crewv1.AddToScheme(scheme.Scheme)
- Expect(err).NotTo(HaveOccurred())
-
- //+kubebuilder:scaffold:scheme
-
- k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme})
- Expect(err).NotTo(HaveOccurred())
- Expect(k8sClient).NotTo(BeNil())
-
-})
-
-var _ = AfterSuite(func() {
- By("tearing down the test environment")
- err := testEnv.Stop()
- Expect(err).NotTo(HaveOccurred())
-})