Plans

Plan statements that determine actions to take based on resource state

Plans are statements that are evaluated by the nodes to determine actions to take on resources. Currently there are very limited values available future updates will add significantly more values. Below are two common statements. Once a statement has been defined it can be added to pod unit instance spec by referencing the name as shown below.

plan: +/plan/primary

The statement below checks if the last timestamp for when the host communicated with the IMDS server is less then 60 seconds ago and if the last heartbeat from the instance was more then 60 seconds ago. Then if both of these conditions are true for 15 seconds the instance is stopped.

IF instance.last_timestamp < 60 AND instance.last_heartbeat > 60 FOR 15 THEN 'stop'

The next statement initiates a start action if the instance is not already running. This will override the user attempting to stop an instance.

IF instance.state != 'running' THEN 'start'

Operators

Below are the available operators and functions of each operator.

Operator
Function

==

Values are equal

!=

Values are not equal

<

Int value is less then

>

Int value is greater then

<=

Int value is less then or equal

>=

Int value is greater then or equal

AND

Both conditions must be true

OR

One of the conditions must be true

FOR

The statement must evaluate as true for provided number of seconds

THEN

Action to take if statement evaluates as true

Values

Below are all the values currently available for statements.

Key
Type
Value

unit.name

string

Name of unit

unit.count

int

Number of active deployments

instance.name

string

Name of instance

instance.state

string

State of instance. Includes starting, running, stopped, failed, updating and provisioning

instance.action

string

Current action being taken on instance. Includes start, stop and destroy

instance.processors

int

Number of processors on instance

instance.memory

int

Size of instance memory in megabytes

instance.last_timestamp

int

Number of seconds since the last IMDS sync. This indicates if the host is communicating with the IMDS server. It does not indicate the instance is communicating with the IMDS server. This can be used with the last heartbeat to ignore expired heartbeats if the host has not been communicating with the IMDS server.

instance.last_heartbeat

int

Number of seconds since the last instance heartbeat. This indicates if the host and instance are communicating with the IMDS server.

Last updated