Skip to content

Commit

Permalink
Merge pull request #38 from Comcast/log-rules
Browse files Browse the repository at this point in the history
Generate Early/Late rules - 2.7.0
  • Loading branch information
christiancadieux committed Nov 25, 2022
2 parents 43987b6 + 2978e65 commit a8c27f2
Show file tree
Hide file tree
Showing 31 changed files with 4,714 additions and 303 deletions.
590 changes: 590 additions & 0 deletions Changes/2.6/bgp-worker.go

Large diffs are not rendered by default.

1,132 changes: 1,132 additions & 0 deletions Changes/2.6/system-ipvs.go

Large diffs are not rendered by default.

589 changes: 589 additions & 0 deletions Changes/2.7/bgp-worker.go

Large diffs are not rendered by default.

1,428 changes: 1,428 additions & 0 deletions Changes/2.7/system-ipvs.go

Large diffs are not rendered by default.

22 changes: 10 additions & 12 deletions Dockerfile.fast → Dockerfile-2.7
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,30 @@ FROM golang:1.17-alpine
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/*
WORKDIR /app/src

COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
WORKDIR /app/src/cmd/ravel

RUN CGO_ENABLED=1 go build -v -o /app/src/cmd/ravel/ravel
COPY gobgp_2.22.0_linux_amd64.tar.gz gobgp_2.22.0_linux_amd64.tar.gz
RUN CGO_ENABLED=1 go build -o /app/src/cmd/ravel/ravel
ADD https://github.com/osrg/gobgp/releases/download/v2.22.0/gobgp_2.22.0_linux_amd64.tar.gz gobgp_2.22.0_linux_amd64.tar.gz
RUN tar zxf gobgp_2.22.0_linux_amd64.tar.gz
RUN ls -al


FROM golang:1.17-alpine

FROM hub.comcast.net/k8s-eng/ravel-base:go-1.16
#ARG RAVEL_DELAY=1000
ARG SKIP_MASTER_NODE=N
ARG RAVEL_LOGRULE=N
ARG RAVEL_EARLYLATE=Y
ENV SKIP_MASTER_NODE=$SKIP_MASTER_NODE
ENV RAVEL_LOGRULE=$RAVEL_LOGRULE
ENV RAVEL_EARLYLATE=$RAVEL_EARLYLATE

LABEL MAINTAINER='RDEI Team <[email protected]>'
RUN echo '@edgemain http://dl-3.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories
RUN apk add bash openssh libpcap iptables haproxy iproute2 ipvsadm@edgemain gcc libc-dev git libpcap-dev && rm -rf /var/cache/apk/*; rm -rf /var/cache/apk/*
COPY --from=0 /app/src/cmd/ravel/ravel /bin/
COPY --from=0 /app/src/cmd/ravel/ravel /app/src/cmd/ravel/gobgp /app/src/cmd/ravel/gobgpd /bin/
COPY --from=0 /app/src/cmd/ravel/ravel /bin/kube2ipvs
COPY --from=0 /app/src/cmd/ravel/gobgp /bin/
COPY --from=0 /app/src/cmd/ravel/gobgpd /bin/
#COPY --from=0 /app/src/cmd/ravel/gobgp /bin/
#COPY --from=0 /app/src/cmd/ravel/gobgpd /bin/

RUN chmod 750 /bin/gobgp /bin/gobgpd /bin/ravel
ENTRYPOINT ["/bin/ravel"]
51 changes: 20 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@

# export RAVEL_EARLYLATE=Y

#TAG=v2.6.0-proto205
TAG=v2.6.0-cc20
TAG=v2.7.0-rc1
PROD=v2.7.0
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 @@ -24,40 +28,22 @@ 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

prod:
docker build -t hub.comcast.net/k8s-eng/ravel:${PROD} -f Dockerfile-2.7 .
docker push hub.comcast.net/k8s-eng/ravel:${PROD}
docker build -t hub.comcast.net/k8s-eng/ravel:${PROD}-1.6.2 -f Dockerfile-1.6.2 .
docker push hub.comcast.net/k8s-eng/ravel:${PROD}-1.6.2

build:
build: FORCE
#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 .
docker build -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile-2.7 .
#docker push hub.comcast.net/k8s-eng/ravel:${TAG}

push:
#DOCKER_HOST=ssh://69.252.103.115 docker push hub.comcast.net/k8s-eng/ravel:${TAG}
docker push hub.comcast.net/k8s-eng/ravel:${TAG}

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 build --build-arg RAVEL_LOGRULE=N --build-arg SKIP_MASTER_NODE=Y -t hub.comcast.net/k8s-eng/ravel:${SKIPMASTER} -f Dockerfile-2.7 .
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 .
rc4: FORCE
docker build --build-arg RAVEL_LOGRULE=N --build-arg SKIP_MASTER_NODE=N -t hub.comcast.net/k8s-eng/ravel:2.6.2-rc4 -f Dockerfile .
docker push hub.comcast.net/k8s-eng/ravel:2.6.2-rc4

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



default-gobgp: build-gobgp push-gobgp
Expand All @@ -69,8 +55,11 @@ push-gobgp:
docker push hub.comcast.net/k8s-eng/gobgpd:v2.2.0

remote:
DOCKER_HOST=ssh://69.252.103.115 docker buildx build --platform linux/amd64 --load -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile .
DOCKER_HOST=ssh://69.252.103.115 docker buildx build --platform linux/amd64 --load -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile-2.7 .

m1:
DOCKER_HOST=ssh://69.252.103.115 docker buildx build --platform linux/amd64 --load -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile .
DOCKER_HOST=ssh://69.252.103.115 docker buildx build --platform linux/amd64 --load -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile-2.7 .
#docker buildx build --platform linux/amd64 --load -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile .


FORCE: ;
76 changes: 76 additions & 0 deletions Makefile-2.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#TAG=v2.6.0-proto205
TAG=v2.6.0-cc20
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
# rc6: hub.comcast.net/k8s-eng/ravel:v2.5.0-proto45
# rc7: hub.comcast.net/k8s-eng/ravel:v2.5.0-proto66
# rc8: hub.comcast.net/k8s-eng/ravel:v2.5.0-proto67
# rc9: hub.comcast.net/k8s-eng/ravel:v2.5.0-proto68

# Not a complicated makefile, just a place to ensure
# that we don't forget how to build and push to a registry.
#


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 .

push:
#DOCKER_HOST=ssh://69.252.103.115 docker push hub.comcast.net/k8s-eng/ravel:${TAG}
docker push hub.comcast.net/k8s-eng/ravel:${TAG}

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 .
rc4: FORCE
docker build --build-arg RAVEL_LOGRULE=N --build-arg SKIP_MASTER_NODE=N -t hub.comcast.net/k8s-eng/ravel:2.6.2-rc4 -f Dockerfile .
docker push hub.comcast.net/k8s-eng/ravel:2.6.2-rc4

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



default-gobgp: build-gobgp push-gobgp

build-gobgp:
docker build -t hub.comcast.net/k8s-eng/gobgpd:v2.2.0 -f Dockerfile.gobgp .

push-gobgp:
docker push hub.comcast.net/k8s-eng/gobgpd:v2.2.0

remote:
DOCKER_HOST=ssh://69.252.103.115 docker buildx build --platform linux/amd64 --load -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile .

m1:
DOCKER_HOST=ssh://69.252.103.115 docker buildx build --platform linux/amd64 --load -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile .
#docker buildx build --platform linux/amd64 --load -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile .
65 changes: 65 additions & 0 deletions Makefile-2.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

# export RAVEL_EARLYLATE=Y

#TAG=v2.6.0-proto205
TAG=v2.7.0-rc1
PROD=v2.7.0
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.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
# rc6: hub.comcast.net/k8s-eng/ravel:v2.5.0-proto45
# rc7: hub.comcast.net/k8s-eng/ravel:v2.5.0-proto66
# rc8: hub.comcast.net/k8s-eng/ravel:v2.5.0-proto67
# rc9: hub.comcast.net/k8s-eng/ravel:v2.5.0-proto68

# Not a complicated makefile, just a place to ensure
# that we don't forget how to build and push to a registry.
#


default: build

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

prod:
docker build -t hub.comcast.net/k8s-eng/ravel:${PROD} -f Dockerfile-2.7 .
docker push hub.comcast.net/k8s-eng/ravel:${PROD}
docker build -t hub.comcast.net/k8s-eng/ravel:${PROD}-1.6.2 -f Dockerfile-1.6.2 .
docker push hub.comcast.net/k8s-eng/ravel:${PROD}-1.6.2

build: FORCE
#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-2.7 .
#docker push hub.comcast.net/k8s-eng/ravel:${TAG}


skipmaster:
docker build --build-arg RAVEL_LOGRULE=N --build-arg SKIP_MASTER_NODE=Y -t hub.comcast.net/k8s-eng/ravel:${SKIPMASTER} -f Dockerfile-2.7 .
docker push hub.comcast.net/k8s-eng/ravel:${SKIPMASTER}



default-gobgp: build-gobgp push-gobgp

build-gobgp:
docker build -t hub.comcast.net/k8s-eng/gobgpd:v2.2.0 -f Dockerfile.gobgp .

push-gobgp:
docker push hub.comcast.net/k8s-eng/gobgpd:v2.2.0

remote:
DOCKER_HOST=ssh://69.252.103.115 docker buildx build --platform linux/amd64 --load -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile-2.7 .

m1:
DOCKER_HOST=ssh://69.252.103.115 docker buildx build --platform linux/amd64 --load -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile-2.7 .
#docker buildx build --platform linux/amd64 --load -t hub.comcast.net/k8s-eng/ravel:${TAG} -f Dockerfile .


FORCE: ;
Loading

0 comments on commit a8c27f2

Please sign in to comment.