Skip to content

Commit

Permalink
Merge branch 'master' of github.com:argoproj/argo-rollouts into step-…
Browse files Browse the repository at this point in the history
…plugin
  • Loading branch information
zachaller committed Aug 7, 2024
2 parents 941e8e0 + 48131eb commit be995fb
Show file tree
Hide file tree
Showing 9 changed files with 384 additions and 15 deletions.
2 changes: 2 additions & 0 deletions USERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Organizations below are **officially** using Argo Rollouts. Please send a PR wit
1. [BukuKas](https://bukukas.co.id/)
1. [Calm](https://www.calm.com/)
1. [CircleCI](https://circleci.com/)
1. [Cloudflare](https://cloudflare.com/)
1. [Codefresh](https://codefresh.io/)
1. [Credit Karma](https://creditkarma.com/)
1. [DaoCloud](https://daocloud.io)
Expand All @@ -36,6 +37,7 @@ Organizations below are **officially** using Argo Rollouts. Please send a PR wit
1. [PagerDuty](https://www.pagerduty.com/)
1. [PayPal](https://www.paypal.com/)
1. [PayPay](https://paypay.ne.jp/)
1. [Priceline](https://priceline.com)
1. [Productboard](https://www.productboard.com)
1. [Quipper](https://www.quipper.com/)
1. [Quizlet](https://quizlet.com)
Expand Down
7 changes: 7 additions & 0 deletions docs/features/kustomize.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ configurations:
- https://argoproj.github.io/argo-rollouts/features/kustomize/rollout-transform.yaml
```
- With Kustomize 5 it is possible to reference the configuration directly from a remote resource:
```yaml
configurations:
- https://argoproj.github.io/argo-rollouts/features/kustomize/rollout-transform-kustomize-v5.yaml
```
- With Kustomize 4.5.5 kustomize can use kubernetes OpenAPI data to get merge key and patch strategy information about [resource types](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/openapi). For example, given the following rollout:
```yaml
Expand Down
274 changes: 274 additions & 0 deletions docs/features/kustomize/rollout-transform-kustomize-v5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
# https://github.com/kubernetes-sigs/kustomize/blob/master/api/konfig/builtinpluginconsts/namereference.go
nameReference:
- kind: ConfigMap
version: v1
fieldSpecs:
- path: spec/template/spec/volumes/configMap/name
kind: Rollout
- path: spec/template/spec/containers/env/valueFrom/configMapKeyRef/name
kind: Rollout
- path: spec/template/spec/initContainers/env/valueFrom/configMapKeyRef/name
kind: Rollout
- path: spec/template/spec/containers/envFrom/configMapRef/name
kind: Rollout
- path: spec/template/spec/initContainers/envFrom/configMapRef/name
kind: Rollout
- path: spec/template/spec/volumes/projected/sources/configMap/name
kind: Rollout
- path: spec/templates/template/spec/volumes/configMap/name
kind: Experiment
- path: spec/templates/template/spec/containers/env/valueFrom/configMapKeyRef/name
kind: Experiment
- path: spec/templates/template/spec/initContainers/env/valueFrom/configMapKeyRef/name
kind: Experiment
- path: spec/templates/template/spec/containers/envFrom/configMapRef/name
kind: Experiment
- path: spec/templates/template/spec/initContainers/envFrom/configMapRef/name
kind: Experiment
- path: spec/templates/template/spec/volumes/projected/sources/configMap/name
kind: Experiment
- path: spec/metrics/provider/job/spec/template/spec/volumes/configMap/name
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/containers/env/valueFrom/configMapKeyRef/name
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/initContainers/env/valueFrom/configMapKeyRef/name
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/containers/envFrom/configMapRef/name
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/initContainers/envFrom/configMapRef/name
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/volumes/projected/sources/configMap/name
kind: AnalysisTemplate
- kind: Secret
version: v1
fieldSpecs:
- path: spec/template/spec/volumes/secret/secretName
kind: Rollout
- path: spec/template/spec/containers/env/valueFrom/secretKeyRef/name
kind: Rollout
- path: spec/template/spec/initContainers/env/valueFrom/secretKeyRef/name
kind: Rollout
- path: spec/template/spec/containers/envFrom/secretRef/name
kind: Rollout
- path: spec/template/spec/initContainers/envFrom/secretRef/name
kind: Rollout
- path: spec/template/spec/imagePullSecrets/name
kind: Rollout
- path: spec/template/spec/volumes/projected/sources/secret/name
kind: Rollout
- path: spec/templates/template/spec/volumes/secret/secretName
kind: Experiment
- path: spec/templates/template/spec/containers/env/valueFrom/secretKeyRef/name
kind: Experiment
- path: spec/templates/template/spec/initContainers/env/valueFrom/secretKeyRef/name
kind: Experiment
- path: spec/templates/template/spec/containers/envFrom/secretRef/name
kind: Experiment
- path: spec/templates/template/spec/initContainers/envFrom/secretRef/name
kind: Experiment
- path: spec/templates/template/spec/imagePullSecrets/name
kind: Experiment
- path: spec/templates/template/spec/volumes/projected/sources/secret/name
kind: Experiment
- path: spec/metrics/provider/job/spec/template/spec/volumes/secret/secretName
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/containers/env/valueFrom/secretKeyRef/name
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/initContainers/env/valueFrom/secretKeyRef/name
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/containers/envFrom/secretRef/name
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/initContainers/envFrom/secretRef/name
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/imagePullSecrets/name
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/volumes/projected/sources/secret/name
kind: AnalysisTemplate
- kind: ServiceAccount
version: v1
fieldSpecs:
- path: spec/template/spec/serviceAccountName
kind: Rollout
- path: spec/templates/template/spec/serviceAccountName
kind: Experiment
- path: spec/metrics/provider/job/spec/template/spec/serviceAccountName
kind: AnalysisTemplate
- kind: PersistentVolumeClaim
version: v1
fieldSpecs:
- path: spec/template/spec/volumes/persistentVolumeClaim/claimName
kind: Rollout
- path: spec/templates/template/spec/volumes/persistentVolumeClaim/claimName
kind: Experiment
- path: spec/metrics/provider/job/spec/template/spec/volumes/persistentVolumeClaim/claimName
kind: AnalysisTemplate
- kind: PriorityClass
version: v1
group: scheduling.k8s.io
fieldSpecs:
- path: spec/template/spec/priorityClassName
kind: Rollout
- path: spec/templates/template/spec/priorityClassName
kind: Experiment
- path: spec/metrics/provider/job/spec/template/spec/priorityClassName
kind: AnalysisTemplate

# The name references below are unique to Rollouts and not applicable to Deployment
- kind: Service
version: v1
fieldSpecs:
- path: spec/strategy/blueGreen/activeService
kind: Rollout
- path: spec/strategy/blueGreen/previewService
kind: Rollout
- path: spec/strategy/canary/canaryService
kind: Rollout
- path: spec/strategy/canary/stableService
kind: Rollout
- path: spec/strategy/canary/trafficRouting/alb/rootService
kind: Rollout
- kind: VirtualService
group: networking.istio.io
fieldSpecs:
- path: spec/strategy/canary/trafficRouting/istio/virtualService/name
kind: Rollout
- kind: DestinationRule
group: networking.istio.io
fieldSpecs:
- path: spec/strategy/canary/trafficRouting/istio/destinationRule/name
kind: Rollout
- kind: Ingress
group: networking.k8s.io
fieldSpecs:
- path: spec/strategy/canary/trafficRouting/alb/ingress
kind: Rollout
- path: spec/strategy/canary/trafficRouting/nginx/stableIngress
kind: Rollout
- kind: Ingress
group: extensions
fieldSpecs:
- path: spec/strategy/canary/trafficRouting/alb/ingress
kind: Rollout
- path: spec/strategy/canary/trafficRouting/nginx/stableIngress
kind: Rollout
- kind: AnalysisTemplate
group: argoproj.io
fieldSpecs:
- path: spec/strategy/blueGreen/prePromotionAnalysis/templates/templateName
kind: Rollout
- path: spec/strategy/blueGreen/postPromotionAnalysis/templates/templateName
kind: Rollout
- path: spec/strategy/canary/analysis/templates/templateName
kind: Rollout
- path: spec/strategy/canary/steps/analysis/templates/templateName
kind: Rollout
- path: spec/strategy/canary/steps/experiment/analyses/templateName
kind: Rollout
- path: spec/analyses/templateName
kind: Experiment
- kind: Rollout
fieldSpecs:
- path: spec/scaleTargetRef/name
kind: HorizontalPodAutoscaler
- kind: Deployment
version: v1
group: apps
fieldSpecs:
- path: spec/workloadRef/name
kind: Rollout
- kind: Mapping
group: getambassador.io
fieldSpecs:
- path: spec/strategy/canary/trafficRouting/ambassador/mappings
kind: Rollout

# https://github.com/kubernetes-sigs/kustomize/blob/master/api/konfig/builtinpluginconsts/commonlabels.go
commonLabels:
- path: spec/selector/matchLabels
create: true
kind: Rollout
- path: spec/template/metadata/labels
create: true
kind: Rollout
- path: spec/template/spec/affinity/podAffinity/preferredDuringSchedulingIgnoredDuringExecution/podAffinityTerm/labelSelector/matchLabels
create: false
kind: Rollout
- path: spec/template/spec/affinity/podAffinity/requiredDuringSchedulingIgnoredDuringExecution/labelSelector/matchLabels
create: false
kind: Rollout
- path: spec/template/spec/affinity/podAntiAffinity/preferredDuringSchedulingIgnoredDuringExecution/podAffinityTerm/labelSelector/matchLabels
create: false
kind: Rollout
- path: spec/template/spec/affinity/podAntiAffinity/requiredDuringSchedulingIgnoredDuringExecution/labelSelector/matchLabels
create: false
kind: Rollout

templateLabels:
- path: spec/template/metadata/labels
create: true
kind: Rollout

# https://github.com/kubernetes-sigs/kustomize/blob/master/api/konfig/builtinpluginconsts/commonannotations.go
commonAnnotations:
- path: spec/template/metadata/annotations
create: true
kind: Rollout

# https://github.com/kubernetes-sigs/kustomize/blob/master/api/konfig/builtinpluginconsts/varreference.go
varReference:
- path: spec/template/spec/containers/args
kind: Rollout
- path: spec/template/spec/containers/command
kind: Rollout
- path: spec/template/spec/containers/env/value
kind: Rollout
- path: spec/template/spec/containers/volumeMounts/mountPath
kind: Rollout
- path: spec/template/spec/initContainers/args
kind: Rollout
- path: spec/template/spec/initContainers/command
kind: Rollout
- path: spec/template/spec/initContainers/env/value
kind: Rollout
- path: spec/template/spec/initContainers/volumeMounts/mountPath
kind: Rollout
- path: spec/templates/template/spec/containers/args
kind: Experiment
- path: spec/templates/template/spec/containers/command
kind: Experiment
- path: spec/templates/template/spec/containers/env/value
kind: Experiment
- path: spec/templates/template/spec/containers/volumeMounts/mountPath
kind: Experiment
- path: spec/templates/template/spec/initContainers/args
kind: Experiment
- path: spec/templates/template/spec/initContainers/command
kind: Experiment
- path: spec/templates/template/spec/initContainers/env/value
kind: Experiment
- path: spec/templates/template/spec/initContainers/volumeMounts/mountPath
kind: Experiment
- path: spec/metrics/provider/job/spec/template/spec/containers/args
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/containers/command
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/containers/env/value
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/containers/volumeMounts/mountPath
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/initContainers/args
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/initContainers/command
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/initContainers/env/value
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/initContainers/volumeMounts/mountPath
kind: AnalysisTemplate
- path: spec/metrics/provider/job/spec/template/spec/volumes/nfs/server
kind: AnalysisTemplate

# https://github.com/kubernetes-sigs/kustomize/blob/master/api/konfig/builtinpluginconsts/replicas.go
replicas:
- path: spec/replicas
create: true
kind: Rollout
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ require (
github.com/stretchr/testify v1.9.0
github.com/tj/assert v0.0.3
github.com/valyala/fasttemplate v1.2.2
golang.org/x/oauth2 v0.21.0
golang.org/x/oauth2 v0.22.0
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -878,8 +878,8 @@ golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4Iltr
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE=
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA=
golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
3 changes: 2 additions & 1 deletion rollout/analysis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2532,7 +2532,7 @@ func TestRolloutPostPromotionAnalysisSuccess(t *testing.T) {
Status: v1alpha1.AnalysisPhaseRunning,
}

rs1 := newReplicaSetWithStatus(r1, 0, 0)
rs1 := newReplicaSetWithStatus(r1, 1, 1)
rs2 := newReplicaSetWithStatus(r2, 1, 1)
rs1PodHash := rs1.Labels[v1alpha1.DefaultRolloutUniqueLabelKey]
rs2PodHash := rs2.Labels[v1alpha1.DefaultRolloutUniqueLabelKey]
Expand All @@ -2558,6 +2558,7 @@ func TestRolloutPostPromotionAnalysisSuccess(t *testing.T) {
patch := f.getPatchedRollout(patchIndex)
expectedPatch := fmt.Sprintf(`{
"status": {
"replicas":2,
"stableRS": "%s",
"blueGreen": {
"postPromotionAnalysisRunStatus":{"status":"Successful"}
Expand Down
16 changes: 6 additions & 10 deletions rollout/bluegreen.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,14 @@ func (c *rolloutContext) rolloutBlueGreen() error {
return c.syncRolloutStatusBlueGreen(previewSvc, activeSvc)
}

func (c *rolloutContext) reconcileBlueGreenStableReplicaSet(activeSvc *corev1.Service) error {
if _, ok := activeSvc.Spec.Selector[v1alpha1.DefaultRolloutUniqueLabelKey]; !ok {
return nil
}
activeRS, _ := replicasetutil.GetReplicaSetByTemplateHash(c.allRSs, activeSvc.Spec.Selector[v1alpha1.DefaultRolloutUniqueLabelKey])
if activeRS == nil {
c.log.Warn("There shouldn't be a nil active replicaset if the active Service selector is set")
func (c *rolloutContext) reconcileBlueGreenStableReplicaSet() error {
if c.stableRS == nil {
c.log.Info("Stable ReplicaSet doesn't exist and hence no reconciliation is required.")
return nil
}

c.log.Infof("Reconciling stable ReplicaSet '%s'", activeRS.Name)
_, _, err := c.scaleReplicaSetAndRecordEvent(activeRS, defaults.GetReplicasOrDefault(c.rollout.Spec.Replicas))
c.log.Infof("Reconciling stable ReplicaSet '%s'", c.stableRS.Name)
_, _, err := c.scaleReplicaSetAndRecordEvent(c.stableRS, defaults.GetReplicasOrDefault(c.rollout.Spec.Replicas))
if err != nil {
return fmt.Errorf("failed to scaleReplicaSetAndRecordEvent in reconcileBlueGreenStableReplicaSet: %w", err)
}
Expand All @@ -94,7 +90,7 @@ func (c *rolloutContext) reconcileBlueGreenReplicaSets(activeSvc *corev1.Service
if err != nil {
return err
}
err = c.reconcileBlueGreenStableReplicaSet(activeSvc)
err = c.reconcileBlueGreenStableReplicaSet()
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit be995fb

Please sign in to comment.