mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-05 14:42:05 +09:00
## What this PR does
A Harbor with trivy enabled and no `storageClass` cannot be changed
after install: every upgrade of `harbor-<name>-system` is rejected on
the trivy StatefulSet, so the release stays not Ready and no later chart
change reaches it. The chart read the class for the trivy
`volumeClaimTemplate` from the PVC, which the default-StorageClass
admission stamps, instead of from the StatefulSet template, which it
never touches. The commit reads the class from the live StatefulSet
template.
The failure was reproduced on a cluster running v1.7.3 by patching a
Harbor created with `spec: {}`. The new helm-unittest suite mocks the
live StatefulSet and its defaulted PVC; all three cases fail on main and
pass here, and the 77 tests of the chart pass.
Closes #5540
### Screenshots
Not a UI change.
### Downstream repositories
- [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
fix(harbor): a Harbor with trivy enabled and no storageClass can be changed after install again; the chart keeps the volume class of the live trivy StatefulSet instead of copying the class the PVC got from the default StorageClass.
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Bug Fixes**
* Trivy storage-class handling now reflects the storage class configured
on its StatefulSet volume template. Existing fallback behavior is
unchanged.
* **Tests**
* Added coverage for Trivy storage-class behavior when the StatefulSet
template has no storage class, when a storage class is configured, and
when the chart’s `storageClass` setting is present.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
How to test packages local
cd packages/core/installer
make image-cozystack REGISTRY=YOUR_CUSTOM_REGISTRY
make apply
kubectl delete po -l app=source-controller -n cozy-fluxcd