Chapter 2. Configure resource requests and limits for GitOps plugin components
You can configure CPU and memory resource requests and limits for the GitOps console plugin and its backend cluster components. Resource allocation is controlled through the GitOpsService custom resource (CR) and can be modified during creation or update. The GitOpsService controller reconciles both the backend and plugin resources. You can define separate or identical resource configurations for each component depending on your requirements.
2.1. Enabling the GitOpsService custom resource Copy linkLink copied to clipboard!
To enable resource configuration for the GitOps plugin components, specify the .spec.consolePlugin.backend.resources field for the backend component and the .spec.consolePlugin.gitopsPlugin.resources field for the GitOps console plugin. The resources section defines the requests (minimum resources) and limits (maximum resources) for each component.
Prerequisites
- You have logged in to the OpenShift Container Platform cluster as an administrator.
- You have installed the Red Hat OpenShift GitOps Operator on your OpenShift Container Platform cluster.
Procedure
Get the
GitOpsServiceCR by running the following command.$ oc get gitopsservice -AExample output:
NAMESPACE NAME AGE openshift-gitops cluster 5dEdit the
GitOpsServiceCR by running the following command.$ oc edit gitopsservice cluster -n openshift-gitopsIn the
.spec.consolePluginsection, add the.backend.resourcesand.gitopsPlugin.resourcesfields. These sections define requests and limits for CPU and memory.Example configuration:
apiVersion: pipelines.openshift.io/v1alpha1 kind: GitOpsService metadata: name: cluster spec: consolePlugin: backend: resources: limits: cpu: 100m memory: 1Gi requests: cpu: 100m memory: 1Gi gitopsPlugin: resources: limits: cpu: 200m memory: 2Gi requests: cpu: 100m memory: 1GiSave and exit the editor.
After you update the
GitOpsServiceCR, theGitOpsServicecontroller applies the specified resource requests and limits to the backend and the GitOps plugin components.
Verification
To verify that the resource requests and limits have been applied:
Verify the resource configuration:
$ oc describe pod <pod-name> -n openshift-gitopsLook for the
LimitsandRequestssections in the output and ensure they match your configuration.
2.2. Behavior of resource configuration Copy linkLink copied to clipboard!
The following information describes how the GitOpsService controller applies resource values defined in the GitOpsService custom resource (CR).
-
Specified values: When you define resource values in the
GitOpsServiceCR, theGitOpsServicecontroller applies those values only to the components you specify. For example, if you configure resource limits only for the backend, those values apply to the backend deployment and not to the plugin. -
Default values: If you do not define any resource values in the
GitOpsServicecustom resource, theGitOpsServicecontroller applies default values to all components.
| Component | Request CPU | Request Memory | Limit CPU | Limit Memory |
|---|---|---|---|---|
| Backend | 250m | 128Mi | 500m | 256Mi |
| GitOps plugin | 250m | 128Mi | 500m | 256Mi |