mercari / tortoise

Tortoise: Shell-Shockingly-Good Kubernetes Autoscaling
MIT License
418 stars 18 forks source link

Update controller-tools to latest version #406

Open e-volusian opened 5 months ago

e-volusian commented 5 months ago

Main is on controller-tools version 0.13.0. On that version, I get error from make install:

# make install
test -s /mnt/vdb/root/repos/mercari/tortoise/bin/kustomize || { curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- 3.8.7 /mnt/vdb/root/repos/mercari/tortoise/bin; }
/mnt/vdb/root/repos/mercari/tortoise/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa0de0f]
<snip>
created by sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check in goroutine 1
    /mnt/vdb/root/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:260 +0x1c5
make: *** [Makefile:43: manifests] Error 2

Fixed in v0.15.0

sanposhiho commented 5 months ago

Well, it's not reproducible for me. Instead of make install, you may want to use Yaml files in https://github.com/mercari/tortoise/tree/main/manifests directly.

toasahi commented 5 months ago

I am in the same situation. Environment mac m1 : v14.4.1 docker-desktop : v4.30.0 kubernetes: v1.29.2

Verification command: make install make install

test -s /Users/kubernetes/tortoise/bin/kustomize || { curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- 3.8.7 /Users/kubernetes/tortoise/bin; }
/Users/kubernetes/tortoise/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1047f0fb0]
e-volusian commented 5 months ago

@toasahi -- I'm not sure if your comment means that you did or did not get it working. Regardless, the fix is to change:

CONTROLLER_TOOLS_VERSION ?= v0.13.0

to

CONTROLLER_TOOLS_VERSION ?= v0.15.0

on line 130 of Makefile. After I did this, tortoise built, installed, and is working and currently GatheringData.

toasahi commented 5 months ago

Thank you, @e-volusian "CONTROLLER_TOOLS_VERSION ? = v0.15.0" but the error still occurs.

test -s /Users/kubernetes/tortoise/bin/kustomize || { curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- 3.8.7 /Users/kubernetes/tortoise/bin; }
/Users/kubernetes/tortoise/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1047f0fb0]
e-volusian commented 5 months ago

According to my notes, these are the three things I had to do to make the install work on a brand new kind cluster:

  1. Make sure cert-manager installed
  2. Make sure the namespace system exists
  3. Upgrade controller-tools version to v0.15.0

Not sure if those will help you, but....that's all I got. 🤷

sanposhiho commented 5 months ago

Instead of make install, you may want to use Yaml files in https://github.com/mercari/tortoise/tree/main/manifests directly

Again, this workaround should work for everyone. Applying yaml files in https://github.com/mercari/tortoise/tree/main/manifests equals make install and make deploy. Try out this way if you still get into trouble.

toasahi commented 5 months ago

Instead of make install, you may want to use Yaml files in https://github.com/mercari/tortoise/tree/main/manifests directly

Again, this workaround should work for everyone. Applying yaml files in https://github.com/mercari/tortoise/tree/main/manifests equals make install and make deploy. Try out this way if you still get into trouble.

Thank you, @e-volusian @sanposhiho I was able to solve the problem!

The procedure is left here.

  1. kubectl create ns system
  2. kubectl apply -f . /crd
  3. kubectl apply -f . /default
    Error from server (NotFound): error when creating "default/apps_v1_deployment_tortoise-controller-manager.yaml": namespaces "tortoise-system" not found
    Error from server (NotFound): error when creating "default/cert-manager.io_v1_certificate_tortoise-serving-cert.yaml": namespaces "tortoise-system" not found
    Error from server (NotFound): error when creating "default/cert-manager.io_v1_issuer_tortoise-selfsigned-issuer.yaml": namespaces "tortoise-system" not found
    Error from server (NotFound): error when creating "default/rbac.authorization.k8s.io_v1_role_tortoise-leader-election-role.yaml": namespaces "tortoise-system" not found
    Error from server (NotFound): error when creating "default/rbac.authorization.k8s.io_v1_rolebinding_tortoise-leader-election-rolebinding.yaml": namespaces "tortoise-system" not found
    Error from server (NotFound): error when creating "default/v1_configmap_tortoise-manager-config.yaml": namespaces "tortoise-system" not found
  4. kubectl apply -f . /default

This procedure has been used to deploy tortoise.