Move GetHostname() from k/k/pkg/util/node to k/component-helpers/node/util

In fact, this actually uses pkg/util/node's GetHostname() but takes
the unit tests from cmd/kubeadm/app/util's private fork of that
function since they were more extensive. (Of course the fact that
kubeadm had a private fork of this function is a strong argument for
moving it to component-helpers.)
This commit is contained in:
Dan Winship
2023-01-26 09:27:21 -05:00
parent d29e3bd7aa
commit f994ae2521
10 changed files with 19 additions and 72 deletions

View File

@@ -42,7 +42,7 @@ import (
"k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/wait"
volumehelpers "k8s.io/cloud-provider/volume/helpers"
"k8s.io/kubernetes/pkg/util/node"
nodeutil "k8s.io/component-helpers/node/util"
"k8s.io/kubernetes/pkg/volume"
volutil "k8s.io/kubernetes/pkg/volume/util"
)
@@ -327,7 +327,7 @@ func (util *rbdUtil) rbdUnlock(b rbdMounter) error {
}
// Construct lock id using host name and a magic prefix.
hostName, err := node.GetHostname("")
hostName, err := nodeutil.GetHostname("")
if err != nil {
return err
}