diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 138ee1b..5eb5076 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -32,10 +32,10 @@ jobs: if: ${{ github.event.inputs.chart == 'greptimedb-cluster' }} shell: bash run: | - .github/scripts/deploy-greptimedb-cluster.sh + ./scripts/deploy-greptimedb-cluster.sh - name: Deploy greptimedb-standalone chart if: ${{ github.event.inputs.chart == 'greptimedb-standalone' }} shell: bash run: | - .github/scripts/deploy-greptimedb-standalone.sh + ./scripts/deploy-greptimedb-standalone.sh diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5b435ee..6cf32d7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -56,4 +56,4 @@ jobs: - name: Release charts to S3 shell: bash run: | - .github/scripts/release-charts-to-s3.sh ${{ vars.AWS_RELEASE_BUCKET }} + ./scripts/release-charts-to-s3.sh ${{ vars.AWS_RELEASE_BUCKET }} diff --git a/Makefile b/Makefile index 62363c5..0b5a978 100644 --- a/Makefile +++ b/Makefile @@ -25,12 +25,16 @@ check-docs: docs ## Check docs .PHONY: e2e e2e: ## Run e2e tests - .github/scripts/deploy-greptimedb-cluster.sh - .github/scripts/deploy-greptimedb-standalone.sh + ./scripts/deploy-greptimedb-cluster.sh + ./scripts/deploy-greptimedb-standalone.sh .PHONY: crds crds: ## Run update crd - .github/scripts/update-crds.sh + ./scripts/update-crds.sh + +.PHONY: upgrade-crds +upgrade-crds: ## Upgrade the crds in the cluster. + ./scripts/upgrade-crds.sh $(CRDS_VERSION) .PHONY: check-crds check-crds: crds ## Check crd @@ -44,4 +48,4 @@ check-crds: crds ## Check crd # make update-chart CHART=greptimedb-operator VERSION=0.1.0-alpha.23 # [the greptimedb-operator image tag not have 'v' prefix] .PHONY: update-chart update-chart: ## Run update chart - .github/scripts/update-chart.sh $(CHART) $(VERSION) + ./scripts/update-chart.sh $(CHART) $(VERSION) diff --git a/charts/greptimedb-operator/Chart.yaml b/charts/greptimedb-operator/Chart.yaml index 75be78e..bc3a994 100644 --- a/charts/greptimedb-operator/Chart.yaml +++ b/charts/greptimedb-operator/Chart.yaml @@ -3,7 +3,7 @@ kubeVersion: ">=1.18.0-0" description: The greptimedb-operator Helm chart for Kubernetes. name: greptimedb-operator appVersion: 0.1.0-alpha.27 -version: 0.1.19 +version: 0.1.20 type: application home: https://github.com/GreptimeTeam/greptimedb-operator sources: diff --git a/charts/greptimedb-operator/README.md b/charts/greptimedb-operator/README.md index 22e6f45..359842a 100644 --- a/charts/greptimedb-operator/README.md +++ b/charts/greptimedb-operator/README.md @@ -2,7 +2,7 @@ The greptimedb-operator Helm chart for Kubernetes. -![Version: 0.1.19](https://img.shields.io/badge/Version-0.1.19-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0-alpha.27](https://img.shields.io/badge/AppVersion-0.1.0--alpha.27-informational?style=flat-square) +![Version: 0.1.20](https://img.shields.io/badge/Version-0.1.20-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0-alpha.27](https://img.shields.io/badge/AppVersion-0.1.0--alpha.27-informational?style=flat-square) ## Source Code @@ -42,12 +42,21 @@ helm upgrade \ ## Upgrade CRDs -Helm cannot upgrade custom resource definitions in the `/crds` folder [by design](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations). When the CRDs are upgraded, you can upgrade CRDs by using `kubectl` manually: +Helm cannot upgrade custom resource definitions in the `/crds` folder [by design](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations). -```console -kubectl apply -f https://github.com/GreptimeTeam/greptimedb-operator/releases/download/latest/greptimedbclusters.yaml -kubectl apply -f https://github.com/GreptimeTeam/greptimedb-operator/releases/download/latest/greptimedbstandalones.yaml -``` +You can upgrade the CRDs manually to **ensure the version of operator and CRDs are aligned**: + +- If your `helm-charts` repository is already up-to-date, you can upgrade the CRDs by the following command: + + ```console + make upgrade-crds + ``` + +- If you want to upgrade the CRDs to the latest released version: + + ```console + make upgrade-crds CRDS_VERSION=latest + ``` ## How to Uninstall diff --git a/charts/greptimedb-operator/README.md.gotmpl b/charts/greptimedb-operator/README.md.gotmpl index 430b327..3634f0c 100644 --- a/charts/greptimedb-operator/README.md.gotmpl +++ b/charts/greptimedb-operator/README.md.gotmpl @@ -41,12 +41,21 @@ helm upgrade \ ## Upgrade CRDs -Helm cannot upgrade custom resource definitions in the `/crds` folder [by design](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations). When the CRDs are upgraded, you can upgrade CRDs by using `kubectl` manually: +Helm cannot upgrade custom resource definitions in the `/crds` folder [by design](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations). -```console -kubectl apply -f https://github.com/GreptimeTeam/greptimedb-operator/releases/download/latest/greptimedbclusters.yaml -kubectl apply -f https://github.com/GreptimeTeam/greptimedb-operator/releases/download/latest/greptimedbstandalones.yaml -``` +You can upgrade the CRDs manually to **ensure the version of operator and CRDs are aligned**: + +- If your `helm-charts` repository is already up-to-date, you can upgrade the CRDs by the following command: + + ```console + make upgrade-crds + ``` + +- If you want to upgrade the CRDs to the latest released version: + + ```console + make upgrade-crds CRDS_VERSION=latest + ``` ## How to Uninstall diff --git a/.github/scripts/deploy-greptimedb-cluster.sh b/scripts/deploy-greptimedb-cluster.sh similarity index 100% rename from .github/scripts/deploy-greptimedb-cluster.sh rename to scripts/deploy-greptimedb-cluster.sh diff --git a/.github/scripts/deploy-greptimedb-standalone.sh b/scripts/deploy-greptimedb-standalone.sh similarity index 100% rename from .github/scripts/deploy-greptimedb-standalone.sh rename to scripts/deploy-greptimedb-standalone.sh diff --git a/.github/scripts/release-charts-to-s3.sh b/scripts/release-charts-to-s3.sh similarity index 100% rename from .github/scripts/release-charts-to-s3.sh rename to scripts/release-charts-to-s3.sh diff --git a/.github/scripts/setup-e2e-env.sh b/scripts/setup-e2e-env.sh similarity index 100% rename from .github/scripts/setup-e2e-env.sh rename to scripts/setup-e2e-env.sh diff --git a/.github/scripts/update-chart.sh b/scripts/update-chart.sh similarity index 100% rename from .github/scripts/update-chart.sh rename to scripts/update-chart.sh diff --git a/.github/scripts/update-crds.sh b/scripts/update-crds.sh similarity index 100% rename from .github/scripts/update-crds.sh rename to scripts/update-crds.sh diff --git a/scripts/upgrade-crds.sh b/scripts/upgrade-crds.sh new file mode 100755 index 0000000..6a44906 --- /dev/null +++ b/scripts/upgrade-crds.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -e + +OPERATOR_VERSION=${1:-$(awk '/appVersion:/{print $2}' "charts/greptimedb-operator/Chart.yaml")} + +function upgrade_crds() { + if [ -z "$OPERATOR_VERSION" ]; then + echo "Failed to get the operator version." + exit 1 + fi + + if [ "$OPERATOR_VERSION" == "latest" ]; then + echo "Applying CRDs for the latest released greptimedb-operator version" + kubectl apply -f "https://github.com/GreptimeTeam/greptimedb-operator/releases/latest/download/greptimedbclusters.yaml" + kubectl apply -f "https://github.com/GreptimeTeam/greptimedb-operator/releases/latest/download/greptimedbstandalones.yaml" + exit 0 + fi + + echo "Applying CRDs for the current greptimedb-operator version $OPERATOR_VERSION" + kubectl apply -f "https://github.com/GreptimeTeam/greptimedb-operator/releases/download/v$OPERATOR_VERSION/greptimedbclusters.yaml" + kubectl apply -f "https://github.com/GreptimeTeam/greptimedb-operator/releases/download/v$OPERATOR_VERSION/greptimedbstandalones.yaml" +} + +upgrade_crds