Skip to content

Commit

Permalink
Move crds to templates folder (#19)
Browse files Browse the repository at this point in the history
* Move crds to templates folder

* Add parameter to control if qdrantversions CRD is included

- Update makefile to add a conditional block to the qdrantversions template
- Add parameter to the chart values
- Remove duplicated qdrantversions.yaml file

* Make bot management and regional CRDs configurable

* Add CI to ensure make gen was run

---------

Co-authored-by: Bastian Hofmann <[email protected]>
  • Loading branch information
areina and bashofmann authored Sep 26, 2024
1 parent b9025d4 commit 62c73e0
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 106 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/pr-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ jobs:
with:
version: v1.59.1 # Specify the golangci-lint version, so we are stable
args: --timeout 10m # Increase the timeout to 10 minutes

- name: Run make gen
run: |
make gen
- name: Ensure that make gen did not result in changes
uses: CatChen/check-git-status-action@v1
with:
fail-if-not-clean: true
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,20 @@ gen: manifests generate format vet ## Generate code containing DeepCopy, DeepCop

.PHONY: manifests
manifests: controller-gen ## Generate CustomResourceDefinition objects.
$(CONTROLLER_GEN) crd paths="./..." output:crd:artifacts:config=charts/qdrant-operator-crds/crds
cp charts/qdrant-operator-crds/crds/qdrant.io_qdrantversions.yaml charts/qdrant-operator-crds/crds-for-cluster-api/qdrant.io_qdrantversions.yaml
rm charts/qdrant-operator-crds/templates/management-crds/*.yaml
rm charts/qdrant-operator-crds/templates/region-crds/*.yaml
$(CONTROLLER_GEN) crd paths="./..." output:crd:artifacts:config=charts/qdrant-operator-crds/templates
mv charts/qdrant-operator-crds/templates/qdrant.io_qdrantversions.yaml charts/qdrant-operator-crds/templates/management-crds/
mv charts/qdrant-operator-crds/templates/qdrant*.yaml charts/qdrant-operator-crds/templates/region-crds/
for file in charts/qdrant-operator-crds/templates/management-crds/*.yaml; do \
echo "{{ if .Values.includeManagementCRDs }}" | cat - $$file > temp && mv temp $$file; \
echo "{{ end }}" >> $$file; \
done
for file in charts/qdrant-operator-crds/templates/region-crds/*.yaml; do \
echo "{{ if .Values.includeRegionCRDs }}" | cat - $$file > temp && mv temp $$file; \
echo "{{ end }}" >> $$file; \
done
helm lint charts/qdrant-operator-crds

.PHONY: generate
generate: controller-gen crd-ref-docs ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand Down
104 changes: 0 additions & 104 deletions charts/qdrant-operator-crds/crds/qdrant.io_qdrantversions.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.includeManagementCRDs }}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -102,3 +103,4 @@ spec:
served: true
storage: true
subresources: {}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.includeRegionCRDs }}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -1727,3 +1728,4 @@ spec:
storage: true
subresources:
status: {}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.includeRegionCRDs }}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -105,3 +106,4 @@ spec:
served: true
storage: true
subresources: {}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.includeRegionCRDs }}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -1096,3 +1097,4 @@ spec:
served: true
storage: true
subresources: {}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.includeRegionCRDs }}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -111,3 +112,4 @@ spec:
served: true
storage: true
subresources: {}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.includeRegionCRDs }}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -125,3 +126,4 @@ spec:
served: true
storage: true
subresources: {}
{{ end }}
4 changes: 4 additions & 0 deletions charts/qdrant-operator-crds/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Include management-crds in the deployment
includeManagementCRDs: false
# Include region-crds in the deployment
includeRegionCRDs: true

0 comments on commit 62c73e0

Please sign in to comment.