loadbalancer: use auto-reload for confd (file watcher)
This commit is contained in:
parent
2a4c8910e8
commit
2b2041f028
@ -26,7 +26,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/docker/go-connections/nat"
|
"github.com/docker/go-connections/nat"
|
||||||
"github.com/go-test/deep"
|
"github.com/go-test/deep"
|
||||||
@ -74,14 +73,7 @@ func UpdateLoadbalancerConfig(ctx context.Context, runtime runtimes.Runtime, clu
|
|||||||
return fmt.Errorf("error writing new loadbalancer config to container: %w", err)
|
return fmt.Errorf("error writing new loadbalancer config to container: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
command := "confd -onetime -backend file -file /etc/confd/values.yaml -log-level debug && nginx -s reload"
|
// TODO: check if loadbalancer is running fine after auto-applying the change
|
||||||
if err := runtime.ExecInNode(ctx, cluster.ServerLoadBalancer, []string{"sh", "-c", command}); err != nil {
|
|
||||||
if strings.Contains(err.Error(), "host not found in upstream") {
|
|
||||||
log.Warnf("Loadbalancer configuration updated, but one or more k3d nodes seem to be down, check the logs:\n%s", err.Error())
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
FROM nginx:1.19-alpine
|
FROM nginx:1.19-alpine
|
||||||
|
# TODO:_ consider switching to https://github.com/abtreece/confd to not maintain a custom fork anymore
|
||||||
ARG CONFD_REPO=iwilltry42/confd
|
ARG CONFD_REPO=iwilltry42/confd
|
||||||
ARG CONFD_VERSION=0.17.0-rc.0
|
ARG CONFD_VERSION=0.17.0-rc.0
|
||||||
ARG OS=linux
|
ARG OS=linux
|
||||||
|
Loading…
Reference in New Issue
Block a user