test(harbor): pin the resources of the nginx proxy and the portal (#5025)

## What this PR does

#4095 gave the Harbor nginx proxy the `t1.small` preset and moved the
portal from `t1.nano` to `t1.micro`, so neither falls back to the
LimitRange default of a tenant namespace, 250m CPU and 128Mi. It came
without a test. This adds a helm-unittest suite that pins both presets
in the nested HelmRelease and checks that they stay the same when the
other components are resized, so dropping them or tying them to another
component's values fails the suite.

Both containers run nginx with `worker_processes auto`, which starts one
worker per CPU of the node whatever the container's CPU limit is. With
the proxy config the chart renders and `goharbor/nginx-photon:v2.15.1`,
96 workers idle at about 205 MiB, so on a node with many CPUs the proxy
is OOMKilled at 128Mi before it serves a request. That is what happened
on a v1.6.5 cluster, where both nginx pods of a default Harbor restarted
5 and 6 times within minutes, because `release-1.6` never got #4095. The
backport, with this suite and the measurements, is a separate PR.

`helm unittest .` in `packages/apps/harbor` passes 47 of 47 with
helm-unittest 1.1.2. With the #4095 hunk reverted the three new cases
fail and the 44 existing ones pass. Each of seven template mutations
fails at least one new case. They drop the nginx block, give nginx
`t1.micro` or the portal `t1.nano`, tie nginx to the core values or the
portal to the jobservice values, misspell the `resources` key under
nginx, and make core ignore its preset, which the resize case checks so
that it cannot pass on overrides that never reach the release.

### Screenshots

Not a UI change.

### Downstream repositories

One new helm-unittest suite in `packages/apps/harbor/tests`. No
template, values key, schema, default, README or package change, so no
trigger map entry applies.

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
NONE
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Tests**
* Added Helm coverage verifying default resource settings for Harbor’s
nginx and portal components.
* Added coverage confirming nginx and portal memory allocations remain
consistent when related service resources are customized.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Backported-from: 614847976f
This commit is contained in:
Myasnikov Daniil committed 2026-11-25 09:58:11 +00:00
commit e22103a5a7
1 file changed
+76
@@ -0,0 +1,76 @@
suite: nginx proxy and portal resources
release:
name: harbor
namespace: tenant-test
set:
_namespace:
host: example.org
ingress: nginx
gateway: ""
seaweedfs: seaweedfs
_cluster:
solver: http01
tests:
- it: sizes the nginx proxy with t1.small instead of leaving it to the namespace LimitRange
template: templates/harbor.yaml
documentSelector:
path: kind
value: HelmRelease
asserts:
- equal:
path: spec.values.harbor.nginx.resources.limits.memory
value: 512Mi
- equal:
path: spec.values.harbor.nginx.resources.limits.cpu
value: "1"
- exists:
path: spec.values.harbor.nginx.resources.requests.memory
- it: sizes the portal with t1.micro
template: templates/harbor.yaml
documentSelector:
path: kind
value: HelmRelease
asserts:
- equal:
path: spec.values.harbor.portal.resources.limits.memory
value: 256Mi
- equal:
path: spec.values.harbor.portal.resources.limits.cpu
value: 500m
- exists:
path: spec.values.harbor.portal.resources.requests.memory
- it: keeps both sizes when the other components are resized
template: templates/harbor.yaml
documentSelector:
path: kind
value: HelmRelease
set:
core:
resourcesPreset: t1.nano
registry:
resources:
cpu: "2"
memory: 1Gi
jobservice:
resourcesPreset: t1.medium
asserts:
- equal:
path: spec.values.harbor.core.resources.limits.memory
value: 128Mi
- equal:
path: spec.values.harbor.registry.registry.resources.limits.memory
value: 1Gi
- equal:
path: spec.values.harbor.jobservice.resources.limits.memory
value: 1Gi
- equal:
path: spec.values.harbor.nginx.resources.limits.memory
value: 512Mi
- equal:
path: spec.values.harbor.portal.resources.limits.memory
value: 256Mi