Skip to content

Commit

Permalink
refactor: remove unnecessary config logic
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyanker committed Mar 13, 2021
1 parent b06dad2 commit 00fdac8
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions pkg/pinger/config.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package pinger

import (
"context"
"flag"
"os"
"strings"
"time"

"github.com/spf13/pflag"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
Expand Down Expand Up @@ -134,21 +131,6 @@ func ParseFlags() (*Configuration, error) {
return nil, err
}

if config.Mode == "job" {
ds, err := config.KubeClient.AppsV1().DaemonSets(config.DaemonSetNamespace).Get(context.Background(), config.DaemonSetName, metav1.GetOptions{})
if err != nil {
return nil, err
}
for _, arg := range ds.Spec.Template.Spec.Containers[0].Command {
arg = strings.Trim(arg, "\"")
if config.ExternalAddress == "114.114.114.114" && strings.HasPrefix(arg, "--external-address=") {
config.ExternalAddress = strings.TrimPrefix(arg, "--external-address=")
}
if config.ExternalDNS == "alauda.cn" && strings.HasPrefix(arg, "--external-dns=") {
config.ExternalDNS = strings.TrimPrefix(arg, "--external-dns=")
}
}
}
klog.Infof("pinger config is %+v", config)
return config, nil
}
Expand Down

0 comments on commit 00fdac8

Please sign in to comment.