Skip to content

Commit

Permalink
fix: Support kustomize v5 labels transformer. Fixes #3105 (#3775)
Browse files Browse the repository at this point in the history
* feat: add rollout-transform-2023-10-09.yaml which has been adapted for kustomize v5

Signed-off-by: Jethro Lee <[email protected]>

* Rename to rollout-transform-kustomize-v5.yaml

Signed-off-by: Hidetake Iwata <[email protected]>

* Add link to doc

Signed-off-by: Hidetake Iwata <[email protected]>

---------

Signed-off-by: Jethro Lee <[email protected]>
Signed-off-by: Hidetake Iwata <[email protected]>
Co-authored-by: Jethro Lee <[email protected]>
  • Loading branch information
int128 and dlemfh authored Aug 7, 2024
1 parent 827ce59 commit 48131eb
Show file tree
Hide file tree
Showing 2 changed files with 281 additions and 0 deletions.
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

0 comments on commit 48131eb

Please sign in to comment.