From 5f0c69f93327da6980aedb19951c20ae56c7eb91 Mon Sep 17 00:00:00 2001 From: Lukas Nagel Date: Sat, 23 Nov 2024 16:47:52 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Updated=20to=20helm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/HugoBuildAndDeploy.yaml | 9 +--- .github/workflows/HugoBuildDev.yaml | 41 ------------------- helm/.helmignore | 23 +++++++++++ helm/Chart.yaml | 6 +++ .../templates/deployment.yaml | 6 ++- helm/templates/namespace.yaml | 4 ++ helm/values.yaml | 1 + 7 files changed, 39 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/HugoBuildDev.yaml create mode 100644 helm/.helmignore create mode 100644 helm/Chart.yaml rename Deployment/Kubernetes.yaml => helm/templates/deployment.yaml (95%) create mode 100644 helm/templates/namespace.yaml create mode 100644 helm/values.yaml diff --git a/.github/workflows/HugoBuildAndDeploy.yaml b/.github/workflows/HugoBuildAndDeploy.yaml index 2433310..0d4c515 100644 --- a/.github/workflows/HugoBuildAndDeploy.yaml +++ b/.github/workflows/HugoBuildAndDeploy.yaml @@ -85,12 +85,5 @@ jobs: # Checkout the repository - uses: actions/checkout@v3 - - name: Find and Replace - uses: jacobtomlinson/gha-find-replace@v3 - with: - find: "{{RUN_NUMBER}}" - replace: ${{ github.run_number }} - regex: false - # Deploy Kubernetes YAML - - run: kubectl apply -f ./Deployment/Kubernetes.yaml --kubeconfig ${{ steps.write_file.outputs.filePath }} \ No newline at end of file + - run: helm upgrade --install fedodo-org ./helm --kubeconfig ${{ steps.write_file.outputs.filePath }} --set runNumber=${{ github.run_number }} \ No newline at end of file diff --git a/.github/workflows/HugoBuildDev.yaml b/.github/workflows/HugoBuildDev.yaml deleted file mode 100644 index 05b0678..0000000 --- a/.github/workflows/HugoBuildDev.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: HugoBuildDev - -on: - workflow_dispatch: # To have the ability to run the workflow manually - - push: - branches: [dev] - -env: - NAME: ./ - CONTAINER-NAME: fedodo-home - -jobs: - ReleaseDEV: - runs-on: ubuntu-latest - - steps: - # Checkout the repository - - uses: actions/checkout@v3 - - # Install Hugo - - name: Hugo setup - uses: peaceiris/actions-hugo@v2.5.0 - with: - extended: true - - # Build the hugo repository - - run: hugo - working-directory: ./${{ env.NAME }}/ - - - name: Login to Docker Hub - uses: docker/login-action@v1 - with: - username: fedodo - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build the Docker image - run: docker build . --file ./${{ env.NAME }}/Dockerfile --tag fedodo/${{ env.CONTAINER-NAME }}:dev - - - name: Push the image to dockerhub - run: docker push fedodo/${{ env.CONTAINER-NAME }}:dev \ No newline at end of file diff --git a/helm/.helmignore b/helm/.helmignore new file mode 100644 index 0000000..691fa13 --- /dev/null +++ b/helm/.helmignore @@ -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/ \ No newline at end of file diff --git a/helm/Chart.yaml b/helm/Chart.yaml new file mode 100644 index 0000000..1a69da7 --- /dev/null +++ b/helm/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: fedodo-homepage +description: A Helm chart for Kubernetes +type: application +version: 0.0.1 +appVersion: 0.0.1 \ No newline at end of file diff --git a/Deployment/Kubernetes.yaml b/helm/templates/deployment.yaml similarity index 95% rename from Deployment/Kubernetes.yaml rename to helm/templates/deployment.yaml index 9343499..e86751b 100644 --- a/Deployment/Kubernetes.yaml +++ b/helm/templates/deployment.yaml @@ -14,12 +14,14 @@ spec: spec: containers: - name: fedodo-home - image: fedodo/fedodo-home:{{RUN_NUMBER}} + image: fedodo/fedodo-home:{{ .Values.runNumber }} imagePullPolicy: Always resources: + requests: + memory: "128Mi" + cpu: "50m" limits: memory: "128Mi" - cpu: "500m" ports: - containerPort: 80 name: port-http diff --git a/helm/templates/namespace.yaml b/helm/templates/namespace.yaml new file mode 100644 index 0000000..729ba86 --- /dev/null +++ b/helm/templates/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: fedodo-org \ No newline at end of file diff --git a/helm/values.yaml b/helm/values.yaml new file mode 100644 index 0000000..b7c9dec --- /dev/null +++ b/helm/values.yaml @@ -0,0 +1 @@ +runNumber: 0 \ No newline at end of file