Skip to main content Link Search Menu Expand Document (external link)

Command

The command trait replaces the command that is executed by the component container image with a given one. This could be useful for debugging operations or to include extra arguments. Alternatively, some component types such as webservice or worker already provide properties to change the command and its arguments.

The following snippet shows an example application with a command trait modifying the arguments of the component.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: my-app
  annotations: 
    version: "v0.0.1"
    description: "My application"
spec:
  components:
    - name: busybox
      type: worker
      properties:
        image: my-app-image:v1.0.0
      traits:
        - type: command
          properties:
            # by default, the following command will replace the command declared in the main container -> busybox
            command: ["cmd"]
            containerName: container-name # (Optional) Specify the name of the target container, if not set, use the component name
            # if you want to replace the existing args in the container, use the `args` parameter
            args: ["86400"] # (Optional) Replace the existing args in the container
            addArgs: ["86400"] # (Optional) Append args to the existing args
            delArgs: ["86400"] # (Optional) Delete existing arg