diff --git a/Makefile b/Makefile index 5b0e996..2ad86b1 100644 --- a/Makefile +++ b/Makefile @@ -120,10 +120,10 @@ PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le docker-buildx: ## 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 etcd-operator-builder - $(CONTAINER_TOOL) buildx use etcd-operator-builder + - $(CONTAINER_TOOL) buildx create --name test-operator-builder + $(CONTAINER_TOOL) buildx use test-operator-builder - $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross . - - $(CONTAINER_TOOL) buildx rm etcd-operator-builder + - $(CONTAINER_TOOL) buildx rm test-operator-builder rm Dockerfile.cross .PHONY: build-installer @@ -170,10 +170,10 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest GOLANGCI_LINT = $(LOCALBIN)/golangci-lint ## Tool Versions -KUSTOMIZE_VERSION ?= v5.4.3 +KUSTOMIZE_VERSION ?= v5.5.0 CONTROLLER_TOOLS_VERSION ?= v0.16.4 ENVTEST_VERSION ?= release-0.19 -GOLANGCI_LINT_VERSION ?= v1.59.1 +GOLANGCI_LINT_VERSION ?= v1.61.0 .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. diff --git a/PROJECT b/PROJECT index 40c7c87..9eca043 100644 --- a/PROJECT +++ b/PROJECT @@ -5,7 +5,7 @@ domain: etcd.io layout: - go.kubebuilder.io/v4 -projectName: etcd-operator +projectName: test-operator repo: go.etcd.io/etcd-operator resources: - api: @@ -13,7 +13,7 @@ resources: namespaced: true controller: true domain: etcd.io - group: clusters + group: operator kind: EtcdCluster path: go.etcd.io/etcd-operator/api/v1alpha1 version: v1alpha1 diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go index e845835..9acf45f 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1alpha1/groupversion_info.go @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package v1alpha1 contains API Schema definitions for the clusters v1alpha1 API group. +// Package v1alpha1 contains API Schema definitions for the operator v1alpha1 API group. // +kubebuilder:object:generate=true -// +groupName=clusters.etcd.io +// +groupName=operator.etcd.io package v1alpha1 import ( @@ -26,7 +26,7 @@ import ( var ( // GroupVersion is group version used to register these objects. - GroupVersion = schema.GroupVersion{Group: "clusters.etcd.io", Version: "v1alpha1"} + GroupVersion = schema.GroupVersion{Group: "operator.etcd.io", Version: "v1alpha1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme. SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} diff --git a/cmd/main.go b/cmd/main.go index 3ec11e1..7a1c99a 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -35,7 +35,7 @@ import ( metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" "sigs.k8s.io/controller-runtime/pkg/webhook" - clustersv1alpha1 "go.etcd.io/etcd-operator/api/v1alpha1" + operatorv1alpha1 "go.etcd.io/etcd-operator/api/v1alpha1" "go.etcd.io/etcd-operator/internal/controller" // +kubebuilder:scaffold:imports ) @@ -48,7 +48,7 @@ var ( func init() { utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - utilruntime.Must(clustersv1alpha1.AddToScheme(scheme)) + utilruntime.Must(operatorv1alpha1.AddToScheme(scheme)) // +kubebuilder:scaffold:scheme } @@ -98,26 +98,24 @@ func main() { // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server. // More info: - // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/metrics/server + // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.1/pkg/metrics/server // - https://book.kubebuilder.io/reference/metrics.html metricsServerOptions := metricsserver.Options{ BindAddress: metricsAddr, SecureServing: secureMetrics, - // TODO(user): TLSOpts is used to allow configuring the TLS config used for the server. If certificates are - // not provided, self-signed certificates will be generated by default. This option is not recommended for - // production environments as self-signed certificates do not offer the same level of trust and security - // as certificates issued by a trusted Certificate Authority (CA). The primary risk is potentially allowing - // unauthorized access to sensitive metrics data. Consider replacing with CertDir, CertName, and KeyName - // to provide certificates, ensuring the server communicates using trusted and secure certificates. - TLSOpts: tlsOpts, + TLSOpts: tlsOpts, } if secureMetrics { // FilterProvider is used to protect the metrics endpoint with authn/authz. // These configurations ensure that only authorized users and service accounts // can access the metrics endpoint. The RBAC are configured in 'config/rbac/kustomization.yaml'. More info: - // https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/metrics/filters#WithAuthenticationAndAuthorization + // https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.1/pkg/metrics/filters#WithAuthenticationAndAuthorization metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization + + // TODO(user): If CertDir, CertName, and KeyName are not specified, controller-runtime will automatically + // generate self-signed certificates for the metrics server. While convenient for development and testing, + // this setup is not recommended for production. } mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ diff --git a/config/crd/bases/clusters.etcd.io_etcdclusters.yaml b/config/crd/bases/operator.etcd.io_etcdclusters.yaml similarity index 96% rename from config/crd/bases/clusters.etcd.io_etcdclusters.yaml rename to config/crd/bases/operator.etcd.io_etcdclusters.yaml index fdae794..0cb092a 100644 --- a/config/crd/bases/clusters.etcd.io_etcdclusters.yaml +++ b/config/crd/bases/operator.etcd.io_etcdclusters.yaml @@ -4,9 +4,9 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.16.4 - name: etcdclusters.clusters.etcd.io + name: etcdclusters.operator.etcd.io spec: - group: clusters.etcd.io + group: operator.etcd.io names: kind: EtcdCluster listKind: EtcdClusterList diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 3948730..ca614b9 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -2,7 +2,7 @@ # since it depends on service name and namespace that are out of this kustomize package. # It should be run by config/default resources: -- bases/clusters.etcd.io_etcdclusters.yaml +- bases/operator.etcd.io_etcdclusters.yaml # +kubebuilder:scaffold:crdkustomizeresource patches: @@ -12,11 +12,9 @@ patches: # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD -#- path: patches/cainjection_in_etcdclusters.yaml # +kubebuilder:scaffold:crdkustomizecainjectionpatch # [WEBHOOK] To enable webhook, uncomment the following section # the following config is for teaching kustomize how to do kustomization for CRDs. - #configurations: #- kustomizeconfig.yaml diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 2fbe4d5..5477adc 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -1,12 +1,12 @@ # Adds namespace to all resources. -namespace: etcd-operator-system +namespace: test-operator-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: etcd-operator- +namePrefix: test-operator- # Labels to add to all resources and selectors. #labels: @@ -48,6 +48,41 @@ patches: # [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: # Uncomment the following block if you have any webhook +# kind: Service +# version: v1 +# name: webhook-service +# fieldPath: .metadata.name # Name 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 +# # - source: # Uncomment the following block if you have a ValidatingWebhook (--programmatic-validation) # kind: Certificate # group: cert-manager.io @@ -140,38 +175,3 @@ patches: # delimiter: '/' # index: 1 # create: true -# -# - source: # Uncomment the following block if you enable cert-manager -# kind: Service -# version: v1 -# name: webhook-service -# fieldPath: .metadata.name # Name 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/metrics_service.yaml b/config/default/metrics_service.yaml index 07ffb27..7b5cd94 100644 --- a/config/default/metrics_service.yaml +++ b/config/default/metrics_service.yaml @@ -3,7 +3,7 @@ kind: Service metadata: labels: control-plane: controller-manager - app.kubernetes.io/name: etcd-operator + app.kubernetes.io/name: test-operator app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-service namespace: system diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index c3164c4..4a86e34 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -3,7 +3,7 @@ kind: Namespace metadata: labels: control-plane: controller-manager - app.kubernetes.io/name: etcd-operator + app.kubernetes.io/name: test-operator app.kubernetes.io/managed-by: kustomize name: system --- @@ -14,7 +14,7 @@ metadata: namespace: system labels: control-plane: controller-manager - app.kubernetes.io/name: etcd-operator + app.kubernetes.io/name: test-operator app.kubernetes.io/managed-by: kustomize spec: selector: diff --git a/config/network-policy/allow-metrics-traffic.yaml b/config/network-policy/allow-metrics-traffic.yaml index 9f83870..154d5eb 100644 --- a/config/network-policy/allow-metrics-traffic.yaml +++ b/config/network-policy/allow-metrics-traffic.yaml @@ -5,7 +5,7 @@ apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: labels: - app.kubernetes.io/name: etcd-operator + app.kubernetes.io/name: test-operator app.kubernetes.io/managed-by: kustomize name: allow-metrics-traffic namespace: system diff --git a/config/prometheus/monitor.yaml b/config/prometheus/monitor.yaml index b6cad92..dd66fec 100644 --- a/config/prometheus/monitor.yaml +++ b/config/prometheus/monitor.yaml @@ -4,7 +4,7 @@ kind: ServiceMonitor metadata: labels: control-plane: controller-manager - app.kubernetes.io/name: etcd-operator + app.kubernetes.io/name: test-operator app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-monitor namespace: system diff --git a/config/rbac/etcdcluster_editor_role.yaml b/config/rbac/etcdcluster_editor_role.yaml index e3fe9f3..cc6d101 100644 --- a/config/rbac/etcdcluster_editor_role.yaml +++ b/config/rbac/etcdcluster_editor_role.yaml @@ -3,12 +3,12 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: etcd-operator + app.kubernetes.io/name: test-operator app.kubernetes.io/managed-by: kustomize name: etcdcluster-editor-role rules: - apiGroups: - - clusters.etcd.io + - operator.etcd.io resources: - etcdclusters verbs: @@ -20,7 +20,7 @@ rules: - update - watch - apiGroups: - - clusters.etcd.io + - operator.etcd.io resources: - etcdclusters/status verbs: diff --git a/config/rbac/etcdcluster_viewer_role.yaml b/config/rbac/etcdcluster_viewer_role.yaml index 455491a..b71a075 100644 --- a/config/rbac/etcdcluster_viewer_role.yaml +++ b/config/rbac/etcdcluster_viewer_role.yaml @@ -3,12 +3,12 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: - app.kubernetes.io/name: etcd-operator + app.kubernetes.io/name: test-operator app.kubernetes.io/managed-by: kustomize name: etcdcluster-viewer-role rules: - apiGroups: - - clusters.etcd.io + - operator.etcd.io resources: - etcdclusters verbs: @@ -16,7 +16,7 @@ rules: - list - watch - apiGroups: - - clusters.etcd.io + - operator.etcd.io resources: - etcdclusters/status verbs: diff --git a/config/rbac/leader_election_role.yaml b/config/rbac/leader_election_role.yaml index ef5189e..1fe7a6a 100644 --- a/config/rbac/leader_election_role.yaml +++ b/config/rbac/leader_election_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: labels: - app.kubernetes.io/name: etcd-operator + app.kubernetes.io/name: test-operator app.kubernetes.io/managed-by: kustomize name: leader-election-role rules: diff --git a/config/rbac/leader_election_role_binding.yaml b/config/rbac/leader_election_role_binding.yaml index f7cf464..5411d9d 100644 --- a/config/rbac/leader_election_role_binding.yaml +++ b/config/rbac/leader_election_role_binding.yaml @@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: labels: - app.kubernetes.io/name: etcd-operator + app.kubernetes.io/name: test-operator app.kubernetes.io/managed-by: kustomize name: leader-election-rolebinding roleRef: diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 859ff1e..0f57b69 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -5,7 +5,7 @@ metadata: name: manager-role rules: - apiGroups: - - clusters.etcd.io + - operator.etcd.io resources: - etcdclusters verbs: @@ -17,13 +17,13 @@ rules: - update - watch - apiGroups: - - clusters.etcd.io + - operator.etcd.io resources: - etcdclusters/finalizers verbs: - update - apiGroups: - - clusters.etcd.io + - operator.etcd.io resources: - etcdclusters/status verbs: diff --git a/config/rbac/role_binding.yaml b/config/rbac/role_binding.yaml index 4d24efd..864dd42 100644 --- a/config/rbac/role_binding.yaml +++ b/config/rbac/role_binding.yaml @@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: labels: - app.kubernetes.io/name: etcd-operator + app.kubernetes.io/name: test-operator app.kubernetes.io/managed-by: kustomize name: manager-rolebinding roleRef: diff --git a/config/rbac/service_account.yaml b/config/rbac/service_account.yaml index fa4a570..a71057f 100644 --- a/config/rbac/service_account.yaml +++ b/config/rbac/service_account.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ServiceAccount metadata: labels: - app.kubernetes.io/name: etcd-operator + app.kubernetes.io/name: test-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 0e248f6..f3c97ab 100644 --- a/config/samples/kustomization.yaml +++ b/config/samples/kustomization.yaml @@ -1,4 +1,4 @@ ## Append samples of your project ## resources: -- clusters_v1alpha1_etcdcluster.yaml +- operator_v1alpha1_etcdcluster.yaml # +kubebuilder:scaffold:manifestskustomizesamples diff --git a/config/samples/clusters_v1alpha1_etcdcluster.yaml b/config/samples/operator_v1alpha1_etcdcluster.yaml similarity index 64% rename from config/samples/clusters_v1alpha1_etcdcluster.yaml rename to config/samples/operator_v1alpha1_etcdcluster.yaml index a2a37a4..7687adf 100644 --- a/config/samples/clusters_v1alpha1_etcdcluster.yaml +++ b/config/samples/operator_v1alpha1_etcdcluster.yaml @@ -1,8 +1,8 @@ -apiVersion: clusters.etcd.io/v1alpha1 +apiVersion: operator.etcd.io/v1alpha1 kind: EtcdCluster metadata: labels: - app.kubernetes.io/name: etcd-operator + app.kubernetes.io/name: test-operator app.kubernetes.io/managed-by: kustomize name: etcdcluster-sample spec: diff --git a/go.mod b/go.mod index 6b61fa7..7fcf649 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/onsi/gomega v1.33.1 k8s.io/apimachinery v0.31.0 k8s.io/client-go v0.31.0 - sigs.k8s.io/controller-runtime v0.19.0 + sigs.k8s.io/controller-runtime v0.19.1 ) require ( diff --git a/go.sum b/go.sum index a8ec01d..0958667 100644 --- a/go.sum +++ b/go.sum @@ -241,8 +241,8 @@ k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1 k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 h1:2770sDpzrjjsAtVhSeUFseziht227YAWYHLGNM8QPwY= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= -sigs.k8s.io/controller-runtime v0.19.0 h1:nWVM7aq+Il2ABxwiCizrVDSlmDcshi9llbaFbC0ji/Q= -sigs.k8s.io/controller-runtime v0.19.0/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= +sigs.k8s.io/controller-runtime v0.19.1 h1:Son+Q40+Be3QWb+niBXAg2vFiYWolDjjRfO8hn/cxOk= +sigs.k8s.io/controller-runtime v0.19.1/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/internal/controller/etcdcluster_controller.go b/internal/controller/etcdcluster_controller.go index af98093..065f6c6 100644 --- a/internal/controller/etcdcluster_controller.go +++ b/internal/controller/etcdcluster_controller.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - clustersv1alpha1 "go.etcd.io/etcd-operator/api/v1alpha1" + operatorv1alpha1 "go.etcd.io/etcd-operator/api/v1alpha1" ) // EtcdClusterReconciler reconciles a EtcdCluster object @@ -33,9 +33,9 @@ type EtcdClusterReconciler struct { Scheme *runtime.Scheme } -// +kubebuilder:rbac:groups=clusters.etcd.io,resources=etcdclusters,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=clusters.etcd.io,resources=etcdclusters/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=clusters.etcd.io,resources=etcdclusters/finalizers,verbs=update +// +kubebuilder:rbac:groups=operator.etcd.io,resources=etcdclusters,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=operator.etcd.io,resources=etcdclusters/status,verbs=get;update;patch +// +kubebuilder:rbac:groups=operator.etcd.io,resources=etcdclusters/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. @@ -45,7 +45,7 @@ type EtcdClusterReconciler struct { // the user. // // For more details, check Reconcile and its Result here: -// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile +// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.1/pkg/reconcile func (r *EtcdClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { _ = log.FromContext(ctx) @@ -57,7 +57,7 @@ func (r *EtcdClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) // SetupWithManager sets up the controller with the Manager. func (r *EtcdClusterReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&clustersv1alpha1.EtcdCluster{}). + For(&operatorv1alpha1.EtcdCluster{}). Named("etcdcluster"). Complete(r) } diff --git a/internal/controller/etcdcluster_controller_test.go b/internal/controller/etcdcluster_controller_test.go index 2537586..93e059c 100644 --- a/internal/controller/etcdcluster_controller_test.go +++ b/internal/controller/etcdcluster_controller_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clustersv1alpha1 "go.etcd.io/etcd-operator/api/v1alpha1" + operatorv1alpha1 "go.etcd.io/etcd-operator/api/v1alpha1" ) var _ = Describe("EtcdCluster Controller", func() { @@ -40,13 +40,13 @@ var _ = Describe("EtcdCluster Controller", func() { Name: resourceName, Namespace: "default", // TODO(user):Modify as needed } - etcdcluster := &clustersv1alpha1.EtcdCluster{} + etcdcluster := &operatorv1alpha1.EtcdCluster{} BeforeEach(func() { By("creating the custom resource for the Kind EtcdCluster") err := k8sClient.Get(ctx, typeNamespacedName, etcdcluster) if err != nil && errors.IsNotFound(err) { - resource := &clustersv1alpha1.EtcdCluster{ + resource := &operatorv1alpha1.EtcdCluster{ ObjectMeta: metav1.ObjectMeta{ Name: resourceName, Namespace: "default", @@ -59,7 +59,7 @@ var _ = Describe("EtcdCluster Controller", func() { AfterEach(func() { // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &clustersv1alpha1.EtcdCluster{} + resource := &operatorv1alpha1.EtcdCluster{} err := k8sClient.Get(ctx, typeNamespacedName, resource) Expect(err).NotTo(HaveOccurred()) diff --git a/internal/controller/suite_test.go b/internal/controller/suite_test.go index aa2b0ac..0c9ba00 100644 --- a/internal/controller/suite_test.go +++ b/internal/controller/suite_test.go @@ -33,7 +33,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - clustersv1alpha1 "go.etcd.io/etcd-operator/api/v1alpha1" + operatorv1alpha1 "go.etcd.io/etcd-operator/api/v1alpha1" // +kubebuilder:scaffold:imports ) @@ -77,7 +77,7 @@ var _ = BeforeSuite(func() { Expect(err).NotTo(HaveOccurred()) Expect(cfg).NotTo(BeNil()) - err = clustersv1alpha1.AddToScheme(scheme.Scheme) + err = operatorv1alpha1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) // +kubebuilder:scaffold:scheme diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 78e2ddf..138ed1d 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -43,7 +43,7 @@ var ( // projectImage is the name of the image which will be build and loaded // with the code source changes to be tested. - projectImage = "example.com/etcd-operator:v0.0.1" + projectImage = "example.com/test-operator:v0.0.1" ) // TestE2E runs the end-to-end (e2e) test suite for the project. These tests execute in an isolated, @@ -52,7 +52,7 @@ var ( // CertManager and Prometheus. func TestE2E(t *testing.T) { RegisterFailHandler(Fail) - _, _ = fmt.Fprintf(GinkgoWriter, "Starting etcd-operator integration test suite\n") + _, _ = fmt.Fprintf(GinkgoWriter, "Starting test-operator integration test suite\n") RunSpecs(t, "e2e suite") } diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 61cddb3..0707e8c 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -31,16 +31,16 @@ import ( ) // namespace where the project is deployed in -const namespace = "etcd-operator-system" +const namespace = "test-operator-system" // serviceAccountName created for the project -const serviceAccountName = "etcd-operator-controller-manager" +const serviceAccountName = "test-operator-controller-manager" // metricsServiceName is the name of the metrics service of the project -const metricsServiceName = "etcd-operator-controller-manager-metrics-service" +const metricsServiceName = "test-operator-controller-manager-metrics-service" // metricsRoleBindingName is the name of the RBAC that will be created to allow get the metrics data -const metricsRoleBindingName = "etcd-operator-metrics-binding" +const metricsRoleBindingName = "test-operator-metrics-binding" var _ = Describe("Manager", Ordered, func() { var controllerPodName string @@ -166,7 +166,7 @@ var _ = Describe("Manager", Ordered, func() { It("should ensure the metrics endpoint is serving metrics", func() { By("creating a ClusterRoleBinding for the service account to allow access to metrics") cmd := exec.Command("kubectl", "create", "clusterrolebinding", metricsRoleBindingName, - "--clusterrole=etcd-operator-metrics-reader", + "--clusterrole=test-operator-metrics-reader", fmt.Sprintf("--serviceaccount=%s:%s", namespace, serviceAccountName), ) _, err := utils.Run(cmd)