Skip to content

Conversation

@gianlucam76
Copy link
Member

This PR introduces the new ClusterPromotion CRD, which enables a declarative, multi-stage, progressive rollout of a single configuration (defined in profileSpec) across multiple sets of clusters.

  1. Staged Rollout: Users can define an ordered series of stages, each with its own clusterSelector. This allows a configuration to be deployed first to, for example, staging clusters, and then subsequently to production clusters.
  2. ClusterProfile Generation: For each stage, Sveltos will automatically create a ClusterProfile using the shared profileSpec and the stage's specific clusterSelector. This keeps the configuration definition DRY (Don't Repeat Yourself) while maintaining Sveltos's core reconciliation logic.
  3. Promotion Control: The trigger field within each stage dictates how Sveltos should move to the next stage:
  4. Automated Promotion: Using auto with a delay for instance, Sveltos waits for the specified duration (e.g., 5m) after the previous stage's ClusterProfile is deemed successfully deployed before creating the next stage's ClusterProfile.

The following example demonstrates rolling out the kyverno-latest Helm chart with a specific replica count:

  1. Sveltos deploys the configuration to all clusters matching env: staging.
  2. After the staging ClusterProfile is successfully deployed, Sveltos waits for 5 minutes.
  3. The configuration is then automatically promoted and deployed to all clusters matching env: production.
apiVersion: config.projectsveltos.io/v1beta1
kind: ClusterPromotion
metadata:
  name: test
spec:
  profileSpec:
    syncMode: Continuous
    helmCharts:
    - repositoryURL:    https://kyverno.github.io/kyverno/
      repositoryName:   kyverno
      chartName:        kyverno/kyverno
      chartVersion:     3.4.2
      releaseName:      kyverno-latest
      releaseNamespace: kyverno
      helmChartAction:  Install
      values: |
        admissionController:
          replicas: 3
        backgroundController:
          replicas: 3
        cleanupController:
          replicas: 3
        reportsController:
          replicas: 3
  stages:
  - name: staging
    clusterSelector:
      matchLabels:
        env: staging
    trigger:
      auto:
        delay: 5m
  - name: production
    clusterSelector:
      matchLabels:
        env: production
    trigger:
      auto:
        delay: 5m

This ensures that any issues in the configuration have a chance to surface in a pre-production environment during the delay period before the production rollout begins.

  • New CRD: ClusterPromotion is introduced to define the staging workflow.
  • Controller Logic: A new controller manages the ClusterPromotion lifecycle, sequentially creating, monitoring and deleting the underlying, generated ClusterProfile resources for each stage.
  • Status Tracking: The ClusterPromotion status clearly tracks the progress through the stages, indicating which stage is currently active and the status of its corresponding ClusterProfile.

This PR introduces the new **ClusterPromotion** CRD, which enables a declarative, multi-stage,
progressive rollout of a single configuration (defined in profileSpec) across multiple sets of clusters.

1. **Staged Rollout**: Users can define an ordered series of stages, each with its own clusterSelector.
This allows a configuration to be deployed first to, for example, staging clusters, and then subsequently
to production clusters.
2. **ClusterProfile Generation**: For each stage, Sveltos will automatically create a ClusterProfile using
the shared profileSpec and the stage's specific clusterSelector. This keeps the configuration definition
DRY (Don't Repeat Yourself) while maintaining Sveltos's core reconciliation logic.
3. **Promotion Control**: The trigger field within each stage dictates how Sveltos should move to the next stage:
4. **Automated Promotion**: Using auto with a delay for instance, Sveltos waits for the specified duration
(e.g., 5m) after the previous stage's ClusterProfile is deemed successfully deployed before creating the next
stage's ClusterProfile.

The following example demonstrates rolling out the kyverno-latest Helm chart with a specific replica count:

1. Sveltos deploys the configuration to all clusters matching env: staging.
2. After the staging ClusterProfile is successfully deployed, Sveltos waits for 5 minutes.
3. The configuration is then automatically promoted and deployed to all clusters matching env: production.

```yaml
apiVersion: config.projectsveltos.io/v1beta1
kind: ClusterPromotion
metadata:
  name: test
spec:
  profileSpec:
    syncMode: Continuous
    helmCharts:
    - repositoryURL:    https://kyverno.github.io/kyverno/
      repositoryName:   kyverno
      chartName:        kyverno/kyverno
      chartVersion:     3.4.2
      releaseName:      kyverno-latest
      releaseNamespace: kyverno
      helmChartAction:  Install
      values: |
        admissionController:
          replicas: 3
        backgroundController:
          replicas: 3
        cleanupController:
          replicas: 3
        reportsController:
          replicas: 3
  stages:
  - name: staging
    clusterSelector:
      matchLabels:
        env: staging
    trigger:
      auto:
        delay: 5m
  - name: production
    clusterSelector:
      matchLabels:
        env: production
    trigger:
      auto:
        delay: 5m
```

This ensures that any issues in the configuration have a chance to surface in a pre-production environment
during the delay period before the production rollout begins.

- New CRD: ClusterPromotion is introduced to define the staging workflow.
- Controller Logic: A new controller manages the ClusterPromotion lifecycle, sequentially creating, monitoring
and deleting the underlying, generated ClusterProfile resources for each stage.
- Status Tracking: The ClusterPromotion status clearly tracks the progress through the stages, indicating which
stage is currently active and the status of its corresponding ClusterProfile.
@gianlucam76 gianlucam76 merged commit e9b3f4a into projectsveltos:release-1.1 Oct 10, 2025
8 checks passed
@gianlucam76 gianlucam76 deleted the release-1.1 branch October 10, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant