Skip to content

Commit

Permalink
Use Pulsar 4.0.0 image, bump chart version to 3.7.0, kube-prometheus-…
Browse files Browse the repository at this point in the history
…stack to 65.x (#542)

* Use Pulsar 4.0.0 image, bump chart version to 3.7.0

* Bump kube-prometheus-stack to 65.x.x

* Remove testing with latest and test with previous LTS version

- run kube-prometheus-stack test with previous LTS version since
  the older chart version doesn't support Pulsar 4.0.0 image

* Fix passing "--values" to helm command

* Move ci runner config to a script

* Attempt to fix pulsar-manager-cluster-initialize
  • Loading branch information
lhotari authored Oct 29, 2024
1 parent 64e67c1 commit d877fc3
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 80 deletions.
18 changes: 13 additions & 5 deletions .ci/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,29 @@ ci::create_cluster

ci::helm_repo_add

extra_opts=""
extra_opts=()

# Add any arguments after $1 to extra_opts
shift # Remove $1 from the argument list
while [[ $# -gt 0 ]]; do
extra_opts+=("$1")
shift
done

if [[ "x${SYMMETRIC}" == "xtrue" ]]; then
extra_opts="-s"
extra_opts+=("-s")
fi

if [[ "x${EXTRA_SUPERUSERS}" != "x" ]]; then
extra_opts="${extra_opts} --pulsar-superusers proxy-admin,broker-admin,admin,${EXTRA_SUPERUSERS}"
extra_opts+=("--pulsar-superusers" "proxy-admin,broker-admin,admin,${EXTRA_SUPERUSERS}")
fi

install_type="install"
test_action="produce-consume"
if [[ "$UPGRADE_FROM_VERSION" != "" ]]; then
# install older version of pulsar chart
PULSAR_CHART_VERSION="$UPGRADE_FROM_VERSION"
ci::install_pulsar_chart install ${PULSAR_HOME}/.ci/values-common.yaml ${PULSAR_HOME}/${VALUES_FILE} ${extra_opts}
ci::install_pulsar_chart install ${PULSAR_HOME}/.ci/values-common.yaml ${PULSAR_HOME}/${VALUES_FILE} "${extra_opts[@]}"
install_type="upgrade"
echo "Wait 10 seconds"
sleep 10
Expand All @@ -68,7 +76,7 @@ fi

PULSAR_CHART_VERSION="local"
# install (or upgrade) pulsar chart
ci::install_pulsar_chart ${install_type} ${PULSAR_HOME}/.ci/values-common.yaml ${PULSAR_HOME}/${VALUES_FILE} ${extra_opts}
ci::install_pulsar_chart ${install_type} ${PULSAR_HOME}/.ci/values-common.yaml ${PULSAR_HOME}/${VALUES_FILE} "${extra_opts[@]}"

echo "Wait 10 seconds"
sleep 10
Expand Down
20 changes: 0 additions & 20 deletions .ci/clusters/values-pulsar-latest.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
# under the License.
#

defaultPulsarImageTag: 3.3.2
defaultPulsarImageTag: 3.0.7
41 changes: 41 additions & 0 deletions .ci/configure_ci_runner_for_debugging.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
# this script is used to install tools for the GitHub Actions CI runner while debugging with ssh

if [[ -z "${GITHUB_ACTIONS}" ]]; then
echo "Error: This script is intended to run only in GitHub Actions environment"
exit 1
fi

cat >> $HOME/.bashrc <<'EOF'
function use_kind_kubeconfig() {
export KUBECONFIG=$(ls $HOME/kind/pulsar-ci-*/kubeconfig.yaml)
}
function kubectl() {
# use kind environment's kubeconfig
if [ -z "$KUBECONFIG" ]; then
use_kind_kubeconfig
fi
command kubectl "$@"
}
function k9s() {
# use kind environment's kubeconfig
if [ -z "$KUBECONFIG" ]; then
use_kind_kubeconfig
fi
# install k9s on the fly
if [ ! -x /usr/local/bin/k9s ]; then
echo "Installing k9s..."
curl -L -s https://github.com/derailed/k9s/releases/download/v0.32.5/k9s_Linux_amd64.tar.gz | sudo tar xz -C /usr/local/bin k9s
fi
command k9s "$@"
}
alias k=kubectl
EOF
cat >> $HOME/.bash_profile <<'EOF'
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
EOF
24 changes: 19 additions & 5 deletions .ci/helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,29 @@ function ci::install_pulsar_chart() {
local install_type=$1
local common_value_file=$2
local value_file=$3
local extra_opts="$4 $5 $6 $7 $8"
shift 3
local extra_values=()
local extra_opts=()
local values_next=false
for arg in "$@"; do
if [[ "$arg" == "--values" ]]; then
extra_values+=("$arg")
values_next=true
elif [[ "$values_next" == true ]]; then
extra_values+=("$arg")
values_next=false
else
extra_opts+=("$arg")
fi
done
local install_args

if [[ "${install_type}" == "install" ]]; then
echo "Installing the pulsar chart"
${KUBECTL} create namespace ${NAMESPACE}
ci::install_cert_manager
echo ${CHARTS_HOME}/scripts/pulsar/prepare_helm_release.sh -k ${CLUSTER} -n ${NAMESPACE} ${extra_opts}
${CHARTS_HOME}/scripts/pulsar/prepare_helm_release.sh -k ${CLUSTER} -n ${NAMESPACE} ${extra_opts}
echo ${CHARTS_HOME}/scripts/pulsar/prepare_helm_release.sh -k ${CLUSTER} -n ${NAMESPACE} "${extra_opts[@]}"
${CHARTS_HOME}/scripts/pulsar/prepare_helm_release.sh -k ${CLUSTER} -n ${NAMESPACE} "${extra_opts[@]}"
sleep 10

# install metallb for loadbalancer support
Expand Down Expand Up @@ -154,8 +168,8 @@ function ci::install_pulsar_chart() {
fi
fi
set -x
${HELM} template --values ${common_value_file} --values ${value_file} ${CLUSTER} ${CHART_ARGS}
${HELM} ${install_type} --values ${common_value_file} --values ${value_file} --namespace=${NAMESPACE} ${CLUSTER} ${CHART_ARGS} ${install_args}
${HELM} template --values ${common_value_file} --values ${value_file} "${extra_values[@]}" ${CLUSTER} ${CHART_ARGS}
${HELM} ${install_type} --values ${common_value_file} --values ${value_file} "${extra_values[@]}" --namespace=${NAMESPACE} ${CLUSTER} ${CHART_ARGS} ${install_args}
set +x

if [[ "${install_type}" == "install" ]]; then
Expand Down
50 changes: 6 additions & 44 deletions .github/workflows/pulsar-helm-chart-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ jobs:
values_file: .ci/clusters/values-upgrade.yaml
shortname: upgrade
type: upgrade
- name: Use Pulsar Image
values_file: .ci/clusters/values-pulsar-image.yaml
shortname: pulsar-image
- name: Use previous LTS Pulsar Image
values_file: .ci/clusters/values-pulsar-previous-lts.yaml
shortname: pulsar-previous-lts
- name: JWT Asymmetric Keys
values_file: .ci/clusters/values-jwt-asymmetric.yaml
shortname: jwt-asymmetric
Expand Down Expand Up @@ -209,13 +209,6 @@ jobs:
values_file: .ci/clusters/values-pulsar-manager.yaml
shortname: pulsar-manager
include:
- k8sVersion:
version: "1.23.17"
kind_image_tag: v1.23.17@sha256:14d0a9a892b943866d7e6be119a06871291c517d279aedb816a4b4bc0ec0a5b3
testScenario:
name: "Pulsar Latest"
values_file: .ci/clusters/values-pulsar-latest.yaml
shortname: pulsar-latest
- k8sVersion:
version: "1.23.17"
kind_image_tag: v1.23.17@sha256:14d0a9a892b943866d7e6be119a06871291c517d279aedb816a4b4bc0ec0a5b3
Expand All @@ -236,8 +229,8 @@ jobs:
version: "1.23.17"
kind_image_tag: v1.23.17@sha256:14d0a9a892b943866d7e6be119a06871291c517d279aedb816a4b4bc0ec0a5b3
testScenario:
name: "Upgrade kube-prometheus-stack"
values_file: .ci/clusters/values-prometheus-grafana.yaml
name: "Upgrade kube-prometheus-stack for previous LTS"
values_file: .ci/clusters/values-prometheus-grafana.yaml --values .ci/clusters/values-pulsar-previous-lts.yaml
shortname: prometheus-grafana
type: upgrade
upgradeFromVersion: 3.2.0
Expand All @@ -263,38 +256,7 @@ jobs:

- name: Setup debugging tools for ssh access
if: ${{ github.repository != 'apache/pulsar-helm-chart' && github.event_name == 'pull_request' }}
run: |
cat >> $HOME/.bashrc <<'EOF'
function use_kind_kubeconfig() {
export KUBECONFIG=$(ls $HOME/kind/pulsar-ci-*/kubeconfig.yaml)
}
function kubectl() {
# use kind environment's kubeconfig
if [ -z "$KUBECONFIG" ]; then
use_kind_kubeconfig
fi
command kubectl "$@"
}
function k9s() {
# use kind environment's kubeconfig
if [ -z "$KUBECONFIG" ]; then
use_kind_kubeconfig
fi
# install k9s on the fly
if [ ! -x /usr/local/bin/k9s ]; then
echo "Installing k9s..."
curl -L -s https://github.com/derailed/k9s/releases/download/v0.32.5/k9s_Linux_amd64.tar.gz | sudo tar xz -C /usr/local/bin k9s
fi
command k9s "$@"
}
EOF
cat >> $HOME/.bash_profile <<'EOF'
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
EOF
run: .ci/configure_ci_runner_for_debugging.sh

- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,27 +245,42 @@ helm upgrade -f pulsar.yaml \

For more detailed information, see our [Upgrading](http://pulsar.apache.org/docs/helm-upgrade/) guide.

## Upgrading from Helm Chart version 3.0.0-3.6.0 to 3.7.0 version and above

The kube-prometheus-stack version has been upgraded to 65.x.x in Pulsar Helm Chart version 3.7.0 .
Before running "helm upgrade", you should first upgrade the Prometheus Operator CRDs as [instructed
in kube-prometheus-stack upgrade notes](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#from-64x-to-65x).

There's a script to run the required commands:

```shell
./scripts/kube-prometheus-stack/upgrade_prometheus_operator_crds.sh 0.77.1
```

After, this you can proceed with `helm upgrade`.

## Upgrading from Helm Chart version 3.0.0-3.4.x to 3.5.0 version and above

The kube-prometheus-stack version has been upgraded to 59.x.x in Pulsar Helm Chart version 3.5.0 .
Before running "helm upgrade", you should first upgrade the Prometheus Operator CRDs as [instructed
in kube-prometheus-stack upgrade notes](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#from-58x-to-59x).

There's a script to run the required commands:

```shell
./scripts/kube-prometheus-stack/upgrade_prometheus_operator_crds.sh 0.74.0
```

After, this you can proceed with `helm upgrade`.


## Upgrading from Helm Chart version 3.0.0-3.2.x to 3.3.0 version and above

The kube-prometheus-stack version has been upgraded to 56.x.x in Pulsar Helm Chart version 3.3.0 .
Before running "helm upgrade", you should first upgrade the Prometheus Operator CRDs as [instructed
in kube-prometheus-stack upgrade notes](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#from-55x-to-56x).

There's a script to run the required commands:

```shell
./scripts/kube-prometheus-stack/upgrade_prometheus_operator_crds.sh 0.71.0
```
Expand Down
6 changes: 3 additions & 3 deletions charts/pulsar/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#

apiVersion: v2
appVersion: "3.0.7"
appVersion: "4.0.0"
description: Apache Pulsar Helm chart for Kubernetes
name: pulsar
version: 3.6.0
version: 3.7.0
kubeVersion: ">=1.23.0-0"
home: https://pulsar.apache.org
sources:
Expand All @@ -33,6 +33,6 @@ maintainers:
email: [email protected]
dependencies:
- name: kube-prometheus-stack
version: 59.x.x
version: 65.x.x
repository: https://prometheus-community.github.io/helm-charts
condition: kube-prometheus-stack.enabled
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ spec:
command: [ "sh", "-c" ]
args:
- |
cd /tmp
ADMIN_URL={{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}-admin:{{ .Values.pulsar_manager.adminService.port }}
CSRF_TOKEN=$(curl http://${ADMIN_URL}/pulsar-manager/csrf-token)
UI_URL={{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}:{{ .Values.pulsar_manager.service.port }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# This script is used to upgrade the Prometheus Operator CRDs before running "helm upgrade"
# source: https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#upgrading-an-existing-release-to-a-new-major-version
# "Run these commands to update the CRDs before applying the upgrade."
PROMETHEUS_OPERATOR_VERSION="${1:-"0.74.0"}"
PROMETHEUS_OPERATOR_VERSION="${1:-"0.77.1"}"
PREFIX_URL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v${PROMETHEUS_OPERATOR_VERSION}/example/prometheus-operator-crd"
for crd in alertmanagerconfigs alertmanagers podmonitors probes prometheusagents prometheuses prometheusrules scrapeconfigs servicemonitors thanosrulers; do
# "--force-conflicts" is required to upgrade the CRDs. Following instructions from https://github.com/prometheus-community/helm-charts/issues/2489
Expand Down

0 comments on commit d877fc3

Please sign in to comment.