Skip to content

Commit

Permalink
Remove get boostrap IP code
Browse files Browse the repository at this point in the history
Since we eliminate the need for the master nodes to know the bootstrap IP address
for unicast Keepalived, we can delete the code that implements this functionality.
  • Loading branch information
yboaron committed Oct 27, 2020
1 parent c7ce890 commit c5a202a
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 135 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ network_closure.sh
/monitor
/dynkeepalived
/corednsmonitor
/unicastipserver
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ RUN GO111MODULE=on go build --mod=vendor -o runtimecfg ./cmd/runtimecfg
RUN GO111MODULE=on go build --mod=vendor cmd/dynkeepalived/dynkeepalived.go
RUN GO111MODULE=on go build --mod=vendor cmd/corednsmonitor/corednsmonitor.go
RUN GO111MODULE=on go build --mod=vendor cmd/monitor/monitor.go
RUN GO111MODULE=on go build --mod=vendor cmd/unicastipserver/unicastipserver.go

FROM centos:8

Expand All @@ -15,7 +14,6 @@ COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/runtimecfg
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/monitor /usr/bin
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/dynkeepalived /usr/bin
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/corednsmonitor /usr/bin
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/unicastipserver /usr/bin
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/scripts/* /usr/bin/
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/scripts/ip*tables /usr/sbin/

Expand Down
2 changes: 0 additions & 2 deletions Dockerfile.openshift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ RUN GO111MODULE=on go build --mod=vendor -o runtimecfg ./cmd/runtimecfg
RUN GO111MODULE=on go build --mod=vendor cmd/dynkeepalived/dynkeepalived.go
RUN GO111MODULE=on go build --mod=vendor cmd/corednsmonitor/corednsmonitor.go
RUN GO111MODULE=on go build --mod=vendor cmd/monitor/monitor.go
RUN GO111MODULE=on go build --mod=vendor cmd/unicastipserver/unicastipserver.go

FROM registry.svc.ci.openshift.org/ocp/4.7:base

Expand All @@ -15,7 +14,6 @@ COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/runtimecfg
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/monitor /usr/bin
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/dynkeepalived /usr/bin
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/corednsmonitor /usr/bin
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/unicastipserver /usr/bin
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/scripts/* /usr/bin/
COPY --from=builder /go/src/github.com/openshift/baremetal-runtimecfg/scripts/ip*tables /usr/sbin/

Expand Down
46 changes: 0 additions & 46 deletions cmd/unicastipserver/unicastipserver.go

This file was deleted.

22 changes: 0 additions & 22 deletions pkg/config/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"os"
"sort"
"strings"
"time"

"github.com/ghodss/yaml"
"github.com/sirupsen/logrus"
Expand All @@ -24,7 +23,6 @@ import (
)

const localhostKubeApiServerUrl string = "https://localhost:6443"
const bootstrapIpServerPort string = "64444"

var log = logrus.New()

Expand Down Expand Up @@ -181,26 +179,6 @@ func (c *Cluster) PopulateVRIDs() error {
}
return nil
}
func GetBootstrapIP(apiVip string) (bootstrapIP string, err error) {
conn, err := net.DialTimeout("tcp", net.JoinHostPort(apiVip, bootstrapIpServerPort), 10*time.Second)
if err != nil {
log.Debugf("An error occurred on dial: %v", err)
return "", err
}
defer conn.Close()

bootstrapIP, err = bufio.NewReader(conn).ReadString('\n')
if err != nil {
log.Infof("An error occurred on read: %v", err)
return "", err
}

bootstrapIP = strings.TrimSpace(bootstrapIP)

log.Infof("Got bootstrap IP %v", bootstrapIP)

return bootstrapIP, err
}

func GetVRRPConfig(apiVip, ingressVip, dnsVip net.IP) (vipIface net.Interface, nonVipAddr *net.IPNet, err error) {
vips := make([]net.IP, 0)
Expand Down
24 changes: 0 additions & 24 deletions pkg/monitor/dynkeepalived.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ const (
started APIState = iota
)

var (
gBootstrapIP string
)

func getActualMode(cfgPath string) (error, bool) {
enableUnicast := false
_, err := os.Stat(cfgPath)
Expand All @@ -67,9 +63,6 @@ func updateUnicastConfig(kubeconfigPath string, newConfig, appliedConfig *config
if !newConfig.EnableUnicast {
return
}
retrieveBootstrapIpAddr(newConfig.Cluster.APIVIP)
newConfig.BootstrapIP = gBootstrapIP

newConfig.IngressConfig, err = config.GetIngressConfig(kubeconfigPath)
if err != nil {
log.Warnf("Could not retrieve ingress config: %v", err)
Expand All @@ -95,23 +88,6 @@ func doesConfigChanged(curConfig, appliedConfig *config.Node) bool {
return cfgChanged && validConfig
}

func retrieveBootstrapIpAddr(apiVip string) {
var err error

if gBootstrapIP != "" {
return
}
// we don't need to read the bootstrap IP address for bootstrap node
if os.Getenv("IS_BOOTSTRAP") == "yes" {
gBootstrapIP = ""
return
}
gBootstrapIP, err = config.GetBootstrapIP(apiVip)
if err != nil {
log.Debugf("Could not retrieve bootstrap IP: %v", err)
}
}

type modeUpdateInfo struct {
Mode string
Time time.Time
Expand Down
38 changes: 0 additions & 38 deletions pkg/monitor/unicastipserver.go

This file was deleted.

0 comments on commit c5a202a

Please sign in to comment.