Link Search Menu Expand Document

Apply application

The apply-application workflow step modifies the way in which the application is deployed in Kubernetes. The default approach is to deploy each component of the application sequentially, which is reflected on its status as:

Workflow status for a standard deployment
workflow:
    appRevision: apply-application-v1:3c04ce51c92daa8b
    contextBackend:
      ...
    finished: false
    message: executing
    mode: DAG
    ...
    steps:
    - firstExecuteTime: "<date_time>"
      id: s4b7uh6xsc
      lastExecuteTime: "<date_time>"
      name: component1
      phase: succeeded
      type: apply-component
    - firstExecuteTime: "<date_time>"
      id: hxgypfnk99
      lastExecuteTime: "<date_time>"
      message: wait healthy
      name: component2
      phase: running
      reason: Wait
      type: apply-component
    suspend: false
    terminated: false

With this trait, the system decides the best way to deploy the application and produces a single step in the workflow status:

Workflow status for an application using apply-application
  workflow:
    appRevision: apply-application-v1:58d9daa92f971d4c
    contextBackend:
      ...
    finished: false
    message: executing
    mode: StepByStep
    ...
    steps:
    - firstExecuteTime: "<date_time>"
      id: kjxg67og9w
      lastExecuteTime: "<date_time>"
      message: wait healthy
      name: apply-app
      phase: running
      reason: Wait
      type: apply-application
    suspend: false
    terminated: false

The following snippet shows an application that makes use of the apply-application workflow step to modify its deployment approach:

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: my-app
  annotations: 
    version: "v0.0.1"
    description: "My apply-application application"
spec:
  components:
    - name: component1
      type: worker
      properties:
        image: my-app-image:v1.0.0
        cmd: ["cmd"]     
        cpu: "0.25"
        memory: "200Mi"
    - name: component2
      type: worker
      properties:
        image: my-app-image:v1.0.0
        cmd: ["cmd"]     
        cpu: "0.25"
        memory: "200Mi"
      traits:
        - type: scaler
          properties:
            replicas: 1
  workflow:
    steps:
    - name: apply-app
      # Apply all the traits and the components in an application
      type: apply-application # Set to apply-application 
      # No arguments required