Skip to content

Conversation

@banjoh
Copy link
Member

@banjoh banjoh commented Nov 6, 2025

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:

  • 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: ghcr.io/banjoh/velero-plugin-cnpg-restore:latest
          imagePullPolicy: Always # Optional: defaults to IfNotPresent

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?

@banjoh banjoh marked this pull request as draft November 6, 2025 14:33
@banjoh banjoh force-pushed the evansmungai/sc-131045/add-ec-config-to-add-velero-plugins branch from ccb27c9 to 0db3432 Compare November 6, 2025 14:35
@github-actions
Copy link

github-actions bot commented Nov 6, 2025

This PR has been released (on staging) and is available for download with a embedded-cluster-smoke-test-staging-app license ID.

Online Installer:

curl "https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci/appver-dev-11ad835" -H "Authorization: $EC_SMOKE_TEST_LICENSE_ID" -o embedded-cluster-smoke-test-staging-app-ci.tgz

Airgap Installer (may take a few minutes before the airgap bundle is built):

curl "https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci-airgap/appver-dev-11ad835?airgap=true" -H "Authorization: $EC_SMOKE_TEST_LICENSE_ID" -o embedded-cluster-smoke-test-staging-app-ci.tgz

Happy debugging!

@banjoh banjoh changed the title feat: add Velero plugin configuration schema and validation feat: add velero plugin configuration schema and validation Nov 7, 2025
@banjoh banjoh marked this pull request as ready for review November 7, 2025 15:36
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]>
@banjoh banjoh force-pushed the evansmungai/sc-131045/add-ec-config-to-add-velero-plugins branch from 7a3670b to d3986cc Compare November 7, 2025 15:43
return errors
}

// validateImageFormat validates that an image string follows a valid OCI image reference format
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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?

Signed-off-by: Evans Mungai <[email protected]>
}

return nil
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Image Validation Fails Documented Short Names

The validateImageFormat function rejects short image names like velero-plugin-postgres:v1.0.0, but the documentation in config_types.go and CRD schemas explicitly states these formats are valid and will use the proxy registry. The registry.ParseReference call requires at least a repository component (e.g., repo/image), making it incompatible with the documented support for short names. This creates a mismatch where users following the documented examples will encounter validation errors.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants