fbpx
POSThttps://api.spotinst.io/ocean/gcp/k8s/deploymentScaler?accountId={ACCOUNT_ID}

Create a deployment pod autoscaling policies.

URL Parameters

Parameter Type Description
ACCOUNT_ID * String

The Spotinst accountId associated with your token.

Example: act-123abc
Request

Headers
{
  "Authorization": "Bearer ${token}",
  "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
  "deploymentScaler": {
    "oceanId" : "o-123",
    "deploymentName": "myDepName",
    "namespace": "myNamespace",
    "capacityLimits": {
      "min": 2,
      "max": 6
    },
    "scaling": {
      "up": [
        {
			"policyName": "alarm up",
            "source": "stackdriver",
            "metricName": "num_undelivered_messages",
            "statistic": "average",
            "unit": "none",
            "operator": "gte",
            "threshold": 120,
            "namespace": "pubsub",
            "period": 300,
            "evaluationPeriods": 2,
            "cooldown": 360,
            "isEnabled" : true,
            "action": {
              "type": "adjustment",
              "target": 1
            },
            "dimensions": [
              {
                "name": "pubsub_subscription",
                "value": "p_sub-1234"
              }
            ]
        }
      ],
      "down": [
        {
            "policyName": "alarm down",
            "source": "stackdriver",
            "metricName": "num_undelivered_messages",
            "statistic": "average",
            "unit": "none",
            "operator": "lt",
            "threshold": 10,
            "namespace": "pubsub",
            "period": 60,
            "evaluationPeriods": 3,
            "cooldown": 120,
            "action": {
              "type": "adjustment",
              "adjustment": 3
            },
            "dimensions": [
              {
                  "name": "pubsub_subscription",
                  "value": "p_sub-1234"
              }
            ]
        }
      ]
    }
  }
}
Attribute Type Description
deploymentScaler * Object

deploymentScaler.oceanId * String

The Ocean cluster ID.

deploymentScaler.namespace * String

The namespace name.

deploymentScaler.deploymentName * String

The deployment name. deployment must exist in cluster

deploymentScaler.capacityLimits * Object

Set capacity limits for amount of pods in deployment

deploymentScaler.capacityLimits.min * Integer

Minimum number of pods

deploymentScaler.capacityLimits.max * Integer

Maximum number of pods

deploymentScaler.scaling * Object

Define scaling policies by metrics

deploymentScaler.scaling.up Array<Object>

Create scaling up policy

deploymentScaler.scaling.up.policyName String

The policy name

deploymentScaler.scaling.up.source String

The policy source. valid values: "stackdriver"

Example: stackdriver
deploymentScaler.scaling.up.metricName String

The name of the metric

Example: Latency
deploymentScaler.scaling.up.statistic String

The metric statistics to return. Valid Values: average, sum, min, max

Example: average
deploymentScaler.scaling.up.unit String

The unit for the alarm’s associated metric. Valid Values: seconds , microseconds , milliseconds , bytes , kilobytes , megabytes , gigabytes , terabytes , bits , kilobits , megabits , gigabits , terabits , percent , count , bytes/second , kilobytes/second , megabytes/second , gigabytes/second , terabytes/second , bits/second , kilobits/second , megabits/second , gigabits/second , terabits/second , count/second , none

Example: bytes
deploymentScaler.scaling.up.operator String

The operator to use in order to determine if the scaling policy is applicable. Valid values: gt, gte, lt, lte

Example: gte
deploymentScaler.scaling.up.threshold Double

The value against which the specified statistic is compared

Example: 120
deploymentScaler.scaling.up.namespace String

The namespace for the alarm’s associated metric.

Example: pubsub
deploymentScaler.scaling.up.period Integer

The period in seconds over which the statistic is applied.

Example: 300
deploymentScaler.scaling.up.evaluationPeriods Integer

The number of periods over which data is compared to the specified threshold.

Example: 2
deploymentScaler.scaling.up.cooldown Integer

The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.

Example: 360
deploymentScaler.scaling.up.isEnabled Boolean

Specifies whether the scaling policy described in this block is enabled.

Example: true
deploymentScaler.scaling.up.action Object

The action to take when scale up is needed

deploymentScaler.scaling.up.action.type * String

The type of the action to take when scale up is needed. Valid Values: adjustment, percentageAdjustment, setTarget

Example: adjustment
deploymentScaler.scaling.up.action.adjustment * Integer

The number / percentage associated with the specified type. Required on type = "adjustment" or "percentageAdjustment". use target or adjustment, can't use both

Example: 1
deploymentScaler.scaling.up.action.target * Integer

The number / percentage associated with the specified type. Required on type = "setTarget". use target or adjustment, can't use both

Example: 1
deploymentScaler.scaling.up.dimensions Array<Object>

The dimensions for the alarm’s associated metric

deploymentScaler.scaling.up.dimensions.name String

The dimension name

Example: LoadBalancerName
deploymentScaler.scaling.up.dimensions.value String

The dimension value

Example: elb-1234
deploymentScaler.scaling.down Object

Create scaling down policy

deploymentScaler.scaling.down.policyName String

The policy name

deploymentScaler.scaling.down.source String

The policy source. valid values: "stackdriver"

Example: stackdriver
deploymentScaler.scaling.down.metricName String

The name of the metric

Example: Latency
deploymentScaler.scaling.down.statistic String

The metric statistics to return. Valid Values: average, sum, min, max

Example: average
deploymentScaler.scaling.down.unit String

The unit for the alarm’s associated metric. Valid Values: seconds , microseconds , milliseconds , bytes , kilobytes , megabytes , gigabytes , terabytes , bits , kilobits , megabits , gigabits , terabits , percent , count , bytes/second , kilobytes/second , megabytes/second , gigabytes/second , terabytes/second , bits/second , kilobits/second , megabits/second , gigabits/second , terabits/second , count/second , none

Example: bytes
deploymentScaler.scaling.down.operator String

The operator to use in order to determine if the scaling policy is applicable. Valid values: gt, gte, lt, lte

Example: lt
deploymentScaler.scaling.down.threshold Double

The value against which the specified statistic is compared

Example: 10
deploymentScaler.scaling.down.namespace String

The namespace for the alarm’s associated metric.

Example: pubsub
deploymentScaler.scaling.down.period Integer

The period in seconds over which the statistic is applied.

Example: 60
deploymentScaler.scaling.down.evaluationPeriods Integer

The number of periods over which data is compared to the specified threshold.

Example: 3
deploymentScaler.scaling.down.cooldown Integer

The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.

Example: 120
deploymentScaler.scaling.down.isEnabled Boolean

Specifies whether the scaling policy described in this block is enabled.

Example: true
deploymentScaler.scaling.down.action Object

The action to take when scale up is needed

deploymentScaler.scaling.down.action.type String

The type of the action to take when scale up is needed. Valid Values: adjustment, percentageAdjustment, setTarget

Example: adjustment
deploymentScaler.scaling.down.action.adjustment Integer

The number / percentage associated with the specified type. Required on type = "adjustment" or "percentageAdjustment". use target or adjustment, can't use both

Example: 1
deploymentScaler.scaling.down.action.target Integer

The number / percentage associated with the specified type. Required on type = "setTarget". use target or adjustment, can't use both

Example: 1
deploymentScaler.scaling.down.dimensions Array<Object>

The dimensions for the alarm’s associated metric

deploymentScaler.scaling.down.dimensions.name String

The dimension name

Example: LoadBalancerName
deploymentScaler.scaling.down.dimensions.value String

The dimension value

Example: elb-1234
Response - 200

Body
Copied!
Downloaded!
{
    "request": {
        "id": "33a8c1d6-e882-4089-aa1c-6bd3ce54842d",
        "url": "/ocean/gcp/k8s/deploymentScaler/sds-60081f60?accountId=act-594fb635",
        "method": "POST",
        "timestamp": "2019-01-05T13:13:41.907Z"
    },
    "response": {
        "status": {
            "code": 200,
            "message": "OK"
        },
        "kind": "spotinst:ocean:gcp:k8s:cluster:deploymentScaler",
        "items": [
			{
              "deploymentScaler": {
				"id": "sds-60081f60",
                "oceanId" : "o-123",
                "namespace": "myNamespace",
                "deploymentName": "myDepName",
                "capacityLimits": {
                  "min": 2,
                  "max": 6
                },
                "scaling": {
                  "up": [
                    {
                      "policyName": "alarm up",
                      "source": "stackdriver",
                      "metricName": "num_undelivered_messages",
                      "statistic": "average",
                      "unit": "none",
                      "operator": "gte",
                      "threshold": 120,
                      "namespace": "pubsub",
                      "period": 300,
                      "evaluationPeriods": 2,
                      "cooldown": 360,
                      "isEnabled" : true,
                      "action": {
                        "type": "adjustment",
                        "target": 1
                      },
                      "dimensions": [
                        {
                          "name": "pubsub_subscription",
                          "value": "p_sub-1234"
                        }
                      ]
                    }
                  ],
                  "down": [
                    {
                      "policyName": "alarm down",
                      "source": "stackdriver",
                      "metricName": "num_undelivered_messages",
                      "statistic": "average",
                      "unit": "none",
                      "operator": "lt",
                      "threshold": 10,
                      "namespace": "pubsub",
                      "period": 60,
                      "evaluationPeriods": 3,
                      "cooldown": 120,
                      "action": {
                        "type": "adjustment",
                        "adjustment": 3
                      },
                      "dimensions": [
                        {
                            "name": "pubsub_subscription",
                            "value": "p_sub-1234"
                        }
                      ]
                    }
                  ]
                }
              }
			}
        ],
        "count": 1
    }
}