From bcd45df751edd87a806fbb5a421cb0aaedefcacd Mon Sep 17 00:00:00 2001 From: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:31:40 +0100 Subject: [PATCH] feat: add helm chart --- .github/workflows/helm-build.yaml | 67 +++++++++++++++++++++++++++++ README.md | 28 ++++++++++++ src/main/resources/application.yaml | 9 ++-- 3 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/helm-build.yaml diff --git a/.github/workflows/helm-build.yaml b/.github/workflows/helm-build.yaml new file mode 100644 index 0000000..65eb2c6 --- /dev/null +++ b/.github/workflows/helm-build.yaml @@ -0,0 +1,67 @@ +name: Helm Chart Build + +on: + workflow_dispatch: + push: + branches: + - "main" + - "release-*" + +concurrency: + group: helm-${{ github.ref }} + cancel-in-progress: true + +jobs: + prepare: + runs-on: ubuntu-latest + steps: + - name: Extract tag + id: extract_tag + run: | + tag=$(if [[ ${{github.ref_name}} == v* ]];then echo "${{github.ref_name}}"; else echo "latest"; fi) + echo "tag=$tag" >> $GITHUB_OUTPUT + outputs: + tag: ${{ steps.extract_tag.outputs.tag }} + + helm-build: + runs-on: ubuntu-latest + needs: + - prepare + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: "21" + cache: "maven" + - name: Create Helm + run: | + ## Set -Dquarkus.container-image.tag as empty to remove the "v" prefix from the container image of Deployment + mvn package -DskipTests -Dquarkus.container-image.tag= + + # YQ + sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq + sudo chmod +x /usr/bin/yq + + APP_IMAGE_TAG=$TAG yq e -i '.appVersion=strenv(APP_IMAGE_TAG)' target/helm/Chart.yaml + env: + TAG: ${{ needs.prepare.outputs.tag }} + - name: Git add Helm + id: git-add-helm + continue-on-error: true + run: | + cp -R target/helm/ ./ + + if [ -z $(git status --porcelain) ]; then + echo "has_changes=false" >> $GITHUB_OUTPUT + else + echo git status + git add helm/* + echo "has_changes=true" >> $GITHUB_OUTPUT + fi + - name: Commit and Push + uses: trustification/release-tools/.github/actions/commit@main + if: steps.git-add-helm.outputs.has_changes == 'true' + with: + commit_message: "🔅 Helm chart update" + branch: ${{github.ref_name}} \ No newline at end of file diff --git a/README.md b/README.md index e991de7..27ae240 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,31 @@ +# Quick Start - Helm Chart + +If you want to give a quick try of the operator without the whole glory of OLM you can deploy our Operator using Helm. + +- Start minikube: + +```shell +minikube start --addons=ingress,dashboard +``` + +- Install the Helm Chart: + +```shell +helm install myhelm helm/ +``` + +- Create an instance of Trustify: + +```shell +cat << EOF | kubectl apply -f - +apiVersion: "org.trustify/v1alpha1" +kind: "Trustify" +metadata: + name: myapp +spec: { } +EOF +``` + # Local development ## Minikube diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 12cb205..77f33ec 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -21,13 +21,10 @@ quarkus: helm: enabled: true # https://quarkus.io/guides/deploying-to-kubernetes#environment-variables-from-keyvalue-pairs - openshift: - env: - vars: - related-image-trustify-server: ${related.image.server} - related-image-db: ${related.image.db} - related-image-importer: ${related.image.importer} kubernetes: + idempotent: "true" + prometheus: + generate-service-monitor: "false" env: vars: related-image-trustify-server: ${related.image.server}