Skip to content

Commit 8f6f5dd

Browse files
committed
Remove helmify / kustomize, switch to helm-chart only.
This PR removes the helmify step and removes kustomize as an option to render the manager/rbacs/crd. Helmify took a lot of work creating a helm-chart based on the boilerplate generated by kubebuilder. But ultimatively, it imposes too many constraints to the outcome of the helm-chart and makes it hard to implement custom renditions (like using .AppVersion as a image tag). Thus this PR is removing the kustomize files, leaving only the generated CRDs in the config directory (which don't need any templating) and symlinks it to the helm chart.
1 parent 9813dcb commit 8f6f5dd

39 files changed

+12
-694
lines changed

.github/workflows/helm-oci-package-ghcr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
fetch-depth: 0
2929
fetch-tags: true
3030
- name: Install Helm
31-
uses: azure/setup-helm@v4.3.1
31+
uses: azure/setup-helm@v4
3232
- name: Lint Helm Chart
3333
run: helm lint charts/openstack-hypervisor-operator
3434
- name: Package Helm Chart

.golangci.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ linters:
138138
- G112
139139
# if we put a password or token into a serialized payload, guess what, we probably did that on purpose
140140
- G117
141-
# this triggers on net/http.Request.ParseForm() and its callers, e.g. net/http.Request.FormValue(), complaining about potential memory exhaustion from unbounded form parsing;
142-
# but that is incorrect, ParseForm() by default never parses more than 10 MiB for this specific reason
143-
- G120
144141
# created file permissions are restricted by umask if necessary
145142
- G306
146143
# the following lints cause false-positives in many repositories, should be fixed with the next release. (see https://github.com/securego/gosec/issues/1500)

.pre-commit-config.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,3 @@ repos:
2727
entry: sh -c "gmake check || make check"
2828
language: system
2929
pass_filenames: false
30-
- id: helmify
31-
name: helmify
32-
entry: sh -c "gmake helmify || make helmify"
33-
language: system
34-
pass_filenames: false
35-
- id: go-build
36-
name: go build
37-
entry: sh -c "gmake build-all || make build-all"
38-
language: system
39-
pass_filenames: false

Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ default: build-all
3535

3636
.PHONY: install-crds
3737
install-crds: generate ## Install CRDs into the K8s cluster specified in ~/.kube/config.
38-
kubectl kustomize config/crd | kubectl apply -f -
39-
40-
.PHONY: helmify
41-
helmify:
42-
kubectl kustomize config/default | helmify -crd-dir charts/openstack-hypervisor-operator
38+
kubectl apply -f config/crd/*.yaml
4339

4440
install-goimports: FORCE
4541
@if ! hash goimports 2>/dev/null; then printf "\e[1;36m>> Installing goimports (this may take a while)...\e[0m\n"; go install golang.org/x/tools/cmd/goimports@latest; fi
@@ -117,7 +113,7 @@ check: FORCE static-check build/cover.html build-all
117113

118114
generate: install-controller-gen
119115
@printf "\e[1;36m>> controller-gen\e[0m\n"
120-
@controller-gen crd:allowDangerousTypes=true rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
116+
@controller-gen crd:allowDangerousTypes=true rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=charts/openstack-hypervisor-operator/crds
121117
@controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
122118
@controller-gen applyconfiguration paths="./..."
123119

Makefile.maker.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ binaries:
77

88
controllerGen:
99
enabled: true
10-
crdOutputPath: config/crd/bases
10+
crdOutputPath: charts/openstack-hypervisor-operator/crds
1111
objectHeaderFile: hack/boilerplate.go.txt
1212
rbacRoleName: manager-role
13+
allowDangerousTypes: true
1314

1415
coverageTest:
1516
only: '/internal'
@@ -72,8 +73,4 @@ reuse:
7273
verbatim: |
7374
.PHONY: install-crds
7475
install-crds: generate ## Install CRDs into the K8s cluster specified in ~/.kube/config.
75-
kubectl kustomize config/crd | kubectl apply -f -
76-
77-
.PHONY: helmify
78-
helmify:
79-
kubectl kustomize config/default | helmify -crd-dir charts/openstack-hypervisor-operator
76+
kubectl apply -f config/crd/*.yaml

api/v1/suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var _ = BeforeSuite(func() {
4848

4949
By("bootstrapping test environment")
5050
testEnv = &envtest.Environment{
51-
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
51+
CRDDirectoryPaths: []string{filepath.Join("..", "..", "charts", "openstack-hypervisor-operator", "crds")},
5252
ErrorIfCRDPathMissing: true,
5353
BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s",
5454
fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)),
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: openstack-hypervisor-operator
33
description: A Helm chart for Kubernetes
4-
appVersion: 0.1.0
5-
version: 0.2.9
4+
appVersion: latest
5+
version: 1.0.0
66
type: application

config/crd/bases/kvm.cloud.sap_evictions.yaml renamed to charts/openstack-hypervisor-operator/crds/kvm.cloud.sap_evictions.yaml

File renamed without changes.

config/crd/bases/kvm.cloud.sap_hypervisors.yaml renamed to charts/openstack-hypervisor-operator/crds/kvm.cloud.sap_hypervisors.yaml

File renamed without changes.

charts/openstack-hypervisor-operator/values.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ controllerManager:
2323
osUserDomainName: ""
2424
osUsername: ""
2525
image:
26-
repository: keppel.eu-de-1.cloud.sap/ccloud/openstack-hypervisor-operator
27-
tag: latest
26+
repository: ghcr.io/cobaltcore-dev/openstack-hypervisor-operator
2827
resources:
2928
limits:
3029
cpu: 500m

0 commit comments

Comments
 (0)