kubesphere / kubesphere/kubekey
panic: runtime error: index out of range [0] with length 0 with ipv6 calico config file
- Dominant language
- Go
- Stars
- 2.9k
- Forks
- 834
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 31
Description
### What is version of KubeKey has the issue?
v3.1.7
### What is your os environment?
Ubuntu22.04
### KubeKey config file
```yaml
cat config.yaml
apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
name: sample
spec:
hosts:
- {name: ubuntu, address: "127.0.0.1", internalAddress: "127.0.0.1", privateKeyPath: "~/.ssh/id_ed25519"}
roleGroups:
etcd:
- ubuntu
control-plane:
- ubuntu
worker:
- ubuntu
controlPlaneEndpoint:
## Internal loadbalancer for apiservers
# internalLoadbalancer: haproxy
domain: ::1
address: ""
port: 6443
kubernetes:
version: v1.28.6
clusterName: cluster.local
autoRenewCerts: true
containerManager: containerd
# apiserverArgs:
# - service-node-port-range=1-65535
etcd:
type: kubekey
network:
plugin: calico
kubePodsCIDR: "fd00:10:244::/48"
kubeServiceCIDR: "fd00:10:245::/112"
## multus support. https://github.com/k8snetworkplumbingwg/multus-cni
multusCNI:
enabled: true
addons: []
```
### A clear and concise description of what happend.
I want to deploy a standalone cluster of k8s and with calico's ipv6, but I found index out of range [0] with length 0 error. May i ask does kubekey support ipv6? or is my configuration wrong? I would be delighted to receive a response,thx
### Relevant log output
```shell
11:18:37 CST [InstallKubeBinariesModule] Enable kubelet service
11:18:37 CST success: [ubuntu]
11:18:37 CST [InstallKubeBinariesModule] Generate kubelet env
11:18:37 CST success: [ubuntu]
11:18:37 CST [InitKubernetesModule] Generate kubeadm config
panic: runtime error: index out of range [0] with length 0
goroutine 633 [running]:
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/util.networkRange(0xc00063f890)
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/util/ip.go:125 +0x14e
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/util.GetAvailableIP({0xc00051bc50?, 0x11?})
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/util/ip.go:79 +0x4a
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/util.ParseIp({0xc00051bc50?, 0x11?})
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/util/ip.go:40 +0xfd
github.com/kubesphere/kubekey/v3/cmd/kk/apis/kubekey/v1alpha2.(*ClusterSpec).GenerateCertSANs(0xc0002c3800)
github.com/kubesphere/kubekey/v3/cmd/kk/apis/kubekey/v1alpha2/cluster_types.go:157 +0x2b8
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/kubernetes.(*GenerateKubeadmConfig).Execute(0xc000a686e0, {0x2890ed0, 0xc0002e6a80})
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/kubernetes/tasks.go:294 +0x14bb
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/task.(*RemoteTask).ExecuteWithRetry(0xc000afea80, {0x2890ed0, 0xc0002e6a80})
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/task/remote_task.go:216 +0x119
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/task.(*RemoteTask).Run(0xc000afea80, {0x2890ed0, 0xc0002e6a80}, {0x2897cb0, 0xc00071c9f0}, 0x9a3e06?, 0xc000534780?)
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/task/remote_task.go:152 +0x1c5
created by github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/task.(*RemoteTask).RunWithTimeout
github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/task/remote_task.go:109 +0x16d
```
### Additional information
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with cmd/kk/pkg/core/util/ip.go, especially networkRange, GetAvailableIP, and ParseIp, then trace their use from GenerateCertSANs in cmd/kk/apis/kubekey/v1alpha2/cluster_types.go. Reproduce the supplied IPv6 Calico configuration and determine whether the result should support it without panicking or report a clear configuration error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- infrastructure, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100