defenseunicorns / uds-core

A secure runtime platform for mission-critical capabilities
https://uds.defenseunicorns.com
Apache License 2.0
44 stars 18 forks source link

improve unique name validation of uds-package custom resources #493

Open anthonywendt opened 3 months ago

anthonywendt commented 3 months ago

Describe what should be investigated or refactored

This issue and PR addressed a case where some uds-package derived network policies would end up with duplicate names and would drop legitimate network polices from being created. The fix was to add port to those derived netpols to make them unique.

We talked about how there is potential to create custom network policies with the same name as the derived network policies. This could lead to network policies being corrupted and causing applications to not work.

There is validation that happens when a uds-package.yaml is applied, but there could be some missed name collisions when the resources are actually created. Those get lost in that they just apply on top of each other when the names are the same. There is probably some work that could be done to improve unique naming and consistent validation on uds-package resources.

https://github.com/defenseunicorns/uds-core/blob/main/src/pepr/operator/crd/validators/package-validator.ts https://github.com/defenseunicorns/uds-core/blob/main/src/pepr/operator/controllers/network/policies.ts