Skip to content

Commit

Permalink
Always run antctl in Pod for e2e tests (#5349)
Browse files Browse the repository at this point in the history
* Always run antctl in Pod for e2e tests

Instead of copying the antctl binary to the Node.

This simplifies tests in the following ways:
* No need to generate a Kubeconfig using the kube-system/antctl
  ServiceAccount token. Instead we define a ServiceAccount in the test
  Namepace, bind the antctl ClusterRole to it, and use it for the antctl
  Pod.
* No need to use different antctl binary paths for Kind and VMs.
* Easier lifecyle management when running antctl proxy.

We also remove the assumption that curl is available on the
control-plane Node.

Signed-off-by: Antonin Bas <[email protected]>
  • Loading branch information
antoninbas authored Aug 7, 2023
1 parent 49638ef commit ceb8c25
Show file tree
Hide file tree
Showing 8 changed files with 280 additions and 326 deletions.
7 changes: 3 additions & 4 deletions build/images/Dockerfile.build.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ RUN go mod download
COPY . /antrea

RUN make antrea-agent antrea-controller antrea-cni antrea-controller-instr-binary antrea-agent-instr-binary
# The e2e tests for antctl currently copy the antctl binary from the Docker container
# to the host Node, and run the binary from the host. The host may be missing some
# system libraries that are required to run the binary, so we need to disable CGO
# to avoid such dependencies and ensure that the binary is portable.
# Disable CGO for antctl in case it is copied outside of the container image. It
# also reduces the size of the binary and aligns with how we distribute antctl
# in release assets.
RUN CGO_ENABLED=0 make antctl-linux antctl-instr-binary
RUN mv bin/antctl-linux bin/antctl

Expand Down
6 changes: 3 additions & 3 deletions build/images/Dockerfile.build.ubi
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ RUN go mod download
COPY . /antrea

RUN make antrea-agent antrea-controller antrea-cni
# Disable CGO for antctl in case it is copied outside of the container image,
# such as in e2e tests. It also reduces the size of the binary and aligns with
# how we distribute antctl in release assets.
# Disable CGO for antctl in case it is copied outside of the container image. It
# also reduces the size of the binary and aligns with how we distribute antctl
# in release assets.
RUN CGO_ENABLED=0 make antctl-linux
RUN mv bin/antctl-linux bin/antctl

Expand Down
6 changes: 3 additions & 3 deletions build/images/Dockerfile.build.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ RUN go mod download
COPY . /antrea

RUN make antrea-agent antrea-controller antrea-cni
# Disable CGO for antctl in case it is copied outside of the container image,
# such as in e2e tests. It also reduces the size of the binary and aligns with
# how we distribute antctl in release assets.
# Disable CGO for antctl in case it is copied outside of the container image. It
# also reduces the size of the binary and aligns with how we distribute antctl
# in release assets.
RUN CGO_ENABLED=0 make antctl-linux
RUN mv bin/antctl-linux bin/antctl

Expand Down
Loading

0 comments on commit ceb8c25

Please sign in to comment.