-
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
automatically adjust pr envs resource request #560
base: main
Are you sure you want to change the base?
Conversation
This will run every 6 hours and ensure that as more pr-envs are being added, they are resource regulated a long the way. Right now they would not be regulated until next time the manuel script would be run
kubectl patch deployment $deploy -n $ns \ | ||
--type=json \ | ||
-p="[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/resources\", \"value\": {\"requests\": {\"cpu\": \"15m\", \"memory\": \"$memory_request\"}, \"limits\": {\"cpu\": \"200m\", \"memory\": \"$memory_limit\"}}}]" |
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.
Does the output here reveal if the deployment was changed or not? If so - you could skip the wait, if the resources had already been set.
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.
that is a good point, will have to look into that
I like your approach. Could you turn it into a helm chart instead, so the relationship between the resources is clearly marked for someone inspecting the cluster? |
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: namespace-lister | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["namespaces"] | ||
verbs: ["list"] | ||
- apiGroups: ["apps"] | ||
resources: ["deployments"] | ||
verbs: ["get", "list", "patch"] |
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.
This does more than just listing namespaces. Perhaps name the resource for what uses them instead. This will be easier if you convert it to a helm chart.
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.
yeah... sorry about that. I started out with a logging functionality to test it out and get a quick feedback loop. Will fix
What does this PR do?
This adds a cronjob, which will run every 6 hours. It will take approximately pr-envs*1'ish minute to complete.
The job will adjust the redis, varnish, nginx and cli deployments to create pods with a set resource request, fitting for pr environments.
This is in effect now
Should this be tested by the reviewer and how?
Any specific requests for how the PR should be reviewed?
What are the relevant tickets?
https://reload.atlassian.net/jira/software/c/projects/DDFDRIFT/boards/464?selectedIssue=DDFDRIFT-264