client module¶
-
class
client.
TychoClient
(url)¶ Bases:
object
Python client to Tycho dynamic application deployment API.
-
delete
(request)¶ Delete a service.
Given the GUID of a running service, delete it and all its constituent parts.
The general format of a delete request is:
{ "name" : <GUID> }
- Parameters
request (JSON) – A request formatted as above.
-
down
(names)¶ Bring down a service.
CLI endpoint for deleting running systems.:
tycho down <GUID>
- Parameters
names – GUIDs of systems to delete.
-
format_name
(name)¶ Format a service name to be a valid DNS label.
- Parameters
name – Format a name.
-
list
(name, terse=False)¶ List status of executing systems.
CLI endpoint to list status of services.:
tycho status tycho status -terse
- Parameters
name (str) – GUID of a service to get status for.
terse (boolean) – Print just the GUID for running systems
-
parse_env
(environment)¶
-
request
(service, request)¶ Send a request to the server. Generic underlayer to all requests.
- Parameters
service – URL path to the service to invoke.
request – JSON to send to the API endpoint.
-
start
(request)¶ Start a service.
The general format of a start request is:
{ "name" : <name of the system>, "env" : <text of .env environment variables>, "system" : <JSON of a docker-compose yaml> }
- Parameters
request (JSON) – A request object formatted as above.
-
status
(request)¶ Get status of running systems.
Get the status of a system by GUID or across systems.
The format of a request is:
{}
- Parameters
request (JSON) – Request formatted as above.
-
up
(name, system, settings='')¶ Bring a service up starting with a docker-compose spec.
CLI endpoint to start a service on the Tycho compute fabric.:
tycho up -f path/to/docker-compose.yaml
- Parameters
name (str) – Name of the system.
system (JSON) – Docker-compose JSON structure.
settings (str) – The textual contents of a .env file.
-
-
class
client.
TychoClientFactory
¶ Bases:
object
Locate a Tycho API instance in a Kubernetes cluster.
This is written to work wheter run in-cluster or standalone. If we’re running outside of the cluster we use the environment’s kubernetes configuration. If we’re running insde kubernetes, we use the “in cluster” configuration to locate the configuration.
-
get_client
(name='tycho-api', namespace='default')¶ Locate the client endpoint using the K8s API.
Locate the Tycho API using the K8S API. We do this by reading services in the given namespace with the given name. Then we look for a load balancer IP and port to build a URL. This works for public cloud clusters. With some modification, it could work for Minikube but that is a future effort.
- Parameters
name (str) – Name of the Tycho API service in Kubernetes.
namespace (str) – The namespace the service is deployed to.
-