-
Notifications
You must be signed in to change notification settings - Fork 8
feat: add velero plugin configuration schema and validation #3169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add velero plugin configuration schema and validation #3169
Conversation
ccb27c9 to
0db3432
Compare
|
This PR has been released (on staging) and is available for download with a embedded-cluster-smoke-test-staging-app license ID. Online Installer: Airgap Installer (may take a few minutes before the airgap bundle is built): Happy debugging! |
Add support for configuring custom Velero plugins in the Embedded Cluster
Config CRD. This is the first PR in a series to enable vendors to extend
EC's disaster recovery capabilities with specialized backup plugins.
Changes:
- Add VeleroExtensions and VeleroPlugin types to ConfigSpec.Extensions
- Regenerate CRD schema to include velero.plugins field with validation
- Implement plugin validation in lint validator:
- Validate image format (OCI reference format)
- Detect duplicate plugin images
- Check for required fields
- Add unit tests for validation logic
The new configuration structure allows vendors to specify custom Velero
plugins as OCI images that will be injected as initContainers into the
Velero deployment. Image references support both explicit registry paths
and short names that will use EC's proxy registry.
Example configuration:
extensions:
velero:
plugins:
- image: myvendor/velero-plugin:v1.0.0
This sets the foundation for PR 2 which will implement the Helm values
generation to actually inject these plugins into the Velero deployment.
Refs: SC-131045
Signed-off-by: Evans Mungai <[email protected]>
7a3670b to
d3986cc
Compare
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
| return errors | ||
| } | ||
|
|
||
| // validateImageFormat validates that an image string follows a valid OCI image reference format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a standard regex used by tools like docker that we can just use instead of reimplementing this from scratch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is. I changed this implementation to use oras library for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the comment below about basic validation irrelevant / inaccurate now then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is. I removed it
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
…/add-ec-config-to-add-velero-plugins
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
pkg/lint/validator_test.go
Outdated
| expectError: true, | ||
| errorCount: 1, | ||
| errorFields: []string{"extensions.velero.plugins[0].image"}, | ||
| errorMsgs: []string{"invalid repository"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
* feat: add Velero plugin configuration schema and validation
Add support for configuring custom Velero plugins in the Embedded Cluster
Config CRD. This is the first PR in a series to enable vendors to extend
EC's disaster recovery capabilities with specialized backup plugins.
Changes:
- Add VeleroExtensions and VeleroPlugin types to ConfigSpec.Extensions
- Regenerate CRD schema to include velero.plugins field with validation
- Implement plugin validation in lint validator:
- Validate image format (OCI reference format)
- Detect duplicate plugin images
- Check for required fields
- Add unit tests for validation logic
The new configuration structure allows vendors to specify custom Velero
plugins as OCI images that will be injected as initContainers into the
Velero deployment. Image references support both explicit registry paths
and short names that will use EC's proxy registry.
Example configuration:
extensions:
velero:
plugins:
- image: myvendor/velero-plugin:v1.0.0
This sets the foundation for PR 2 which will implement the Helm values
generation to actually inject these plugins into the Velero deployment.
Refs: SC-131045
Signed-off-by: Evans Mungai <[email protected]>
* Additional unit tests for image format validation
Signed-off-by: Evans Mungai <[email protected]>
* Add container name to Velero plugin configuration
Signed-off-by: Evans Mungai <[email protected]>
* Use oras-go to validate image format
Signed-off-by: Evans Mungai <[email protected]>
* Better test name
Signed-off-by: Evans Mungai <[email protected]>
* Fix failing tests
Signed-off-by: Evans Mungai <[email protected]>
* Remove unsupported example from config_types.go
Signed-off-by: Evans Mungai <[email protected]>
* Remove unnecessary comments
Signed-off-by: Evans Mungai <[email protected]>
* Additional comment to explain to copilot
Signed-off-by: Evans Mungai <[email protected]>
* Use ReferenceRegexp to validate image format
Signed-off-by: Evans Mungai <[email protected]>
* Fix failing unit test
Signed-off-by: Evans Mungai <[email protected]>
* Fix lint errors
Signed-off-by: Evans Mungai <[email protected]>
---------
Signed-off-by: Evans Mungai <[email protected]>
What this PR does / why we need it:
Add support for configuring custom Velero plugins in the Embedded Cluster Config CRD. This is the first PR in a series to enable vendors to extend EC's disaster recovery capabilities with specialized backup plugins.
Changes:
The new configuration structure allows vendors to specify custom Velero plugins as OCI images that will be injected as initContainers into the Velero deployment. Image references support both explicit registry paths and short names that will use EC's proxy registry.
Example configuration:
This sets the foundation for #3177 which will implement the Helm values generation to actually inject these plugins into the Velero deployment.
Which issue(s) this PR fixes:
Ref: sc-131045
Does this PR require a test?
Does this PR require a release note?
Does this PR require documentation?