Skip to content

Commit 412dc17

Browse files
committed
Keep it simple
1 parent 5f66b1a commit 412dc17

File tree

4 files changed

+23
-49
lines changed

4 files changed

+23
-49
lines changed

HOW-TO-START-DEVELOPMENT.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,21 @@
66
## Build your develop environment
77

88
### Easy way
9-
1. Create and prepare kind cluster, build image and load it into cluster, deploy etcd-operator, RBAC, webhook certs:
9+
1. Create and prepare kind cluster:
10+
```shell
11+
make kind-prepare
12+
```
13+
2. Build image and load it into cluster, deploy etcd-operator, RBAC, webhook certs
1014
```shell
1115
make deploy
1216
```
1317

14-
2. To deploy your code changes, redeploy etcd-operator:
18+
3. To deploy your code changes, redeploy etcd-operator:
1519
```shell
1620
make redeploy
1721
```
1822

19-
3. To clean up after all, delete kind cluster:
23+
4. To clean up after all, delete kind cluster:
2024
```shell
2125
make kind-delete
2226
```

Makefile

+13-26
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,19 @@ build-installer: manifests generate kustomize ## Generate a consolidated YAML wi
126126
KIND_CLUSTER_NAME ?= etcd-operator-kind
127127
NAMESPACE_NAME ?= etcd-operator-system
128128

129-
CERT_MANAGER_NAMESPACE ?= cert-manager
129+
PROMETHEUS_OPERATOR_VERSION ?= v0.72.0
130130
CERT_MANAGER_VERSION ?= v1.14.4
131131

132132
ifndef ignore-not-found
133133
ignore-not-found = false
134134
endif
135135

136136
.PHONY: install
137-
install: manifests kustomize kind-create ## Install CRDs into the K8s cluster specified in ~/.kube/config
137+
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config
138138
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -
139139

140140
.PHONY: uninstall
141-
uninstall: manifests kustomize kind-create ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
141+
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
142142
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete -n $(NAMESPACE_NAME) --ignore-not-found=$(ignore-not-found) -f -
143143

144144
.PHONY: deploy
@@ -147,14 +147,18 @@ deploy: manifests kustomize kind-load ## Deploy controller to the K8s cluster sp
147147
$(KUSTOMIZE) build config/default | $(KUBECTL) -n $(NAMESPACE_NAME) apply -f -
148148

149149
.PHONY: undeploy
150-
undeploy: kustomize kind-create ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
150+
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
151151
$(KUSTOMIZE) build config/default | $(KUBECTL) delete -n $(NAMESPACE_NAME) --ignore-not-found=$(ignore-not-found) -f -
152152

153153
.PHONY: redeploy
154154
redeploy: deploy ## Redeploy controller with new docker image.
155155
# force recreate pods
156156
$(KUBECTL) rollout restart -n $(NAMESPACE_NAME) deploy/etcd-operator-controller-manager
157157

158+
.PHONY: kind-load
159+
kind-load: docker-build ## Build and upload docker image to the local Kind cluster.
160+
$(KIND) load docker-image ${IMG} --name $(KIND_CLUSTER_NAME)
161+
158162
.PHONY: kind-create
159163
kind-create: kind ## Create kubernetes cluster using Kind.
160164
@if ! $(KIND) get clusters | grep -q $(KIND_CLUSTER_NAME); then \
@@ -167,19 +171,12 @@ kind-delete: kind ## Create kubernetes cluster using Kind.
167171
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME); \
168172
fi
169173

170-
.PHONY: kind-load
171-
kind-load: docker-build kind-prepare ## Build and upload docker image to the local Kind cluster.
172-
$(KIND) load docker-image ${IMG} --name $(KIND_CLUSTER_NAME)
173-
174174
.PHONY: kind-prepare
175-
kind-prepare: kind-create ## Prepare kind cluster for installing etcd-operator.
176-
$(HELM) upgrade \
177-
cert-manager \
178-
https://charts.jetstack.io/charts/cert-manager-$(CERT_MANAGER_VERSION).tgz \
179-
--install \
180-
--namespace $(CERT_MANAGER_NAMESPACE) \
181-
--create-namespace \
182-
--set installCRDs=true
175+
kind-prepare: kind-create
176+
# Install prometheus operator
177+
$(KUBECTL) apply --server-side -f "https://github.com/prometheus-operator/prometheus-operator/releases/download/$(PROMETHEUS_OPERATOR_VERSION)/bundle.yaml"
178+
# Install cert-manager operator
179+
$(KUBECTL) apply --server-side -f "https://github.com/jetstack/cert-manager/releases/download/$(CERT_MANAGER_VERSION)/cert-manager.yaml"
183180

184181
##@ Dependencies
185182

@@ -194,19 +191,16 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
194191
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
195192
ENVTEST ?= $(LOCALBIN)/setup-envtest
196193
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
197-
HELM ?= $(LOCALBIN)/helm
198194
KIND ?= $(LOCALBIN)/kind
199195

200196
## Tool Versions
201197
KUSTOMIZE_VERSION ?= v5.3.0
202198
CONTROLLER_TOOLS_VERSION ?= v0.14.0
203199
ENVTEST_VERSION ?= latest
204200
GOLANGCI_LINT_VERSION ?= v1.54.2
205-
HELM_VERSION ?= v3.14.3
206201
KIND_VERSION ?= v0.22.0
207202

208203
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
209-
HELM_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3"
210204

211205
.PHONY: kustomize
212206
kustomize: $(LOCALBIN)
@@ -229,13 +223,6 @@ golangci-lint: $(LOCALBIN)
229223
@test -x $(GOLANGCI_LINT) && $(GOLANGCI_LINT) version | grep -q $(GOLANGCI_LINT_VERSION) || \
230224
GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
231225

232-
helm: $(LOCALBIN)
233-
@if test -x $(HELM) && ! $(HELM) version | grep -q $(HELM_VERSION); then \
234-
rm -f $(HELM); \
235-
fi
236-
PATH="$(LOCALBIN):$(PATH)"
237-
@test -x $(HELM) || { curl -Ss $(HELM_INSTALL_SCRIPT) | sed "s|/usr/local/bin|$(LOCALBIN)|" | bash -s -- --no-sudo --version $(HELM_VERSION); }
238-
239226
kind: $(LOCALBIN)
240227
@test -x $(KIND) && $(KIND) version | grep -q $(KIND_VERSION) || \
241228
GOBIN=$(LOCALBIN) go install sigs.k8s.io/kind@$(KIND_VERSION)

test/e2e/e2e_test.go

+1-18
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,8 @@ var _ = Describe("controller", Ordered, func() {
5959
var controllerPodName string
6060
var err error
6161

62-
// projectimage stores the name of the image used in the example
63-
var projectimage = "example.com/etcd-operator:v0.0.1"
64-
65-
By("building the manager(Operator) image")
66-
cmd := exec.Command("make", "docker-build", fmt.Sprintf("IMG=%s", projectimage))
67-
_, err = utils.Run(cmd)
68-
ExpectWithOffset(1, err).NotTo(HaveOccurred())
69-
70-
By("loading the the manager(Operator) image on Kind")
71-
err = utils.LoadImageToKindClusterWithName(projectimage)
72-
ExpectWithOffset(1, err).NotTo(HaveOccurred())
73-
74-
By("installing CRDs")
75-
cmd = exec.Command("make", "install")
76-
// TODO: Handle CRD installation error
77-
_, _ = utils.Run(cmd)
78-
7962
By("deploying the controller-manager")
80-
cmd = exec.Command("make", "deploy", fmt.Sprintf("IMG=%s", projectimage))
63+
cmd := exec.Command("make", "deploy")
8164
_, err = utils.Run(cmd)
8265
ExpectWithOffset(1, err).NotTo(HaveOccurred())
8366

test/utils/utils.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ import (
2626
)
2727

2828
const (
29-
prometheusOperatorVersion = "v0.68.0"
29+
prometheusOperatorVersion = "v0.72.0"
3030
prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" +
3131
"releases/download/%s/bundle.yaml"
3232

33-
certmanagerVersion = "v1.5.3"
33+
certmanagerVersion = "v1.14.4"
3434
certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
3535
)
3636

0 commit comments

Comments
 (0)