- Notifications
You must be signed in to change notification settings - Fork9
Container to define pod dependency on other pods
License
yogeshlonkar/pod-dependency-init-container
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This container can be used as init container to specify dependency of other pod. It will check for exiting pod with success status. If any pod with given label selector is found running in current namespace it will exit with success else exit with failure after timeout.
Use withgithub packages orThe docker image is hosted on docker hub and can be found onhub.docker.com orgithub-packages
| Environment Variable | Required | Default | Description |
|---|---|---|---|
| POD_LABELS | Yes | - | This is comma (,) separated string of labels of dependency pods which will be checked forRunning phase. |
| MAX_RETRY | NO | 5 | Maximum number of times for which init container will try to check if dependency pods areRunning. |
| RETRY_TIME_OUT | NO | 1500 | Number of milliseconds init container will pause between each retry. |
Example usage:
spec:containers:...serviceAccountName:{{ .Values.serviceAccount }}#optionalinitContainers: -name:pod-dependencyimage:ylonkar/pod-dependency-init-container:1.0.2env: -name:POD_LABELSvalue:app=nodeapp,name=mongo-1 -name:MAX_RETRYvalue:"10" -name:RETRY_TIME_OUTvalue:"5000"
In case of RBAC this container requirespods resourceget,list,watch access. Which can be provided by below yaml
---kind:ClusterRoleapiVersion:rbac.authorization.k8s.io/v1beta1metadata:name:{{ .Values.serviceAccount }}rules: -apiGroups: -""resources: -pods -services -endpointsverbs: -get -list -watch---apiVersion:v1kind:ServiceAccountmetadata:name:{{ .Values.serviceAccount }}namespace:{{ .Values.namespace }}---kind:ClusterRoleBindingapiVersion:rbac.authorization.k8s.io/v1beta1metadata:name:system:serviceaccount:{{ .Values.serviceAccount }}:defaultroleRef:apiGroup:rbac.authorization.k8s.iokind:ClusterRolename:{{ .Values.serviceAccount }}subjects:-kind:ServiceAccountname:{{ .Values.serviceAccount }}namespace:{{ .Values.namespace }}
- Add tests!
- Add to travis-ci
About
Container to define pod dependency on other pods
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.