Override

The override policy provides a mechanism to overwrite fields of the rendered Kubernetes entities. This type of policy can be used to set common labels to all component, add debug arguments to commands, etc. In combination with the deploy workflow step, the effect of the policy can be restricted to a subset of components.

The following snippet shows an application making use of an override policy to alter different component fields.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: my-app
spec:
  components:
    - name: my-component
      type: worker
      properties:
        image: my-app-image:v1.0.0
  policies:
    - name: policy-name # Policy Name
      type: override # Set to override
      properties:
        components:
        # Example 1
          - name: my-component # (Optional) Name of the component to override. If empty, all components will be merged
            properties: # (Optional) Properties
              image: my-app-image:v2.0.0 # patch the image (p.e.)
        # Example 2
          - type: worker # (Optional) type of the component to patch
            traits: # (Optional) Trait to apply
              - type: scaler # Trait type
                properties:
                  replicas: 2
  workflow:
    steps:      
      - type: deploy # Uses a deploy step to deploy components with policies
        name: deploy-test
        properties:
          policies: ["policy-name"]