Skip to content

Commit d66609d

Browse files
deliahuvishalbollu
authored andcommitted
Wait for resources to be deleted on cluster update (#604)
(cherry picked from commit 33015f6)
1 parent e730222 commit d66609d

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

manager/install.sh

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,53 @@ function main() {
122122
echo "✓ configured autoscaling"
123123

124124
kubectl -n=cortex delete --ignore-not-found=true daemonset fluentd >/dev/null 2>&1 # Pods in DaemonSets cannot be modified
125+
if [ "$(kubectl -n=cortex get pods -l app=fluentd -o json | jq -j '.items | length')" -ne "0" ]; then
126+
echo -n "○ configuring logging "
127+
until [ "$(kubectl -n=cortex get pods -l app=fluentd -o json | jq -j '.items | length')" -eq "0" ]; do
128+
echo -n "."
129+
sleep 2
130+
done
131+
echo
132+
fi
125133
envsubst < manifests/fluentd.yaml | kubectl apply -f - >/dev/null
126134
echo "✓ configured logging"
127135

128136
kubectl -n=cortex delete --ignore-not-found=true daemonset cloudwatch-agent-statsd >/dev/null 2>&1 # Pods in DaemonSets cannot be modified
137+
if [ "$(kubectl -n=cortex get pods -l name=cloudwatch-agent-statsd -o json | jq -j '.items | length')" -ne "0" ]; then
138+
echo -n "○ configuring metrics "
139+
until [ "$(kubectl -n=cortex get pods -l name=cloudwatch-agent-statsd -o json | jq -j '.items | length')" -eq "0" ]; do
140+
echo -n "."
141+
sleep 2
142+
done
143+
echo
144+
fi
129145
envsubst < manifests/metrics-server.yaml | kubectl apply -f - >/dev/null
130146
envsubst < manifests/statsd.yaml | kubectl apply -f - >/dev/null
131147
echo "✓ configured metrics"
132148

133149
if [[ "$CORTEX_INSTANCE_TYPE" == p* ]] || [[ "$CORTEX_INSTANCE_TYPE" == g* ]]; then
134-
kubectl -n=cortex delete --ignore-not-found=true daemonset nvidia-device-plugin-daemonset >/dev/null 2>&1 # Pods in DaemonSets cannot be modified
150+
kubectl -n=kube-system delete --ignore-not-found=true daemonset nvidia-device-plugin-daemonset >/dev/null 2>&1 # Pods in DaemonSets cannot be modified
151+
if [ "$(kubectl -n=kube-system get pods -l name=nvidia-device-plugin-ds -o json | jq -j '.items | length')" -ne "0" ]; then
152+
echo -n "○ configuring gpu support "
153+
until [ "$(kubectl -n=kube-system get pods -l name=nvidia-device-plugin-ds -o json | jq -j '.items | length')" -eq "0" ]; do
154+
echo -n "."
155+
sleep 2
156+
done
157+
echo
158+
fi
135159
envsubst < manifests/nvidia.yaml | kubectl apply -f - >/dev/null
136160
echo "✓ configured gpu support"
137161
fi
138162

139-
kubectl -n=cortex delete --ignore-not-found=true deployment operator >/dev/null 2>&1
163+
kubectl -n=cortex delete --ignore-not-found=true --grace-period=10 deployment operator >/dev/null 2>&1
164+
if [ "$(kubectl -n=cortex get pods -l workloadID=operator -o json | jq -j '.items | length')" -ne "0" ]; then
165+
echo -n "○ starting operator "
166+
until [ "$(kubectl -n=cortex get pods -l workloadID=operator -o json | jq -j '.items | length')" -eq "0" ]; do
167+
echo -n "."
168+
sleep 2
169+
done
170+
echo
171+
fi
140172
envsubst < manifests/operator.yaml | kubectl apply -f - >/dev/null
141173
echo "✓ started operator"
142174

0 commit comments

Comments
 (0)