From c287943bdd5e5079c1a1af2c9615d84f3d9ef158 Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Wed, 27 Apr 2022 16:06:16 +0800 Subject: [PATCH] Add status.hostIPs in ConvertDownwardAPIFieldLabel --- pkg/apis/core/pods/helpers.go | 1 + pkg/apis/core/pods/helpers_test.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/pkg/apis/core/pods/helpers.go b/pkg/apis/core/pods/helpers.go index 71810c5005c..defc69c11f5 100644 --- a/pkg/apis/core/pods/helpers.go +++ b/pkg/apis/core/pods/helpers.go @@ -84,6 +84,7 @@ func ConvertDownwardAPIFieldLabel(version, label, value string) (string, string, "spec.schedulerName", "status.phase", "status.hostIP", + "status.hostIPs", "status.podIP", "status.podIPs": return label, value, nil diff --git a/pkg/apis/core/pods/helpers_test.go b/pkg/apis/core/pods/helpers_test.go index 5552a55a720..791268fe47d 100644 --- a/pkg/apis/core/pods/helpers_test.go +++ b/pkg/apis/core/pods/helpers_test.go @@ -203,6 +203,20 @@ func TestConvertDownwardAPIFieldLabel(t *testing.T) { expectedLabel: "status.podIPs", expectedValue: "10.244.0.6", }, + { + version: "v1", + label: "status.hostIPs", + value: "10.244.0.6,fd00::6", + expectedLabel: "status.hostIPs", + expectedValue: "10.244.0.6,fd00::6", + }, + { + version: "v1", + label: "status.hostIPs", + value: "10.244.0.6", + expectedLabel: "status.hostIPs", + expectedValue: "10.244.0.6", + }, } for _, tc := range testCases { label, value, err := ConvertDownwardAPIFieldLabel(tc.version, tc.label, tc.value)