forked from Katenary/katenary
fix(err): No port with depends_on
As #182 were not clear, the `depends_on` from a compose file needs, at this time, to check the port of the dependent service. If the port is not declared (ports or with label), we need to "fail", not to "warn. Fixes #182
This commit is contained in:
@@ -268,13 +268,12 @@ func (d *Deployment) DependsOn(to *Deployment, servicename string) error {
|
||||
for _, container := range to.Spec.Template.Spec.Containers {
|
||||
commands := []string{}
|
||||
if len(container.Ports) == 0 {
|
||||
logger.Warn("No ports found for service ",
|
||||
logger.Fatal("No ports found for service ",
|
||||
servicename,
|
||||
". You should declare a port in the service or use "+
|
||||
labels.LabelPorts+
|
||||
" label.",
|
||||
)
|
||||
os.Exit(1)
|
||||
}
|
||||
for _, port := range container.Ports {
|
||||
command := fmt.Sprintf("until nc -z %s %d; do\n sleep 1;\ndone", to.Name, port.ContainerPort)
|
||||
|
||||
Reference in New Issue
Block a user