Skip to content

Commit

Permalink
contrib: Support upgrade in install-tetragon.sh
Browse files Browse the repository at this point in the history
Using `helm upgrade --install` instead of `helm install` makes it possible to
use the same script for both installing and upgrading Tetragon in a Kubernetes
cluster.

Also added a timeout for `kubectl rollout status` command to prevent the script
from hanging forever, and made some minor changes to improve maintainability.

Signed-off-by: Anna Kapuscinska <[email protected]>
  • Loading branch information
lambdanis committed Jul 31, 2023
1 parent 9a8371e commit 6c70333
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions contrib/localdev/bootstrap-kind-cluster.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#! /bin/bash

error() {
echo $@ 1>&2
echo "$@" 1>&2
exit 1
}

set -eu

PROJECT_ROOT="$(realpath $(dirname "${BASH_SOURCE[0]}")/../..)"
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
cd "$PROJECT_ROOT"
source contrib/localdev/conf

Expand Down
16 changes: 8 additions & 8 deletions contrib/localdev/install-tetragon.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#! /bin/bash

error() {
echo $@ 1>&2
echo "$@" 1>&2
exit 1
}

set -eu

PROJECT_ROOT="$(realpath $(dirname "${BASH_SOURCE[0]}")/../..)"
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
cd "$PROJECT_ROOT"
source contrib/localdev/conf

Expand Down Expand Up @@ -72,26 +72,26 @@ if [ "$FORCE" == 1 ]; then
fi

# Set helm options
declare -a helm_opts=("install" "--namespace" "kube-system")
if [ ! -z "$IMAGE" ]; then
declare -a helm_opts=("--namespace" "kube-system")
if [ -n "$IMAGE" ]; then
helm_opts+=("--set" "tetragon.image.override=$IMAGE")
if [ "$IS_KIND" == 1 ]; then
kind load docker-image "$IMAGE" --name "$CLUSTER_NAME"
fi
fi
if [ ! -z "$OPERATOR" ]; then
if [ -n "$OPERATOR" ]; then
helm_opts+=("--set" "tetragonOperator.image.override=$OPERATOR")
if [ "$IS_KIND" == 1 ]; then
kind load docker-image "$OPERATOR" --name "$CLUSTER_NAME"
fi
fi
if [ ! -z "$VALUES" ]; then
if [ -n "$VALUES" ]; then
helm_opts+=("--values" "$VALUES")
fi
helm_opts+=("tetragon" "./install/kubernetes")

echo "Installing Tetragon in cluster..." 1>&2
helm "${helm_opts[@]}"
helm upgrade --install "${helm_opts[@]}"

echo "Waiting for Tetragon deployment..." 1>&2
kubectl rollout status -n kube-system ds/tetragon -w
kubectl rollout status -n kube-system ds/tetragon -w --timeout 5m

0 comments on commit 6c70333

Please sign in to comment.