Skip to content

Commit 949f010

Browse files
authored
feat: Use kustomize instead of Helm for deployment (#72)
1 parent ef2a855 commit 949f010

File tree

68 files changed

+708
-1057
lines changed

Some content is hidden

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

68 files changed

+708
-1057
lines changed

.github/workflows/checks.yml

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -134,70 +134,3 @@ jobs:
134134
run: devbox run -- make pre-commit
135135
env:
136136
SKIP: no-commit-to-branch,golangci-lint,actionlint-system
137-
138-
lint-test-helm:
139-
runs-on: ubuntu-22.04
140-
env:
141-
KIND_CLUSTER_NAME: chart-testing
142-
KIND_KUBECONFIG: ct-kind-kubeconfig
143-
steps:
144-
- name: Checkout
145-
uses: actions/checkout@v4
146-
with:
147-
fetch-depth: 0
148-
149-
- name: Install devbox
150-
uses: jetify-com/[email protected]
151-
with:
152-
enable-cache: true
153-
154-
- name: Run chart-testing (list-changed)
155-
id: list-changed
156-
run: |
157-
changed="$(devbox run -- \
158-
ct list-changed --config charts/ct-config.yaml \
159-
)"
160-
if [[ -n "$changed" ]]; then
161-
echo "changed=true" >> "$GITHUB_OUTPUT"
162-
fi
163-
164-
- if: steps.list-changed.outputs.changed == 'true'
165-
name: Run chart-testing (lint)
166-
run: |
167-
devbox run -- \
168-
ct lint --config charts/ct-config.yaml
169-
170-
- if: steps.list-changed.outputs.changed == 'true'
171-
name: Create kind cluster
172-
run: devbox run -- make kind.create
173-
174-
- if: steps.list-changed.outputs.changed == 'true'
175-
name: Build Docker images
176-
run: devbox run -- make release-snapshot
177-
178-
- if: steps.list-changed.outputs.changed == 'true'
179-
name: Sideload docker image
180-
run: |
181-
devbox run -- \
182-
kind load docker-image \
183-
--name "${KIND_CLUSTER_NAME}" \
184-
"ko.local/${{ github.event.repository.name }}:$(devbox run -- gojq -r '.version+"-"+.runtime.goarch' dist/metadata.json)"
185-
186-
- if: steps.list-changed.outputs.changed == 'true'
187-
name: Setup Cluster API and cert-manager
188-
run: devbox run -- make clusterctl.init
189-
190-
- if: steps.list-changed.outputs.changed == 'true'
191-
name: Run chart-testing (install)
192-
run: |
193-
devbox run -- \
194-
ct install \
195-
--config charts/ct-config.yaml \
196-
--helm-extra-set-args "--set-string image.repository=ko.local/${{ github.event.repository.name }} --set-string image.tag=$(devbox run -- gojq -r '.version+"-"+.runtime.goarch' dist/metadata.json)"
197-
env:
198-
KUBECONFIG: ${{ env.KIND_KUBECONFIG }}
199-
200-
- if: steps.list-changed.outputs.changed == 'true' && always()
201-
name: Delete chart-testing KinD cluster
202-
run: |
203-
devbox run -- make kind.delete

.github/workflows/github-pages.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,6 @@ jobs:
5151
run: if [[ -f package-lock.json || -f npm-shrinkwrap.json ]]; then npm ci; fi
5252
working-directory: docs
5353

54-
- name: Update Helm index
55-
env:
56-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57-
run: |
58-
mapfile -t releases < <( devbox run -- make list-releases )
59-
for release in "${releases[@]}"; do
60-
if devbox run -- gh release download "${release}" \
61-
--pattern '${{ github.event.repository.name }}-*.tgz' \
62-
--dir docs/static/helm 2>/dev/null; then
63-
devbox run -- helm repo index docs/static/helm \
64-
--url "https://github.com/${{ github.repository }}/releases/download/${release}" \
65-
--merge docs/static/helm/index.yaml
66-
rm -f docs/static/helm/*.tgz
67-
fi
68-
done
69-
7054
- name: Build with Hugo
7155
env:
7256
# For maximum backward compatibility with Hugo modules

.github/workflows/release-tag.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,6 @@ jobs:
5454
env:
5555
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5656

57-
- name: Package Helm chart and attach to release
58-
env:
59-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60-
run: |
61-
devbox run -- helm package ./charts/${{ github.event.repository.name }} \
62-
--destination . \
63-
--version ${{ github.ref_name }} \
64-
--app-version ${{ github.ref_name }}
65-
devbox run -- gh release upload ${{ github.ref_name }} ${{ github.event.repository.name }}-*.tgz
66-
6757
- name: Build GitHub pages
6858
uses: benc-uk/workflow-dispatch@v1
6959
with:

.goreleaser.yml

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,8 @@ archives:
4040

4141
before:
4242
hooks:
43-
- |
44-
sh -ec 'cat <<EOF > ipam-components.yaml
45-
apiVersion: v1
46-
kind: Namespace
47-
metadata:
48-
name: caipamx-system
49-
$(helm template {{ .ProjectName }} ./charts/{{ .ProjectName }} \
50-
--namespace caipamx-system \
51-
--include-crds \
52-
--set-string image.tag=v{{ trimprefix .Version "v" }}{{ if .IsSnapshot }}-{{ .Runtime.Goarch }} \
53-
--set-string image.repository=ko.local/{{ .ProjectName }}{{ end }} \
54-
)
55-
EOF'
56-
- sed -i -e 's/\${/$${/g' -e 's/v0.0.0-dev/v{{ trimprefix .Version "v" }}/g' ipam-components.yaml
43+
- kustomize build ./config/default >ipam-components.yaml
44+
- sed -i -e 's/v0.0.0-dev/v{{ trimprefix .Version "v" }}/g' ipam-components.yaml
5745
- |
5846
sh -ec 'gojq --yaml-input --yaml-output \
5947
".releaseSeries |= (. + [{contract: \"v1beta1\", major: {{ .Major }}, minor: {{ .Minor }}}] | unique)" \
@@ -82,19 +70,6 @@ builds:
8270
- amd64
8371
- arm64
8472
mod_timestamp: '{{ .CommitTimestamp }}'
85-
hooks:
86-
post:
87-
- |
88-
sh -ec 'if [ {{ .IsSnapshot }} == true ] && [ {{ .Runtime.Goarch }} == {{ .Arch }} ]; then
89-
env SOURCE_DATE_EPOCH=$(date +%s) \
90-
KO_DATA_DATE_EPOCH=$(date +%s) \
91-
KO_DOCKER_REPO=ko.local/{{ .ProjectName }} \
92-
ko build \
93-
--bare \
94-
--platform linux/{{ .Arch }} \
95-
-t v{{ trimprefix .Version "v" }}-{{ .Arch }} \
96-
./cmd/controller
97-
fi'
9873
- id: cli
9974
dir: ./cmd/caipamx
10075
binary: caipamx

.pre-commit-config.yaml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,12 @@
44
repos:
55
- repo: local
66
hooks:
7-
- id: schema-chart
8-
name: schema-chart
9-
entry: make schema-chart
10-
language: system
11-
files: "^charts/[^/]+/values.yaml$"
127
- id: golangci-lint
138
name: golangci-lint
149
entry: make go-generate lint
1510
language: system
1611
files: "(.*\\.go|go.mod|go.sum|go.mk)$"
1712
pass_filenames: false
18-
- id: chart-docs
19-
name: chart-docs
20-
entry: make chart-docs
21-
language: system
22-
files: "^charts/"
23-
pass_filenames: false
2413
- id: hugo-mod-tidy
2514
name: hugo-mod-tidy
2615
entry: bash -c "cd docs && hugo mod tidy"
@@ -46,7 +35,6 @@ repos:
4635
- id: check-yaml
4736
args: ["-m", "--unsafe"]
4837
stages: [pre-commit]
49-
exclude: ^charts/.+/templates/
5038
- id: mixed-line-ending
5139
args: ["-f", "lf"]
5240
exclude: \.bat$
@@ -65,7 +53,6 @@ repos:
6553
stages: [pre-commit]
6654
- id: end-of-file-fixer
6755
stages: [pre-commit]
68-
exclude: ^charts/[^/]+/README.md$
6956
- repo: https://github.com/rhysd/actionlint
7057
rev: v1.7.7
7158
hooks:
@@ -98,7 +85,7 @@ repos:
9885
hooks:
9986
- id: markdownlint
10087
stages: [pre-commit]
101-
exclude: ^(CHANGELOG.md|charts/[^/]+/README.md|.github/pull_request_template.md)$
88+
exclude: ^(CHANGELOG.md|.github/pull_request_template.md)$
10289
- repo: https://github.com/Lucas-C/pre-commit-hooks
10390
rev: v1.5.5
10491
hooks:
@@ -116,7 +103,6 @@ repos:
116103
name: License headers - YAML and Makefiles
117104
stages: [pre-commit]
118105
files: (^Makefile|\.(ya?ml|mk))$
119-
exclude: ^docs/static/helm/index\.yaml$
120106
args:
121107
- --license-filepath
122108
- hack/license-header.txt

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ make dev.run-on-kind
2424
eval $(make kind.kubeconfig)
2525
```
2626

27-
Pro-tip: to redeploy without rebuilding the binaries, images, etc (useful if you have only changed the Helm chart for
27+
Pro-tip: to redeploy without rebuilding the binaries, images, etc (useful if you have only changed the deployment
2828
example), run:
2929

3030
```shell

api/v1alpha1/v1alpha1_suite_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package v1alpha1_test
55

66
import (
7-
"path/filepath"
7+
"os/exec"
88
"testing"
99

1010
. "github.com/onsi/ginkgo/v2"
@@ -33,10 +33,14 @@ var _ = BeforeSuite(func() {
3333
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
3434

3535
By("bootstrapping test environment")
36+
crdTempDir := GinkgoT().TempDir()
37+
38+
Expect(
39+
exec.Command("kustomize", "build", "../../config/crd", "-o", crdTempDir).Run(),
40+
).To(Succeed())
41+
3642
testEnv = &envtest.Environment{
37-
CRDDirectoryPaths: []string{
38-
filepath.Join("..", "..", "charts", "cluster-api-ipam-provider-nutanix", "crds"),
39-
},
43+
CRDDirectoryPaths: []string{crdTempDir},
4044
ErrorIfCRDPathMissing: true,
4145
}
4246

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/chart_schema.yaml

Lines changed: 0 additions & 40 deletions
This file was deleted.

charts/cluster-api-ipam-provider-nutanix/Chart.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

charts/cluster-api-ipam-provider-nutanix/README.md

Lines changed: 0 additions & 47 deletions
This file was deleted.

charts/cluster-api-ipam-provider-nutanix/README.md.gotmpl

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)