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

Scaler

The scaler trait statically modifies the number of replicas of a given component. This is specilly useful for component definitions that do not provide such capability on its properties. For a dynamic approach to change the replication, check the cpuscaler trait.

The following snippet shows an application in which the number of replicas for a component is set with the trait.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: my-app
  annotations: 
    version: "v0.0.1"
    description: "My scaler application"
spec:
  components:
  - name: scaler-component
    type: worker
    properties:
        image: my-app-image:v1.0.0
        cmd: ["cmd"]     
        cpu: "0.25"
        memory: "200Mi"
    traits:
      - type: scaler # Set to scaler
        properties:
          replicas: 2 # (Required) number of replicas. 1 by default