Skip to content

Commit 9453255

Browse files
Merge pull request #20116 from openshift-cherrypick-robot/cherry-pick-20013-to-release-3.10
[release-3.10] Fix default image paths used in network diagnostics
2 parents 2926935 + c604aa4 commit 9453255

File tree

1 file changed

+14
-5
lines changed
  • pkg/oc/admin/diagnostics/diagnostics/cluster/network/in_pod/util

1 file changed

+14
-5
lines changed

pkg/oc/admin/diagnostics/diagnostics/cluster/network/in_pod/util/util.go

+14-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
networktypedclient "github.com/openshift/origin/pkg/network/generated/internalclientset/typed/network/internalversion"
1818
osclientcmd "github.com/openshift/origin/pkg/oc/cli/util/clientcmd"
1919
"github.com/openshift/origin/pkg/util/netutils"
20+
"github.com/openshift/origin/pkg/version"
2021
)
2122

2223
const (
@@ -37,15 +38,23 @@ const (
3738
NetworkDiagDefaultTestPodPort = 8080
3839
)
3940

40-
func GetNetworkDiagDefaultPodImage() string {
41+
func getImageFromTemplate(name string) string {
4142
imageTemplate := variable.NewDefaultImageTemplate()
42-
imageTemplate.Format = variable.DefaultImagePrefix + ":${version}"
43-
return imageTemplate.ExpandOrDie("")
43+
imageTemplate.Format = variable.Expand(imageTemplate.Format, func(s string) (string, bool) {
44+
if s == "version" {
45+
return strings.TrimRight("v"+version.Get().Major+"."+version.Get().Minor, "+"), true
46+
}
47+
return "", false
48+
}, variable.Identity)
49+
return imageTemplate.ExpandOrDie(name)
50+
}
51+
52+
func GetNetworkDiagDefaultPodImage() string {
53+
return getImageFromTemplate("control-plane")
4454
}
4555

4656
func GetNetworkDiagDefaultTestPodImage() string {
47-
imageTemplate := variable.NewDefaultImageTemplate()
48-
return imageTemplate.ExpandOrDie("deployer")
57+
return getImageFromTemplate("deployer")
4958
}
5059

5160
func GetOpenShiftNetworkPlugin(clusterNetworkClient networktypedclient.ClusterNetworksGetter) (string, bool, error) {

0 commit comments

Comments
 (0)