From f12a192f2efd164373fefe117f104c05ce88c1ee Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Sat, 16 Sep 2023 21:00:35 +0900 Subject: [PATCH] refactor: recreate with kubebuilder go/v4 plugin (#260) --- CONTRIBUTING.md | 39 +-- Dockerfile | 8 +- Makefile | 116 +-------- PROJECT | 3 - README.md | 2 +- api/v1alpha1/groupversion_info.go | 2 +- api/v1alpha1/mysql_types.go | 2 +- api/v1alpha1/mysqldb_types.go | 2 +- api/v1alpha1/mysqluser_types.go | 2 +- api/v1alpha1/zz_generated.deepcopy.go | 3 +- bundle.Dockerfile | 20 -- ...er-manager-metrics-service_v1_service.yaml | 17 -- ...-operator-manager-config_v1_configmap.yaml | 17 -- ...c.authorization.k8s.io_v1_clusterrole.yaml | 10 - .../mysql-operator.clusterserviceversion.yaml | 238 ------------------ .../mysql.nakamasato.com_mysqls.yaml | 62 ----- .../mysql.nakamasato.com_mysqlusers.yaml | 131 ---------- bundle/metadata/annotations.yaml | 14 -- bundle/tests/scorecard/config.yaml | 75 ------ bundle/tests/scorecard/kuttl/kuttl-test.yaml | 5 - .../kuttl/with-valid-mysql/00-assert.yaml | 6 - .../with-valid-mysql/00-mysql-deployment.yaml | 28 --- .../with-valid-mysql/00-mysql-service.yaml | 18 -- cmd/main.go | 2 +- .../bases/mysql.nakamasato.com_mysqldbs.yaml | 2 +- .../bases/mysql.nakamasato.com_mysqls.yaml | 2 +- .../mysql.nakamasato.com_mysqlusers.yaml | 2 +- config/crd/kustomization.yaml | 8 +- .../crd/patches/cainjection_in_mysqldbs.yaml | 2 +- config/crd/patches/cainjection_in_mysqls.yaml | 2 +- .../patches/cainjection_in_mysqlusers.yaml | 2 +- config/default/kustomization.yaml | 138 +++++++--- config/default/manager_auth_proxy_patch.yaml | 16 +- config/default/manager_config_patch.yaml | 10 - .../default/manager_gcp_sa_secret_patch.yaml | 22 +- config/install/controller_manager_config.yaml | 11 - config/install/kustomization.yaml | 4 - config/manager/controller_manager_config.yaml | 11 - config/manager/kustomization.yaml | 8 - config/manager/manager.yaml | 54 +++- .../mysql-operator.clusterserviceversion.yaml | 53 ---- config/manifests/kustomization.yaml | 27 -- config/prometheus/monitor.yaml | 6 + .../rbac/auth_proxy_client_clusterrole.yaml | 7 + config/rbac/auth_proxy_role.yaml | 7 + config/rbac/auth_proxy_role_binding.yaml | 7 + config/rbac/auth_proxy_service.yaml | 6 + config/rbac/leader_election_role.yaml | 7 + config/rbac/leader_election_role_binding.yaml | 7 + config/rbac/mysql_editor_role.yaml | 7 + config/rbac/mysql_viewer_role.yaml | 7 + config/rbac/mysqluser_editor_role.yaml | 7 + config/rbac/mysqluser_viewer_role.yaml | 7 + config/rbac/role_binding.yaml | 7 + config/rbac/service_account.yaml | 7 + config/samples/kustomization.yaml | 4 +- config/samples/mysql_v1alpha1_mysql.yaml | 6 + config/samples/mysql_v1alpha1_mysqluser.yaml | 6 + config/scorecard/bases/config.yaml | 7 - config/scorecard/kustomization.yaml | 16 -- config/scorecard/patches/basic.config.yaml | 10 - config/scorecard/patches/olm.config.yaml | 50 ---- docs/developer-guide/debug.md | 18 +- docs/developer-guide/versions.md | 34 ++- e2e/skaffold.yaml | 1 + go.mod | 5 +- go.sum | 28 +-- hack/boilerplate.go.txt | 2 +- internal/controller/mysql_controller.go | 2 +- internal/controller/mysqldb_controller.go | 2 +- internal/controller/mysqluser_controller.go | 2 +- internal/controller/suite_test.go | 2 +- skaffold.yaml | 2 + 73 files changed, 401 insertions(+), 1081 deletions(-) delete mode 100644 bundle.Dockerfile delete mode 100644 bundle/manifests/mysql-operator-controller-manager-metrics-service_v1_service.yaml delete mode 100644 bundle/manifests/mysql-operator-manager-config_v1_configmap.yaml delete mode 100644 bundle/manifests/mysql-operator-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml delete mode 100644 bundle/manifests/mysql-operator.clusterserviceversion.yaml delete mode 100644 bundle/manifests/mysql.nakamasato.com_mysqls.yaml delete mode 100644 bundle/manifests/mysql.nakamasato.com_mysqlusers.yaml delete mode 100644 bundle/metadata/annotations.yaml delete mode 100644 bundle/tests/scorecard/config.yaml delete mode 100644 bundle/tests/scorecard/kuttl/kuttl-test.yaml delete mode 100644 bundle/tests/scorecard/kuttl/with-valid-mysql/00-assert.yaml delete mode 100644 bundle/tests/scorecard/kuttl/with-valid-mysql/00-mysql-deployment.yaml delete mode 100644 bundle/tests/scorecard/kuttl/with-valid-mysql/00-mysql-service.yaml delete mode 100644 config/install/controller_manager_config.yaml delete mode 100644 config/manager/controller_manager_config.yaml delete mode 100644 config/manifests/bases/mysql-operator.clusterserviceversion.yaml delete mode 100644 config/manifests/kustomization.yaml delete mode 100644 config/scorecard/bases/config.yaml delete mode 100644 config/scorecard/kustomization.yaml delete mode 100644 config/scorecard/patches/basic.config.yaml delete mode 100644 config/scorecard/patches/olm.config.yaml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d2829ff7..5fa82b4d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -98,13 +98,12 @@ golangci-lint run ./... ``` 1. MySQL user is deleted. ``` - docker exec -it $(docker ps | grep mysql | head -1 |awk '{print $1}') mysql -uroot -ppassword + docker exec -it $(docker ps | grep mysql | head -1 |awk '{print $1}') mysql -uroot -ppassword -e 'select User, Host from mysql.user;' ```
details ```sql - mysql> select User, Host from mysql.user; +---------------+-----------+ | User | Host | +---------------+-----------+ @@ -157,30 +156,33 @@ docker rm -f $(docker ps | grep mysql | head -1 |awk '{print $1}') ``` NAME HOST ADMINUSER CONNECTED USERCOUNT DBCOUNT REASON - mysql.mysql.nakamasato.com/mysql-sample mysql.default root true 1 0 Ping succeded and updated MySQLClients + mysql.mysql.nakamasato.com/mysql-sample mysql.default root true 1 1 Ping succeded and updated MySQLClients - NAME MYSQLUSER SECRET PHASE REASON - mysqluser.mysql.nakamasato.com/nakamasato true true Ready Both secret and mysql user are successfully created. + NAME PHASE REASON SCHEMAMIGRATION + mysqldb.mysql.nakamasato.com/sample-db Ready Database successfully created {"dirty":false,"version":0} + + NAME MYSQLUSER SECRET PHASE REASON + mysqluser.mysql.nakamasato.com/sample-user true true Ready Both secret and mysql user are successfully created. ``` 1. Confirm MySQL user is created in MySQL container. ```bash - kubectl exec -it $(kubectl get po | grep mysql | head -1 | awk '{print $1}') -- mysql -uroot -ppassword -e 'select User, Host from mysql.user where User = "nakamasato";' + kubectl exec -it $(kubectl get po | grep mysql | head -1 | awk '{print $1}') -- mysql -uroot -ppassword -e 'select User, Host from mysql.user where User = "sample-user";' ``` ``` mysql: [Warning] Using a password on the command line interface can be insecure. - +------------+------+ - | User | Host | - +------------+------+ - | nakamasato | % | - +------------+------+ + +-------------+------+ + | User | Host | + +-------------+------+ + | sample-user | % | + +-------------+------+ ``` -1. `Secret` `mysql-mysql-sample-nakamasato` is created for the MySQL user. +1. `Secret` `mysql-mysql-sample-sample-user` is created for the MySQL user. ``` - kubectl get secret mysql-mysql-sample-nakamasato -o jsonpath='{.data.password}' + kubectl get secret mysql-mysql-sample-sample-user -o jsonpath='{.data.password}' ``` 1. Clean up the Custom Resources (`MySQL` and `MySQLUser` resources). @@ -192,8 +194,8 @@ docker rm -f $(docker ps | grep mysql | head -1 |awk '{print $1}')
If getting stuck in deletion ``` - kubectl exec -it $(kubectl get po | grep mysql | head -1 | awk '{print $1}') -- mysql -uroot -ppassword -e 'delete from mysql.user where User = "nakamasato";' - kubectl patch mysqluser nakamasato -p '{"metadata":{"finalizers": []}}' --type=merge + kubectl exec -it $(kubectl get po | grep mysql | head -1 | awk '{print $1}') -- mysql -uroot -ppassword -e 'delete from mysql.user where User = "sample-user";' + kubectl patch mysqluser sample-user -p '{"metadata":{"finalizers": []}}' --type=merge ```
@@ -314,10 +316,10 @@ docker rm -f $(docker ps | grep mysql | head -1 |awk '{print $1}') # 4. Test -## 4.1. Versions +## 4.1. Tools -- Ginkgo: v1.16.4 -- Gomega: v1.13.0 +- Ginkgo +- Gomega ## 4.2. Controller Test @@ -568,7 +570,6 @@ PASS
-# 5. OLM (ToDo) # 6. Tips ## 6.1. Error: `Operation cannot be fulfilled on mysqlusers.mysql.nakamasato.com \"john\": StorageError: invalid object, Code: 4, Key: /registry/mysql.nakamasato.com/mysqlusers/default/john, ResourceVersion: 0, AdditionalErrorMsg: Precondition failed: UID in precondition: cd9c94d1-992a-457d-8fab-489b21ed02e9, UID in object meta:` diff --git a/Dockerfile b/Dockerfile index 8760baf0..cab2a5b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ # Build the manager binary -FROM golang:1.21 as builder +FROM golang:1.20 as builder +ARG TARGETOS +ARG TARGETARCH WORKDIR /workspace # Copy the Go Modules manifests @@ -15,6 +17,10 @@ COPY api/ api/ COPY internal/ internal/ # 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 diff --git a/Makefile b/Makefile index 160dc3c1..55abfe51 100644 --- a/Makefile +++ b/Makefile @@ -1,55 +1,8 @@ -# VERSION defines the project version for the bundle. -# Update this value when you upgrade the version of your project. -# To re-generate a bundle for another specific version without changing the standard setup, you can: -# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) -# - use environment variables to overwrite this value (e.g export VERSION=0.0.2) -VERSION ?= 0.0.1 - -# CHANNELS define the bundle channels used in the bundle. -# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable") -# To re-generate a bundle for other specific channels without changing the standard setup, you can: -# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable) -# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable") -ifneq ($(origin CHANNELS), undefined) -BUNDLE_CHANNELS := --channels=$(CHANNELS) -endif - -# DEFAULT_CHANNEL defines the default channel used in the bundle. -# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable") -# To re-generate a bundle for any other default channel without changing the default setup, you can: -# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable) -# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable") -ifneq ($(origin DEFAULT_CHANNEL), undefined) -BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL) -endif -BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL) - -# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images. -# This variable is used to construct full image tags for bundle and catalog images. -# -# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both -# nakamasato.com/mysql-operator-bundle:$VERSION and nakamasato.com/mysql-operator-catalog:$VERSION. -IMAGE_TAG_BASE ?= nakamasato/mysql-operator - -# BUNDLE_IMG defines the image:tag used for the bundle. -# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=/:) -BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION) - -# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command -BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS) - -# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests -# You can enable this value if you would like to use SHA Based Digests -# To enable set flag to true -USE_IMAGE_DIGESTS ?= false -ifeq ($(USE_IMAGE_DIGESTS), true) - BUNDLE_GEN_FLAGS += --use-image-digests -endif # Image URL to use all building/pushing image targets IMG ?= ghcr.io/nakamasato/mysql-operator # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. -ENVTEST_K8S_VERSION = 1.28.0 +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)) @@ -110,7 +63,6 @@ vet: ## Run go vet against code. .PHONY: test test: manifests generate fmt vet envtest ginkgo ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" $(GINKGO) -cover -coverprofile cover.out -covermode=atomic -skip-package=e2e ./... -# KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out ##@ Build @@ -126,7 +78,7 @@ run: manifests generate fmt vet ## Run a controller from your host. # (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: ## Build docker image with the manager. +docker-build: test ## Build docker image with the manager. $(CONTAINER_TOOL) build -t ${IMG} . .PHONY: docker-push @@ -141,7 +93,7 @@ docker-push: ## Push docker image with the manager. # 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: ## Build and push docker image for the manager for cross-platform support +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 @@ -188,8 +140,8 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest GINKGO ?= $(LOCALBIN)/ginkgo ## Tool Versions -KUSTOMIZE_VERSION ?= v5.1.1 -CONTROLLER_TOOLS_VERSION ?= v0.13.0 +KUSTOMIZE_VERSION ?= v5.0.1 +CONTROLLER_TOOLS_VERSION ?= v0.12.0 GINKGO_VERSION ?= v2.12.0 .PHONY: kustomize @@ -215,63 +167,7 @@ $(ENVTEST): $(LOCALBIN) .PHONY: ginkgo ginkgo: test -s $(LOCALBIN)/ginkgo && $(LOCALBIN)/ginkgo version | grep -q $(GINKGO_VERSION) || \ - GOBIN=$(LOCALBIN) go install github.com/onsi/ginkgo/v2/ginkgo@$(GINKGO_VERSION) - -.PHONY: bundle -bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files. - operator-sdk generate kustomize manifests -q - cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) - $(KUSTOMIZE) build config/manifests | operator-sdk generate bundle $(BUNDLE_GEN_FLAGS) - operator-sdk bundle validate ./bundle - -.PHONY: bundle-build -bundle-build: ## Build the bundle image. - $(CONTAINER_TOOL) build -f bundle.Dockerfile -t $(BUNDLE_IMG) . - -.PHONY: bundle-push -bundle-push: ## Push the bundle image. - $(MAKE) docker-push IMG=$(BUNDLE_IMG) - -.PHONY: opm -OPM = ./bin/opm -opm: ## Download opm locally if necessary. -ifeq (,$(wildcard $(OPM))) -ifeq (,$(shell which opm 2>/dev/null)) - @{ \ - set -e ;\ - mkdir -p $(dir $(OPM)) ;\ - OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \ - curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0/$${OS}-$${ARCH}-opm ;\ - chmod +x $(OPM) ;\ - } -else -OPM = $(shell which opm) -endif -endif - -# A comma-separated list of bundle images (e.g. make catalog-build BUNDLE_IMGS=example.com/operator-bundle:v0.1.0,example.com/operator-bundle:v0.2.0). -# These images MUST exist in a registry and be pull-able. -BUNDLE_IMGS ?= $(BUNDLE_IMG) - -# The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0). -CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:v$(VERSION) - -# Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image. -ifneq ($(origin CATALOG_BASE_IMG), undefined) -FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG) -endif - -# Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'. -# This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see: -# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator -.PHONY: catalog-build -catalog-build: opm ## Build a catalog image. - $(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) - -# Push the catalog image. -.PHONY: catalog-push -catalog-push: ## Push a catalog image. - $(MAKE) docker-push IMG=$(CATALOG_IMG) + GOBIN=$(LOCALBIN) go install github.com/onsi/ginkgo/v2/ginkgo@$(GINKGO_VERSION) kuttl: kubectl kuttl test diff --git a/PROJECT b/PROJECT index 0228e812..47a701b2 100644 --- a/PROJECT +++ b/PROJECT @@ -5,9 +5,6 @@ domain: nakamasato.com layout: - go.kubebuilder.io/v4 -plugins: - manifests.sdk.operatorframework.io/v2: {} - scorecard.sdk.operatorframework.io/v2: {} projectName: mysql-operator repo: github.com/nakamasato/mysql-operator resources: diff --git a/README.md b/README.md index 3e1659a8..3adbb823 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Reduce human operations: ## Versions -- Go: 1.21 +- Go: 1.20 ## Components diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go index 248ff197..bbc36b2f 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1alpha1/groupversion_info.go @@ -1,5 +1,5 @@ /* -Copyright 2021. +Copyright 2023. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/api/v1alpha1/mysql_types.go b/api/v1alpha1/mysql_types.go index 91e4a3d3..f92162e6 100644 --- a/api/v1alpha1/mysql_types.go +++ b/api/v1alpha1/mysql_types.go @@ -1,5 +1,5 @@ /* -Copyright 2021. +Copyright 2023. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/api/v1alpha1/mysqldb_types.go b/api/v1alpha1/mysqldb_types.go index 5ff77b92..1efbff85 100644 --- a/api/v1alpha1/mysqldb_types.go +++ b/api/v1alpha1/mysqldb_types.go @@ -1,5 +1,5 @@ /* -Copyright 2021. +Copyright 2023. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/api/v1alpha1/mysqluser_types.go b/api/v1alpha1/mysqluser_types.go index fc791cb8..75275791 100644 --- a/api/v1alpha1/mysqluser_types.go +++ b/api/v1alpha1/mysqluser_types.go @@ -1,5 +1,5 @@ /* -Copyright 2021. +Copyright 2023. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 95af6e5b..7626e892 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1,7 +1,8 @@ //go:build !ignore_autogenerated +// +build !ignore_autogenerated /* -Copyright 2021. +Copyright 2023. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/bundle.Dockerfile b/bundle.Dockerfile deleted file mode 100644 index 33625843..00000000 --- a/bundle.Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM scratch - -# Core bundle labels. -LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1 -LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/ -LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/ -LABEL operators.operatorframework.io.bundle.package.v1=mysql-operator -LABEL operators.operatorframework.io.bundle.channels.v1=alpha -LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.28.0 -LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 -LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4 - -# Labels for testing. -LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1 -LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ - -# Copy files to locations specified by labels. -COPY bundle/manifests /manifests/ -COPY bundle/metadata /metadata/ -COPY bundle/tests/scorecard /tests/scorecard/ diff --git a/bundle/manifests/mysql-operator-controller-manager-metrics-service_v1_service.yaml b/bundle/manifests/mysql-operator-controller-manager-metrics-service_v1_service.yaml deleted file mode 100644 index c465d031..00000000 --- a/bundle/manifests/mysql-operator-controller-manager-metrics-service_v1_service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - creationTimestamp: null - labels: - control-plane: controller-manager - name: mysql-operator-controller-manager-metrics-service -spec: - ports: - - name: https - port: 8443 - protocol: TCP - targetPort: https - selector: - control-plane: controller-manager -status: - loadBalancer: {} diff --git a/bundle/manifests/mysql-operator-manager-config_v1_configmap.yaml b/bundle/manifests/mysql-operator-manager-config_v1_configmap.yaml deleted file mode 100644 index 1633a236..00000000 --- a/bundle/manifests/mysql-operator-manager-config_v1_configmap.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -data: - controller_manager_config.yaml: | - apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 - kind: ControllerManagerConfig - health: - healthProbeBindAddress: :8081 - metrics: - bindAddress: 127.0.0.1:8080 - webhook: - port: 9443 - leaderElection: - leaderElect: true - resourceName: dfc6d3c2.nakamasato.com -kind: ConfigMap -metadata: - name: mysql-operator-manager-config diff --git a/bundle/manifests/mysql-operator-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml b/bundle/manifests/mysql-operator-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml deleted file mode 100644 index a9eb8d5e..00000000 --- a/bundle/manifests/mysql-operator-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - creationTimestamp: null - name: mysql-operator-metrics-reader -rules: -- nonResourceURLs: - - /metrics - verbs: - - get diff --git a/bundle/manifests/mysql-operator.clusterserviceversion.yaml b/bundle/manifests/mysql-operator.clusterserviceversion.yaml deleted file mode 100644 index 8c9b77d8..00000000 --- a/bundle/manifests/mysql-operator.clusterserviceversion.yaml +++ /dev/null @@ -1,238 +0,0 @@ -apiVersion: operators.coreos.com/v1alpha1 -kind: ClusterServiceVersion -metadata: - annotations: - alm-examples: |- - [ - { - "apiVersion": "mysql.nakamasato.com/v1alpha1", - "kind": "MySQL", - "metadata": { - "name": "mysql-sample" - }, - "spec": { - "admin_password": "password", - "admin_user": "root", - "host": "localhost" - } - }, - { - "apiVersion": "mysql.nakamasato.com/v1alpha1", - "kind": "MySQLUser", - "metadata": { - "name": "nakamasato" - }, - "spec": { - "mysqlName": "mysql-sample" - } - } - ] - capabilities: Basic Install - operators.operatorframework.io/builder: operator-sdk-v1.11.0 - operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 - name: mysql-operator.v0.0.1 - namespace: placeholder -spec: - apiservicedefinitions: {} - customresourcedefinitions: - owned: - - description: MySQL is the Schema for the mysqls API - displayName: My SQL - kind: MySQL - name: mysqls.mysql.nakamasato.com - version: v1alpha1 - - description: MySQLUser is the Schema for the mysqlusers API - displayName: My SQLUser - kind: MySQLUser - name: mysqlusers.mysql.nakamasato.com - version: v1alpha1 - description: Manage MySQL user - displayName: nakamasat-mysql-operator - icon: - - base64data: "" - mediatype: "" - install: - spec: - clusterPermissions: - - rules: - - apiGroups: - - mysql.nakamasato.com - resources: - - mysqls - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - mysql.nakamasato.com - resources: - - mysqls/finalizers - verbs: - - update - - apiGroups: - - mysql.nakamasato.com - resources: - - mysqls/status - verbs: - - get - - patch - - update - - apiGroups: - - mysql.nakamasato.com - resources: - - mysqlusers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - mysql.nakamasato.com - resources: - - mysqlusers/finalizers - verbs: - - update - - apiGroups: - - mysql.nakamasato.com - resources: - - mysqlusers/status - verbs: - - get - - patch - - update - - apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create - - apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create - serviceAccountName: mysql-operator-controller-manager - deployments: - - name: mysql-operator-controller-manager - spec: - replicas: 1 - selector: - matchLabels: - control-plane: controller-manager - strategy: {} - template: - metadata: - labels: - control-plane: controller-manager - spec: - containers: - - args: - - --secure-listen-address=0.0.0.0:8443 - - --upstream=http://127.0.0.1:8080/ - - --logtostderr=true - - --v=10 - image: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0 - name: kube-rbac-proxy - ports: - - containerPort: 8443 - name: https - protocol: TCP - resources: {} - - args: - - --health-probe-bind-address=:8081 - - --metrics-bind-address=127.0.0.1:8080 - - --leader-elect - command: - - /manager - image: ghcr.io/nakamasato/mysql-operator:latest - livenessProbe: - httpGet: - path: /healthz - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 20 - name: manager - readinessProbe: - httpGet: - path: /readyz - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 - resources: - limits: - cpu: 200m - memory: 100Mi - requests: - cpu: 100m - memory: 20Mi - securityContext: - allowPrivilegeEscalation: false - securityContext: - runAsNonRoot: true - serviceAccountName: mysql-operator-controller-manager - terminationGracePeriodSeconds: 10 - permissions: - - 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 - serviceAccountName: mysql-operator-controller-manager - strategy: deployment - installModes: - - supported: false - type: OwnNamespace - - supported: false - type: SingleNamespace - - supported: false - type: MultiNamespace - - supported: true - type: AllNamespaces - keywords: - - mysql - - mysql-operator - links: - - name: Mysql Operator - url: https://mysql-operator.domain - maintainers: - - email: masatonaka1989@gmail.com - name: nakamasato - maturity: alpha - provider: - name: nakamasato - version: 0.0.1 diff --git a/bundle/manifests/mysql.nakamasato.com_mysqls.yaml b/bundle/manifests/mysql.nakamasato.com_mysqls.yaml deleted file mode 100644 index 92bc0767..00000000 --- a/bundle/manifests/mysql.nakamasato.com_mysqls.yaml +++ /dev/null @@ -1,62 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.6.1 - creationTimestamp: null - name: mysqls.mysql.nakamasato.com -spec: - group: mysql.nakamasato.com - names: - kind: MySQL - listKind: MySQLList - plural: mysqls - singular: mysql - scope: Namespaced - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: MySQL is the Schema for the mysqls 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: MySQLSpec defines the desired state of MySQL - properties: - admin_password: - type: string - admin_user: - type: string - host: - description: Foo is an example field of MySQL. Edit mysql_types.go - to remove/update - type: string - required: - - admin_password - - admin_user - type: object - status: - description: MySQLStatus defines the observed state of MySQL - type: object - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/bundle/manifests/mysql.nakamasato.com_mysqlusers.yaml b/bundle/manifests/mysql.nakamasato.com_mysqlusers.yaml deleted file mode 100644 index 1dbbd2a3..00000000 --- a/bundle/manifests/mysql.nakamasato.com_mysqlusers.yaml +++ /dev/null @@ -1,131 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.6.1 - creationTimestamp: null - name: mysqlusers.mysql.nakamasato.com -spec: - group: mysql.nakamasato.com - names: - kind: MySQLUser - listKind: MySQLUserList - plural: mysqlusers - singular: mysqluser - scope: Namespaced - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: MySQLUser is the Schema for the mysqlusers 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: MySQLUserSpec defines the desired state of MySQLUser - properties: - host: - default: '%' - type: string - mysqlName: - type: string - required: - - mysqlName - type: object - status: - description: MySQLUserStatus defines the observed state of MySQLUser - properties: - conditions: - items: - description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - type FooStatus struct{ // Represents the observations of a - foo's current state. // Known .status.conditions.type are: - \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type - \ // +patchStrategy=merge // +listType=map // +listMapKey=type - \ Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` - \n // other fields }" - properties: - lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/bundle/metadata/annotations.yaml b/bundle/metadata/annotations.yaml deleted file mode 100644 index 70d711d3..00000000 --- a/bundle/metadata/annotations.yaml +++ /dev/null @@ -1,14 +0,0 @@ -annotations: - # Core bundle annotations. - operators.operatorframework.io.bundle.mediatype.v1: registry+v1 - operators.operatorframework.io.bundle.manifests.v1: manifests/ - operators.operatorframework.io.bundle.metadata.v1: metadata/ - operators.operatorframework.io.bundle.package.v1: mysql-operator - operators.operatorframework.io.bundle.channels.v1: alpha - operators.operatorframework.io.metrics.builder: operator-sdk-v1.11.0 - operators.operatorframework.io.metrics.mediatype.v1: metrics+v1 - operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3 - - # Annotations for testing. - operators.operatorframework.io.test.mediatype.v1: scorecard+v1 - operators.operatorframework.io.test.config.v1: tests/scorecard/ diff --git a/bundle/tests/scorecard/config.yaml b/bundle/tests/scorecard/config.yaml deleted file mode 100644 index 9546b48c..00000000 --- a/bundle/tests/scorecard/config.yaml +++ /dev/null @@ -1,75 +0,0 @@ -apiVersion: scorecard.operatorframework.io/v1alpha3 -kind: Configuration -metadata: - name: config -stages: -- parallel: true - tests: - - entrypoint: - - scorecard-test - - basic-check-spec - image: quay.io/operator-framework/scorecard-test:v1.10.1 - labels: - suite: basic - test: basic-check-spec-test - storage: - spec: - mountPath: {} - - entrypoint: - - scorecard-test - - olm-bundle-validation - image: quay.io/operator-framework/scorecard-test:v1.10.1 - labels: - suite: olm - test: olm-bundle-validation-test - storage: - spec: - mountPath: {} - - entrypoint: - - scorecard-test - - olm-crds-have-validation - image: quay.io/operator-framework/scorecard-test:v1.10.1 - labels: - suite: olm - test: olm-crds-have-validation-test - storage: - spec: - mountPath: {} - - entrypoint: - - scorecard-test - - olm-crds-have-resources - image: quay.io/operator-framework/scorecard-test:v1.10.1 - labels: - suite: olm - test: olm-crds-have-resources-test - storage: - spec: - mountPath: {} - - entrypoint: - - scorecard-test - - olm-spec-descriptors - image: quay.io/operator-framework/scorecard-test:v1.10.1 - labels: - suite: olm - test: olm-spec-descriptors-test - storage: - spec: - mountPath: {} - - entrypoint: - - scorecard-test - - olm-status-descriptors - image: quay.io/operator-framework/scorecard-test:v1.10.1 - labels: - suite: olm - test: olm-status-descriptors-test - storage: - spec: - mountPath: {} -- tests: - - image: quay.io/operator-framework/scorecard-test-kuttl:v2.0.0 - labels: - suite: kuttlsuite - test: kuttltest1 -storage: - spec: - mountPath: {} diff --git a/bundle/tests/scorecard/kuttl/kuttl-test.yaml b/bundle/tests/scorecard/kuttl/kuttl-test.yaml deleted file mode 100644 index 2d824430..00000000 --- a/bundle/tests/scorecard/kuttl/kuttl-test.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kudo.dev/v1beta1 -kind: TestSuite -parallel: 4 -timeout: 120 -startControlPlane: false diff --git a/bundle/tests/scorecard/kuttl/with-valid-mysql/00-assert.yaml b/bundle/tests/scorecard/kuttl/with-valid-mysql/00-assert.yaml deleted file mode 100644 index 60dd043d..00000000 --- a/bundle/tests/scorecard/kuttl/with-valid-mysql/00-assert.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: mysql -status: - readyReplicas: 1 diff --git a/bundle/tests/scorecard/kuttl/with-valid-mysql/00-mysql-deployment.yaml b/bundle/tests/scorecard/kuttl/with-valid-mysql/00-mysql-deployment.yaml deleted file mode 100644 index 8b85c759..00000000 --- a/bundle/tests/scorecard/kuttl/with-valid-mysql/00-mysql-deployment.yaml +++ /dev/null @@ -1,28 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - creationTimestamp: null - labels: - app: mysql - name: mysql -spec: - replicas: 1 - selector: - matchLabels: - app: mysql - strategy: {} - template: - metadata: - creationTimestamp: null - labels: - app: mysql - spec: - containers: - - image: mysql:8 - name: mysql - # https://hub.docker.com/_/mysql - env: - - name: MYSQL_ROOT_PASSWORD - value: password - resources: {} -status: {} diff --git a/bundle/tests/scorecard/kuttl/with-valid-mysql/00-mysql-service.yaml b/bundle/tests/scorecard/kuttl/with-valid-mysql/00-mysql-service.yaml deleted file mode 100644 index f32ae4e6..00000000 --- a/bundle/tests/scorecard/kuttl/with-valid-mysql/00-mysql-service.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - creationTimestamp: null - labels: - app: mysql - name: mysql -spec: - ports: - - name: "3306" - port: 3306 - protocol: TCP - targetPort: 3306 - selector: - app: mysql - type: ClusterIP -status: - loadBalancer: {} diff --git a/cmd/main.go b/cmd/main.go index 748df3dc..b27c2ecc 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -1,5 +1,5 @@ /* -Copyright 2021. +Copyright 2023. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/config/crd/bases/mysql.nakamasato.com_mysqldbs.yaml b/config/crd/bases/mysql.nakamasato.com_mysqldbs.yaml index 6a57a708..bd0c9b6b 100644 --- a/config/crd/bases/mysql.nakamasato.com_mysqldbs.yaml +++ b/config/crd/bases/mysql.nakamasato.com_mysqldbs.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.12.0 name: mysqldbs.mysql.nakamasato.com spec: group: mysql.nakamasato.com diff --git a/config/crd/bases/mysql.nakamasato.com_mysqls.yaml b/config/crd/bases/mysql.nakamasato.com_mysqls.yaml index 8bbed229..a30996ae 100644 --- a/config/crd/bases/mysql.nakamasato.com_mysqls.yaml +++ b/config/crd/bases/mysql.nakamasato.com_mysqls.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.12.0 name: mysqls.mysql.nakamasato.com spec: group: mysql.nakamasato.com diff --git a/config/crd/bases/mysql.nakamasato.com_mysqlusers.yaml b/config/crd/bases/mysql.nakamasato.com_mysqlusers.yaml index 2f53b5df..b8c8340a 100644 --- a/config/crd/bases/mysql.nakamasato.com_mysqlusers.yaml +++ b/config/crd/bases/mysql.nakamasato.com_mysqlusers.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.13.0 + controller-gen.kubebuilder.io/version: v0.12.0 name: mysqlusers.mysql.nakamasato.com spec: group: mysql.nakamasato.com diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 901892c7..440fb18c 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -2,24 +2,24 @@ # since it depends on service name and namespace that are out of this kustomize package. # It should be run by config/default resources: -- bases/mysql.nakamasato.com_mysqlusers.yaml - bases/mysql.nakamasato.com_mysqls.yaml - bases/mysql.nakamasato.com_mysqldbs.yaml +- bases/mysql.nakamasato.com_mysqlusers.yaml #+kubebuilder:scaffold:crdkustomizeresource -patchesStrategicMerge: +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_mysqlusers.yaml #- patches/webhook_in_mysqls.yaml #- patches/webhook_in_mysqldbs.yaml +#- patches/webhook_in_mysqlusers.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_mysqlusers.yaml #- patches/cainjection_in_mysqls.yaml #- patches/cainjection_in_mysqldbs.yaml +#- patches/cainjection_in_mysqlusers.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/config/crd/patches/cainjection_in_mysqldbs.yaml b/config/crd/patches/cainjection_in_mysqldbs.yaml index 4bef81ed..269e5b9d 100644 --- a/config/crd/patches/cainjection_in_mysqldbs.yaml +++ b/config/crd/patches/cainjection_in_mysqldbs.yaml @@ -3,5 +3,5 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME name: mysqldbs.mysql.nakamasato.com diff --git a/config/crd/patches/cainjection_in_mysqls.yaml b/config/crd/patches/cainjection_in_mysqls.yaml index 6231ac6e..522e9f18 100644 --- a/config/crd/patches/cainjection_in_mysqls.yaml +++ b/config/crd/patches/cainjection_in_mysqls.yaml @@ -3,5 +3,5 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME name: mysqls.mysql.nakamasato.com diff --git a/config/crd/patches/cainjection_in_mysqlusers.yaml b/config/crd/patches/cainjection_in_mysqlusers.yaml index 3c3a8dd9..5267e869 100644 --- a/config/crd/patches/cainjection_in_mysqlusers.yaml +++ b/config/crd/patches/cainjection_in_mysqlusers.yaml @@ -3,5 +3,5 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME name: mysqlusers.mysql.nakamasato.com diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 85a0e13e..25ed1d45 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -9,10 +9,12 @@ namespace: mysql-operator-system namePrefix: mysql-operator- # Labels to add to all resources and selectors. -#commonLabels: -# someName: someValue +#labels: +#- includeSelectors: true +# pairs: +# someName: someValue -bases: +resources: - ../crd - ../rbac - ../manager @@ -36,10 +38,6 @@ patchesStrategicMerge: # 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 - # [GCP SecretManager] Mount GCP service account key as secret # - manager_gcp_sa_secret_patch.yaml @@ -52,32 +50,102 @@ patchesStrategicMerge: # 'CERTMANAGER' needs to be enabled to use ca injection #- webhookcainjection_patch.yaml -# the following config is for teaching kustomize how to do var substitution -vars: # [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix. -#- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR -# objref: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -# fieldref: -# fieldpath: metadata.namespace -#- name: CERTIFICATE_NAME -# objref: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -#- name: SERVICE_NAMESPACE # namespace of the service -# objref: -# kind: Service -# version: v1 -# name: webhook-service -# fieldref: -# fieldpath: metadata.namespace -#- name: SERVICE_NAME -# objref: -# kind: Service -# version: v1 -# name: webhook-service +# 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/config/default/manager_auth_proxy_patch.yaml b/config/default/manager_auth_proxy_patch.yaml index 4e2232fa..73fad2a6 100644 --- a/config/default/manager_auth_proxy_patch.yaml +++ b/config/default/manager_auth_proxy_patch.yaml @@ -10,16 +10,28 @@ spec: spec: containers: - name: kube-rbac-proxy - image: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0 + 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=10" + - "--v=0" ports: - containerPort: 8443 protocol: TCP name: https + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 5m + memory: 64Mi - name: manager args: - "--health-probe-bind-address=:8081" diff --git a/config/default/manager_config_patch.yaml b/config/default/manager_config_patch.yaml index 6c400155..f6f58916 100644 --- a/config/default/manager_config_patch.yaml +++ b/config/default/manager_config_patch.yaml @@ -8,13 +8,3 @@ spec: 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/config/default/manager_gcp_sa_secret_patch.yaml b/config/default/manager_gcp_sa_secret_patch.yaml index fd0c7875..fdea75d9 100644 --- a/config/default/manager_gcp_sa_secret_patch.yaml +++ b/config/default/manager_gcp_sa_secret_patch.yaml @@ -8,16 +8,28 @@ spec: spec: containers: - name: kube-rbac-proxy - image: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0 + 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=10" + - "--v=0" ports: - - containerPort: 8443 - protocol: TCP - name: https + - containerPort: 8443 + protocol: TCP + name: https + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 5m + memory: 64Mi - name: manager args: - "--cloud-secret-manager=gcp" diff --git a/config/install/controller_manager_config.yaml b/config/install/controller_manager_config.yaml deleted file mode 100644 index 97f58e02..00000000 --- a/config/install/controller_manager_config.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 -kind: ControllerManagerConfig -health: - healthProbeBindAddress: :8081 -metrics: - bindAddress: 127.0.0.1:8080 -webhook: - port: 9443 -leaderElection: - leaderElect: true - resourceName: dfc6d3c2.nakamasato.com diff --git a/config/install/kustomization.yaml b/config/install/kustomization.yaml index fc0868fd..2a45ece7 100644 --- a/config/install/kustomization.yaml +++ b/config/install/kustomization.yaml @@ -9,10 +9,6 @@ resources: generatorOptions: disableNameSuffixHash: true -configMapGenerator: -- files: - - controller_manager_config.yaml - name: manager-config apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: diff --git a/config/manager/controller_manager_config.yaml b/config/manager/controller_manager_config.yaml deleted file mode 100644 index 97f58e02..00000000 --- a/config/manager/controller_manager_config.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 -kind: ControllerManagerConfig -health: - healthProbeBindAddress: :8081 -metrics: - bindAddress: 127.0.0.1:8080 -webhook: - port: 9443 -leaderElection: - leaderElect: true - resourceName: dfc6d3c2.nakamasato.com diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index ef182613..8cb2dba3 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -1,13 +1,5 @@ resources: - manager.yaml - -generatorOptions: - disableNameSuffixHash: true - -configMapGenerator: -- files: - - controller_manager_config.yaml - name: manager-config apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index db096284..2e7f965f 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -3,6 +3,12 @@ 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: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: system --- apiVersion: apps/v1 @@ -12,6 +18,12 @@ metadata: 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: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize spec: selector: matchLabels: @@ -19,11 +31,40 @@ spec: 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 @@ -34,6 +75,9 @@ spec: name: manager securityContext: allowPrivilegeEscalation: false + capabilities: + drop: + - "ALL" livenessProbe: httpGet: path: /healthz @@ -46,12 +90,14 @@ spec: 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: 200m - memory: 100Mi + cpu: 500m + memory: 128Mi requests: - cpu: 100m - memory: 20Mi + cpu: 10m + memory: 64Mi serviceAccountName: controller-manager terminationGracePeriodSeconds: 10 diff --git a/config/manifests/bases/mysql-operator.clusterserviceversion.yaml b/config/manifests/bases/mysql-operator.clusterserviceversion.yaml deleted file mode 100644 index ca9b448c..00000000 --- a/config/manifests/bases/mysql-operator.clusterserviceversion.yaml +++ /dev/null @@ -1,53 +0,0 @@ -apiVersion: operators.coreos.com/v1alpha1 -kind: ClusterServiceVersion -metadata: - annotations: - alm-examples: '[]' - capabilities: Basic Install - name: mysql-operator.v0.0.0 - namespace: placeholder -spec: - apiservicedefinitions: {} - customresourcedefinitions: - owned: - - description: MySQL is the Schema for the mysqls API - displayName: My SQL - kind: MySQL - name: mysqls.mysql.nakamasato.com - version: v1alpha1 - - description: MySQLUser is the Schema for the mysqlusers API - displayName: My SQLUser - kind: MySQLUser - name: mysqlusers.mysql.nakamasato.com - version: v1alpha1 - description: Manage MySQL user - displayName: nakamasat-mysql-operator - icon: - - base64data: "" - mediatype: "" - install: - spec: - deployments: null - strategy: "" - installModes: - - supported: false - type: OwnNamespace - - supported: false - type: SingleNamespace - - supported: false - type: MultiNamespace - - supported: true - type: AllNamespaces - keywords: - - mysql - - mysql-operator - links: - - name: Mysql Operator - url: https://mysql-operator.domain - maintainers: - - email: masatonaka1989@gmail.com - name: nakamasato - maturity: alpha - provider: - name: nakamasato - version: 0.0.0 diff --git a/config/manifests/kustomization.yaml b/config/manifests/kustomization.yaml deleted file mode 100644 index 2c8aec0c..00000000 --- a/config/manifests/kustomization.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# These resources constitute the fully configured set of manifests -# used to generate the 'manifests/' directory in a bundle. -resources: -- bases/mysql-operator.clusterserviceversion.yaml -- ../default -- ../samples -- ../scorecard - -# [WEBHOOK] To enable webhooks, uncomment all the sections with [WEBHOOK] prefix. -# Do NOT uncomment sections with prefix [CERTMANAGER], as OLM does not support cert-manager. -# These patches remove the unnecessary "cert" volume and its manager container volumeMount. -#patchesJson6902: -#- target: -# group: apps -# version: v1 -# kind: Deployment -# name: controller-manager -# namespace: system -# patch: |- -# # Remove the manager container's "cert" volumeMount, since OLM will create and mount a set of certs. -# # Update the indices in this path if adding or removing containers/volumeMounts in the manager's Deployment. -# - op: remove -# path: /spec/template/spec/containers/1/volumeMounts/0 -# # Remove the "cert" volume, since OLM will create and mount a set of certs. -# # Update the indices in this path if adding or removing volumes in the manager's Deployment. -# - op: remove -# path: /spec/template/spec/volumes/0 diff --git a/config/prometheus/monitor.yaml b/config/prometheus/monitor.yaml index d19136ae..78e7e2f4 100644 --- a/config/prometheus/monitor.yaml +++ b/config/prometheus/monitor.yaml @@ -5,6 +5,12 @@ 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: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-monitor namespace: system spec: diff --git a/config/rbac/auth_proxy_client_clusterrole.yaml b/config/rbac/auth_proxy_client_clusterrole.yaml index 51a75db4..f7bac5e7 100644 --- a/config/rbac/auth_proxy_client_clusterrole.yaml +++ b/config/rbac/auth_proxy_client_clusterrole.yaml @@ -1,6 +1,13 @@ 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: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: metrics-reader rules: - nonResourceURLs: diff --git a/config/rbac/auth_proxy_role.yaml b/config/rbac/auth_proxy_role.yaml index 80e1857c..6a06f030 100644 --- a/config/rbac/auth_proxy_role.yaml +++ b/config/rbac/auth_proxy_role.yaml @@ -1,6 +1,13 @@ 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: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: proxy-role rules: - apiGroups: diff --git a/config/rbac/auth_proxy_role_binding.yaml b/config/rbac/auth_proxy_role_binding.yaml index ec7acc0a..d2a7c5ec 100644 --- a/config/rbac/auth_proxy_role_binding.yaml +++ b/config/rbac/auth_proxy_role_binding.yaml @@ -1,6 +1,13 @@ 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: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: proxy-rolebinding roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/config/rbac/auth_proxy_service.yaml b/config/rbac/auth_proxy_service.yaml index 71f17972..88c3a538 100644 --- a/config/rbac/auth_proxy_service.yaml +++ b/config/rbac/auth_proxy_service.yaml @@ -3,6 +3,12 @@ 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: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-service namespace: system spec: diff --git a/config/rbac/leader_election_role.yaml b/config/rbac/leader_election_role.yaml index 4190ec80..5ca1b9ac 100644 --- a/config/rbac/leader_election_role.yaml +++ b/config/rbac/leader_election_role.yaml @@ -2,6 +2,13 @@ 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: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: leader-election-role rules: - apiGroups: diff --git a/config/rbac/leader_election_role_binding.yaml b/config/rbac/leader_election_role_binding.yaml index 1d1321ed..d0625499 100644 --- a/config/rbac/leader_election_role_binding.yaml +++ b/config/rbac/leader_election_role_binding.yaml @@ -1,6 +1,13 @@ 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: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: leader-election-rolebinding roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/config/rbac/mysql_editor_role.yaml b/config/rbac/mysql_editor_role.yaml index d00eeb74..f36eff4d 100644 --- a/config/rbac/mysql_editor_role.yaml +++ b/config/rbac/mysql_editor_role.yaml @@ -2,6 +2,13 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: mysql-editor-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: mysql-editor-role rules: - apiGroups: diff --git a/config/rbac/mysql_viewer_role.yaml b/config/rbac/mysql_viewer_role.yaml index f4239964..a405aa28 100644 --- a/config/rbac/mysql_viewer_role.yaml +++ b/config/rbac/mysql_viewer_role.yaml @@ -2,6 +2,13 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: mysql-viewer-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: mysql-viewer-role rules: - apiGroups: diff --git a/config/rbac/mysqluser_editor_role.yaml b/config/rbac/mysqluser_editor_role.yaml index ebb5840a..a2972169 100644 --- a/config/rbac/mysqluser_editor_role.yaml +++ b/config/rbac/mysqluser_editor_role.yaml @@ -2,6 +2,13 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: mysqluser-editor-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: mysqluser-editor-role rules: - apiGroups: diff --git a/config/rbac/mysqluser_viewer_role.yaml b/config/rbac/mysqluser_viewer_role.yaml index 6d174be8..78ab757a 100644 --- a/config/rbac/mysqluser_viewer_role.yaml +++ b/config/rbac/mysqluser_viewer_role.yaml @@ -2,6 +2,13 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: mysqluser-viewer-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: mysqluser-viewer-role rules: - apiGroups: diff --git a/config/rbac/role_binding.yaml b/config/rbac/role_binding.yaml index 2070ede4..ae153845 100644 --- a/config/rbac/role_binding.yaml +++ b/config/rbac/role_binding.yaml @@ -1,6 +1,13 @@ 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: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: manager-rolebinding roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/config/rbac/service_account.yaml b/config/rbac/service_account.yaml index 7cd6025b..ec06d960 100644 --- a/config/rbac/service_account.yaml +++ b/config/rbac/service_account.yaml @@ -1,5 +1,12 @@ 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: mysql-operator + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize name: controller-manager namespace: system diff --git a/config/samples/kustomization.yaml b/config/samples/kustomization.yaml index 5c4a1842..9f12d43c 100644 --- a/config/samples/kustomization.yaml +++ b/config/samples/kustomization.yaml @@ -1,6 +1,6 @@ -## Append samples you want in your CSV to this file as resources ## +## Append samples of your project ## resources: -- mysql_v1alpha1_mysqluser.yaml - mysql_v1alpha1_mysql.yaml - mysql_v1alpha1_mysqldb.yaml +- mysql_v1alpha1_mysqluser.yaml #+kubebuilder:scaffold:manifestskustomizesamples diff --git a/config/samples/mysql_v1alpha1_mysql.yaml b/config/samples/mysql_v1alpha1_mysql.yaml index 77fab6e5..73ba1f37 100644 --- a/config/samples/mysql_v1alpha1_mysql.yaml +++ b/config/samples/mysql_v1alpha1_mysql.yaml @@ -1,6 +1,12 @@ apiVersion: mysql.nakamasato.com/v1alpha1 kind: MySQL metadata: + labels: + app.kubernetes.io/name: mysql + app.kubernetes.io/instance: mysql-sample + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/created-by: mysql-operator name: mysql-sample spec: host: localhost diff --git a/config/samples/mysql_v1alpha1_mysqluser.yaml b/config/samples/mysql_v1alpha1_mysqluser.yaml index 60d49084..e124212e 100644 --- a/config/samples/mysql_v1alpha1_mysqluser.yaml +++ b/config/samples/mysql_v1alpha1_mysqluser.yaml @@ -1,6 +1,12 @@ apiVersion: mysql.nakamasato.com/v1alpha1 kind: MySQLUser metadata: + labels: + app.kubernetes.io/name: mysqluser + app.kubernetes.io/instance: sample-user + app.kubernetes.io/part-of: mysql-operator + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/created-by: mysql-operator name: sample-user spec: mysqlName: mysql-sample diff --git a/config/scorecard/bases/config.yaml b/config/scorecard/bases/config.yaml deleted file mode 100644 index c7704784..00000000 --- a/config/scorecard/bases/config.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: scorecard.operatorframework.io/v1alpha3 -kind: Configuration -metadata: - name: config -stages: -- parallel: true - tests: [] diff --git a/config/scorecard/kustomization.yaml b/config/scorecard/kustomization.yaml deleted file mode 100644 index 50cd2d08..00000000 --- a/config/scorecard/kustomization.yaml +++ /dev/null @@ -1,16 +0,0 @@ -resources: -- bases/config.yaml -patchesJson6902: -- path: patches/basic.config.yaml - target: - group: scorecard.operatorframework.io - version: v1alpha3 - kind: Configuration - name: config -- path: patches/olm.config.yaml - target: - group: scorecard.operatorframework.io - version: v1alpha3 - kind: Configuration - name: config -#+kubebuilder:scaffold:patchesJson6902 diff --git a/config/scorecard/patches/basic.config.yaml b/config/scorecard/patches/basic.config.yaml deleted file mode 100644 index bf75b8fa..00000000 --- a/config/scorecard/patches/basic.config.yaml +++ /dev/null @@ -1,10 +0,0 @@ -- op: add - path: /stages/0/tests/- - value: - entrypoint: - - scorecard-test - - basic-check-spec - image: quay.io/operator-framework/scorecard-test:v1.10.1 - labels: - suite: basic - test: basic-check-spec-test diff --git a/config/scorecard/patches/olm.config.yaml b/config/scorecard/patches/olm.config.yaml deleted file mode 100644 index 89f191ac..00000000 --- a/config/scorecard/patches/olm.config.yaml +++ /dev/null @@ -1,50 +0,0 @@ -- op: add - path: /stages/0/tests/- - value: - entrypoint: - - scorecard-test - - olm-bundle-validation - image: quay.io/operator-framework/scorecard-test:v1.10.1 - labels: - suite: olm - test: olm-bundle-validation-test -- op: add - path: /stages/0/tests/- - value: - entrypoint: - - scorecard-test - - olm-crds-have-validation - image: quay.io/operator-framework/scorecard-test:v1.10.1 - labels: - suite: olm - test: olm-crds-have-validation-test -- op: add - path: /stages/0/tests/- - value: - entrypoint: - - scorecard-test - - olm-crds-have-resources - image: quay.io/operator-framework/scorecard-test:v1.10.1 - labels: - suite: olm - test: olm-crds-have-resources-test -- op: add - path: /stages/0/tests/- - value: - entrypoint: - - scorecard-test - - olm-spec-descriptors - image: quay.io/operator-framework/scorecard-test:v1.10.1 - labels: - suite: olm - test: olm-spec-descriptors-test -- op: add - path: /stages/0/tests/- - value: - entrypoint: - - scorecard-test - - olm-status-descriptors - image: quay.io/operator-framework/scorecard-test:v1.10.1 - labels: - suite: olm - test: olm-status-descriptors-test diff --git a/docs/developer-guide/debug.md b/docs/developer-guide/debug.md index 70460636..04f7884d 100644 --- a/docs/developer-guide/debug.md +++ b/docs/developer-guide/debug.md @@ -8,7 +8,23 @@ sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock ``` -Ref: https://github.com/GoogleContainerTools/skaffold/issues/7985 +or Check your docker context and use the default one (this didn't work) + +``` +docker context ls +NAME TYPE DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR +default moby Current DOCKER_HOST based configuration unix:///var/run/docker.sock +desktop-linux * moby Docker Desktop unix:///Users/yourname/.docker/run/docker.sock +``` + +``` +docker context use default +``` + +Ref: +1. https://github.com/GoogleContainerTools/skaffold/issues/7985 +1. https://github.com/docker/for-mac/issues/6529 +1. https://stackoverflow.com/questions/74170319/skaffold-cannot-connect-to-the-docker-daemon-on-docker-desktop-for-macos ### Server rejected event diff --git a/docs/developer-guide/versions.md b/docs/developer-guide/versions.md index 8536f99d..477c21c7 100644 --- a/docs/developer-guide/versions.md +++ b/docs/developer-guide/versions.md @@ -56,6 +56,38 @@ Steps: ## kubebuilder -### [Migration from go/v3 to go/v4 (manually)](https://book.kubebuilder.io/migration/manually_migration_guide_gov3_to_gov4) +### Migration from go/v3 to go/v4 +- https://book.kubebuilder.io/migration/manually_migration_guide_gov3_to_gov4 - https://github.com/kubernetes-sigs/kubebuilder/blob/master/testdata/project-v4/Makefile +- https://book.kubebuilder.io/migration/migration_guide_gov3_to_gov4 + + +``` +kubebuilder version +Version: main.version{KubeBuilderVersion:"3.11.0", KubernetesVendor:"1.27.1", GitCommit:"3a3d1d9573f5b8fe7252bf49cec6e67ba87c88e7", BuildDate:"2023-06-20T19:20:03Z", GoOs:"darwin", GoArch:"arm64"} +``` + +``` +go mod init github.com/nakamasato/mysql-operator +``` + +``` +kubebuilder init --domain nakamasato.com --plugins=go/v4 +``` + +``` +kubebuilder create api --group mysql --version v1alpha1 --kind MySQL --controller --api +kubebuilder create api --group mysql --version v1alpha1 --kind MySQLDB --controller --api +kubebuilder create api --group mysql --version v1alpha1 --kind MySQLUser --controller --api +``` + +Copy apis + +Copy internal packages +``` +cp -r ../mysql-operator/internal/metrics internal +cp -r ../mysql-operator/internal/mysql internal/mysql +cp -r ../mysql-operator/internal/secret internal/ +cp -r ../mysql-operator/internal/utils internal/ +``` diff --git a/e2e/skaffold.yaml b/e2e/skaffold.yaml index 4eea3740..021ad6be 100644 --- a/e2e/skaffold.yaml +++ b/e2e/skaffold.yaml @@ -10,6 +10,7 @@ build: dockerfile: Dockerfile local: push: false + useDockerCLI: true manifests: kustomize: paths: diff --git a/go.mod b/go.mod index c80fe52d..45fc5065 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nakamasato/mysql-operator -go 1.21 +go 1.20 require ( cloud.google.com/go/secretmanager v1.11.1 @@ -49,7 +49,7 @@ require ( github.com/googleapis/gax-go/v2 v2.11.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/imdario/mergo v0.3.12 // indirect + github.com/imdario/mergo v0.3.6 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -61,7 +61,6 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/spf13/pflag v1.0.5 // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.10.0 // indirect diff --git a/go.sum b/go.sum index b294fdcf..1a7558aa 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.110.2 h1:sdFPBr6xG9/wkBbfhmUz/JmZC7X6LavQgcrVINrKiVA= -cloud.google.com/go v0.110.2/go.mod h1:k04UEeEtb6ZBRTv3dZz4CeJC3jKGxyhl0sAiVVquxiw= cloud.google.com/go/compute v1.19.3 h1:DcTwsFgGev/wV5+q8o2fzgcHOaac+DKGC91ZlvpsQds= cloud.google.com/go/compute v1.19.3/go.mod h1:qxvISKp/gYnXkSAD1ppcSOveRAmzxicEv/JlizULFrI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= @@ -11,14 +10,11 @@ cloud.google.com/go/iam v1.1.0/go.mod h1:nxdHjaKfCr7fNYx/HJMM8LgiMugmveWlkatear5 cloud.google.com/go/secretmanager v1.11.1 h1:cLTCwAjFh9fKvU6F13Y4L9vPcx9yiWPyWXE4+zkuEQs= cloud.google.com/go/secretmanager v1.11.1/go.mod h1:znq9JlXgTNdBeQk9TBW/FnR/W4uChEKGeqQWAJ8SXFw= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -40,15 +36,10 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dhui/dktest v0.3.16 h1:i6gq2YQEtcrjKbeJpBkWjE8MmLZPYllcjOFbTZuPDnw= -github.com/dhui/dktest v0.3.16/go.mod h1:gYaA3LRmM8Z4vJl2MA0THIigJoZrwOansEOsp+kqxp0= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= -github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE= -github.com/docker/docker v20.10.24+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE= github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -58,7 +49,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= -github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -142,8 +132,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= +github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= @@ -154,7 +144,6 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -164,14 +153,12 @@ github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= -github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/nakamasato/test-db-driver v0.0.0-20230330121357-46698833afb6 h1:eHuS0xqrhqWdnfncukdmHS2IHvj8GFb3LHOIihnw3/A= @@ -181,9 +168,7 @@ github.com/onsi/ginkgo/v2 v2.12.0/go.mod h1:ZNEzXISYlqpb8S36iN71ifqLi3vVD1rVJGvW github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= -github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= -github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -199,10 +184,8 @@ github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y= -github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -216,7 +199,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= @@ -229,7 +211,6 @@ go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= -go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -258,7 +239,6 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -290,7 +270,6 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -387,7 +366,6 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt index 7515c64b..6975adbe 100644 --- a/hack/boilerplate.go.txt +++ b/hack/boilerplate.go.txt @@ -1,5 +1,5 @@ /* -Copyright 2021. +Copyright 2023. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/internal/controller/mysql_controller.go b/internal/controller/mysql_controller.go index a98c5ad9..fb240ba0 100644 --- a/internal/controller/mysql_controller.go +++ b/internal/controller/mysql_controller.go @@ -1,5 +1,5 @@ /* -Copyright 2021. +Copyright 2023. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/internal/controller/mysqldb_controller.go b/internal/controller/mysqldb_controller.go index 329d6e41..c01bfb8a 100644 --- a/internal/controller/mysqldb_controller.go +++ b/internal/controller/mysqldb_controller.go @@ -1,5 +1,5 @@ /* -Copyright 2021. +Copyright 2023. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/internal/controller/mysqluser_controller.go b/internal/controller/mysqluser_controller.go index 07afd711..f78a9e0f 100644 --- a/internal/controller/mysqluser_controller.go +++ b/internal/controller/mysqluser_controller.go @@ -1,5 +1,5 @@ /* -Copyright 2021. +Copyright 2023. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/internal/controller/suite_test.go b/internal/controller/suite_test.go index 8d9f8713..2bd7f262 100644 --- a/internal/controller/suite_test.go +++ b/internal/controller/suite_test.go @@ -1,5 +1,5 @@ /* -Copyright 2021. +Copyright 2023. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/skaffold.yaml b/skaffold.yaml index 3db67b44..61246f20 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -8,6 +8,8 @@ build: context: . docker: dockerfile: Dockerfile + local: + useDockerCLI: true manifests: kustomize: paths: