Loading
Add the capability to verify the signature of sylva-units artifacts
Description
This MR adds support for OCI artifact signature verification in the Sylva Units Operator by introducing a verify field in the SylvaUnitsSource specification.
Changes
API Changes
- Added
Verifyfield toSylvaUnitsSourcePresetstructure - Added CEL validation to ensure
verifycan only be set for OCI source types - The
verifyfield supports both Cosign and Notation providers
Controller Changes
- Modified
GenerateOCIRepositoriesfunction to propagate verification configuration to Flux OCIRepository resources - Both
sylva-unitsandkustomize-unitsOCIRepository resources inherit the same verification configuration
Testing
- Added comprehensive unit tests for OCI repository generation with verification
- Added CEL validation tests for the
verifyfield - Tests cover: Cosign with secret, Cosign keyless (OIDC), Notation, and validation rules
Usage Examples
Using Cosign with a public key stored in a Secret:
apiVersion: unitsoperator.sylva/v1alpha1
kind: SylvaUnitsRelease
metadata:
name: my-release
namespace: my-namespace
spec:
sylvaUnitsSource:
type: oci
url: oci://registry.example.com/sylva-units
tag: v1.2.3
verify:
provider: cosign
secretRef:
name: cosign-public-keys
Using Cosign with keyless verification (OIDC):
apiVersion: unitsoperator.sylva/v1alpha1
kind: SylvaUnitsRelease
metadata:
name: my-release
namespace: my-namespace
spec:
sylvaUnitsSource:
type: oci
url: oci://registry.example.com/sylva-units
tag: v1.2.3
verify:
provider: cosign
matchOIDCIdentity:
- issuer: "^https://gitlab.com$"
subject: "^https://gitlab.com/sylva-projects/.*$"
Using Notation:
apiVersion: unitsoperator.sylva/v1alpha1
kind: SylvaUnitsRelease
metadata:
name: my-release
namespace: my-namespace
spec:
sylvaUnitsSource:
type: oci
url: oci://registry.example.com/sylva-units
tag: v1.2.3
verify:
provider: notation
secretRef:
name: notation-certificates
Validation Rules
- The
verifyfield is optional - It can only be used with
type: ocisources (enforced by CEL validation) - The
providermust be eithercosignornotation(enforced by enum validation) - Either
secretReformatchOIDCIdentitycan be specified for Cosign (both are optional)
Dependencies
This feature requires:
- Flux source-controller API v1.2.0+ (already present in dependencies)
- Flux
pkg/apis/metapackage (added as dependency)
Related Issues
Closes #42 (closed)
Edited by François-Régis Menguy