Enable container resource limits

Airship components have shown heavy resources usage at times, causing
problems to production workloads. Assuming that extensive resource
usage could be caused by a software problem, we choose to relaunch a
components as a remediate solution. The relaunch would be handeled by
Kubernetes.

This patch sets resource usage limits and resource usage requests to
the following values:

  resources:
    limits:
      cpu: 0.4
      memory: 8Gi
    requests:
      cpu: 0.0125
      memory: 128Mi

Limits and requests details are described in
Kubernetes documentation [0].

We have to specify both limits and requests for the reasons
described in documentation [1].

Previously it has been potentially possible to control limits by
enabling 'pod.resources' section in Helm values file, and using
"helm-toolkit.snippets.kubernetes_resources" snippet sourced from
OpenStack-Helm Infra repository. With this patch this would no longer
be possible, as this functionality is depreciated [2] and has been
agreed to be removed from OpenStack-Helm toolkit [3].

Alternative solution would have been to use LimitRange plugin [4]. It
has been decided by Pete Birley to use standard limits & requests
instead.

This change is appied across all Airship components.

[0] https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
[1] https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/#what-if-you-specify-a-container-s-limit-but-not-its-request
[2] 5596247f3f
[3] http://eavesdrop.openstack.org/meetings/openstack_helm/2019/openstack_helm.2019-06-04-15.00.log.html#l-92
[4] https://kubernetes.io/docs/concepts/policy/limit-range/

Change-Id: I247b85848a1df6fd7f19a0d86523e764c3ef7c33
This commit is contained in:
Roman Gorshunov 2020-02-22 02:25:54 +01:00
parent 40a01b2c4c
commit d092e20f02
2 changed files with 8 additions and 0 deletions

View File

@ -59,8 +59,12 @@ spec:
ucp-control-plane: enabled
containers:
- resources:
limits:
cpu: 0.4
memory: 8Gi
requests:
cpu: 0.1
memory: 128Mi
securityContext:
privileged: true
image: ${UBUNTU_IMAGE}

View File

@ -65,8 +65,12 @@ spec:
openstack-control-plane: enabled
containers:
- resources:
limits:
cpu: 0.4
memory: 8Gi
requests:
cpu: 0.1
memory: 128Mi
securityContext:
privileged: true
image: ${UBUNTU_IMAGE}