Skip to content

Commit

Permalink
use kind
Browse files Browse the repository at this point in the history
  • Loading branch information
kmrmt committed Dec 13, 2024
1 parent 0473919 commit 6bba642
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--net host --add-host host.docker.internal:host-gateway"
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand Down
15 changes: 12 additions & 3 deletions Makefile.d/e2e.mk
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,21 @@ e2e/actions/run/job: \
## run GitHub Actions E2E test (Stream CRUD with read replica )
e2e/actions/run/readreplica: \
hack/benchmark/assets/dataset/$(E2E_DATASET_NAME) \
minikube/restart
kind/vs/restart \
k8s/metrics/metrics-server/deploy
helm upgrade --install --set args={--kubelet-insecure-tls} metrics-server metrics-server/metrics-server -n kube-system
kubectl wait -n kube-system --for=condition=Available deployment/metrics-server --timeout=$(E2E_WAIT_FOR_START_TIMEOUT)
sleep 2
kubectl wait -n kube-system --for=condition=Ready pod -l k8s-app=metrics-server --timeout=$(E2E_WAIT_FOR_START_TIMEOUT)
kubectl wait -n kube-system --for=condition=ContainersReady pod -l k8s-app=metrics-server --timeout=$(E2E_WAIT_FOR_START_TIMEOUT)
kubectl wait -n kube-system --for=condition=Ready pod -l app.kubernetes.io/name=metrics-server --timeout=$(E2E_WAIT_FOR_START_TIMEOUT)
kubectl wait -n kube-system --for=condition=ContainersReady pod -l app.kubernetes.io/name=metrics-server --timeout=$(E2E_WAIT_FOR_START_TIMEOUT)
sleep 3
mkdir -p $(TEMP_DIR)/csi-driver-hostpath \
&& curl -fsSL https://github.com/kubernetes-csi/csi-driver-host-path/archive/refs/tags/v1.15.0.tar.gz | tar zxf - -C $(TEMP_DIR)/csi-driver-hostpath --strip-components 1 \
&& cd $(TEMP_DIR)/csi-driver-hostpath \
&& deploy/kubernetes-latest/deploy.sh \
&& kubectl apply -f ./examples/csi-storageclass.yaml \
&& kubectl apply -f ././examples/csi-pvc.yaml \
&& rm -rf $(TEMP_DIR)/csi-driver-hostpath
$(MAKE) k8s/vald/deploy \
HELM_VALUES=$(ROOTDIR)/.github/helm/values/values-readreplica.yaml
sleep 20
Expand Down
40 changes: 37 additions & 3 deletions Makefile.d/kind.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

SNAPSHOTTER_VERSION=v8.2.0

.PHONY: kind/install
## install KinD
kind/install: $(BINDIR)/kind
Expand All @@ -25,7 +28,8 @@ $(BINDIR)/kind:

.PHONY: kind/start
## start kind (kubernetes in docker) cluster
kind/start:
kind/start: \
$(BINDIR)/docker
kind create cluster --name $(NAME)
@make kind/login

Expand All @@ -36,7 +40,8 @@ kind/login:

.PHONY: kind/stop
## stop kind (kubernetes in docker) cluster
kind/stop:
kind/stop: \
$(BINDIR)/docker
kind delete cluster --name $(NAME)

.PHONY: kind/restart
Expand All @@ -54,7 +59,6 @@ kind/cluster/start:
kubectl apply -f https://projectcontour.io/quickstart/operator.yaml
kubectl apply -f https://projectcontour.io/quickstart/contour-custom-resource.yaml


.PHONY: kind/cluster/stop
## stop kind (kubernetes in docker) multi node cluster
kind/cluster/stop:
Expand All @@ -70,3 +74,33 @@ kind/cluster/login:
kind/cluster/restart: \
kind/cluster/stop \
kind/cluster/start

.PHONY: kind/vs/start
## start kind (kubernetes in docker) cluster with volume snapshot
kind/vs/start: \
$(BINDIR)/docker
sed -e 's/apiServerAddress: "127.0.0.1"/apiServerAddress: "$(shell grep host.docker.internal /etc/hosts | cut -f1)"/' $(ROOTDIR)/k8s/debug/kind/e2e.yaml | kind create cluster --name $(NAME)-vs --config -

kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/$(SNAPSHOTTER_VERSION)/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/$(SNAPSHOTTER_VERSION)/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/$(SNAPSHOTTER_VERSION)/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/$(SNAPSHOTTER_VERSION)/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/$(SNAPSHOTTER_VERSION)/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml

@make kind/vs/login

.PHONY: kind/vs/stop
## stop kind (kubernetes in docker) cluster with volume snapshot
kind/vs/stop:
kind delete cluster --name $(NAME)-vs

.PHONY: kind/vs/login
## login command for kind (kubernetes in docker) cluster with volume snapshot
kind/vs/login:
kubectl cluster-info --context kind-$(NAME)-vs

.PHONY: kind/vs/restart
## restart kind (kubernetes in docker) cluster with volume snapshot
kind/vs/restart: \
kind/vs/stop \
kind/vs/start
2 changes: 1 addition & 1 deletion Makefile.d/minikube.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $(BINDIR)/minikube:
.PHONY: minikube/start
minikube/start: \
$(BINDIR)/docker
minikube start --driver=docker --force
minikube start --driver=docker --force --alsologtostderr -v=1
minikube addons enable volumesnapshots
minikube addons enable csi-hostpath-driver
minikube addons disable storage-provisioner
Expand Down

0 comments on commit 6bba642

Please sign in to comment.