Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(k8s): add Helm Chart #500

Merged
merged 14 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/publish_on_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@ jobs:
version: latest
args: release --clean
env:
# https://github.com/goreleaser/goreleaser/blob/3345f8c9c5b287198a29d3db228388148b788c5e/www/docs/customization/builds.md?plain=1#L416-L418
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHART_REPO_REMOTE: "https://${{ secrets.HCLOUD_BOT_TOKEN }}@github.com/hetznercloud/helm-charts"
2 changes: 2 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ jobs:
deploy/kubernetes/hcloud-csi.yml
deploy/kubernetes/controller/deployment.yaml
deploy/kubernetes/node/daemonset.yaml
chart/Chart.yaml
chart/values.yaml
54 changes: 46 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,53 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Verify manifests are up to date
run: |
kustomize build deploy/kubernetes > /tmp/hcloud-csi.yml
# Workaround for kustomize stripping all comments. This comment is
# needed to automatically bump the referenced container tag through
# release-please
sed -i '/hetznercloud\/hcloud-csi-driver/ s/$/ # x-release-please-version/' /tmp/hcloud-csi.yml
diff deploy/kubernetes/hcloud-csi.yml /tmp/hcloud-csi.yml

- name: Run tests
run: |
go vet ./...
go test $(go list ./... | grep -v e2e) -v

deploy-manifests:
name: Check deployment manifests
runs-on: ubuntu-latest
steps:
- uses: yokawasa/action-setup-kube-tools@v0.9.3
with:
setup-tools: |
helm
helm: v3.11.2

- uses: actions/checkout@v4
- name: Generate manifests from helm chart
run: hack/update-deployment-yamls.sh

- name: Check for diff
run: git diff --exit-code -- deploy/

- name: Show warning
if: ${{ failure() }}
run: echo "::error title=Deployment Manifests outdated::Please run hack/update-deployment-yamls.sh and commit the changes to deploy/"

helm-chart:
name: Verify Helm Chart
runs-on: ubuntu-latest
steps:
- uses: yokawasa/action-setup-kube-tools@v0.9.3
with:
setup-tools: |
helm
helm: v3.11.2

- uses: actions/checkout@v4

# This step also verifies that the chart builds
- name: Verify Snapshots
run: |
hack/update-helm-snapshots.sh
git diff --exit-code -- deploy/
- name: Show warning
if: ${{ failure() }}
run: echo "::error title=Helm Snapshots outdated::Please run hack/update-helm-snapshots.sh and commit the changes to chart/.snapshots/"

- name: Helm Lint
run: helm lint chart/
2 changes: 1 addition & 1 deletion .github/workflows/test_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ jobs:

skaffold build --tag="e2e-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}"
tag=$(skaffold build --tag="e2e-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}" --quiet --output="{{ (index .Builds 0).Tag }}")
skaffold deploy --images=hetznercloud/hcloud-csi-driver=$tag
skaffold deploy --images=docker.io/hetznercloud/hcloud-csi-driver=$tag

test/e2e/kubernetes/run-e2e-tests.sh
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ hack/.*

# Build output
dist/
hcloud-csi-*.tgz

# Test binary for integration tests
test/integration/integration.tests
test/integration/integration.tests
21 changes: 21 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
before:
hooks:
- ./hack/release-generate-deployment-yamls.sh {{ .Version }}

builds:
- id: controller
main: ./cmd/controller
Expand Down Expand Up @@ -48,3 +52,20 @@ docker_manifests:
- hetznercloud/hcloud-csi-driver:{{ if not .IsSnapshot }}v{{ end }}{{ .Version }}-amd64
- hetznercloud/hcloud-csi-driver:{{ if not .IsSnapshot }}v{{ end }}{{ .Version }}-arm64v8
- hetznercloud/hcloud-csi-driver:{{ if not .IsSnapshot }}v{{ end }}{{ .Version }}-armv6

release:
ids: [""]
extra_files:
- glob: "./hcloud-csi-*.tgz"

publishers:
- name: helm-chart-repo

# make sure that this is only executed once. There are no separate ids per binary built,
# we filter for no actual ID and then run the publisher for the checksum.
ids: [""]
checksum: true

cmd: ./hack/release-publish-helm-chart.sh hcloud-csi-{{ .Version }}.tgz
env:
- CHART_REPO_REMOTE={{ .Env.CHART_REPO_REMOTE }}
23 changes: 23 additions & 0 deletions chart/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj

.snapshots
Loading
Loading