Skip to content

Commit e4cc56a

Browse files
committed
refactor config structure for split k0smotron installations
Signed-off-by: apedriza <[email protected]>
1 parent eff01b2 commit e4cc56a

File tree

129 files changed

+16150
-688
lines changed

Some content is hidden

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

129 files changed

+16150
-688
lines changed

.github/workflows/capi-smoke-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ jobs:
7979
run: |
8080
kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.24/deploy/local-path-storage.yaml
8181
82-
- name: Download install manifest for k0smotron
82+
- name: Download install manifest for k0smotron standalone
8383
uses: actions/download-artifact@v5
8484
with:
85-
name: install-yaml
85+
name: install-standalone-yaml
8686

8787
- name: Run inttest for CAPI with docker provider
8888
run: |

.github/workflows/go.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ jobs:
7575
config.yaml
7676
k0sproject-k0smotron/
7777
78-
- name: Generate install yaml
78+
- name: Generate install yaml for standalone mode
7979
run: |
80-
make release
80+
make release-standalone
8181
82-
- name: Upload install yaml
82+
- name: Upload install-standalone yaml
8383
uses: actions/upload-artifact@v4
8484
with:
85-
name: install-yaml
86-
path: install.yaml
85+
name: install-standalone-yaml
86+
path: install-standalone.yaml
8787

8888
unittest:
8989
name: Unit & Integration tests
@@ -171,7 +171,7 @@ jobs:
171171
- name: Download install manifest for k0smotron
172172
uses: actions/download-artifact@v5
173173
with:
174-
name: install-yaml
174+
name: install-standalone-yaml
175175

176176
- name: Load k0smotron image bundle
177177
run: |
@@ -265,11 +265,6 @@ jobs:
265265
run: |
266266
docker load -i k0smotron-image-bundle.tar
267267
268-
- name: Download install manifest
269-
uses: actions/download-artifact@v5
270-
with:
271-
name: install-yaml
272-
273268
- name: Run e2e test
274269
run: |
275270
export TEST_NAME=Test$(echo "${{ matrix.e2e-suite }}" | awk -F'-' '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) substr($i,2)}1' OFS='')

.github/workflows/publish-docs.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
echo STABLE="$STABLE" >> $GITHUB_OUTPUT
8282
8383
# Ensures the current branch is gh-pages,
84-
# Creates / updates the "install.yaml" file with the corresponding versions
84+
# Creates / updates the "install.yaml" and "install-standalone.yaml" files with the corresponding versions
8585
# Commits if the files were changed
8686
# Finally pushes if there are unpushed commits
8787
- name: Create install files
@@ -94,9 +94,12 @@ jobs:
9494
run: |
9595
STABLE=${{ steps.set_versions.outputs.STABLE }}
9696
make release IMG=quay.io/k0sproject/k0smotron:${STABLE}
97+
make release-standalone IMG=quay.io/k0sproject/k0smotron:${STABLE}
9798
cp install.yaml /tmp/install.yaml
99+
cp install-standalone.yaml /tmp/install-standalone.yaml
98100
git checkout gh-pages
99101
cp /tmp/install.yaml ${STABLE}/install.yaml
100-
git add ${STABLE}/install.yaml && git update-index --refresh
101-
git diff-index --quiet HEAD -- || git commit -m "Update install.yaml to ${STABLE}"
102+
cp /tmp/install-standalone.yaml ${STABLE}/install-standalone.yaml
103+
git add ${STABLE}/install.yaml ${STABLE}/install-standalone.yaml && git update-index --refresh
104+
git diff-index --quiet HEAD -- || git commit -m "Update install.yaml and install-standalone.yaml to ${STABLE}"
102105
git push origin gh-pages

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Generated files
22
install.yaml
3+
install-standalone.yaml
34
bootstrap-components.yaml
45
control-plane-components.yaml
56
infrastructure-components.yaml

Makefile

Lines changed: 68 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -65,28 +65,50 @@ help: ## Display this help.
6565
### CRD manifests (one per API group)
6666
.PHONY: manifests-bootstrap manifests-controlplane manifests-infrastructure manifests-k0smotron
6767
manifests-bootstrap: $(CONTROLLER_GEN) ## Generate CRDs for bootstrap.cluster.x-k8s.io
68-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook \
69-
paths="./..." \
70-
output:crd:artifacts:config=config/crd/bases/bootstrap
71-
find ./config/crd/bases/bootstrap -type f ! -name "bootstrap*" ! -name "kustomization.yaml" -print0 | xargs -0 rm
68+
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true \
69+
paths="./api/bootstrap/v1beta1/..." \
70+
paths=./internal/controller/bootstrap/... \
71+
output:crd:artifacts:config=config/clusterapi/bootstrap/crd \
72+
output:rbac:dir=config/clusterapi/bootstrap/rbac
7273

7374
manifests-controlplane: $(CONTROLLER_GEN) ## Generate CRDs for controlplane.cluster.x-k8s.io
7475
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook \
75-
paths="./..." \
76-
output:crd:artifacts:config=config/crd/bases/controlplane
77-
find ./config/crd/bases/controlplane -type f ! -name "controlplane*" ! -name "kustomization.yaml" -print0 | xargs -0 rm
76+
paths="./api/controlplane/v1beta1/..." \
77+
paths="./api/k0smotron.io/v1beta1/..." \
78+
paths=./internal/controller/controlplane/... \
79+
paths=./internal/controller/k0smotron.io/... \
80+
output:crd:artifacts:config=config/clusterapi/controlplane/crd \
81+
output:rbac:dir=config/clusterapi/controlplane/rbac \
82+
output:webhook:dir=config/clusterapi/controlplane/webhook
7883

7984
manifests-infrastructure: $(CONTROLLER_GEN) ## Generate CRDs for infrastructure.cluster.x-k8s.io
85+
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true \
86+
paths="./api/infrastructure/v1beta1/..." \
87+
paths=./internal/controller/infrastructure/... \
88+
output:crd:artifacts:config=config/clusterapi/infrastructure/crd \
89+
output:rbac:dir=config/clusterapi/infrastructure/rbac
90+
91+
manifests-standalone: $(CONTROLLER_GEN) ## Generate CRDs for k0smotron.io standalone
8092
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook \
81-
paths="./..." \
82-
output:crd:artifacts:config=config/crd/bases/infrastructure
83-
find ./config/crd/bases/infrastructure -type f ! -name "infrastructure*" ! -name "kustomization.yaml" -print0 | xargs -0 rm
93+
paths="./api/k0smotron.io/v1beta1/..." \
94+
paths=./internal/controller/k0smotron.io/... \
95+
output:crd:artifacts:config=config/standalone/crd \
96+
output:rbac:dir=config/standalone/rbac \
97+
output:webhook:dir=config/standalone/webhook
8498

85-
manifests-k0smotron: $(CONTROLLER_GEN) ## Generate CRDs for k0smotron.io
99+
manifests-capi-integration: $(CONTROLLER_GEN)
86100
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook \
87-
paths="./..." \
88-
output:crd:artifacts:config=config/crd/bases/k0smotron.io
89-
find ./config/crd/bases/k0smotron.io -type f ! -name "k0smotron.io*" ! -name "kustomization.yaml" -print0 | xargs -0 rm
101+
paths="./api/bootstrap/v1beta1/..." \
102+
paths=./internal/controller/bootstrap/... \
103+
paths="./api/controlplane/v1beta1/..." \
104+
paths="./api/k0smotron.io/v1beta1/..." \
105+
paths=./internal/controller/controlplane/... \
106+
paths=./internal/controller/k0smotron.io/... \
107+
paths="./api/infrastructure/v1beta1/..." \
108+
paths=./internal/controller/infrastructure/... \
109+
output:crd:artifacts:config=config/clusterapi/all/crd/bases \
110+
output:rbac:dir=config/clusterapi/all/rbac \
111+
output:webhook:dir=config/clusterapi/all/webhook
90112

91113
.PHONY: manifests
92114
manifests: manifests-bootstrap manifests-controlplane manifests-infrastructure manifests-k0smotron ## Generate all CRD YAMLs per group
@@ -99,7 +121,7 @@ generate_targets += api/infrastructure/v1beta1/zz_generated.deepcopy.go
99121
$(generate_targets): $(CONTROLLER_GEN)
100122
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
101123

102-
generate: $(generate_targets) clusterapi-manifests ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
124+
generate: $(generate_targets) manifests ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
103125

104126

105127
GO_PKGS=$(shell go list ./...)
@@ -141,10 +163,6 @@ e2e: generate-e2e-templates-main
141163
build:
142164
go build -o bin/manager cmd/main.go
143165

144-
.PHONY: run
145-
run: manifests generate fmt vet ## Run a controller from your host.
146-
go run ./cmd/main.go
147-
148166
# If you wish built the manager image targeting other platforms you can use the --platform flag.
149167
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
150168
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
@@ -185,49 +203,43 @@ ifndef ignore-not-found
185203
ignore-not-found = false
186204
endif
187205

188-
.PHONY: install
189-
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
190-
$(KUSTOMIZE) build config/crd | kubectl create -f -
191-
192-
.PHONY: uninstall
193-
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.
194-
$(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
195-
196206
.PHONY: deploy
197207
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
198-
cd config/manager && $(KUSTOMIZE) edit set image k0s/k0smotron=${IMG}
199-
$(KUSTOMIZE) build config/default | kubectl create -f -
208+
cd config/clusterapi/all/manager && $(KUSTOMIZE) edit set image k0s/k0smotron=${IMG}
209+
$(KUSTOMIZE) build config/clusterapi/all | kubectl create -f -
210+
git checkout config/clusterapi/all/manager/kustomization.yaml
200211

201212
.PHONY: undeploy
202213
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
203-
$(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
214+
$(KUSTOMIZE) build config/clusterapi/all | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
204215

205216
.PHONY: release
206-
release: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
207-
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
208-
$(KUSTOMIZE) build config/default > install.yaml
209-
git checkout config/manager/kustomization.yaml
210-
211-
clusterapi-manifests:
212-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths="./api/bootstrap/..." output:crd:artifacts:config=config/clusterapi/bootstrap/bases
213-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths="./api/controlplane/..." output:crd:artifacts:config=config/clusterapi/controlplane/bases
214-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths="./api/infrastructure/..." output:crd:artifacts:config=config/clusterapi/infrastructure/bases
215-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths="./api/k0smotron.io/..." output:crd:artifacts:config=config/clusterapi/k0smotron.io/bases
216-
217-
bootstrap-components.yaml: $(CONTROLLER_GEN) clusterapi-manifests kustomize
218-
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
217+
release: manifests-capi-integration kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
218+
cd config/clusterapi/all/manager && $(KUSTOMIZE) edit set image controller=${IMG}
219+
$(KUSTOMIZE) build config/clusterapi/all > install.yaml
220+
git checkout config/clusterapi/all/manager/kustomization.yaml
221+
222+
.PHONY: release-standalone
223+
release-standalone: manifests-standalone kustomize ## Generate install yaml for standalone mode
224+
cd config/standalone/manager && $(KUSTOMIZE) edit set image controller=${IMG}
225+
$(KUSTOMIZE) build config/standalone > install-standalone.yaml
226+
git checkout config/standalone/manager/kustomization.yaml
227+
228+
bootstrap-components.yaml: $(CONTROLLER_GEN) manifests-infrastructure kustomize
229+
cd config/clusterapi/bootstrap/manager && $(KUSTOMIZE) edit set image controller=${IMG}
219230
$(KUSTOMIZE) build config/clusterapi/bootstrap/ > bootstrap-components.yaml
220-
git checkout config/manager/kustomization.yaml
231+
git checkout config/clusterapi/bootstrap/manager/kustomization.yaml
221232

222-
control-plane-components.yaml: $(CONTROLLER_GEN) clusterapi-manifests kustomize
223-
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
233+
control-plane-components.yaml: $(CONTROLLER_GEN) manifests-controlplane kustomize
234+
cd config/clusterapi/controlplane/manager && $(KUSTOMIZE) edit set image controller=${IMG}
224235
$(KUSTOMIZE) build config/clusterapi/controlplane/ > control-plane-components.yaml
225-
git checkout config/manager/kustomization.yaml
236+
git checkout config/clusterapi/controlplane/manager/kustomization.yaml
226237

227-
infrastructure-components.yaml: $(CONTROLLER_GEN) clusterapi-manifests kustomize
228-
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
238+
infrastructure-components.yaml: $(CONTROLLER_GEN) manifests-infrastructure kustomize
239+
cd config/clusterapi/infrastructure/manager && $(KUSTOMIZE) edit set image controller=${IMG}
229240
$(KUSTOMIZE) build config/clusterapi/infrastructure/ > infrastructure-components.yaml
230-
git checkout config/manager/kustomization.yaml
241+
git checkout config/clusterapi/infrastructure/manager/kustomization.yaml
242+
231243
##@ Build Dependencies
232244

233245
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
@@ -262,23 +274,23 @@ $(CRDOC): Makefile.variables | $(LOCALBIN)
262274

263275
.PHONY: docs-generate-bootstrap docs-generate-controlplane docs-generate-infrastructure docs-generate-k0smotron docs-generate-reference
264276
docs-generate-bootstrap: $(CRDOC) ## Generate docs for bootstrap CRDs
265-
$(CRDOC) --resources config/crd/bases/bootstrap --output docs/resource-reference/bootstrap.cluster.x-k8s.io-v1beta1.md
277+
$(CRDOC) --resources config/clusterapi/bootstrap/crd --output docs/resource-reference/bootstrap.cluster.x-k8s.io-v1beta1.md
266278

267279
docs-generate-controlplane: $(CRDOC) ## Generate docs for controlplane CRDs
268-
$(CRDOC) --resources config/crd/bases/controlplane --output docs/resource-reference/controlplane.cluster.x-k8s.io-v1beta1.md
280+
$(CRDOC) --resources config/clusterapi/controlplane/crd --output docs/resource-reference/controlplane.cluster.x-k8s.io-v1beta1.md
269281

270282
docs-generate-infrastructure: $(CRDOC) ## Generate docs for infrastructure CRDs
271-
$(CRDOC) --resources config/crd/bases/infrastructure --output docs/resource-reference/infrastructure.cluster.x-k8s.io-v1beta1.md
283+
$(CRDOC) --resources config/clusterapi/infrastructure/crd --output docs/resource-reference/infrastructure.cluster.x-k8s.io-v1beta1.md
272284

273285
docs-generate-k0smotron: $(CRDOC) ## Generate docs for k0smotron CRDs
274-
$(CRDOC) --resources config/crd/bases/k0smotron.io --output docs/resource-reference/k0smotron.io-v1beta1.md
286+
$(CRDOC) --resources config/standalone/crd --output docs/resource-reference/k0smotron.io-v1beta1.md
275287

276288
# Generate docs for all CRDs apis
277289
docs-generate-reference: docs-generate-bootstrap docs-generate-controlplane docs-generate-infrastructure docs-generate-k0smotron
278290

279291
## Generate all code, manifests, documentation, and release artifacts
280292
.PHONY: generate-all
281-
generate-all: clean generate manifests clusterapi-manifests docs-generate-reference release
293+
generate-all: clean generate docs-generate-reference release
282294

283295
.PHONY: $(smoketests)
284296
$(smoketests): release k0smotron-image-bundle.tar
@@ -330,7 +342,7 @@ kind-deploy-capi:
330342

331343
.PHONY: kind-deploy-k0smotron
332344
kind-deploy-k0smotron: release k0smotron-image-bundle.tar
333-
kind load image-archive k0smotron-image-bundle.tar --name k0smotron
345+
kind load image-archive k0smotron-image-bundle.tar
334346
kubectl apply --server-side=true -f install.yaml
335347
kubectl rollout restart -n k0smotron deployment/k0smotron-controller-manager
336348

0 commit comments

Comments
 (0)