-
Notifications
You must be signed in to change notification settings - Fork 8
feat: add support for custom Velero plugins via EC config #3177
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 support for custom Velero plugins via EC config #3177
Conversation
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]>
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
Ref: sc-131045
Add ability to configure custom Velero plugins through the Embedded Cluster
config specification. Plugins are injected as initContainers into the Velero
deployment.
Changes:
- Add VeleroPlugin type to ConfigSpec.Extensions.Velero with required Name
and Image fields, and optional ImagePullPolicy
- Implement plugin injection in Velero addon's GenerateHelmValues to read
plugins from EmbeddedConfigSpec and append as initContainers
- Add validation for Velero plugins (duplicate names/images, image format)
- Fix validateImageFormat to correctly distinguish registry ports from image
tags (e.g., registry.io:5000/repo/image:tag)
- Add EmbeddedConfigSpec field to Velero struct to pass config during
installation/upgrade/restore
- Add comprehensive unit tests for plugin injection scenarios
- Update CRD schemas and generated deepcopy methods
The implementation only uses plugins from EmbeddedConfigSpec, following the
existing pattern where EndUserConfigSpec is only used for overrides via
addOnOverrides mechanism.
Example configuration:
extensions:
velero:
plugins:
- name: velero-plugin-postgresql
image: myvendor/velero-postgresql:v1.0.0
imagePullPolicy: Always
Signed-off-by: Evans Mungai <[email protected]>
|
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! |
Signed-off-by: Evans Mungai <[email protected]>
be277fe to
e40e253
Compare
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
pkg/addons/velero/values.go
Outdated
| } | ||
|
|
||
| // Inject custom Velero plugins from ConfigSpec before any further processing | ||
| if err := v.injectPluginInitContainers(hv, domains); err != nil { |
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.
why not call this inside helmValues() function above?
| } | ||
|
|
||
| // validateVeleroPlugins validates Velero plugin configurations | ||
| func (v *Validator) validateVeleroPlugins(veleroExt ecv1beta1.VeleroExtensions) []error { |
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.
hmm, this seems like something that should exist in the new EC lint code rather than / in addition to here.
pkg/lint/validator.go
Outdated
| return fmt.Errorf("image cannot be empty") | ||
| } | ||
|
|
||
| // Basic validation: image should not contain invalid characters |
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.
why not just use the ReferenceRegexp regex from https://pkg.go.dev/github.com/distribution/reference?
sgalsaleh
left a comment
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.
Can you please add 3 dryrun tests for:
- V2 installs
- V3 headless installs
- V3 non-headless installs?
For V2 dryrun install tests, the code is at: https://github.com/replicatedhq/embedded-cluster/blob/main/tests/dryrun/install_test.go
For V3 dryrun install tests, the code is at: https://github.com/replicatedhq/embedded-cluster/blob/main/tests/dryrun/v3_install_test.go
You can follow the existing pattern. You'll need to create a custom EC config for these tests that include custom velero plugins in the EC config and only use it for these 3 tests, and verify that the velero helm values are generated correctly.
…/add-ec-config-to-add-velero-plugins
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
Ref: sc-131045
Add ability to configure custom Velero plugins through the Embedded Cluster
config specification. Plugins are injected as initContainers into the Velero
deployment.
Changes:
- Add VeleroPlugin type to ConfigSpec.Extensions.Velero with required Name
and Image fields, and optional ImagePullPolicy
- Implement plugin injection in Velero addon's GenerateHelmValues to read
plugins from EmbeddedConfigSpec and append as initContainers
- Add validation for Velero plugins (duplicate names/images, image format)
- Fix validateImageFormat to correctly distinguish registry ports from image
tags (e.g., registry.io:5000/repo/image:tag)
- Add EmbeddedConfigSpec field to Velero struct to pass config during
installation/upgrade/restore
- Add comprehensive unit tests for plugin injection scenarios
- Update CRD schemas and generated deepcopy methods
The implementation only uses plugins from EmbeddedConfigSpec, following the
existing pattern where EndUserConfigSpec is only used for overrides via
addOnOverrides mechanism.
Example configuration:
extensions:
velero:
plugins:
- name: velero-plugin-postgresql
image: myvendor/velero-postgresql:v1.0.0
imagePullPolicy: Always
Signed-off-by: Evans Mungai <[email protected]>
…values' of github.com:replicatedhq/embedded-cluster into evansmungai/sc-131045/add-inject-velero-plugin-to-helm-values
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]>
Ref: sc-131045
Add ability to configure custom Velero plugins through the Embedded Cluster
config specification. Plugins are injected as initContainers into the Velero
deployment.
Changes:
- Add VeleroPlugin type to ConfigSpec.Extensions.Velero with required Name
and Image fields, and optional ImagePullPolicy
- Implement plugin injection in Velero addon's GenerateHelmValues to read
plugins from EmbeddedConfigSpec and append as initContainers
- Add validation for Velero plugins (duplicate names/images, image format)
- Fix validateImageFormat to correctly distinguish registry ports from image
tags (e.g., registry.io:5000/repo/image:tag)
- Add EmbeddedConfigSpec field to Velero struct to pass config during
installation/upgrade/restore
- Add comprehensive unit tests for plugin injection scenarios
- Update CRD schemas and generated deepcopy methods
The implementation only uses plugins from EmbeddedConfigSpec, following the
existing pattern where EndUserConfigSpec is only used for overrides via
addOnOverrides mechanism.
Example configuration:
extensions:
velero:
plugins:
- name: velero-plugin-postgresql
image: myvendor/velero-postgresql:v1.0.0
imagePullPolicy: Always
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]>
…values' of github.com:replicatedhq/embedded-cluster into evansmungai/sc-131045/add-inject-velero-plugin-to-helm-values
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
…ns' into evansmungai/sc-131045/add-inject-velero-plugin-to-helm-values
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
…/add-inject-velero-plugin-to-helm-values
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]>
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
…-nodomains.yaml Signed-off-by: Evans Mungai <[email protected]>
Done |
pkg/addons/velero/values_test.go
Outdated
| require.NotEmpty(t, values["initContainers"]) | ||
| initContainers := values["initContainers"].([]any) | ||
|
|
||
| // Find our plugin container |
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.
how about asserting the number of plugins is at most 2 same as the test above? same for the tests below
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
What this PR does / why we need it:
Add ability to configure custom Velero plugins through the Embedded Cluster
config specification. Plugins are injected as initContainers into the Velero
deployment.
Changes:
and Image fields, and optional ImagePullPolicy
plugins from EmbeddedConfigSpec and append as initContainers
tags (e.g., registry.io:5000/repo/image:tag)
installation/upgrade/restore
The implementation only uses plugins from EmbeddedConfigSpec, following the
existing pattern where EndUserConfigSpec is only used for overrides via
addOnOverrides mechanism.
Example configuration:
Signed-off-by: Evans Mungai [email protected]
Which issue(s) this PR fixes:
sc-131045
Does this PR require a test?
Does this PR require a release note?
Does this PR require documentation?