Skip to content

Commit ef7dca4

Browse files
authored
Merge pull request #49 from datum-cloud/multicluster-tweaks
Multicluster tweaks
2 parents 015c71c + 6588d19 commit ef7dca4

File tree

10 files changed

+6780
-8
lines changed

10 files changed

+6780
-8
lines changed

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
170170
DEFAULTER_GEN ?= $(LOCALBIN)/defaulter-gen
171171
ENVTEST ?= $(LOCALBIN)/setup-envtest
172172
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
173+
CRDOC ?= $(LOCALBIN)/crdoc
173174

174175
## Tool Versions
175176
KUSTOMIZE_VERSION ?= v5.5.0
@@ -178,6 +179,9 @@ DEFAULTER_GEN_VERSION ?= v0.32.3
178179
ENVTEST_VERSION ?= release-0.19
179180
GOLANGCI_LINT_VERSION ?= v2.1.5
180181

182+
# renovate: datasource=go depName=fybrik.io/crdoc
183+
CRDOC_VERSION ?= v0.6.4
184+
181185
.PHONY: kustomize
182186
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
183187
$(KUSTOMIZE): $(LOCALBIN)
@@ -203,6 +207,10 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
203207
$(GOLANGCI_LINT): $(LOCALBIN)
204208
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
205209

210+
.PHONY: crdoc
211+
crdoc: ## Download crdoc locally if necessary.
212+
$(call go-install-tool,$(CRDOC),fybrik.io/crdoc,$(CRDOC_VERSION))
213+
206214
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
207215
# $1 - target path with name of binary
208216
# $2 - package url which can be installed
@@ -218,3 +226,20 @@ mv $(1) $(1)-$(3) ;\
218226
} ;\
219227
ln -sf $(1)-$(3) $(1)
220228
endef
229+
230+
.PHONY: api-docs
231+
api-docs: crdoc kustomize
232+
@{ \
233+
set -e ;\
234+
TMP_MANIFEST_DIR=$$(mktemp -d) ; \
235+
cp -r config/crd/* $$TMP_MANIFEST_DIR; \
236+
$(MAKE) CRD_OPTIONS=$(CRD_OPTIONS),maxDescLen=1200 MANIFEST_DIR=$$TMP_MANIFEST_DIR/bases manifests ;\
237+
TMP_DIR=$$(mktemp -d) ; \
238+
$(KUSTOMIZE) build $$TMP_MANIFEST_DIR -o $$TMP_DIR ;\
239+
mkdir -p docs/api ;\
240+
for crdmanifest in $$TMP_DIR/*; do \
241+
filename="$$(basename -s .compute.datumapis.com.yaml $$crdmanifest)" ;\
242+
filename="$${filename#apiextensions.k8s.io_v1_customresourcedefinition_}" ;\
243+
$(CRDOC) --resources $$crdmanifest --output docs/api/$$filename.md ;\
244+
done;\
245+
}

config/manager/config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: apiserver.config.datumapis.com/v1alpha1
2+
kind: WorkloadOperator
3+
metricsServer:
4+
bindAddress: "0"

config/manager/kustomization.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
resources:
22
- manager.yaml
33
- service.yaml
4+
- service_account.yaml
45
apiVersion: kustomize.config.k8s.io/v1beta1
56
kind: Kustomization
67
images:
78
- name: controller
8-
newName: example.com/datum-workload-operator
9-
newTag: v0.0.1
9+
newName: workload-operator
10+
newTag: latest
11+
configMapGenerator:
12+
- files:
13+
- config.yaml
14+
name: config
15+
options:
16+
disableNameSuffixHash: true

config/manager/manager.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ spec:
2727
kubectl.kubernetes.io/default-container: manager
2828
labels:
2929
control-plane: controller-manager
30+
app.kubernetes.io/name: workload-operator
3031
spec:
3132
# TODO(user): Uncomment the following code to configure the nodeAffinity expression
3233
# according to the platforms which are supported by your solution.
@@ -63,6 +64,7 @@ spec:
6364
args:
6465
- --leader-elect
6566
- --health-probe-bind-address=:8081
67+
- --server-config=/config/config.yaml
6668
image: controller:latest
6769
name: manager
6870
securityContext:
@@ -91,5 +93,12 @@ spec:
9193
requests:
9294
cpu: 10m
9395
memory: 64Mi
96+
volumeMounts:
97+
- name: config
98+
mountPath: /config
9499
serviceAccountName: controller-manager
95100
terminationGracePeriodSeconds: 10
101+
volumes:
102+
- name: config
103+
configMap:
104+
name: config

config/manager/service.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ spec:
1313
targetPort: 9443
1414
selector:
1515
control-plane: controller-manager
16+
app.kubernetes.io/name: workload-operator

0 commit comments

Comments
 (0)