Overriding resources for Postgres components on OpenShift

You can optionally override the CPU and Memory resources used by postgres database components.

About this task

There are three postgres components:

  • postgres
  • pgBouncer
  • pgBackRest
The CPU, memory, and PVC resources used by the postgres, pgBouncer, and pgBackRest components depend on the deployment profile that was selected on installation. The resources that are defined for each deployment profile are shown here: Management component deployment profile limits.
Important: The postgres pod is licensed based on CPU use, so adjusting this pod's CPU limit has licensing implications, see: Component profiles, CPU limits, memory limits, and licensing

Procedure

To override resources, complete the following procedure

  1. Prepare a patch yaml.
    • Ensure that you specify the name of the container for the resource you want to override. Names:

      • postgres
      • pgBouncer
      • pgBackRest
    • You can override multiple postgres components in parallel. Adding one container section under mgmt-pgcluster template.
    • You can override just a single value, such as CPU limit.
    Examples:
    • Example yaml, to replace all postgres DB resources:
      spec:
        template:
        - name: mgmt-pgcluster
          containers:
          - name: postgres
            resources:
              requests:
                cpu: 1500m
                memory: 8Gi
              limits:
                cpu: 600m
                memory: 512Mi
    • Example yaml, to replace all pgBouncer resources:
      spec:
        template:
        - name: mgmt-pgcluster
          containers:
          - name: pgBouncer
            resources:
              requests:
                cpu: 200m
                memory: 128Mi
              limits:
                cpu: 300m
                memory: 256Mi
      
    • Example yaml,to replace CPU limit of postgres database:
      spec:
        template:
        - name: mgmt-pgcluster
          containers:
          - name: postgres
            resources:
              limits:
                cpu: 1000m
    • Example yaml, to replace CPU limits of postgres DB and pgBouncer:
      spec:
        template:
        - name: mgmt-pgcluster
          containers:
          - name: postgres
            resources:
              limits:
                cpu: 1000m
          - name: pgBouncer
            resources:
              limits:
                cpu: 1000m
  2. Apply the patch yaml:
    oc patch apiconnectcluster <apiconnectcluster-cr-name> --type merge --patch "$(cat patch.yaml)"

Results

The postgres components will restart with updated values.