Skip to content

Commit

Permalink
Enable e2e tests with installer
Browse files Browse the repository at this point in the history
- removed the skip-installation flag from e2e test
- updated test/e2e/BYOHDockerfile to exclude k8s components
- added a few additional required packages to the Dockerfile
- added a new dev-dockerfile to continue having the same experience in
  getting started and local-dev guides
  • Loading branch information
anusha94 committed Jan 13, 2022
1 parent 2a1aaaa commit e4d13be
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 20 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RELEASE_DIR := _dist
# Image URL to use all building/pushing image targets
IMG ?= ${STAGING_REGISTRY}/${IMAGE_NAME}:${TAG}
BYOH_BASE_IMG = byoh/node:v1.22.3
BYOH_BASE_IMG_DEV = byoh-dev/node:v1.22.3
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"

Expand Down Expand Up @@ -111,6 +112,9 @@ docker-push: ## Push docker image with the manager.
prepare-byoh-docker-host-image:
docker build test/e2e -f test/e2e/BYOHDockerFile -t ${BYOH_BASE_IMG}

prepare-byoh-docker-host-image-dev:
docker build test/e2e -f docs/BYOHDockerFileDev -t ${BYOH_BASE_IMG_DEV}

test-e2e: docker-build prepare-byoh-docker-host-image $(GINKGO) cluster-templates ## Run the end-to-end tests
CONTROL_PLANE_ENDPOINT_IP=172.18.10.151 $(GINKGO) -v -trace -tags=e2e -focus="$(GINKGO_FOCUS)" $(_SKIP_ARGS) -nodes=$(GINKGO_NODES) --noColor=$(GINKGO_NOCOLOR) $(GINKGO_ARGS) test/e2e -- \
-e2e.artifacts-folder="$(ARTIFACTS)" \
Expand Down
28 changes: 28 additions & 0 deletions docs/BYOHDockerFileDev
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ARG BASE_IMAGE=ubuntu:20.04
FROM $BASE_IMAGE as build
ARG TARGETARCH
# install containerd
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
systemd conntrack iptables iproute2 ethtool socat util-linux mount \
ebtables kmod libseccomp2 pigz bash ca-certificates \
rsync nfs-common fuse-overlayfs containerd curl gnupg2 \
&& mkdir -p /etc/containerd \
&& containerd config default | tee /etc/containerd/config.toml \
&& ln -s "$(which systemd)" /sbin/init
RUN systemctl enable containerd
COPY kubernetes.list /etc/apt/sources.list.d/kubernetes.list
RUN echo "Installing kubectl kubeadm kubelet" \
&& curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
&& apt-get update \
&& apt-get install -y linux-image-$(uname -r) \
&& apt-get install -y kubelet=1.22.3-00 kubeadm=1.22.3-00 kubectl=1.22.3-00 \
&& apt-mark hold containerd kubelet kubeadm kubectl \
&& apt-get clean \
&& systemctl enable kubelet.service \
&& systemctl enable containerd.service

FROM scratch
COPY --from=build / /

ENTRYPOINT ["/sbin/init"]
2 changes: 1 addition & 1 deletion docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ If not, you could create containers to deploy your workload clusters on. We have

```shell
cd cluster-api-provider-bringyourownhost
make prepare-byoh-docker-host-image
make prepare-byoh-docker-host-image-dev
```

Once the image is ready, lets start 2 docker containers for our deployment. One for the control plane, and one for the worker. (you could of course run more)
Expand Down
2 changes: 1 addition & 1 deletion docs/local_dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ make host-agent-binaries
### Create docker hosts
```shell
cd cluster-api-provider-bringyourownhost
make prepare-byoh-docker-host-image
make prepare-byoh-docker-host-image-dev
```
Run the following to create n hosts, where ```n>1```
```shell
Expand Down
22 changes: 5 additions & 17 deletions test/e2e/BYOHDockerFile
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
ARG BASE_IMAGE=ubuntu:20.04
FROM $BASE_IMAGE as build
ARG TARGETARCH
# install containerd

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
systemd conntrack iptables iproute2 ethtool socat util-linux mount \
ebtables kmod libseccomp2 pigz bash ca-certificates \
rsync nfs-common fuse-overlayfs containerd curl gnupg2\
&& mkdir -p /etc/containerd \
&& containerd config default | tee /etc/containerd/config.toml \
systemd conntrack iptables iproute2 ethtool socat util-linux mount \
ebtables kmod libseccomp2 pigz bash ca-certificates \
rsync nfs-common fuse-overlayfs curl gnupg2 \
dbus ufw linux-image-$(uname -r) \
&& ln -s "$(which systemd)" /sbin/init
RUN systemctl enable containerd
COPY kubernetes.list /etc/apt/sources.list.d/kubernetes.list
RUN echo "Installing kubectl kubeadm kubelet" \
&& curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
&& apt-get update \
&& apt-get install -y linux-image-$(uname -r) \
&& apt-get install -y kubelet=1.22.3-00 kubeadm=1.22.3-00 kubectl=1.22.3-00 \
&& apt-mark hold containerd kubelet kubeadm kubectl \
&& apt-get clean \
&& systemctl enable kubelet.service \
&& systemctl enable containerd.service

FROM scratch
COPY --from=build / /
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e_docker_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func setupByoDockerHost(ctx context.Context, clusterConName, byoHostName, namesp
rconfig := types.ExecConfig{
AttachStdout: true,
AttachStderr: true,
Cmd: []string{"./agent", "--kubeconfig", "/mgmt.conf", "--namespace", namespace, "--skip-installation"},
Cmd: []string{"./agent", "--kubeconfig", "/mgmt.conf", "--namespace", namespace},
}

resp, err := dockerClient.ContainerExecCreate(ctx, byohost.ID, rconfig)
Expand Down

0 comments on commit e4d13be

Please sign in to comment.