From a33f49af4076bdaffa8d4d5770de604e177ddf1d Mon Sep 17 00:00:00 2001 From: Florian BEZANNIER Date: Wed, 14 Apr 2021 14:36:02 +0200 Subject: [PATCH 1/3] fix getSubnets for podman --- pkg/cluster/internal/providers/podman/provision.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cluster/internal/providers/podman/provision.go b/pkg/cluster/internal/providers/podman/provision.go index fc04fd92c2..8a0290b0ad 100644 --- a/pkg/cluster/internal/providers/podman/provision.go +++ b/pkg/cluster/internal/providers/podman/provision.go @@ -281,7 +281,7 @@ func getProxyEnv(cfg *config.Cluster) (map[string]string, error) { } func getSubnets(networkName string) ([]string, error) { - format := `{{range (index (index . "IPAM") "Config")}}{{index . "Subnet"}} {{end}}` + format := `{{index (index .plugins 0).ipam.ranges 0 0 "subnet"}}` cmd := exec.Command("podman", "network", "inspect", "-f", format, networkName) lines, err := exec.OutputLines(cmd) if err != nil { From d711f6f3030a2f02c4fc172f8d2efd3d5b054398 Mon Sep 17 00:00:00 2001 From: Florian BEZANNIER Date: Thu, 15 Apr 2021 17:14:56 +0200 Subject: [PATCH 2/3] handle multiple subnets --- pkg/cluster/internal/providers/podman/provision.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cluster/internal/providers/podman/provision.go b/pkg/cluster/internal/providers/podman/provision.go index 8a0290b0ad..c42c18ebf2 100644 --- a/pkg/cluster/internal/providers/podman/provision.go +++ b/pkg/cluster/internal/providers/podman/provision.go @@ -281,7 +281,7 @@ func getProxyEnv(cfg *config.Cluster) (map[string]string, error) { } func getSubnets(networkName string) ([]string, error) { - format := `{{index (index .plugins 0).ipam.ranges 0 0 "subnet"}}` + format := '{{ range (index (index (index (index . "plugins") 0 ) "ipam" ) "ranges")}}{{ index ( index . 0 ) "subnet" }} {{end}}' cmd := exec.Command("podman", "network", "inspect", "-f", format, networkName) lines, err := exec.OutputLines(cmd) if err != nil { From 731b25943bd3c110aef562b814534ffa3902a351 Mon Sep 17 00:00:00 2001 From: Florian BEZANNIER Date: Thu, 15 Apr 2021 18:04:36 +0200 Subject: [PATCH 3/3] handle multiple subnets fix --- pkg/cluster/internal/providers/podman/provision.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cluster/internal/providers/podman/provision.go b/pkg/cluster/internal/providers/podman/provision.go index c42c18ebf2..d6c166f09c 100644 --- a/pkg/cluster/internal/providers/podman/provision.go +++ b/pkg/cluster/internal/providers/podman/provision.go @@ -281,7 +281,7 @@ func getProxyEnv(cfg *config.Cluster) (map[string]string, error) { } func getSubnets(networkName string) ([]string, error) { - format := '{{ range (index (index (index (index . "plugins") 0 ) "ipam" ) "ranges")}}{{ index ( index . 0 ) "subnet" }} {{end}}' + format := `{{ range (index (index (index (index . "plugins") 0 ) "ipam" ) "ranges")}}{{ index ( index . 0 ) "subnet" }} {{end}}` cmd := exec.Command("podman", "network", "inspect", "-f", format, networkName) lines, err := exec.OutputLines(cmd) if err != nil {