add suggestions from review
Signed-off-by: leonnicolas <leonloechner@gmx.de>
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/spf13/cobra"
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
@@ -88,7 +89,7 @@ func runRoot(_ *cobra.Command, _ []string) error {
|
||||
c := kubernetes.NewForConfigOrDie(config)
|
||||
kc := kiloclient.NewForConfigOrDie(config)
|
||||
ec := apiextensions.NewForConfigOrDie(config)
|
||||
opts.backend = k8s.New(c, kc, ec, topologyLabel)
|
||||
opts.backend = k8s.New(c, kc, ec, topologyLabel, log.NewNopLogger())
|
||||
default:
|
||||
return fmt.Errorf("backend %v unknown; posible values are: %s", backend, availableBackends)
|
||||
}
|
||||
|
@@ -183,17 +183,23 @@ func runShowConfNode(_ *cobra.Command, args []string) error {
|
||||
fallthrough
|
||||
case outputFormatYAML:
|
||||
p := t.AsPeer()
|
||||
if p == nil {
|
||||
return errors.New("cannot generate config from nil peer")
|
||||
}
|
||||
p.AllowedIPs = append(p.AllowedIPs, showConfOpts.allowedIPs...)
|
||||
p.DeduplicateIPs()
|
||||
k8sp := translatePeer(&p)
|
||||
k8sp := translatePeer(p)
|
||||
k8sp.Name = hostname
|
||||
return showConfOpts.serializer.Encode(k8sp, os.Stdout)
|
||||
case outputFormatWireGuard:
|
||||
p := t.AsPeer()
|
||||
if p == nil {
|
||||
return errors.New("cannot generate config from nil peer")
|
||||
}
|
||||
p.AllowedIPs = append(p.AllowedIPs, showConfOpts.allowedIPs...)
|
||||
p.DeduplicateIPs()
|
||||
c, err := (&wireguard.Conf{
|
||||
Peers: []wireguard.Peer{p},
|
||||
Peers: []wireguard.Peer{*p},
|
||||
}).Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to generate configuration: %v", err)
|
||||
|
Reference in New Issue
Block a user