Skip to content

Commit 52bf6d7

Browse files
committed
Change the api group from clusters.etcd.io to operator.etcd.io
Signed-off-by: Benjamin Wang <[email protected]>
1 parent ccbf648 commit 52bf6d7

27 files changed

+102
-106
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
120120
docker-buildx: ## Build and push docker image for the manager for cross-platform support
121121
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
122122
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
123-
- $(CONTAINER_TOOL) buildx create --name etcd-operator-builder
124-
$(CONTAINER_TOOL) buildx use etcd-operator-builder
123+
- $(CONTAINER_TOOL) buildx create --name test-operator-builder
124+
$(CONTAINER_TOOL) buildx use test-operator-builder
125125
- $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
126-
- $(CONTAINER_TOOL) buildx rm etcd-operator-builder
126+
- $(CONTAINER_TOOL) buildx rm test-operator-builder
127127
rm Dockerfile.cross
128128

129129
.PHONY: build-installer
@@ -170,10 +170,10 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
170170
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
171171

172172
## Tool Versions
173-
KUSTOMIZE_VERSION ?= v5.4.3
173+
KUSTOMIZE_VERSION ?= v5.5.0
174174
CONTROLLER_TOOLS_VERSION ?= v0.16.4
175175
ENVTEST_VERSION ?= release-0.19
176-
GOLANGCI_LINT_VERSION ?= v1.59.1
176+
GOLANGCI_LINT_VERSION ?= v1.61.0
177177

178178
.PHONY: kustomize
179179
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.

PROJECT

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
domain: etcd.io
66
layout:
77
- go.kubebuilder.io/v4
8-
projectName: etcd-operator
8+
projectName: test-operator
99
repo: go.etcd.io/etcd-operator
1010
resources:
1111
- api:
1212
crdVersion: v1
1313
namespaced: true
1414
controller: true
1515
domain: etcd.io
16-
group: clusters
16+
group: operator
1717
kind: EtcdCluster
1818
path: go.etcd.io/etcd-operator/api/v1alpha1
1919
version: v1alpha1

api/v1alpha1/groupversion_info.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package v1alpha1 contains API Schema definitions for the clusters v1alpha1 API group.
17+
// Package v1alpha1 contains API Schema definitions for the operator v1alpha1 API group.
1818
// +kubebuilder:object:generate=true
19-
// +groupName=clusters.etcd.io
19+
// +groupName=operator.etcd.io
2020
package v1alpha1
2121

2222
import (
@@ -26,7 +26,7 @@ import (
2626

2727
var (
2828
// GroupVersion is group version used to register these objects.
29-
GroupVersion = schema.GroupVersion{Group: "clusters.etcd.io", Version: "v1alpha1"}
29+
GroupVersion = schema.GroupVersion{Group: "operator.etcd.io", Version: "v1alpha1"}
3030

3131
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
3232
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

cmd/main.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
3636
"sigs.k8s.io/controller-runtime/pkg/webhook"
3737

38-
clustersv1alpha1 "go.etcd.io/etcd-operator/api/v1alpha1"
38+
operatorv1alpha1 "go.etcd.io/etcd-operator/api/v1alpha1"
3939
"go.etcd.io/etcd-operator/internal/controller"
4040
// +kubebuilder:scaffold:imports
4141
)
@@ -48,7 +48,7 @@ var (
4848
func init() {
4949
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
5050

51-
utilruntime.Must(clustersv1alpha1.AddToScheme(scheme))
51+
utilruntime.Must(operatorv1alpha1.AddToScheme(scheme))
5252
// +kubebuilder:scaffold:scheme
5353
}
5454

@@ -98,26 +98,24 @@ func main() {
9898

9999
// Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server.
100100
// More info:
101-
// - https://pkg.go.dev/sigs.k8s.io/[email protected].0/pkg/metrics/server
101+
// - https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/metrics/server
102102
// - https://book.kubebuilder.io/reference/metrics.html
103103
metricsServerOptions := metricsserver.Options{
104104
BindAddress: metricsAddr,
105105
SecureServing: secureMetrics,
106-
// TODO(user): TLSOpts is used to allow configuring the TLS config used for the server. If certificates are
107-
// not provided, self-signed certificates will be generated by default. This option is not recommended for
108-
// production environments as self-signed certificates do not offer the same level of trust and security
109-
// as certificates issued by a trusted Certificate Authority (CA). The primary risk is potentially allowing
110-
// unauthorized access to sensitive metrics data. Consider replacing with CertDir, CertName, and KeyName
111-
// to provide certificates, ensuring the server communicates using trusted and secure certificates.
112-
TLSOpts: tlsOpts,
106+
TLSOpts: tlsOpts,
113107
}
114108

115109
if secureMetrics {
116110
// FilterProvider is used to protect the metrics endpoint with authn/authz.
117111
// These configurations ensure that only authorized users and service accounts
118112
// can access the metrics endpoint. The RBAC are configured in 'config/rbac/kustomization.yaml'. More info:
119-
// https://pkg.go.dev/sigs.k8s.io/[email protected].0/pkg/metrics/filters#WithAuthenticationAndAuthorization
113+
// https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/metrics/filters#WithAuthenticationAndAuthorization
120114
metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization
115+
116+
// TODO(user): If CertDir, CertName, and KeyName are not specified, controller-runtime will automatically
117+
// generate self-signed certificates for the metrics server. While convenient for development and testing,
118+
// this setup is not recommended for production.
121119
}
122120

123121
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{

config/crd/bases/clusters.etcd.io_etcdclusters.yaml renamed to config/crd/bases/operator.etcd.io_etcdclusters.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ kind: CustomResourceDefinition
44
metadata:
55
annotations:
66
controller-gen.kubebuilder.io/version: v0.16.4
7-
name: etcdclusters.clusters.etcd.io
7+
name: etcdclusters.operator.etcd.io
88
spec:
9-
group: clusters.etcd.io
9+
group: operator.etcd.io
1010
names:
1111
kind: EtcdCluster
1212
listKind: EtcdClusterList

config/crd/kustomization.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# since it depends on service name and namespace that are out of this kustomize package.
33
# It should be run by config/default
44
resources:
5-
- bases/clusters.etcd.io_etcdclusters.yaml
5+
- bases/operator.etcd.io_etcdclusters.yaml
66
# +kubebuilder:scaffold:crdkustomizeresource
77

88
patches:
@@ -12,11 +12,9 @@ patches:
1212

1313
# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
1414
# patches here are for enabling the CA injection for each CRD
15-
#- path: patches/cainjection_in_etcdclusters.yaml
1615
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
1716

1817
# [WEBHOOK] To enable webhook, uncomment the following section
1918
# the following config is for teaching kustomize how to do kustomization for CRDs.
20-
2119
#configurations:
2220
#- kustomizeconfig.yaml

config/default/kustomization.yaml

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Adds namespace to all resources.
2-
namespace: etcd-operator-system
2+
namespace: test-operator-system
33

44
# Value of this field is prepended to the
55
# names of all resources, e.g. a deployment named
66
# "wordpress" becomes "alices-wordpress".
77
# Note that it should also match with the prefix (text before '-') of the namespace
88
# field above.
9-
namePrefix: etcd-operator-
9+
namePrefix: test-operator-
1010

1111
# Labels to add to all resources and selectors.
1212
#labels:
@@ -48,6 +48,41 @@ patches:
4848
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
4949
# Uncomment the following replacements to add the cert-manager CA injection annotations
5050
#replacements:
51+
# - source: # Uncomment the following block if you have any webhook
52+
# kind: Service
53+
# version: v1
54+
# name: webhook-service
55+
# fieldPath: .metadata.name # Name of the service
56+
# targets:
57+
# - select:
58+
# kind: Certificate
59+
# group: cert-manager.io
60+
# version: v1
61+
# fieldPaths:
62+
# - .spec.dnsNames.0
63+
# - .spec.dnsNames.1
64+
# options:
65+
# delimiter: '.'
66+
# index: 0
67+
# create: true
68+
# - source:
69+
# kind: Service
70+
# version: v1
71+
# name: webhook-service
72+
# fieldPath: .metadata.namespace # Namespace of the service
73+
# targets:
74+
# - select:
75+
# kind: Certificate
76+
# group: cert-manager.io
77+
# version: v1
78+
# fieldPaths:
79+
# - .spec.dnsNames.0
80+
# - .spec.dnsNames.1
81+
# options:
82+
# delimiter: '.'
83+
# index: 1
84+
# create: true
85+
#
5186
# - source: # Uncomment the following block if you have a ValidatingWebhook (--programmatic-validation)
5287
# kind: Certificate
5388
# group: cert-manager.io
@@ -140,38 +175,3 @@ patches:
140175
# delimiter: '/'
141176
# index: 1
142177
# create: true
143-
#
144-
# - source: # Uncomment the following block if you enable cert-manager
145-
# kind: Service
146-
# version: v1
147-
# name: webhook-service
148-
# fieldPath: .metadata.name # Name of the service
149-
# targets:
150-
# - select:
151-
# kind: Certificate
152-
# group: cert-manager.io
153-
# version: v1
154-
# fieldPaths:
155-
# - .spec.dnsNames.0
156-
# - .spec.dnsNames.1
157-
# options:
158-
# delimiter: '.'
159-
# index: 0
160-
# create: true
161-
# - source:
162-
# kind: Service
163-
# version: v1
164-
# name: webhook-service
165-
# fieldPath: .metadata.namespace # Namespace of the service
166-
# targets:
167-
# - select:
168-
# kind: Certificate
169-
# group: cert-manager.io
170-
# version: v1
171-
# fieldPaths:
172-
# - .spec.dnsNames.0
173-
# - .spec.dnsNames.1
174-
# options:
175-
# delimiter: '.'
176-
# index: 1
177-
# create: true

config/default/metrics_service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Service
33
metadata:
44
labels:
55
control-plane: controller-manager
6-
app.kubernetes.io/name: etcd-operator
6+
app.kubernetes.io/name: test-operator
77
app.kubernetes.io/managed-by: kustomize
88
name: controller-manager-metrics-service
99
namespace: system

config/manager/manager.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Namespace
33
metadata:
44
labels:
55
control-plane: controller-manager
6-
app.kubernetes.io/name: etcd-operator
6+
app.kubernetes.io/name: test-operator
77
app.kubernetes.io/managed-by: kustomize
88
name: system
99
---
@@ -14,7 +14,7 @@ metadata:
1414
namespace: system
1515
labels:
1616
control-plane: controller-manager
17-
app.kubernetes.io/name: etcd-operator
17+
app.kubernetes.io/name: test-operator
1818
app.kubernetes.io/managed-by: kustomize
1919
spec:
2020
selector:

config/network-policy/allow-metrics-traffic.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apiVersion: networking.k8s.io/v1
55
kind: NetworkPolicy
66
metadata:
77
labels:
8-
app.kubernetes.io/name: etcd-operator
8+
app.kubernetes.io/name: test-operator
99
app.kubernetes.io/managed-by: kustomize
1010
name: allow-metrics-traffic
1111
namespace: system

0 commit comments

Comments
 (0)