feat(depends): Use kubernetes API for depends_on management
We were using netcat to port to check if a service is up, but actually we can do like Docker / Podman compose and check the status. For now, I'm using the endpoint status, but maybe we can just check if the object is "up".
This commit is contained in:
@@ -36,6 +36,7 @@ const (
|
||||
LabelEnvFrom Label = KatenaryLabelPrefix + "/env-from"
|
||||
LabelExchangeVolume Label = KatenaryLabelPrefix + "/exchange-volumes"
|
||||
LabelValuesFrom Label = KatenaryLabelPrefix + "/values-from"
|
||||
LabelDependsOn Label = KatenaryLabelPrefix + "/depends-on"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -355,4 +355,25 @@
|
||||
DB_USER: database.MARIADB_USER
|
||||
DB_PASSWORD: database.MARIADB_PASSWORD
|
||||
|
||||
"depends-on":
|
||||
short: "Method to check if a service is ready (for depends_on)."
|
||||
long: |-
|
||||
When a service uses `depends_on`, Katenary creates an initContainer to wait
|
||||
for the dependent service to be ready.
|
||||
|
||||
By default, Katenary uses the Kubernetes API to check if the service endpoint
|
||||
has ready addresses. This method does not require the service to expose a port.
|
||||
|
||||
Set this label to `legacy` to use the old netcat method that requires a port
|
||||
to be defined for the dependent service.
|
||||
example: |-
|
||||
web:
|
||||
image: nginx
|
||||
depends_on:
|
||||
- database
|
||||
labels:
|
||||
# Use legacy netcat method (requires port)
|
||||
{{ .KatenaryPrefix }}/depends-on: legacy
|
||||
type: "string"
|
||||
|
||||
# vim: ft=gotmpl.yaml
|
||||
|
||||
Reference in New Issue
Block a user