Skip to content

Commit b0e481b

Browse files
authored
Merge pull request #43 from datum-cloud/feature/multicluster-runtime
Leverage the multicluster-runtime library to enable the operator to manage resources from many control planes.
2 parents 07b2e60 + 8b4020e commit b0e481b

30 files changed

+1319
-474
lines changed

Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
4848
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths="./..." output:crd:artifacts:config=config/crd/bases
4949

5050
.PHONY: generate
51-
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
51+
generate: controller-gen defaulter-gen
5252
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
53+
$(DEFAULTER_GEN) ./internal/config --output-file=zz_generated.defaults.go
5354

5455
.PHONY: fmt
5556
fmt: ## Run go fmt against code.
@@ -96,9 +97,7 @@ build: manifests generate fmt vet ## Build manager binary.
9697

9798
.PHONY: run
9899
run: manifests generate fmt vet ## Run a controller from your host.
99-
# TODO(jreese) add flags for cert dir, cert name, key name instead of messing
100-
# with tmpdir
101-
TMPDIR=$(LOCALBIN)/tmp go run ./cmd/main.go -health-probe-bind-address 0
100+
go run ./cmd/main.go -health-probe-bind-address 0 --server-config ./config/dev/config.yaml
102101

103102
# If you wish to build the manager image targeting other platforms you can use the --platform flag.
104103
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
@@ -143,12 +142,6 @@ endif
143142
.PHONY: install
144143
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
145144
$(KUSTOMIZE) build config/dev | $(KUBECTL) apply -f -
146-
$(KUBECTL) wait --for=condition=Ready -n kube-system certificate/workload-operator-serving-cert
147-
mkdir -p $(LOCALBIN)/tmp/k8s-webhook-server/serving-certs
148-
$(KUBECTL) get secret -n kube-system workload-operator-webhook-server-cert -o json \
149-
| jq -r '.data["tls.crt"] | @base64d' > $(LOCALBIN)/tmp/k8s-webhook-server/serving-certs/tls.crt
150-
$(KUBECTL) get secret -n kube-system workload-operator-webhook-server-cert -o json \
151-
| jq -r '.data["tls.key"] | @base64d' > $(LOCALBIN)/tmp/k8s-webhook-server/serving-certs/tls.key
152145

153146
.PHONY: uninstall
154147
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.
@@ -174,12 +167,14 @@ $(LOCALBIN):
174167
KUBECTL ?= kubectl
175168
KUSTOMIZE ?= $(LOCALBIN)/kustomize
176169
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
170+
DEFAULTER_GEN ?= $(LOCALBIN)/defaulter-gen
177171
ENVTEST ?= $(LOCALBIN)/setup-envtest
178172
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
179173

180174
## Tool Versions
181175
KUSTOMIZE_VERSION ?= v5.5.0
182176
CONTROLLER_TOOLS_VERSION ?= v0.16.4
177+
DEFAULTER_GEN_VERSION ?= v0.32.3
183178
ENVTEST_VERSION ?= release-0.19
184179
GOLANGCI_LINT_VERSION ?= v2.1.5
185180

@@ -193,6 +188,11 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
193188
$(CONTROLLER_GEN): $(LOCALBIN)
194189
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))
195190

191+
.PHONY: defaulter-gen
192+
defaulter-gen: $(DEFAULTER_GEN) ## Download defaulter-gen locally if necessary.
193+
$(DEFAULTER_GEN): $(LOCALBIN)
194+
$(call go-install-tool,$(DEFAULTER_GEN),k8s.io/code-generator/cmd/defaulter-gen,$(DEFAULTER_GEN_VERSION))
195+
196196
.PHONY: envtest
197197
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
198198
$(ENVTEST): $(LOCALBIN)

0 commit comments

Comments
 (0)