# Windows Dev Container
> Windows VS Code Dev Container postgres-operator .
> Linux Makefile, bash , envtest .
>
> : [DOCS_MAP.ko.md](DOCS_MAP.ko.md) : [dev-setup-wsl.md](dev-setup-wsl.md) E2E : [WORK_HANDOFF.ko.md 3](WORK_HANDOFF.ko.md)
##
| | | |
|---|---|---|
| Windows | 10 21H2+ 11 | `winver` |
| Docker Desktop | 4.x+ | `docker version` |
| VS Code | | `code --version` |
| VS Code Dev Containers | ms-vscode-remote.remote-containers | VS Code |
> Docker Desktop . "Running" .
## 1. devcontainer.json
`go.mod` `go 1.26.0` . `.devcontainer/devcontainer.json`
Go `golang:1.26` .
`.devcontainer/devcontainer.json`:
```json
{
"name": "Kubebuilder DevContainer",
"image": "golang:1.26",
...
}
```
## 2. VS Code
1. VS Code (`C:\keiailab\postgres-operator`)
2. **"Reopen in Container"**
3. `Ctrl+Shift+P` `Dev Containers: Reopen in Container`
4. ( pull + `post-install.sh` 5~10 )
`post-install.sh` :
| | |
|---|---|
| `kind` | Kubernetes (e2e ) |
| `kubebuilder` | CRD/RBAC CLI |
| `kubectl` | Kubernetes |
## 3.
:
```bash
go version # go version go1.26.x linux/amd64
kind version # kind v0.x.x
kubectl version --client
kubebuilder version
docker --version # Docker Desktop DinD
```
## 4.
```bash
# Go
go mod download
# ,
make test-unit
# CRD/RBAC + (envtest )
make test
# : lint + test + audit + validate
make gate
```
## 5. Kubernetes (e2e )
```bash
# kind (make test-e2e )
kind create cluster --name postgres-operator-dev
# kubeconfig
kubectl cluster-info --context kind-postgres-operator-dev
# e2e
make test-e2e
#
kind delete cluster --name postgres-operator-dev
```
## 6. Operator
```bash
#
make docker-build IMG=postgres-operator:dev
# kind (registry push )
kind load docker-image postgres-operator:dev --name postgres-operator-dev
# Helm
helm install postgres-operator ./charts/postgres-operator \
--set image.repository=postgres-operator \
--set image.tag=dev \
--set image.pullPolicy=Never
```
## 7. Make
| | | |
|---|---|---|
| `make test-unit` | (envtest ) | ~30 |
| `make test` | + | ~2 |
| `make test-e2e` | kind e2e | ~10 |
| `make lint` | golangci-lint | ~1 |
| `make gate` | lint + test + audit + validate | ~5 |
| `make manifests generate` | CRD/RBAC/DeepCopy | ~20 |
| `make build` | manager | ~1 |
| `make docker-build` | | ~3 |
##
### Docker Desktop
Docker Desktop Settings Resources WSL Integration
"Enable integration with my default WSL distro" .
### post-install.sh curl
`.devcontainer/devcontainer.json` :
```json
"remoteEnv": {
"GO111MODULE": "on",
"HTTP_PROXY": "http://proxy.example.com:8080",
"HTTPS_PROXY": "http://proxy.example.com:8080"
}
```
### go: module lookup disabled by GONOSUMCHECK
```bash
go env -w GONOSUMDB="*"
go env -w GOFLAGS="-mod=mod"
```
### CRD
API (`api/v1alpha1/`) :
```bash
make manifests generate
```