Skip to content

Commit

Permalink
Update devcontainer
Browse files Browse the repository at this point in the history
Replace minikube with kind to match tests

Signed-off-by: James Taylor <[email protected]>
  • Loading branch information
jt-nti committed Dec 19, 2024
1 parent 692087c commit dbc6b22
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 15 deletions.
35 changes: 21 additions & 14 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},

Expand All @@ -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": {},

Expand All @@ -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"
}
}
31 changes: 30 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 - <<EOF
---
apiVersion: v1
kind: Endpoints
metadata:
name: dockerhost
subsets:
- addresses:
- ip: 172.18.0.1 # this is the gateway IP in the "bridge" docker network
---
apiVersion: v1
kind: Service
metadata:
name: dockerhost
spec:
clusterIP: None
EOF
```

Build your latest k8s builder changes.

Expand Down

0 comments on commit dbc6b22

Please sign in to comment.