-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade Gardener and extensions (#889)
* Upgrade github_com_gardener_gardener (#872) from v1.50.2 to v1.53.2 Co-authored-by: gardener-robot-ci-2 <[email protected]> * [ci:component:github.com/gardener/gardener-extension-runtime-gvisor:v0.5.1->v0.6.0] (#883) * Upgrade github_com_gardener_gardener-extension-runtime-gvisor from v0.5.1 to v0.6.0 Co-authored-by: Gardener CI Robot 3 <[email protected]> Co-authored-by: Johannes Aubart <[email protected]> Co-authored-by: gardener-robot-ci-1 <[email protected]> Co-authored-by: gardener-robot-ci-3 <[email protected]> * upgrade Gardener to v1.53.4 * add finalizer to apiserver ingress Co-authored-by: Gardener CI Robot 1 <[email protected]> Co-authored-by: gardener-robot-ci-2 <[email protected]> Co-authored-by: Gardener CI Robot 2 <[email protected]> Co-authored-by: Gardener CI Robot 3 <[email protected]> Co-authored-by: gardener-robot-ci-3 <[email protected]>
- Loading branch information
1 parent
873bd82
commit ca3636e
Showing
4 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2022 Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# This plugin removes one or more finalizers from a specified resource. | ||
# Removing will only happen on deletion. | ||
# Usage: Specify type, name, and optionally namespace of the resource. Provide a list of finalizers that should be removed from it. If the list contains either '*' or 'all', all finalizers will be removed. | ||
|
||
source "$SOWLIB/pluginutils" | ||
source "$SOWLIB/k8s" | ||
|
||
getRequiredValue type "type" PLUGINCONFIGJSON | ||
getRequiredValue name "name" PLUGINCONFIGJSON | ||
getValue namespace "namespace" PLUGINCONFIGJSON | ||
getValueList finalizers "finalizers" PLUGINCONFIGJSON | ||
K8S_setKubeConfig "$PLUGININSTANCE" "$dir/kubeconfig" | ||
|
||
finalize() | ||
{ | ||
info "removing finalizers from $type ${namespace:-}${namespace:+"/"}$name" | ||
for fin in ${finalizers[@]}; do | ||
if [[ "$fin" == '*' ]] || [[ "$fin" == 'all' ]]; then | ||
echo "removing all finalizers" | ||
exec_cmd kubectl ${namespace:+"--namespace="}${namespace:-} patch "$type" "$name" --type json --patch '[{"op": "remove", "path": "/metadata/finalizers"}]' | ||
break | ||
else | ||
# determine index of specific finalizer | ||
local index=$(kubectl ${namespace:+"--namespace="}${namespace:-} get "$type" "$name" -o json | jq '.metadata.finalizers | map(. == $fin) | index(true)' --arg fin "$fin") | ||
if [[ "$index" == "null" ]]; then | ||
echo "finalizer '$fin' does not exist" | ||
else | ||
echo "Removing finalizer '$fin' (index $index)" | ||
exec_cmd kubectl ${namespace:+"--namespace="}${namespace:-} patch "$type" "$name" --type json --patch "[{\"op\": \"remove\", \"path\": \"/metadata/finalizers/$index\"}]" | ||
fi | ||
fi | ||
done | ||
} | ||
|
||
case "$1" in | ||
deploy) | ||
verbose "Noting to do on deploy." | ||
;; | ||
delete) | ||
finalize | ||
;; | ||
*) fail "unsupported action $1" | ||
esac |