Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions deploy/charts/rig-platform/templates/capsule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: rig.dev/v1alpha2
kind: Capsule
metadata:
name: rig-platform
annotations:
rig.dev/recreate-strategy: "true"
spec:
scale:
horizontal:
Expand Down
11 changes: 11 additions & 0 deletions plugins/capsulesteps/deployment/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"crypto/sha256"
"fmt"
"slices"
"strconv"

"github.com/hashicorp/go-hclog"
"github.com/rigdev/rig/pkg/api/v1alpha2"
Expand All @@ -32,6 +33,8 @@ import (

const (
Name = "rigdev.deployment"

AnnotationRecreateStrategy = "rig.dev/recreate-strategy"
)

// Configuration for the deployment plugin
Expand Down Expand Up @@ -197,6 +200,11 @@ func (p *Plugin) createDeployment(
}
}

strategy := appsv1.RollingUpdateDeploymentStrategyType
if ok, _ := strconv.ParseBool(req.Capsule().GetAnnotations()[AnnotationRecreateStrategy]); ok {
strategy = appsv1.RecreateDeploymentStrategyType
}

d := &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
Kind: "Deployment",
Expand All @@ -211,6 +219,9 @@ func (p *Plugin) createDeployment(
MatchLabels: p.getPodsSelector(current, req),
},
Replicas: replicas,
Strategy: appsv1.DeploymentStrategy{
Type: strategy,
},
Template: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Annotations: podAnnotations,
Expand Down