Service

📘

Note

While using TrueFoundry python SDK type is not a required field in any of the imported classes

Service

Description

Describes the configuration for the service

Schema

{
  "type": "string",
  "replicas": 1,
  "allow_interception": false,
  "rollout_strategy": {}
}

Properties

Name

Type

Required

Description

type

string

false

+

value=service

replicas

any

false

Replicas of service you want to run

allow_interception

boolean

false

Whether to allow intercepts to be applied for this service.
This would inject an additional sidecar in each pod of the service. Not recommended on production

rollout_strategy

object

false

Strategy to dictate how a rollout should happen when a new release for this service is made


Liveliness/Readiness Probe

The modules below help configuring the Health Probes for the Service. Learn more about Health Probes here.

HttpProbe

Description

Describes the Instructions for assessing container health by executing an HTTP GET request.
To learn more you can go here

Schema

{
  "type": "string",
  "path": "string",
  "port": 65535,
  "host": "string",
  "scheme": "HTTP"
}

Properties

Name

Type

Required

Description

type

string

true

+sort=1
+value=http

path

string

true

The endpoint, relative to the port, to which the HTTP GET request should be directed.

port

integer

true

The TCP socket within the container to which the HTTP GET request should be directed.

host

string

false

Host name to connect to, defaults to the pod IP

scheme

string

false

Scheme to use for connecting to the host

HealthProbe

Description

Describes the configuration for the Health Probe's
To learn more you can go here

Schema

{
  "config": {
    "type": "string",
    "path": "string",
    "port": 65535,
    "host": "string",
    "scheme": "HTTP"
  },
  "initial_delay_seconds": 0,
  "period_seconds": 10,
  "timeout_seconds": 1,
  "success_threshold": 1,
  "failure_threshold": 3
}

Properties

NameTypeRequiredDescription
configHttpProbetrueDescribes the Instructions for assessing container health by executing an HTTP GET request.
To learn more you can go here
initial_delay_secondsintegerfalseNumber of seconds after the container is started before the first probe is initiated.
period_secondsintegerfalseHow often, in seconds, to execute the probe.
timeout_secondsintegerfalseNumber of seconds after which the probe times out.
success_thresholdintegerfalseMinimum consecutive successes for the probe to be considered successful after having failed.
failure_thresholdintegerfalseNumber of consecutive failures required to determine the container is not alive (liveness probe) or not ready (readiness probe).

Port

Port

Description

Describes the ports the service should be exposed to.

Schema

{
  "port": 80,
  "protocol": "TCP",
  "expose": true,
  "app_protocol": "http",
  "host": "string",
  "path": "string",
  "rewrite_path_to": "string",
  "auth": {
    "type": "string",
    "username": "string",
    "password": "string"
  }
}

Properties

NameTypeRequiredDescription
portintegertruePort number to expose.
protocolstringtrueProtocol for the port.
exposebooleantrueExpose the port
app_protocolstringfalseApplication Protocol for the port.
Select the application protocol used by your service. For most use cases, this should be http(HTTP/1.1).
If you are running a gRPC server, select the grpc option.
This is only applicable if expose=true.
hoststringfalseHost e.g. ai.example.com, app.truefoundry.com
pathstringfalsePath e.g. /v1/api/ml/, /v2/docs/
rewrite_path_tostringfalseRewrite the path prefix to a different path.
If path is /v1/api and rewrite_path_to is /api. The URI in the HTTP request http://0.0.0.0:8080/v1/api/houses will be rewritten to http://0.0.0.0:8080/api/houses before the request is forwarded your service.
Defaults to /.
This is only applicable if path is given.
authBasicAuthCredsfalseUsername and password for Basic Service Authentication

Enumerate Values

PropertyValue
protocolTCP
protocolUDP
app_protocolhttp
app_protocolgrpc
app_protocoltcp

RolloutStrategy

Rolling

Description

This strategy updates the pods in a rolling fashion such that a subset of the
total pods are replaced with new version at one time.
A commonly used strategy can be to have maxUnavailablePercentage close to 0 so that there
is no downtime and keep the maxSurgePercentage to around 25%. If you are anyways running
a large number of pods, the service can often tolerate a few pods going down - so you
max maxUnavailablePercentage = 10 and maxSurgePercentage=0. You can read about it more
here

Schema

{
  "type": "string",
  "max_unavailable_percentage": 25,
  "max_surge_percentage": 0
}

Properties

Name

Type

Required

Description

type

string

true

+

value=rolling_update

max_unavailable_percentage

integer

true

Percentage of total replicas that can be brought down at one time.
For a value of 25 when replicas are set to 12 this would mean minimum (25% of 12) = 3 pods might be unavailable during the deployment.
Setting this to a higher value can help in speeding up the deployment process.

max_surge_percentage

integer

true

Percentage of total replicas of updated image that can be brought up over the total replicas count.
For a value of 25 when replicas are set to 12 this would mean (12+(25% of 12) = 15) pods might be running at one time.
Setting this to a higher value can help in speeding up the deployment process.

Canary

Description

This strategy brings up the new release without bringing the older release down. Traffic is shifted from the older release to the newer release in a staged manner.
This can help with verifying the health of the new release without shifting complete traffic.

Schema

{
  "type": "string",
  "steps": [
    {
      "weight_percentage": 100,
      "pause_duration": 30
    }
  ]
}

Properties

Name

Type

Required

Description

type

string

true

+

value=canary

steps

[

CanaryStep

]

true

These steps would be executed in order to enable shifting of traffic slowly from stable to canary version

CanaryStep

Description

Describes a canary deployment step

Schema

{
  "weight_percentage": 100,
  "pause_duration": 30
}

Properties

NameTypeRequiredDescription
weight_percentageintegertruePercentage of total traffic to be shifted to the canary release.
The rest will continue to go to the existing deployment
pause_durationintegerfalseDuration for which to pause the release. The release process will wait for these seconds before proceeding to the next step.
If this is not set, the step will pause indefinitely on this step

BlueGreen

Description

This strategy brings up the new release completely before switching the complete load to the new release.
This minimizes the time that two versions are serving traffic at the same time.

Schema

{
  "type": "string",
  "enable_auto_promotion": false,
  "auto_promotion_seconds": 30
}

Properties

Name

Type

Required

Description

type

string

true

+

value=blue_green

enable_auto_promotion

boolean

true

Promote the new release to handle the complete traffic. A manual promotion would be needed if this is disabled

auto_promotion_seconds

integer

false

Promote the new release to handle the complete traffic after waiting for these many seconds


Autoscaling

ServiceAutoscaling

Description

Describes a Service Autoscaling configuration

Schema

{
  "metrics": {}
}

Properties

NameTypeRequiredDescription
metricsobjectfalseMetrics to use for the autoscaler

CPUUtilizationMetric

Description

Describes CPU utilization metric for autoscaling

Schema

{
  "type": "string",
  "value": 0
}

Properties

Name

Type

Required

Description

type

string

true

+

value=cpu_utilization

value

integer

true

Percentage of cpu request averaged over all replicas which the autoscaler should try to maintain

RPSMetric

Description

Describes requests per second metric for autoscaling

Schema

{
  "type": "string",
  "value": 1
}

Properties

Name

Type

Required

Description

type

string

true

+

value=rps

value

integer

true

Average request per second averaged over all replicas that autoscaler should try to maintain

CronMetric

Description

Describes cron metric for autoscaling

Schema

{
  "type": "string",
  "desired_replicas": 1,
  "start": "string",
  "end": "string",
  "timezone": "UTC"
}

Properties

Name

Type

Required

Description

type

string

true

+

value=cron

desired_replicas

integer

false

Desired number of replicas during the given interval. Default value is max_replicas.

start

string

true

Cron expression indicating the start of the cron schedule.

end

string

true

Cron expression indicating the end of the cron schedule.

timezone

string

true

Timezone against which the cron schedule will be calculated, e.g. "Asia/Tokyo". Default is machine's local time.
https://docs.truefoundry.com/docs/list-of-supported-timezones


Authentication

BasicAuthCreds

Description

Username and password for Basic Service Authentication

Schema

{
  "type": "string",
  "username": "string",
  "password": "string"
}

Properties

Name

Type

Required

Description

type

string

true

+

value=basic_auth

username

string

true

+label=Username for service auth
+message=Upto 64 lower case alphanumeric character long
+sort=1

password

string

true

+label=Password for service auth
+message=Password should not be more than 64 characters
+sort=2