loadbalancer: use auto-reload for confd (file watcher)

pull/670/head
iwilltry42 3 years ago
parent 2a4c8910e8
commit 2b2041f028
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
  1. 10
      pkg/client/loadbalancer.go
  2. 1
      proxy/Dockerfile

@ -26,7 +26,6 @@ import (
"context"
"fmt"
"io/ioutil"
"strings"
"github.com/docker/go-connections/nat"
"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)
}
command := "confd -onetime -backend file -file /etc/confd/values.yaml -log-level debug && nginx -s reload"
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
}
// TODO: check if loadbalancer is running fine after auto-applying the change
return nil
}

@ -1,4 +1,5 @@
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_VERSION=0.17.0-rc.0
ARG OS=linux

Loading…
Cancel
Save