Skip to content

Commit 1759ed0

Browse files
committed
add comments.
1 parent 940ff88 commit 1759ed0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

hack/update-operator-dev-deployment.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,18 @@ if ! echo "$current_context" | grep -P '.*-admin@.*-mgt-cluster'; then
6666
fi
6767

6868
branch=$(git branch --show-current)
69+
70+
# No branch name was found. Try to get a git-tag.
6971
if [ "$branch" == "" ]; then
7072
branch=$(git describe --tags --exact-match 2>/dev/null || echo "")
7173
fi
7274

7375
if [ "$branch" == "" ]; then
74-
echo "failed to get branch name"
76+
echo "failed to find git branch/tag name"
7577
exit 1
7678
fi
7779

80+
# Build tag for container image.
7881
tag="dev-$USER-$branch"
7982
tag="$(echo -n "$tag" | tr -c 'a-zA-Z0-9_.-' '-')"
8083

@@ -105,18 +108,23 @@ if ! wait $pid_docker_push; then
105108
exit 1
106109
fi
107110

111+
# Find namespace of caph deployment.
108112
ns=$(kubectl get deployments.apps -A | { grep caph-controller || true; } | cut -d' ' -f1)
109113
if [[ -z $ns ]]; then
110114
echo "failed to get namespace for caph-controller"
111115
exit 1
112116
fi
113117

118+
# Scale deployment to 1.
114119
kubectl scale --replicas=1 -n "$ns" deployment/caph-controller-manager
115120

116121
kubectl set image -n "$ns" deployment/caph-controller-manager manager="$image"
117122

123+
# Set imagePullPolicy to "Always", so that a new image (with same name/tag) gets pulled.
118124
kubectl patch deployment -n "$ns" -p '[{"op": "replace", "path": "/spec/template/spec/containers/0/imagePullPolicy", "value": "Always"}]' --type='json' caph-controller-manager
119125

126+
# If you update the image again, there might be no change the deployment spec.
127+
# Force a rollout:
120128
kubectl rollout restart -n "$ns" deployment caph-controller-manager
121129

122130
trap "echo 'Interrupted! Exiting...'; exit 1" SIGINT

0 commit comments

Comments
 (0)