Deploying application containers of a distributed service
Techniques are disclosed relating to deploying application containers. A computer system may receive a request to deploy an application container onto resources of a target environment such that program code of the application container is executed. The deployment of the application container may be carried out in a mode in which the computer system does not allocate resources for the application container. The computer system may receive a request to deploy a placeholder container in the target environment. The deployment of the placeholder container may be carried out in a different mode in which the computer system allocates resources for the placeholder container. The computer system may cause an allocation of additional resources to the target environment on which to execute program code of the placeholder container. In response to the additional resources being allocated, the computer system may deploy the application container onto the additional resources for execution.
1 . A method, comprising:
receiving, by an orchestration service that is executing on a computer system, a first request to deploy, for a distributed service, an application container onto a set of resources of a target environment such that program code of the application container is executed to implement at least a portion of the distributed service;
storing, by the orchestration service, a deployment object that indicates a state of a deployment of the application container, wherein the deployment of the application container is carried out in a first mode in which the orchestration service does not allocate a node to the target environment on which to execute the application container even when the application container has not been deployed onto the target environment and is associated with a pending state;
subsequent to receiving the first request to deploy the application container, receiving, by the orchestration service, a second request to deploy, for a placeholder service, a placeholder container onto the target environment, wherein a deployment of the placeholder container is carried out in a second mode in which the orchestration service allocates resources that include a node for the deployment of the placeholder container;
causing, by the orchestration service, an allocation of an additional set of resources to the target environment on which to execute program code of the placeholder container; and
in response to the additional set of resources being allocated for the placeholder container, the orchestration service deploying the application container onto a node of the additional set of resources for execution.
2 . The method of claim 1 , wherein the additional set of resources includes an external storage that is external to the node of the additional set of resources, wherein the node of the additional set of resources includes a local storage.
3 . The method of claim 2 , wherein the application container is operable to utilize the local storage while the placeholder container is operable to utilize the external storage.
4 . The method of claim 2 , further comprising:
deploying, by the orchestration service, a local-storage-setup application onto the node of the additional set of resources such that the local-storage-setup application is executed to generate a local storage object that enables the application container to utilize the local storage.
5 . The method of claim 4 , further comprising:
binding, by the orchestration service, the deployment object to the local storage object to cause, in response to the application container crashing, the orchestration service to redeploy the application container onto the node of the additional set of resources.
6 . The method of claim 2 , wherein causing the allocation of the additional set of resources includes issuing a set of requests to a cloud service to allocate the node of the additional set of resources and the external storage to the target environment, wherein the target environment is part of cloud infrastructure that is managed by the cloud service.
7 . The method of claim 1 , further comprising:
detecting, by the orchestration service, that the deployment object indicates the pending state for the application container;
in response to the detecting, the orchestration service identifying whether there exists an available resource in the target environment on which to deploy the application container, wherein the deploying of the application container is performed in response to identifying the additional set of resources; and
after the deploying of the application container, the orchestration service modifying the deployment object to indicate that the application container has been deployed.
8 . The method of claim 1 , further comprising:
detecting, by the orchestration service, that the node of the additional set of resources has crashed; and
subsequent to the detecting, the orchestration service deleting a volume object created for an external volume associated with the node of the additional set of resources, wherein the deleting causes the orchestration service to allocate another set of additional resources to the target environment.
9 . The method of claim 1 , wherein a number of placeholder containers deployed is scaled in proportion to a number of application containers deployed for the distributed service.
10 . The method of claim 1 , wherein the second mode corresponds to a dynamic provisioner mode associated with a Kubernetes platform, and wherein the first mode corresponds to a no-provisioner mode.
11 . A non-transitory computer readable medium having program instructions stored thereon that are capable of causing a computer system to perform operations comprising:
receiving a first request to deploy, for a distributed service, an application container onto a set of resources of a target environment such that program code of the application container is executed to implement at least a portion of the distributed service;
storing a deployment object that indicates a state of a deployment of the application container, wherein the deployment of the application container is carried out in a first mode in which the computer system does not allocate a node to the target environment on which to execute the application container even when the application container is associated with a pending state and has not been deployed onto the target environment as a set of resources requested for the application container is not available in the target environment;
subsequent to receiving the first request to deploy the application container, receiving a second request to deploy, for a placeholder service, a placeholder container onto the target environment, wherein a deployment of the placeholder container is carried out in a second mode in which the computer system allocates resources that include a node for the deployment of the placeholder container;
causing an allocation of an additional set of resources to the target environment on which to execute program code of the placeholder container; and
subsequent to the additional set of resources being allocated for the placeholder container, deploying the application container onto a node of the additional set of resources for execution.
12 . The non-transitory computer readable medium of claim 11 , wherein the operations further comprise:
creating a storage object for the application container;
deploying, onto the node of the additional set of resources, a local-storage-setup application to create a local storage object representing a local storage of the node of the additional set of resources; and
binding the storage object of the application container to the local storage object created by the local-storage-setup application, wherein the binding permits the application container to utilize the local storage and causes the computer system to deploy the application container onto the node of the additional set of resources.
13 . The non-transitory computer readable medium of claim 11 , wherein the additional set of resources includes an external storage that is external to the node of the additional set of resources, and wherein the operations further comprise:
deploying the placeholder container onto the node of the additional set of resources, wherein the placeholder container is operable to utilize the external storage while the application container is operable to utilize a local storage included in the node of the additional set of resources.
14 . The non-transitory computer readable medium of claim 11 , wherein the operations further comprise:
detecting that the deployment object indicates the pending state for the application container;
in response to the detecting, identifying whether there exists an available resource in the target environment on which to deploy the application container, wherein the deploying of the application container is performed in response to identifying the additional set of resources; and
subsequent to deploying the application container, modifying the deployment object to indicate that the application container has been deployed.
15 . A system, comprising:
at least one processor; and
memory having program instructions stored thereon that are executable by the at least one processor to cause the system to perform operations comprising:
receiving a first request to deploy, for a distributed service, an application container onto a set of resources of a target environment such that program code of the application container is executed to implement at least a portion of the distributed service;
storing a deployment object that indicates a state of a deployment of the application container, wherein the deployment of the application container is carried out in a first mode in which the system does not allocate a node to the target environment on which to execute the application container even when the application container is associated with a pending state and has not been deployed onto the target environment as a set of resources requested for the application container is not available in the target environment;
subsequent to receiving the first request to deploy the application container, receiving a second request to deploy, for a placeholder service, a placeholder container the target environment, wherein a deployment of the placeholder container is carried out in a second mode in which the system allocates resources that include a node for the deployment of the placeholder container;
causing an allocation of an additional set of resources to the target environment on which to execute program code of the placeholder container; and
subsequent to the additional set of resources being allocated for the placeholder container, deploying the application container onto a node of the additional set of resources for execution.
16 . The system of claim 15 , wherein the operations further comprise:
detecting that the deployment object indicates the pending state for the application container;
in response to the detecting, identifying whether there exists an available resource in the target environment on which to deploy the application container, wherein the deploying of the application container is performed in response to identifying the additional set of resources; and
subsequent to deploying the application container, modifying the deployment object to indicate that the application container has been deployed.
17 . The system of claim 15 , wherein the operations further comprise:
creating a storage object for the application container;
deploying, onto the node of the additional set of resources, a local-storage-setup application to create a local storage object representing a local storage of the node of the additional set of resources; and
binding the storage object of the application container to the local storage object created by the local-storage-setup application, wherein the binding permits the application container to utilize the local storage and causes the system to deploy the application container onto the node of the additional set of resources.
18 . The system of claim 15 , wherein causing the allocation of the additional set of resources includes issuing a set of requests to a cloud service to allocate the node of the additional set of resources and an external storage to the target environment, wherein the target environment is part of cloud infrastructure that is managed by the cloud service.
19 . The system of claim 15 , wherein the additional set of resources includes an external storage that is external to the node of the additional set of resources, and wherein the operations further comprise:
deploying the placeholder container onto the node of the additional set of resources, wherein the placeholder container is operable to utilize the external storage while the application container is operable to utilize a local storage included in the node of the additional set of resources.