Skip to content

Kustomize Integration

Kustomize can be extended to understand CRD objects through the use of transformer configs. Using transformer configs, kustomize can be "taught" about the structure of a Rollout object and leverage kustomize features such as ConfigMap/Secret generators, variable references, and common labels & annotations. To use Rollouts with kustomize:

  1. Download rollout-transform.yaml into your kustomize directory.

  2. Include rollout-transform.yaml in your kustomize configurations section:

kind: Kustomization
apiVersion: kustomize.config.k8s.io/v1beta1

configurations:
- rollout-transform.yaml

An example kustomize app demonstrating the ability to use transformers with Rollouts can be seen here.

  • With Kustomize 3.6.1 it is possible to reference the configuration directly from a remote resource:
configurations:
  - https://argoproj.github.io/argo-rollouts/features/kustomize/rollout-transform.yaml
  • With Kustomize 4.1.0 kustomize can use kubernetes OpenAPI data to get merge key and patch strategy information about resource types. For example, given the following rollout:
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: rollout-canary
spec:
  strategy:
    canary:
      steps:
      # detail of the canary steps is omitted
  template:
    metadata:
      labels:
        app: rollout-canary
    spec:
      containers:
      - name: rollouts-demo
        image: argoproj/rollouts-demo:blue
        imagePullPolicy: Always
        ports:
        - containerPort: 8080

user can update the Rollout via a patch in a kustomization file, to change the image to nginx

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- rollout-canary.yaml

openapi:
 path: <path-to-directory>/rollout_cr_schema.json

patchesStrategicMerge:
- |-
  apiVersion: argoproj.io/v1alpha1
  kind: Rollout
  metadata:
    name: rollout-canary
  spec:
    template:
      spec:
        containers:
        - name: rollouts-demo
          image: nginx

The OpenAPI data is auto-generated and defined in this file.

An example kustomize app demonstrating the ability to use OpenAPI data with Rollouts can be seen here.