From 970bd406e9644218128cb2eae1417f30a968a5ab Mon Sep 17 00:00:00 2001 From: Felix Delattre Date: Mon, 28 Oct 2024 16:35:51 +0100 Subject: [PATCH 1/4] Added general polder deployment with its dependencies. --- .github/workflows/check_charts.yaml | 4 +-- .gitignore | 44 +++++++++++++++++++++++++---- deployment/helm/polder/.helmignore | 23 +++++++++++++++ deployment/helm/polder/Chart.lock | 9 ++++++ deployment/helm/polder/Chart.yaml | 24 ++++++++++++++++ deployment/helm/polder/values.yaml | 15 ++++++++++ pyproject.toml | 3 +- 7 files changed, 113 insertions(+), 9 deletions(-) create mode 100644 deployment/helm/polder/.helmignore create mode 100644 deployment/helm/polder/Chart.lock create mode 100644 deployment/helm/polder/Chart.yaml create mode 100644 deployment/helm/polder/values.yaml diff --git a/.github/workflows/check_charts.yaml b/.github/workflows/check_charts.yaml index 3e22595..bf222f0 100644 --- a/.github/workflows/check_charts.yaml +++ b/.github/workflows/check_charts.yaml @@ -25,7 +25,7 @@ jobs: - name: Check Version run: | current_version=$(grep '^version=' pyproject.toml | cut -f2 -d= | tr -d ' ' | tr -d '"') - app_version=$(grep 'appVersion:' deployment/helm/Chart.yaml | cut -f2 -d: | tr -d ' ' | tr -d '"') + app_version=$(grep 'appVersion:' deployment/helm/polder/Chart.yaml | cut -f2 -d: | tr -d ' ' | tr -d '"') if [[ "$current_version" != "$app_version" ]]; then echo "❌ current version from pyproject.toml ($current_version) and appVersion from Chart.yaml ($app_version) differs"; exit 1; @@ -74,4 +74,4 @@ jobs: - name: Run chart-testing (install) run: ct install --chart-dirs deployment/k8s - if: steps.list-changed.outputs.changed == 'true' \ No newline at end of file + if: steps.list-changed.outputs.changed == 'true' diff --git a/.gitignore b/.gitignore index fc5174c..c7002dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,41 @@ -.idea -helm/Chart.lock -.DS_STORE +# Dependency directories +node_modules/ + +# General files for the project +pkg/* +*.pyc +bin/* +.project +/.bin +/_test/secrets/*.json + +# OSX leaves these everywhere on SMB shares +._* + +# OSX trash .DS_Store +.DS_STORE -# Dependency directories -node_modules/ \ No newline at end of file +# Files generated by JetBrains IDEs, e.g. IntelliJ IDEA +.idea/ +*.iml + +# Vscode files +.vscode + +# Emacs save files +*~ +\#*\# +.\#* + +# Vim-related files +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +*.un~ +Session.vim +.netrwhist + +# Chart dependencies +**/charts/*.tgz + +.history diff --git a/deployment/helm/polder/.helmignore b/deployment/helm/polder/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/deployment/helm/polder/.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/ diff --git a/deployment/helm/polder/Chart.lock b/deployment/helm/polder/Chart.lock new file mode 100644 index 0000000..f95a237 --- /dev/null +++ b/deployment/helm/polder/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: eoapi + repository: https://devseed.com/eoapi-k8s/ + version: 0.5.0 +- name: webapp-polder + repository: file://../webapp-polder + version: 0.1.0 +digest: sha256:7d2fa7cbafd56b2614fd50464e710584eac65bf1b64a2b644e9457a3f162567d +generated: "2024-11-04T14:12:53.307694627+01:00" diff --git a/deployment/helm/polder/Chart.yaml b/deployment/helm/polder/Chart.yaml new file mode 100644 index 0000000..2de3ebf --- /dev/null +++ b/deployment/helm/polder/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: polder +description: Create a polder - Web AOI viewer - instance. + +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "0.2.0" + +dependencies: + - name: eoapi + version: 0.5.0 + repository: "https://devseed.com/eoapi-k8s/" + - name: webapp-polder + version: 0.1.0 + repository: file://../webapp-polder diff --git a/deployment/helm/polder/values.yaml b/deployment/helm/polder/values.yaml new file mode 100644 index 0000000..f1c2531 --- /dev/null +++ b/deployment/helm/polder/values.yaml @@ -0,0 +1,15 @@ +# Default values for polder. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/ +replicaCount: 1 + +# This is to override the chart name. +nameOverride: "polder" +fullnameOverride: "test-polder" + +# polder custom configuration +mapboxToken: "" +stacApi: "https://rx2hna9pbg.execute-api.eu-central-1.amazonaws.com" +tilerApi: "https://zbrrek2x0i.execute-api.eu-central-1.amazonaws.com" diff --git a/pyproject.toml b/pyproject.toml index 688f929..7c0a2a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: GIS", ] -version="0.0.1" +version="0.2.0" dependencies = [ ] @@ -41,4 +41,3 @@ Documentation = "https://developmentseed.org/polder/" Issues = "https://github.com/developmentseed/polder/issues" Source = "https://github.com/developmentseed/polder" Changelog = "https://developmentseed.org/polder/release-notes/" - From 1c21428874140f5e2a38b32068dfe84bc8d194ce Mon Sep 17 00:00:00 2001 From: Emmanuel Mathot Date: Wed, 6 Nov 2024 10:11:18 +0100 Subject: [PATCH 2/4] make charts check work --- .github/workflows/check_charts.yaml | 8 ++++++-- .gitignore | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_charts.yaml b/.github/workflows/check_charts.yaml index bf222f0..6a35859 100644 --- a/.github/workflows/check_charts.yaml +++ b/.github/workflows/check_charts.yaml @@ -36,6 +36,10 @@ jobs: with: version: v3.9.2 + # Add DevSeed helm repository + - name: Add DevSeed helm repository + run: helm repo add devseed https://devseed.com/eoapi-k8s/ + - uses: actions/setup-python@v5 with: python-version: 3.7 @@ -46,13 +50,13 @@ jobs: - name: Run chart-testing (list-changed) id: list-changed run: | - changed=$(ct list-changed --chart-dirs deployment --target-branch ${{ github.event.repository.default_branch }}) + changed=$(ct list-changed --chart-dirs deployment/helm --target-branch ${{ github.event.repository.default_branch }}) if [[ -n "$changed" ]]; then echo "::set-output name=changed::true" fi - name: Run chart-testing (lint) - run: ct lint --chart-dirs deployment --target-branch ${{ github.event.repository.default_branch }} + run: ct lint --chart-dirs deployment/helm --target-branch ${{ github.event.repository.default_branch }} - name: Build container uses: docker/build-push-action@v6 diff --git a/.gitignore b/.gitignore index c7002dc..4b4be44 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ Session.vim **/charts/*.tgz .history +.venv/ From 0882e946c41b378bd5bc8cfc8760c30835a11417 Mon Sep 17 00:00:00 2001 From: Emmanuel Mathot Date: Wed, 6 Nov 2024 10:51:09 +0100 Subject: [PATCH 3/4] Full helm CI/CD testing - Update Helm chart and workflow for webapp container build - Added postgres operator install - chart-testing enabled with kind installation --- .github/workflows/check_charts.yaml | 13 ++++++++++--- deployment/helm/polder/Chart.yaml | 8 ++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check_charts.yaml b/.github/workflows/check_charts.yaml index 6a35859..588970a 100644 --- a/.github/workflows/check_charts.yaml +++ b/.github/workflows/check_charts.yaml @@ -13,6 +13,9 @@ on: - '.github/workflows/check_charts.yaml' pull_request: +env: + PGO_CHART_VERSION: 5.7.0 + jobs: lint-test: runs-on: ubuntu-latest @@ -58,12 +61,12 @@ jobs: - name: Run chart-testing (lint) run: ct lint --chart-dirs deployment/helm --target-branch ${{ github.event.repository.default_branch }} - - name: Build container + - name: Build webapp container uses: docker/build-push-action@v6 if: steps.list-changed.outputs.changed == 'true' with: platforms: linux/amd64 - context: . + context: webapp file: webapp/Dockerfile push: false tags: "polder:dev" @@ -72,10 +75,14 @@ jobs: uses: helm/kind-action@v1.10.0 if: steps.list-changed.outputs.changed == 'true' + # Install postgres operator + - name: Install postgres operator + run: helm install --set disable_check_for_upgrades=true pgo oci://registry.developers.crunchydata.com/crunchydata/pgo --version ${PGO_CHART_VERSION} + - name: Load container image in kind cluster run: kind load docker-image polder:dev --name chart-testing if: steps.list-changed.outputs.changed == 'true' - name: Run chart-testing (install) - run: ct install --chart-dirs deployment/k8s + run: ct install --chart-dirs deployment/helm --target-branch ${{ github.event.repository.default_branch }} if: steps.list-changed.outputs.changed == 'true' diff --git a/deployment/helm/polder/Chart.yaml b/deployment/helm/polder/Chart.yaml index 2de3ebf..e4b0a9c 100644 --- a/deployment/helm/polder/Chart.yaml +++ b/deployment/helm/polder/Chart.yaml @@ -15,6 +15,14 @@ version: 0.1.0 # It is recommended to use it with quotes. appVersion: "0.2.0" +maintainers: + - name: pantierra # Felix Delattre + url: https://github.com/pantierra + - name: emmanuelmathot # Emmanuel Mathot + url: https://github.com/emmanuelmathot + - name: ciaransweet # Ciaran Sweet + url: https://github.com/ciaransweet + dependencies: - name: eoapi version: 0.5.0 From 4dfbd9327333f5f5265c163dfadae456140aa269 Mon Sep 17 00:00:00 2001 From: Felix Delattre Date: Thu, 7 Nov 2024 15:12:59 +0100 Subject: [PATCH 4/4] Adjusted internal urls. --- deployment/helm/polder/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/helm/polder/values.yaml b/deployment/helm/polder/values.yaml index f1c2531..4f4b0fa 100644 --- a/deployment/helm/polder/values.yaml +++ b/deployment/helm/polder/values.yaml @@ -11,5 +11,5 @@ fullnameOverride: "test-polder" # polder custom configuration mapboxToken: "" -stacApi: "https://rx2hna9pbg.execute-api.eu-central-1.amazonaws.com" -tilerApi: "https://zbrrek2x0i.execute-api.eu-central-1.amazonaws.com" +stacApi: "stac:8080" +tilerApi: "raster:8080"