Skip to content

Commit e9b0ef7

Browse files
authored
Merge pull request #84 from datum-cloud/refactor/config-layout
Reorganize config into base, components, and overlays
2 parents 9868b99 + e23acc3 commit e9b0ef7

61 files changed

Lines changed: 199 additions & 181 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dockerfile.crds

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM bitnami/kubectl:latest
22
WORKDIR /
3-
COPY config/crd/bases/ /crd
3+
COPY config/base/crd/bases/ /crd
44

55
ENTRYPOINT ["/opt/bitnami/kubectl/bin/kubectl"]

Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ help: ## Display this help.
4545

4646
.PHONY: manifests
4747
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
48-
$(CONTROLLER_GEN) rbac:roleName=compute crd:generateEmbeddedObjectMeta=true webhook paths="./..." output:crd:artifacts:config=config/crd/bases output:rbac:artifacts:config=config/controller_rbac
48+
$(CONTROLLER_GEN) rbac:roleName=compute crd:generateEmbeddedObjectMeta=true webhook paths="./..." output:crd:artifacts:config=config/base/crd/bases output:rbac:artifacts:config=config/components/controller_rbac output:webhook:artifacts:config=config/base/webhook
4949

5050
.PHONY: generate
5151
generate: controller-gen defaulter-gen
@@ -97,7 +97,7 @@ build: manifests generate fmt vet ## Build manager binary.
9797

9898
.PHONY: run
9999
run: manifests generate fmt vet ## Run a controller from your host.
100-
go run ./cmd/main.go -health-probe-bind-address 0 --server-config ./config/dev/config.yaml
100+
go run ./cmd/main.go -health-probe-bind-address 0 --server-config ./config/overlays/dev/config.yaml
101101

102102
# If you wish to build the manager image targeting other platforms you can use the --platform flag.
103103
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
@@ -130,8 +130,8 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform
130130
.PHONY: build-installer
131131
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
132132
mkdir -p dist
133-
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
134-
$(KUSTOMIZE) build config/default > dist/install.yaml
133+
cd config/base/manager && $(KUSTOMIZE) edit set image controller=${IMG}
134+
$(KUSTOMIZE) build config/overlays/single-cluster > dist/install.yaml
135135

136136
##@ Deployment
137137

@@ -141,20 +141,20 @@ endif
141141

142142
.PHONY: install
143143
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
144-
$(KUSTOMIZE) build config/dev | $(KUBECTL) apply -f -
144+
$(KUSTOMIZE) build config/overlays/dev | $(KUBECTL) apply -f -
145145

146146
.PHONY: uninstall
147147
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.
148-
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
148+
$(KUSTOMIZE) build config/base/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
149149

150150
.PHONY: deploy
151151
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
152-
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
153-
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
152+
cd config/base/manager && $(KUSTOMIZE) edit set image controller=${IMG}
153+
$(KUSTOMIZE) build config/overlays/single-cluster | $(KUBECTL) apply -f -
154154

155155
.PHONY: undeploy
156156
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.
157-
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
157+
$(KUSTOMIZE) build config/overlays/single-cluster | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
158158

159159
##@ Dependencies
160160

@@ -232,7 +232,7 @@ api-docs: crdoc kustomize
232232
@{ \
233233
set -e ;\
234234
TMP_MANIFEST_DIR=$$(mktemp -d) ; \
235-
cp -r config/crd/* $$TMP_MANIFEST_DIR; \
235+
cp -r config/base/crd/* $$TMP_MANIFEST_DIR; \
236236
$(MAKE) CRD_OPTIONS=$(CRD_OPTIONS),maxDescLen=1200 MANIFEST_DIR=$$TMP_MANIFEST_DIR/bases manifests ;\
237237
TMP_DIR=$$(mktemp -d) ; \
238238
$(KUSTOMIZE) build $$TMP_MANIFEST_DIR -o $$TMP_DIR ;\
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: cert-manager.io/v1
2+
kind: Issuer
3+
metadata:
4+
labels:
5+
app.kubernetes.io/name: compute
6+
app.kubernetes.io/managed-by: kustomize
7+
name: selfsigned-issuer
8+
spec:
9+
selfSigned: {}
10+
---
11+
apiVersion: cert-manager.io/v1
12+
kind: Certificate
13+
metadata:
14+
labels:
15+
app.kubernetes.io/name: compute
16+
app.kubernetes.io/managed-by: kustomize
17+
name: compute-serving-cert
18+
spec:
19+
# The Service name and namespace get substituted in by kustomize
20+
# replacements in the consuming overlay.
21+
dnsNames:
22+
- SERVICE_NAME.SERVICE_NAMESPACE.svc
23+
- SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local
24+
issuerRef:
25+
kind: Issuer
26+
name: selfsigned-issuer
27+
secretName: compute-webhook-cert
File renamed without changes.
File renamed without changes.

config/crd/bases/compute.datumapis.com_instances.yaml renamed to config/base/crd/bases/compute.datumapis.com_instances.yaml

File renamed without changes.

config/crd/bases/compute.datumapis.com_workloaddeployments.yaml renamed to config/base/crd/bases/compute.datumapis.com_workloaddeployments.yaml

File renamed without changes.

config/crd/bases/compute.datumapis.com_workloads.yaml renamed to config/base/crd/bases/compute.datumapis.com_workloads.yaml

File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This kustomization.yaml is not intended to be run by itself,
22
# since it depends on service name and namespace that are out of this kustomize package.
3-
# It should be run by config/default
3+
# It should be run by an overlay under config/overlays/
44
resources:
55
- bases/compute.datumapis.com_instances.yaml
66
- bases/compute.datumapis.com_workloaddeployments.yaml

0 commit comments

Comments
 (0)