Service
Note
While using ServiceFoundry python SDK type
is not a required field in any of the imported classes
Service
Description
Describes the configuration for the service
Schema
Properties
Name | Type | Required | Description |
---|---|---|---|
type | string | true | none |
name | string | true | Name of the service. This uniquely identifies this service in the workspace. > Name can only contain alphanumeric characters and ’-’ and can be atmost 25 characters long |
image | object | true | Specify whether you want to deploy a Docker image or build and deploy from source code |
resources | Resources | false | Describes the resource constraints for the application so that it can be deployed accordingly on the cluster To learn more you can go here |
replicas | integer | true | Number of service instances/replicas you want to run. |
env | object¦null | false | Configure environment variables to be injected in the service.Docs |
ports | [Port] | true | Specify the ports you want the service to be exposed to |
liveness_probe | HealthProbe | false | Describes the configuration for the Health Probe’s To learn more you can go here |
readiness_probe | HealthProbe | false | Describes the configuration for the Health Probe’s To learn more you can go here |
service_account | string | false | Service account that this workload should use |
file_mounts | [FileMount] | false | Files to be mounted +ignore |
Python Examples
Building using a Python Build pack
Building using a Dockerfile
This is useful if you have an already written Dockerfile
Using an already existing Image from an Image Registry
Note: The remote Image Registry should either be public or added to Truefoundry Platform via the Integrations Tab
Deploying from a Git Repository
Note: The remote Git server (Github or Bitbucket) needs to be connected via the Integrations Tab
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
Properties
Name | Type | Required | Description |
---|---|---|---|
type | string | true | none |
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 | none |
scheme | string | false | none |
Python Examples
HealthProbe
Description
Describes the configuration for the Health Probe’s
To learn more you can go here
Schema
Properties
Name | Type | Required | Description |
---|---|---|---|
config | HttpProbe | true | Describes the Instructions for assessing container health by executing an HTTP GET request. To learn more you can go here |
initial_delay_seconds | integer | false | Number of seconds after the container is started before the first probe is initiated. |
period_seconds | integer | false | How often, in seconds, to execute the probe. |
timeout_seconds | integer | false | Number of seconds after which the probe times out. |
success_threshold | integer | false | Minimum consecutive successes for the probe to be considered successful after having failed. |
failure_threshold | integer | false | Number of consecutive failures required to determine the container is not alive (liveness probe) or not ready (readiness probe). |
Python Examples
Port
Port
Description
Describes the ports the service should be exposed to.
Schema
Properties
Name | Type | Required | Description |
---|---|---|---|
protocol | string | true | Protocol for the port. |
port | integer | true | Port number to expose. |
expose | boolean | true | Expose the port |
host | string | false | Host |
path | string | false | Path |
auth | BasicAuthCreds | false | +label=Username and password for service auth |
Enumerate Values
Property | Value |
---|---|
protocol | TCP |
protocol | UDP |