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

Resource

The resource trait permits to define the resources requested for a given component. This is specially useful for component definitions that do not provide such capabilities on their properties.

The following snippet shows an application where the resources requests and limits are set using the trait.

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
        cmd: ["cmd"]
      traits:
        - type: resource # Set to resource
          properties:
            cpu: 0.25 # (Optional) Specify the amount of cpu for requests and limits
            memory: "200Mi" # (Optional) Specify the amount of memory for requests and limits
            requests: # (Optional) Specify resources in requests
              cpu: 0.25 # (Optional) Specify the amount of cpu for requests. 1 by default
              memory: "200Mi" # (Optional) Specify the amount of memory for requests. 2048Mi by default
            limits: # (Optional) Specify resources in limits
              cpu: 0.25 # (Optional) Specify the amount of cpu for limits. 1 by default
              memory: "200Mi" # (Optional) Specify the amount of memory for limits. 2048Mi by default