From dbc6b2257468657081822de3f1bdd43cea0f963e Mon Sep 17 00:00:00 2001 From: James Taylor Date: Tue, 17 Dec 2024 18:20:59 +0000 Subject: [PATCH] Update devcontainer Replace minikube with kind to match tests Signed-off-by: James Taylor --- .devcontainer/devcontainer.json | 35 ++++++++++++++++++++------------- CONTRIBUTING.md | 31 ++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9188899..0fb4e9e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,18 +7,30 @@ // Features to add to the dev container. More info: https://containers.dev/features. "features": { - "ghcr.io/devcontainers/features/python:1": {}, - "ghcr.io/devcontainers-contrib/features/mkdocs:2": { - "plugins": "mkdocs-material mike" - }, "ghcr.io/devcontainers/features/docker-in-docker:2": { - "enableNonRootDocker": "true", - "moby": "true" + "enableNonRootDocker": true, + "moby": true, + "azureDnsAutoDetection": true, + "installDockerBuildx": true, + "installDockerComposeSwitch": false, + "version": "latest", + "dockerDashComposeVersion": "none" }, "ghcr.io/devcontainers/features/kubectl-helm-minikube:1": { "version": "latest", - "helm": "latest", - "minikube": "latest" + "helm": "none", + "minikube": "none" + }, + "ghcr.io/devcontainers-extra/features/kind:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/python:1": { + "installTools": true, + "version": "latest" + }, + "ghcr.io/devcontainers-extra/features/mkdocs:2": { + "version": "latest", + "plugins": "mkdocs-material mike pymdown-extensions mkdocstrings[crystal,python] mkdocs-monorepo-plugin mkdocs-pdf-export-plugin mkdocs-awesome-pages-plugin" } }, @@ -28,11 +40,6 @@ // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": ".devcontainer/postCreateCommand.sh", - // Use 'postStartCommand' to run commands after the container is created like starting minikube. - "postStartCommand": { - "minikube": "nohup bash -c 'minikube start &' > minikube.log 2>&1" - }, - // Configure tool-specific properties. // "customizations": {}, @@ -41,7 +48,7 @@ "containerEnv": { "FABRIC_K8S_BUILDER_DEBUG": "true", - "CORE_PEER_CHAINCODEADDRESS_HOST_OVERRIDE": "host.minikube.internal", + "CORE_PEER_CHAINCODEADDRESS_HOST_OVERRIDE": "dockerhost", "CORE_PEER_CHAINCODELISTENADDRESS_HOST_OVERRIDE": "0.0.0.0" } } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ddc1369..d6edbb0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,36 @@ golangci-lint run ./... ## Development environment There is a [Visual Studio Code Dev Container](https://code.visualstudio.com/docs/devcontainers/containers) which should help develop and test the k8s builder in a consistent development environment. -It includes a preconfigured nano Fabric test network and minikube which can be used to run end to end tests. +It includes a preconfigured nano Fabric test network and [kind](https://kind.sigs.k8s.io/), which can be used to run end to end tests. + +Create a Kubernetes cluster. + +```shell +kind create cluster --name fabric-builder-k8s-dev +``` + +Allow chaincode pods to reach peers. +(Make sure the gateway IP is correct! See [Is it possible accessing host machine ports from Kind pods?](https://github.com/kubernetes-sigs/kind/issues/1200) for background.) + +```shell +kubectl apply -f - <