-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set resource req in all the desired pods in the wanted namespaces #408
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5647209
support having different versions on WM's and standard libs
70e9822
patch cli's req
ed62758
install kubectl, so we can have the cli box patch the pods with resou…
3626597
add task that will run the bash script
b74e488
add script that will patch the resource request for the desired pods
081ddcf
remove this postrollout task as it doesn't work
f413c7d
fix shellcheck stuff
17aa314
more shellcheck stuff
c9b3ce2
ignore this
dd31a75
remove unused function
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 | ||
# | ||
# Lagoon doesn't allow us to set the resource request which results in kubernetes not | ||
# being able to adjust it's workloades properly. | ||
# This script allows us to do that, though in an imperfect way. | ||
# The Script should be obsolote when a vertical pod autoscaler is in place. | ||
|
||
# Namespace | ||
NAMESPACES_RAW=$(kubectl get ns -o jsonpath='{.items[*].metadata.name}') | ||
# shellcheck disable=SC2206 | ||
NAMESPACES=($NAMESPACES_RAW) | ||
|
||
SYSTEM_NAMESPACES=( | ||
"calico-system" | ||
"cert-manager" | ||
"default" | ||
"dpl-cms-develop" | ||
"grafana" | ||
"harbor" | ||
"ingress-nginx" | ||
"k8up" | ||
"kube-node-lease" | ||
"kube-public" | ||
"kube-system" | ||
"kuma-monitoring" | ||
"lagoon" | ||
"lagoon-core" | ||
"loki" | ||
"minio" | ||
"prometheus" | ||
"promtail" | ||
"tigera-operator" | ||
) | ||
|
||
echo "Adjusting resource requests in the cluster" | ||
for NS in "${NAMESPACES[@]}"; do | ||
# Skip system namespaces - those we have enough controll over | ||
if [[ " ${SYSTEM_NAMESPACES[*]} " =~ ${NS} ]]; then | ||
continue | ||
fi | ||
echo "## $NS ##" | ||
# Pod to be adjusted | ||
DEPLOYMENTS=("cli" "nginx" "varnish" "redis") | ||
|
||
# Desired memory request | ||
MEMORY_REQUEST="150Mi" | ||
ITViking marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
for DEPLOYMENT in "${DEPLOYMENTS[@]}"; do | ||
# Patch the deployments resource request | ||
kubectl patch deployments.apps -n "$NS" "$DEPLOYMENT" --type="json" -p='[ | ||
{ | ||
"op": "replace", | ||
"path": "/spec/template/spec/containers/0/resources/requests/memory", | ||
"value": "'"$MEMORY_REQUEST"'" | ||
} | ||
]' | ||
done | ||
done |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate you mentioning why this is needed.