mirror of
https://github.com/kubernetes-sigs/kind.git
synced 2025-11-30 23:16:04 +07:00
fix kind get clusters via nerdctl
Now raising errors when using nerdctl for the provider
```console
> ./kind --version
kind version 0.26.0-alpha
> nerdctl --version
nerdctl version 2.0.1
> ./kind get clusters
ERROR: failed to list clusters: command "nerdctl ps -a --filter label=io.x-k8s.kind.cluster --format '{{index .Labels "io.x-k8s.kind.cluster"}}'" failed with error: exit status 1
Command Output: time="2024-12-09T18:01:03+09:00" level=fatal msg="template: :1:2: executing \"\" at <index .Labels \"io.x-k8s.kind.cluster\">: error calling index: cannot index slice/array with type string"
```
nerdctl fixed the `.Label` behavior in v1.7.0.
2af4cef9e7
However `index .Labels` syntax is not yet supported at least in v2.0.1.
(The style is also used for podman provider, and it is available)
This commit follows up https://github.com/kubernetes-sigs/kind/pull/3429
Signed-off-by: Kenichi Kamiya <kachick1@gmail.com>
This commit is contained in:
@@ -125,7 +125,7 @@ func (p *provider) ListClusters() ([]string, error) {
|
||||
// filter for nodes with the cluster label
|
||||
"--filter", "label="+clusterLabelKey,
|
||||
// format to include the cluster name
|
||||
"--format", fmt.Sprintf(`{{index .Labels "%s"}}`, clusterLabelKey),
|
||||
"--format", fmt.Sprintf(`{{.Label "%s"}}`, clusterLabelKey),
|
||||
)
|
||||
lines, err := exec.OutputLines(cmd)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user