Supporting functions
Kubernetes entrypoint
Kubernetes Entrypoint is a supporting component which can check if a condition is met before spinning up the next container. This component utilizes the initContainer feature in Kubernetes which will be spawn before the next container. It then continuously queries the Kubernetes API until a configurable condition is met and exits afterwards such that the additional initContainers or the main containers can proceed.
The Kubernetes Entrypoint supports one or more of the following scenarios:
-
If Kubernetes jobs are successfully completed;
-
If the other depending Nexeed modules are exposed via Kubernetes service;
-
If a daemonset is deployed and running.
Usage
In some of the Nexeed module’s values.yaml, under the deployments,
statefulSets, and/or daemonSets sections, you may see the dependencies
block.
For example:
local:
jobDependencyLabelValue: "myapp-db-migration-1.0.0"
deployments:
myapp-service:
dependencies:
- module: myapp
jobs:
- jobLabels:
dependencyid: "{{ .Values.local.jobDependencyLabelValue }}"
onlyLatestJob: true
- module: myapp2
service:
- web-app-service
- module: myds
daemonsets:
- myds-daemonsets
Once deployed, the Kubernetes Entrypoint initContainer will wait until the targets have reached their state(s), and then exit to let Kubernetes proceed to the next container(s).