This repository has been archived by the owner on May 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
takes env vars value for poll interval and verbosity. default interva…
…l is 1 sec.
- Loading branch information
Showing
2 changed files
with
95 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,47 @@ | ||
# fabric8-dependency-wait-service | ||
A small go binary that waits for service dependencies to be up and running that can be used as a kubernetes init-container to simplify the startup of complex applications | ||
|
||
# Environment variables | ||
DEPENDENCY_LOG_VERBOSE: true/false, default=false. puts out a little more extra logs. | ||
DEPENDENCY_POLL_INTERVAL: a positive integer, default=1. The interval between each poll of the dependency check. | ||
|
||
# Usage | ||
This utility is used as part of the init-containers. An example is given below. | ||
``` | ||
spec: | ||
template: | ||
metadata: | ||
annotations: | ||
pod.beta.kubernetes.io/init-containers: |- | ||
[ | ||
{ | ||
"name": "init-dependencyservice1", | ||
"image": "fabric8io/fabric8-dependency-wait-service:withEnvVars", | ||
"imagePullPolicy": "IfNotPresent", | ||
"command": ["sh", "-c", "fabric8-dependency-wait-service-linux-amd64 postgres://wit@wit-db:5432"], | ||
"env": [{ | ||
"name": "DEPENDENCY_POLL_INTERVAL", | ||
"value": "9" | ||
}, { | ||
"name": "DEPENDENCY_LOG_VERBOSE", | ||
"value": "true" | ||
}] | ||
}, | ||
{ | ||
"name": "init-dependencyservice2", | ||
"image": "fabric8io/fabric8-dependency-wait-service:withEnvVars", | ||
"imagePullPolicy": "IfNotPresent", | ||
"command": ["sh", "-c", "fabric8-dependency-wait-service-linux-amd64 http://keycloak:80"], | ||
"env": [{ | ||
"name": "DEPENDENCY_POLL_INTERVAL", | ||
"value": "11" | ||
}, { | ||
"name": "DEPENDENCY_LOG_VERBOSE", | ||
"value": "true" | ||
}] | ||
}, | ||
``` | ||
|
||
* the protocols can be only http or postgres (as of now) | ||
* http: for this a get request is made and if the response is 200 then it is ok. | ||
* postgres: for this the pg_isready utility is used. The given postgres url is parsed for username, host, and port and passed to the utility. The db is considered up when a "accepting connections" response is received. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters