apecloud / kubeblocks

KubeBlocks is an open-source control plane software that runs and manages databases, message queues and other stateful applications on K8s.
https://kubeblocks.io
GNU Affero General Public License v3.0
2.05k stars 167 forks source link

[BUG] devcontainer doesn't work #5923

Closed lipingtababa closed 9 months ago

lipingtababa commented 9 months ago

Describe the bug

  1. devcontainer doesn't work.

To Reproduce Steps to reproduce the behavior:

  1. Load devcontainer with VS code.
  2. make test
  3. you get an error like this go run github.com/golang/mock/mockgen -copyright_file ../../../../hack/boilerplate.go.txt -package mocks -destination reconfigure_client_mocks.go github.com/apecloud/kubeblocks/pkg/configuration/proto ReconfigureClient /workspaces/kubeblocks/bin/controller-gen rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths="./cmd/manager/...;./apis/...;./controllers/..." output:crd:artifacts:config=config/crd/bases dataprotection/backuprepo_controller.go:31:2: package slices is not in GOROOT (/usr/local/go/src/slices) note: imported by a module that requires go 1.21

Expected behavior I'm able to run test suite out of box with devcontainer.

Suggestions

  1. Upgrade the go version in devcontainer to go 1.21
  2. Please provide the source code of the devcontainer image in https://hub.docker.com/r/apecloud/kubeblocks-dev/

Desktop (please complete the following information):

Additional context Do you guys use this devcontainer yourselves?

lipingtababa commented 9 months ago

It doesn't solve the problem to upgrade the go from v1.20 to 1.21

 go generate -x ./pkg/configuration/proto/mocks/...
go run github.com/golang/mock/mockgen -copyright_file ../../../../hack/boilerplate.go.txt -package mocks -destination reconfigure_client_mocks.go github.com/apecloud/kubeblocks/pkg/configuration/proto ReconfigureClient
/workspaces/kubeblocks/bin/controller-gen rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths="./cmd/manager/...;./apis/...;./controllers/..." output:crd:artifacts:config=config/crd/bases
applying app.kubernetes.io/name=kubeblocks label to config/crd/bases/apps.kubeblocks.io_backuppolicytemplates.yaml
Error in configuration: context was not found for specified context: k3d-kb-playground
make[1]: *** [Makefile:130: label-crds] Error 1
make: *** [Makefile:123: manifests] Error 2
nayutah commented 9 months ago

@lipingtababa It seems that 'kubectl' cannot find the k8s cluster 'k3d-kb-playground', please exec 'kubectl config get-contexts' in your devcontainer and your windows laptop separately, and post the results, thanks. @ldming Lease adapt the compiling and installation process with windows vscode + devcontainer, and provide a devcontainer image.

ldming commented 9 months ago

The source code of the devcontainer image https://github.com/apecloud/kubeblocks/blob/main/docker/Dockerfile-dev @lipingtababa

The kubeblocks-dev images already been updated.

lipingtababa commented 9 months ago

Hi, @ldming , the issue is still there. While the go version in the source code is 1.21, the version in docker.io/apecloud/kubeblocks-dev:latest is 1.20.

It seems that there is not a pipeline that build the source code and push the image to dockerhub

docker run -it docker.io/apecloud/kubeblocks-dev:latest /bin/bash
Running devcontainer-init.sh ...
Invoking docker-init.sh ...
mount: /sys/kernel/security: permission denied.
Could not mount /sys/kernel/security.
AppArmor detection and --privileged mode might break.
mount: /tmp: permission denied.
mkdir: cannot create directory '/sys/fs/cgroup/init': Read-only file system
/bin/sh: 29: cannot create /sys/fs/cgroup/init/cgroup.procs: Directory nonexistent
/bin/sh: 31: cannot create /sys/fs/cgroup/cgroup.subtree_control: Read-only file system
Not setting dockerd DNS manually.
kubeblocks ➜ /go $ go version
go version go1.20.5 linux/arm64