Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2.6.2 compare #41

Merged
merged 4 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ RUN tar zxf gobgp_2.22.0_linux_amd64.tar.gz
RUN ls -al


FROM alpine:3.8
ARG SKIP_MASTER_NODE=N
ARG RAVEL_LOGRULE=N
ENV SKIP_MASTER_NODE=$SKIP_MASTER_NODE
ENV RAVEL_LOGRULE=$RAVEL_LOGRULE
#FROM alpine:3.8
FROM golang:1.17-alpine
LABEL MAINTAINER='RDEI Team <rdei@comcast.com>'
RUN echo '@edgemain http://dl-3.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories
RUN apk add libpcap iptables haproxy iproute2 ipvsadm@edgemain gcc libc-dev git libpcap-dev && rm -rf /var/cache/apk/*; rm -rf /var/cache/apk/*
Expand Down
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SKIPMASTER=v2.6.1-skip-ipvsmaster
# branch: lab-isolated-later: original 2.6 + logging + skip-master
# branch: log-rules : original 2.6 + early-late rules + logging

# v2.7: iptable version, skip-master, order-rules, group rules, reverse default for ipvs-ignore-node-cordon
# v2.6.1-skip-ipvsmaster : skip-ipvs-master based on env-var. use iptables 1.6.2
# hub.comcast.net/k8s-eng/ravel:v2.6.0-proto205 -> v2.6.0-rc7
# v2.6.0-proto189 -> v2.6.0-rc4
Expand All @@ -20,6 +21,16 @@ SKIPMASTER=v2.6.1-skip-ipvsmaster

default: build

test:
go test github.com/Comcast/Ravel/pkg/system -run TestNewMerge -v

FORCE: ;

cc: FORCE
docker build -t hub.comcast.net/k8s-eng/ravel:cc -f Dockerfile .
docker push hub.comcast.net/k8s-eng/ravel:cc


build:
#docker build --progress plain -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile .
docker build -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile .
Expand All @@ -32,6 +43,22 @@ skipmaster:
docker build --build-arg RAVEL_LOGRULE=N --build-arg SKIP_MASTER_NODE=Y -t hub.comcast.net/k8s-eng/ravel:${SKIPMASTER} -f Dockerfile .
docker push hub.comcast.net/k8s-eng/ravel:${SKIPMASTER}

# ipvsadm.c restore (-R) : ignore return code
rc1: FORCE
docker build --build-arg RAVEL_LOGRULE=N --build-arg SKIP_MASTER_NODE=N -t hub.comcast.net/k8s-eng/ravel:2.6.2-rc1 -f Dockerfile .
docker push hub.comcast.net/k8s-eng/ravel:2.6.2-rc1

# ip.go : fix the Compare, comvert _ to .
rc2: FORCE
docker build --build-arg RAVEL_LOGRULE=N --build-arg SKIP_MASTER_NODE=N -t hub.comcast.net/k8s-eng/ravel:2.6.2-rc2 -f Dockerfile .
docker push hub.comcast.net/k8s-eng/ravel:2.6.2-rc2

# both fixes
rc3: FORCE
docker build --build-arg RAVEL_LOGRULE=N --build-arg SKIP_MASTER_NODE=N -t hub.comcast.net/k8s-eng/ravel:2.6.2-rc3 -f Dockerfile .
docker push hub.comcast.net/k8s-eng/ravel:2.6.2-rc3



default-gobgp: build-gobgp push-gobgp

Expand Down
5 changes: 4 additions & 1 deletion pkg/bgp/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,14 @@ func (b *bgpserver) configure() error {
// log.Debugln("bgp: Setting IPVS settings")
err = b.ipvs.SetIPVS(b.watcher, b.watcher.ClusterConfig, b.logger)
if err != nil {
return fmt.Errorf("bgp: unable to configure ipvs with error %v", err)
// return fmt.Errorf("bgp: unable to configure ipvs with error %v", err)
// continue to do the Set() since some of the rules did succeed, ipvsadm batch only return the last error
log.Errorf("bgp: unable to configure ipvs with error %v", err)
}

err = b.bgp.Set(b.ctx, addrs, configuredAddrs, b.communities)
if err != nil {
log.Errorf("bgp: b.bgp.Set failed - %v", err)
return err
}

Expand Down
7 changes: 3 additions & 4 deletions pkg/system/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,9 @@ func (i *IP) Compare(configured []string, desired []string, v6 bool) ([]string,
for k, v := range configured {
configured[k] = strings.ReplaceAll(v, "_", ".")
}
// swap all desired addresses out to underscores
// for k, v := range desired {
// desired[k] = strings.ReplaceAll(v, ".", "_")
// }
for k, v := range desired {
desired[k] = strings.ReplaceAll(v, "_", ".")
}

removals := []string{}
additions := []string{}
Expand Down
2 changes: 2 additions & 0 deletions pkg/system/ipvs.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,9 @@ func (i *IPVS) SetIPVS(w *watcher.Watcher, config *types.ClusterConfig, logger l

// generate a set of deletions + creations
log.Debugln("ipvs: start merging rules after", time.Since(startTime))

rules := i.merge(ipvsConfigured, ipvsGenerated)

log.Debugln("ipvs: done merging rules after", time.Since(startTime))

if i.logrule && len(rules) > 0 {
Expand Down