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

Hello helm #137

Merged
merged 13 commits into from
Jun 18, 2024
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
69 changes: 69 additions & 0 deletions .github/workflows/release-helm-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: release-helm-chart
on:
# TODO: The following commented lines should be used depending on the release strategy
# release:
# types:
# - released
# OR for a full release workflow
# push:
# tags:
# - 'v*.*.*'
workflow_dispatch:
inputs:
operatorVersion:
description: Operator bundle version
default: 0.0.0
type: string
limitadorVersion:
description: Limitador version
default: latest
type: string
releaseId:
description: Release ID
default: 0
type: string

jobs:
chart_release:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

- name: Build the Helm Chart manifests
run: |
make helm-build \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we should not be doing this. The git commit (or tag) we are releasing should have done previously make helm-build. Any thought?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was thinking it should be part of the building manifests steps just before tagging... However, just a reminder that currently we do that manually before tagging and then let the CI to build the manifests again and publish them to Quay... meaning it's kind of the same in this case, we could run this target and commit it with the rest of the manifests when releasing... but having a separated workflow is convenient when you want to attach charts to other already released operators. What do you reckon?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently we do that manually before tagging and then let the CI to build the manifests again and publish them to Quay.

Isn't that redundant? What I would do, maybe, it is a test to run (on release event) make helm-build and check that no files changed. Same we do with go generate or make bundle.

having a separated workflow is convenient when you want to attach charts to other already released operators

Not sure I follow.

Anyway, I was not asking for changes actually. Whatever you decide is ok for me on this regard.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you, we'll need to address the redundancy in our workflows, part should be reflected in Kuadrant/architecture#41

VERSION=${{ inputs.operatorVersion }} \
LIMITADOR_VERSION=${{ inputs.limitadorVersion }}

- name: Package Helm Chart
run: |
make helm-package

- name: Upload package to GitHub Release
uses: svenstaro/upload-release-action@v2
id: upload-chart
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: charts/limitador-operator-${{ inputs.operatorVersion }}.tgz
asset_name: chart-limitador-operator-${{ inputs.operatorVersion }}.tgz
tag: ${{ github.ref }}
overwrite: true

- name: Sync Helm Chart with repository
run: |
make helm-sync-package \
VERSION=${{ inputs.operatorVersion }} \
HELM_WORKFLOWS_TOKEN=${{ secrets.HELM_WORKFLOWS_TOKEN }} \
BROWSER_DOWNLOAD_URL=${{ steps.upload-chart.outputs.browser_download_url }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*.so
*.dylib
bin
limitador-operator
/limitador-operator

# Test binary, build with `go test -c`
*.test
Expand Down
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ REGISTRY = quay.io

# Organization in container resgistry
ORG ?= kuadrant
REPO_NAME ?= limitador-operator

# kubebuilder-tools still doesn't support darwin/arm64. This is a workaround (https://github.com/kubernetes-sigs/controller-runtime/issues/1657)
ARCH_PARAM =
Expand Down Expand Up @@ -186,6 +187,23 @@ $(GINKGO):
.PHONY: ginkgo
ginkgo: $(GINKGO) ## Download ginkgo locally if necessary.

HELM = $(PROJECT_PATH)/bin/helm
HELM_VERSION = v3.15.0
$(HELM):
@{ \
set -e ;\
mkdir -p $(dir $(HELM)) ;\
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
wget -O helm.tar.gz https://get.helm.sh/helm-$(HELM_VERSION)-$${OS}-$${ARCH}.tar.gz ;\
tar -zxvf helm.tar.gz ;\
mv $${OS}-$${ARCH}/helm $(HELM) ;\
chmod +x $(HELM) ;\
rm -rf $${OS}-$${ARCH} helm.tar.gz ;\
}

.PHONY: helm
helm: $(HELM) ## Download helm locally if necessary.

##@ General

# The help target prints out all targets with their descriptions organized
Expand Down
23 changes: 23 additions & 0 deletions charts/limitador-operator/.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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
13 changes: 13 additions & 0 deletions charts/limitador-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v2
name: limitador-operator
description: A Helm chart for Limitador Operator
type: application
# The version will be properly set when the chart is released matching the operator version
version: "0.0.0"
maintainers:
- email: [email protected]
name: Alex Snaps
- email: [email protected]
name: Didier Di Cesare
- email: [email protected]
name: Eguzki Astiz Lezaun
Loading
Loading