From d09d45bd18827f4afab1b499228438bbc82d3290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 7 Oct 2024 10:24:57 +0200 Subject: [PATCH] Unset the image tag so users have to specify it explicitly --- .ruby-version | 2 +- README.md | 4 ++-- charts/openproject/README.md | 12 +++++++++++- charts/openproject/templates/web-deployment.yaml | 2 ++ charts/openproject/values.yaml | 5 ++--- spec/helm_template.rb | 14 ++++++++++---- 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.ruby-version b/.ruby-version index 619b537..a0891f5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.3 +3.3.4 diff --git a/README.md b/README.md index 092b1f1..5efd3e6 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ We publish newer versions of this chart to the GitHub package registry: https:// We sign our chart using the [Helm Provenance and Integrity](https://helm.sh/docs/topics/provenance/) functionality. You can find the used public key here -- https://github.com/opf/helm-charts/blob/main/signing.key +- https://github.com/opf/helm-charts/blob/main/signing.key - https://keys.openpgp.org/vks/v1/by-fingerprint/CB1CA0488A75B7471EA1B087CF56DD6A0AE260E5 # Contribution -We welcome all contributions. For the release management, we're using the [changeset action](https://github.com/changesets/action) to generate the changelog and maintain the release process. \ No newline at end of file +We welcome all contributions. For the release management, we're using the [changeset action](https://github.com/changesets/action) to generate the changelog and maintain the release process. diff --git a/charts/openproject/README.md b/charts/openproject/README.md index 392a231..dab1f07 100644 --- a/charts/openproject/README.md +++ b/charts/openproject/README.md @@ -46,7 +46,9 @@ helm repo update Install the OpenProject chart in a dedicated `openproject` namespace: ```shell -helm upgrade --create-namespace --namespace openproject --install openproject openproject/openproject +helm upgrade --create-namespace --namespace openproject \ + --install openproject openproject/openproject \ + --set image.tag=14.5.1 ``` The namespace is optional, but we highly recommend it as it does make it easier to manage the resources created for OpenProject. @@ -130,6 +132,14 @@ s3: # port: ``` +### Updating the release + +In case you update the release of OpenProject on the same version of the helm chart, you can use the `helm upgrade` command to update the release. + +```shell +helm upgrade --reuse-values --namespace openproject my-openproject --set image.tag=14.6.0 +``` +Find out more about the [configuration through environment variables](https://www.openproject.org/docs/installation-and-operations/configuration/environment/) section. ### Updating the configuration diff --git a/charts/openproject/templates/web-deployment.yaml b/charts/openproject/templates/web-deployment.yaml index 7d9ad21..d5c11e2 100644 --- a/charts/openproject/templates/web-deployment.yaml +++ b/charts/openproject/templates/web-deployment.yaml @@ -1,3 +1,5 @@ +{{- $image_tag := .Values.image.tag | required ".Values.image.tag is required. Please use the -slim variant from OpenProject and fix it to a full release version X.Y.Z" -}} + --- apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} kind: Deployment diff --git a/charts/openproject/values.yaml b/charts/openproject/values.yaml index 13280dc..635111c 100644 --- a/charts/openproject/values.yaml +++ b/charts/openproject/values.yaml @@ -199,9 +199,8 @@ image: ## Define image tag. ## For the helm chart, use the `-slim` variants as the all-in-one container is not compatible - ## with some of the options (non-root execution, password splitting, etc.) and is inefficient for using in helm - ## due to embedded a number of services. - tag: "14-slim" + # For the latest version, see https://hub.docker.com/r/openproject/openproject/tags + tag: ## Define image sha256 - mutual exclusive with image tag. ## The sha256 has a higher precedence than diff --git a/spec/helm_template.rb b/spec/helm_template.rb index 0957f0b..e62427d 100644 --- a/spec/helm_template.rb +++ b/spec/helm_template.rb @@ -10,13 +10,19 @@ def self.with_defaults(yaml) yaml.is_a?(Hash) ? yaml : YAML.safe_load(yaml) end - def initialize(values, chart = 'openproject', release_name = 'optest', extra_args = '') - debug(values, chart, release_name, extra_args) + def initialize(values, chart = 'openproject') + debug(values, chart, '14-stable') end - def debug(values, chart, release_name, extra_args = '') + def debug(values, chart, image_tag) @values = values - result = Open3.capture3("helm template --debug #{release_name} . #{extra_args} -f -", + + # Set the default image tag + if image_tag + @values["image"] ||= { "tag" => image_tag } + end + + result = Open3.capture3("helm template --debug optest . -f -", chdir: File.join(__dir__, '..', 'charts', chart), stdin_data: YAML.dump(values)) @stdout, @stderr, @exit_code = result