mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 03:08:15 +00:00
Merge pull request #29048 from justinsb/volumes_nodename_not_hostname
Automatic merge from submit-queue Use strongly-typed types.NodeName for a node name We had another bug where we confused the hostname with the NodeName. Also, if we want to use different values for the Node.Name (which is an important step for making installation easier), we need to keep better control over this. A tedious but mechanical commit therefore, to change all uses of the node name to use types.NodeName
This commit is contained in:
@@ -128,7 +128,7 @@ func newTestKubeletWithImageList(
|
||||
kubelet.os = &containertest.FakeOS{}
|
||||
|
||||
kubelet.hostname = testKubeletHostname
|
||||
kubelet.nodeName = testKubeletHostname
|
||||
kubelet.nodeName = types.NodeName(testKubeletHostname)
|
||||
kubelet.runtimeState = newRuntimeState(maxWaitForContainerRuntime)
|
||||
kubelet.runtimeState.setNetworkState(nil)
|
||||
kubelet.networkPlugin, _ = network.InitNetworkPlugin([]network.NetworkPlugin{}, "", nettest.NewFakeHost(nil), componentconfig.HairpinNone, kubelet.nonMasqueradeCIDR, 1440)
|
||||
@@ -211,7 +211,7 @@ func newTestKubeletWithImageList(
|
||||
kubelet.resourceAnalyzer = stats.NewResourceAnalyzer(kubelet, volumeStatsAggPeriod, kubelet.containerRuntime)
|
||||
nodeRef := &api.ObjectReference{
|
||||
Kind: "Node",
|
||||
Name: kubelet.nodeName,
|
||||
Name: string(kubelet.nodeName),
|
||||
UID: types.UID(kubelet.nodeName),
|
||||
Namespace: "",
|
||||
}
|
||||
@@ -232,7 +232,7 @@ func newTestKubeletWithImageList(
|
||||
kubelet.mounter = &mount.FakeMounter{}
|
||||
kubelet.volumeManager, err = kubeletvolume.NewVolumeManager(
|
||||
controllerAttachDetachEnabled,
|
||||
kubelet.hostname,
|
||||
kubelet.nodeName,
|
||||
kubelet.podManager,
|
||||
fakeKubeClient,
|
||||
kubelet.volumePluginMgr,
|
||||
@@ -402,7 +402,7 @@ func TestHandlePortConflicts(t *testing.T) {
|
||||
|
||||
kl.nodeLister = testNodeLister{nodes: []api.Node{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: kl.nodeName},
|
||||
ObjectMeta: api.ObjectMeta{Name: string(kl.nodeName)},
|
||||
Status: api.NodeStatus{
|
||||
Allocatable: api.ResourceList{
|
||||
api.ResourcePods: *resource.NewQuantity(110, resource.DecimalSI),
|
||||
@@ -412,7 +412,7 @@ func TestHandlePortConflicts(t *testing.T) {
|
||||
}}
|
||||
kl.nodeInfo = testNodeInfo{nodes: []api.Node{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: kl.nodeName},
|
||||
ObjectMeta: api.ObjectMeta{Name: string(kl.nodeName)},
|
||||
Status: api.NodeStatus{
|
||||
Allocatable: api.ResourceList{
|
||||
api.ResourcePods: *resource.NewQuantity(110, resource.DecimalSI),
|
||||
@@ -421,7 +421,7 @@ func TestHandlePortConflicts(t *testing.T) {
|
||||
},
|
||||
}}
|
||||
|
||||
spec := api.PodSpec{NodeName: kl.nodeName, Containers: []api.Container{{Ports: []api.ContainerPort{{HostPort: 80}}}}}
|
||||
spec := api.PodSpec{NodeName: string(kl.nodeName), Containers: []api.Container{{Ports: []api.ContainerPort{{HostPort: 80}}}}}
|
||||
pods := []*api.Pod{
|
||||
podWithUidNameNsSpec("123456789", "newpod", "foo", spec),
|
||||
podWithUidNameNsSpec("987654321", "oldpod", "foo", spec),
|
||||
@@ -555,7 +555,7 @@ func TestHandleMemExceeded(t *testing.T) {
|
||||
testKubelet.fakeCadvisor.On("ImagesFsInfo").Return(cadvisorapiv2.FsInfo{}, nil)
|
||||
testKubelet.fakeCadvisor.On("RootFsInfo").Return(cadvisorapiv2.FsInfo{}, nil)
|
||||
|
||||
spec := api.PodSpec{NodeName: kl.nodeName,
|
||||
spec := api.PodSpec{NodeName: string(kl.nodeName),
|
||||
Containers: []api.Container{{Resources: api.ResourceRequirements{
|
||||
Requests: api.ResourceList{
|
||||
"memory": resource.MustParse("90"),
|
||||
@@ -1781,7 +1781,7 @@ func TestHandlePodAdditionsInvokesPodAdmitHandlers(t *testing.T) {
|
||||
kl := testKubelet.kubelet
|
||||
kl.nodeLister = testNodeLister{nodes: []api.Node{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: kl.nodeName},
|
||||
ObjectMeta: api.ObjectMeta{Name: string(kl.nodeName)},
|
||||
Status: api.NodeStatus{
|
||||
Allocatable: api.ResourceList{
|
||||
api.ResourcePods: *resource.NewQuantity(110, resource.DecimalSI),
|
||||
@@ -1791,7 +1791,7 @@ func TestHandlePodAdditionsInvokesPodAdmitHandlers(t *testing.T) {
|
||||
}}
|
||||
kl.nodeInfo = testNodeInfo{nodes: []api.Node{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: kl.nodeName},
|
||||
ObjectMeta: api.ObjectMeta{Name: string(kl.nodeName)},
|
||||
Status: api.NodeStatus{
|
||||
Allocatable: api.ResourceList{
|
||||
api.ResourcePods: *resource.NewQuantity(110, resource.DecimalSI),
|
||||
|
||||
Reference in New Issue
Block a user