-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
corrected local_setup.sh, added local_restore.sh, added script to add…
… license headers
- Loading branch information
1 parent
b7fe287
commit 9a62c2f
Showing
24 changed files
with
610 additions
and
114 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2023 SAP SE or an SAP affiliate company | ||
# | ||
# 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. | ||
|
||
|
||
set -e | ||
|
||
echo "> Adding Apache License header to all go files where it is not present" | ||
|
||
# Uses the tool https://github.com/google/addlicense | ||
YEAR="$(date +%Y)" | ||
addlicense \ | ||
-c "SAP SE or an SAP affiliate company" \ | ||
-y "${YEAR}" \ | ||
-l apache \ | ||
-ignore ".idea/**" \ | ||
-ignore ".vscode/**" \ | ||
-ignore "vendor/**" \ | ||
-ignore "**/*.md" \ | ||
-ignore "**/*.yaml" \ | ||
-ignore "**/Dockerfile" \ | ||
. |
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,7 @@ | ||
{ | ||
"apiVersion": "authentication.gardener.cloud/v1alpha1", | ||
"kind": "AdminKubeconfigRequest", | ||
"spec": { | ||
"expirationSeconds": ${expiry_seconds} | ||
} | ||
} |
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,93 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2023 SAP SE or an SAP affiliate company | ||
# | ||
# 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. | ||
|
||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
############################################################################################################## | ||
# Script restores MCM deployment and removes the annotation dependency-watchdog.gardener.cloud/ignore-scaling | ||
# This script should be called once you are done using local_setup.sh | ||
############################################################################################################## | ||
|
||
declare SHOOT PROJECT | ||
declare LANDSCAPE_NAME="dev" | ||
|
||
function create_usage() { | ||
usage=$(printf '%s\n' " | ||
Usage: $(basename $0) [Options] | ||
Options: | ||
-t | --shoot <shoot-cluster-name> (Required) Name of the Gardener Shoot Cluster | ||
-p | --project <project-name> (Required) Name of the Gardener Project | ||
-l | --landscape <landscape-name> (Optional) Name of the landscape. Defaults to dev | ||
") | ||
echo "${usage}" | ||
} | ||
|
||
function parse_flags() { | ||
while test $# -gt 0; do | ||
case "$1" in | ||
--shoot | -t) | ||
shift | ||
SHOOT="$1" | ||
;; | ||
--project | -p) | ||
shift | ||
PROJECT="$1" | ||
;; | ||
--landscape | -l) | ||
shift | ||
LANDSCAPE_NAME="$1" | ||
;; | ||
--help | -h) | ||
shift | ||
echo "${USAGE}" | ||
exit 0 | ||
;; | ||
esac | ||
shift | ||
done | ||
} | ||
|
||
function validate_args() { | ||
if [[ -z "${SHOOT}" ]]; then | ||
echo -e "Shoot has not been passed. Please provide Shoot either by specifying --shoot or -t argument" | ||
exit 1 | ||
fi | ||
if [[ -z "${PROJECT}" ]]; then | ||
echo -e "Project name has not been passed. Please provide Project name either by specifying --project or -p argument" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function restore_mcm_deployment() { | ||
local virtual_garden_cluster="sap-landscape-${LANDSCAPE_NAME}" | ||
gardenctl target --garden "${virtual_garden_cluster}" --project "${PROJECT}" --shoot "${SHOOT}" --control-plane | ||
eval "$(gardenctl kubectl-env zsh)" | ||
echo "removing annotation dependency-watchdog.gardener.cloud/ignore-scaling from mcm deployment..." | ||
kubectl annotate --overwrite=true deployment/machine-controller-manager dependency-watchdog.gardener.cloud/ignore-scaling- | ||
echo "scaling up mcm deployment to 1..." | ||
kubectl scale deployment/machine-controller-manager --replicas=1 | ||
} | ||
|
||
function main() { | ||
parse_flags "$@" | ||
validate_args | ||
restore_mcm_deployment | ||
} | ||
|
||
USAGE=$(create_usage) | ||
main "$@" |
Oops, something went wrong.