mirror of
https://github.com/rancher/os.git
synced 2025-07-10 21:33:04 +00:00
Waiting for the network if service has label io.rancher.os.after=network
This commit is contained in:
parent
ce9d497890
commit
ebc170def6
@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/rancher/os/config"
|
"github.com/rancher/os/config"
|
||||||
"github.com/rancher/os/pkg/log"
|
"github.com/rancher/os/pkg/log"
|
||||||
|
"github.com/rancher/os/pkg/util/network"
|
||||||
|
|
||||||
"github.com/docker/docker/layer"
|
"github.com/docker/docker/layer"
|
||||||
dockerclient "github.com/docker/engine-api/client"
|
dockerclient "github.com/docker/engine-api/client"
|
||||||
@ -134,6 +135,13 @@ func (s *Service) shouldRebuild(ctx context.Context) (bool, error) {
|
|||||||
func (s *Service) Up(ctx context.Context, options options.Up) error {
|
func (s *Service) Up(ctx context.Context, options options.Up) error {
|
||||||
labels := s.Config().Labels
|
labels := s.Config().Labels
|
||||||
|
|
||||||
|
// wait for networking if necessary
|
||||||
|
if after := labels["io.rancher.os.after"]; after == "network" {
|
||||||
|
if err := network.AllDefaultGWOK(network.DefaultRoutesCheckTimeout); err != nil {
|
||||||
|
log.Warnf("Timeout to wait for the networking ready: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := s.Service.Create(ctx, options.Create); err != nil {
|
if err := s.Service.Create(ctx, options.Create); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user