Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 18, 2021. It is now read-only.

Container to define pod dependency on other pods

License

NotificationsYou must be signed in to change notification settings

yogeshlonkar/pod-dependency-init-container

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

How to use it

Use withgithub packages orThe docker image is hosted on docker hub and can be found onhub.docker.com orgithub-packages

Settings

Environment VariableRequiredDefaultDescription
POD_LABELSYes-This is comma (,) separated string of labels of dependency pods which will be checked forRunning phase.
MAX_RETRYNO5Maximum number of times for which init container will try to check if dependency pods areRunning.
RETRY_TIME_OUTNO1500Number 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"

RBAC

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 }}

To do

  • Add tests!
  • Add to travis-ci

About

Container to define pod dependency on other pods

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp