Add default CPU limit/request for the operator (#30601)

Closes: #27432

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
This commit is contained in:
Peter Zaoral 2024-07-01 15:12:43 +02:00 committed by GitHub
parent fd8cb95595
commit add45a25a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 1 deletions

View file

@ -20,3 +20,7 @@ This is an optimization to reduce traffic and network related resources.
In {project_name} 26, the new method has a default implementation to keep backward compatibility with custom implementation. In {project_name} 26, the new method has a default implementation to keep backward compatibility with custom implementation.
The default implementation performs a single network call per an event, and it will be removed in a future version of {project_name}. The default implementation performs a single network call per an event, and it will be removed in a future version of {project_name}.
= Operator's default CPU and memory limits/requests
In order to follow the best practices, the default CPU and memory limits/requests for the Operator were introduced. It affects both non-OLM and OLM installs. To override the default values for the OLM install, edit the `resources` section in the operator's https://github.com/operator-framework/operator-lifecycle-manager/blob/master/doc/design/subscription-config.md#resources[subscription].

View file

@ -60,7 +60,6 @@ yq ea -i "del(.spec.install.spec.deployments[0].spec.template.spec.containers[0]
yq ea -i "del(.spec.install.spec.deployments[0].spec.template.spec.containers[0].startupProbe)" "$CSV_PATH" yq ea -i "del(.spec.install.spec.deployments[0].spec.template.spec.containers[0].startupProbe)" "$CSV_PATH"
yq ea -i 'del(.spec.install.spec.deployments[0].spec.template.spec.containers[0].env[] | select(.name == "KUBERNETES_NAMESPACE"))' "$CSV_PATH" yq ea -i 'del(.spec.install.spec.deployments[0].spec.template.spec.containers[0].env[] | select(.name == "KUBERNETES_NAMESPACE"))' "$CSV_PATH"
yq ea -i '.spec.install.spec.deployments[0].spec.template.spec.containers[0].resources = {}' "$CSV_PATH"
yq ea -i '.spec.install.spec.deployments[0].spec.strategy = {}' "$CSV_PATH" yq ea -i '.spec.install.spec.deployments[0].spec.strategy = {}' "$CSV_PATH"
yq ea -i '.spec.apiservicedefinitions = {}' "$CSV_PATH" yq ea -i '.spec.apiservicedefinitions = {}' "$CSV_PATH"

View file

@ -16,6 +16,12 @@ kc.operator.keycloak.resources.limits.memory=2Gi
# https://quarkus.io/guides/deploying-to-kubernetes#environment-variables-from-keyvalue-pairs # https://quarkus.io/guides/deploying-to-kubernetes#environment-variables-from-keyvalue-pairs
quarkus.kubernetes.env.vars.related-image-keycloak=${kc.operator.keycloak.image} quarkus.kubernetes.env.vars.related-image-keycloak=${kc.operator.keycloak.image}
#https://quarkus.io/guides/deploying-to-kubernetes#container-resources-management
quarkus.kubernetes.resources.requests.memory=450Mi
quarkus.kubernetes.resources.requests.cpu=300m
quarkus.kubernetes.resources.limits.memory=450Mi
quarkus.kubernetes.resources.limits.cpu=700m
# Bundle config # Bundle config
quarkus.operator-sdk.bundle.package-name=keycloak-operator quarkus.operator-sdk.bundle.package-name=keycloak-operator
quarkus.operator-sdk.bundle.channels=fast quarkus.operator-sdk.bundle.channels=fast