Fix resource limits config for new ingress chart

The _get_platform_res_limit function [1], used by the ingress plugin to
define resource limits, returns zero to both cpu and memory limits when
called from a standard system ("system_type != TIS_AIO_BUILD"). However,
in this case the function also returns "limit_enabled=False" to indicate
that the zero limits should not by applied.

Unlike the previous used ingress chart, the new ingress-nginx-openstack
chart activated by [2] does not support the "resources.enabled" config
to enable/disable the resource limits deployment. Therefore, the invalid
zero limits returned by the _get_platform_res_limit function on standard
systems is being incorrectly applied and preventing the new ingress
chart to be deployed on those systems.

This change ensures that the resource limits overrides will only be
defined and applied when the limits values returned by the function
_get_platform_res_limit are valid (limit_enabled==True).

[1] be275b6776/sysinv/sysinv/sysinv/sysinv/helm/base.py (L348)
[2] https://review.opendev.org/c/starlingx/openstack-armada-app/+/939376

Test Plan:
- STX-O tarball built and applied to a standard system
- ingress-nginx-openstack helm release deployed

Closes-Bug: #2097457

Change-Id: I1b0ae260154f7b365ba458308efff2d41948cd08
Signed-off-by: Alex Figueiredo <alex.fernandesfigueiredo@windriver.com>
This commit is contained in:
Alex Figueiredo
2025-02-05 16:26:52 -03:00
committed by Murillo Arantes
parent 6d861dee3f
commit 203650b90c
@@ -18,33 +18,42 @@ class IngressNginxOpenstackHelm(openstack.OpenstackBaseHelm):
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_INGRESS
def get_overrides(self, namespace=None):
limit_enabled, limit_cpus, limit_mem_mib = self._get_platform_res_limit()
overrides = {
common.HELM_NS_OPENSTACK: {
'controller': {
'replicaCount': self._num_provisioned_controllers(),
'resources': {
'enabled': limit_enabled,
'limits': {
'cpu': "%d000m" % (limit_cpus),
'memory': "%dMi" % (limit_mem_mib)
}
}
'replicaCount': self._num_provisioned_controllers()
},
'defaultBackend': {
'replicaCount': self._num_provisioned_controllers(),
'resources': {
'enabled': limit_enabled,
'limits': {
'cpu': "%d000m" % (limit_cpus),
'memory': "%dMi" % (limit_mem_mib)
}
}
'replicaCount': self._num_provisioned_controllers()
}
}
}
limit_enabled, limit_cpus, limit_mem_mib = self._get_platform_res_limit()
if limit_enabled:
overrides[common.HELM_NS_OPENSTACK] = self._update_overrides(
overrides[common.HELM_NS_OPENSTACK],
{
'controller': {
'resources': {
'limits': {
'cpu': "%d000m" % (limit_cpus),
'memory': "%dMi" % (limit_mem_mib)
}
}
},
'defaultBackend': {
'resources': {
'limits': {
'cpu': "%d000m" % (limit_cpus),
'memory': "%dMi" % (limit_mem_mib)
}
}
}
}
)
if namespace in self.SUPPORTED_NAMESPACES:
return overrides[namespace]
elif namespace: