mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Merge pull request #26096 from euank/set-pod-ip
Automatic merge from submit-queue rkt: Pass through podIP This is needed for the /etc/hosts mount and the downward API to work. Furthermore, this is required for the reported `PodStatus` to be correct. The `Status` bit mostly worked prior to #25062, and this restores that functionality in addition to the new functionality. In retrospect, the regression in status is large enough the prior PR should have included at least some of this; my bad for not realizing the full implications there. #25902 is needed for downwards api stuff, but either merge order is fine as neither will break badly by itself. cc @yifan-gu @dcbw
This commit is contained in:
commit
350efaf13d
129
pkg/kubelet/network/mock_network/network_plugins.go
Normal file
129
pkg/kubelet/network/mock_network/network_plugins.go
Normal file
@ -0,0 +1,129 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Generated code, generated via: `mockgen k8s.io/kubernetes/pkg/kubelet/network NetworkPlugin > $GOPATH/src/k8s.io/kubernetes/pkg/kubelet/network/mock_network/network_plugins.go`
|
||||
// Edited by hand for boilerplate and gofmt.
|
||||
// TODO, this should be autogenerated/autoupdated by scripts.
|
||||
|
||||
package mock_network
|
||||
|
||||
import (
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
componentconfig "k8s.io/kubernetes/pkg/apis/componentconfig"
|
||||
container "k8s.io/kubernetes/pkg/kubelet/container"
|
||||
network "k8s.io/kubernetes/pkg/kubelet/network"
|
||||
sets "k8s.io/kubernetes/pkg/util/sets"
|
||||
)
|
||||
|
||||
// Mock of NetworkPlugin interface
|
||||
type MockNetworkPlugin struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *_MockNetworkPluginRecorder
|
||||
}
|
||||
|
||||
// Recorder for MockNetworkPlugin (not exported)
|
||||
type _MockNetworkPluginRecorder struct {
|
||||
mock *MockNetworkPlugin
|
||||
}
|
||||
|
||||
func NewMockNetworkPlugin(ctrl *gomock.Controller) *MockNetworkPlugin {
|
||||
mock := &MockNetworkPlugin{ctrl: ctrl}
|
||||
mock.recorder = &_MockNetworkPluginRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
func (_m *MockNetworkPlugin) EXPECT() *_MockNetworkPluginRecorder {
|
||||
return _m.recorder
|
||||
}
|
||||
|
||||
func (_m *MockNetworkPlugin) Capabilities() sets.Int {
|
||||
ret := _m.ctrl.Call(_m, "Capabilities")
|
||||
ret0, _ := ret[0].(sets.Int)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockNetworkPluginRecorder) Capabilities() *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "Capabilities")
|
||||
}
|
||||
|
||||
func (_m *MockNetworkPlugin) Event(_param0 string, _param1 map[string]interface{}) {
|
||||
_m.ctrl.Call(_m, "Event", _param0, _param1)
|
||||
}
|
||||
|
||||
func (_mr *_MockNetworkPluginRecorder) Event(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "Event", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockNetworkPlugin) GetPodNetworkStatus(_param0 string, _param1 string, _param2 container.ContainerID) (*network.PodNetworkStatus, error) {
|
||||
ret := _m.ctrl.Call(_m, "GetPodNetworkStatus", _param0, _param1, _param2)
|
||||
ret0, _ := ret[0].(*network.PodNetworkStatus)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
func (_mr *_MockNetworkPluginRecorder) GetPodNetworkStatus(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "GetPodNetworkStatus", arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
func (_m *MockNetworkPlugin) Init(_param0 network.Host, _param1 componentconfig.HairpinMode) error {
|
||||
ret := _m.ctrl.Call(_m, "Init", _param0, _param1)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockNetworkPluginRecorder) Init(arg0, arg1 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "Init", arg0, arg1)
|
||||
}
|
||||
|
||||
func (_m *MockNetworkPlugin) Name() string {
|
||||
ret := _m.ctrl.Call(_m, "Name")
|
||||
ret0, _ := ret[0].(string)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockNetworkPluginRecorder) Name() *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "Name")
|
||||
}
|
||||
|
||||
func (_m *MockNetworkPlugin) SetUpPod(_param0 string, _param1 string, _param2 container.ContainerID) error {
|
||||
ret := _m.ctrl.Call(_m, "SetUpPod", _param0, _param1, _param2)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockNetworkPluginRecorder) SetUpPod(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "SetUpPod", arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
func (_m *MockNetworkPlugin) Status() error {
|
||||
ret := _m.ctrl.Call(_m, "Status")
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockNetworkPluginRecorder) Status() *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "Status")
|
||||
}
|
||||
|
||||
func (_m *MockNetworkPlugin) TearDownPod(_param0 string, _param1 string, _param2 container.ContainerID) error {
|
||||
ret := _m.ctrl.Call(_m, "TearDownPod", _param0, _param1, _param2)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockNetworkPluginRecorder) TearDownPod(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "TearDownPod", arg0, arg1, arg2)
|
||||
}
|
@ -104,7 +104,6 @@ const (
|
||||
dockerAuthTemplate = `{"rktKind":"dockerAuth","rktVersion":"v1","registries":[%q],"credentials":{"user":%q,"password":%q}}`
|
||||
|
||||
defaultRktAPIServiceAddr = "localhost:15441"
|
||||
defaultNetworkName = "rkt.kubernetes.io"
|
||||
|
||||
// ndots specifies the minimum number of dots that a domain name must contain for the resolver to consider it as FQDN (fully-qualified)
|
||||
// we want to able to consider SRV lookup names like _dns._udp.kube-dns.default.svc to be considered relative.
|
||||
@ -563,7 +562,7 @@ func setApp(imgManifest *appcschema.ImageManifest, c *api.Container, opts *kubec
|
||||
}
|
||||
|
||||
// makePodManifest transforms a kubelet pod spec to the rkt pod manifest.
|
||||
func (r *Runtime) makePodManifest(pod *api.Pod, pullSecrets []api.Secret) (*appcschema.PodManifest, error) {
|
||||
func (r *Runtime) makePodManifest(pod *api.Pod, podIP string, pullSecrets []api.Secret) (*appcschema.PodManifest, error) {
|
||||
manifest := appcschema.BlankPodManifest()
|
||||
|
||||
listResp, err := r.apisvc.ListPods(context.Background(), &rktapi.ListPodsRequest{
|
||||
@ -607,7 +606,7 @@ func (r *Runtime) makePodManifest(pod *api.Pod, pullSecrets []api.Secret) (*appc
|
||||
}
|
||||
|
||||
for _, c := range pod.Spec.Containers {
|
||||
err := r.newAppcRuntimeApp(pod, c, requiresPrivileged, pullSecrets, manifest)
|
||||
err := r.newAppcRuntimeApp(pod, podIP, c, requiresPrivileged, pullSecrets, manifest)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -698,11 +697,10 @@ func (r *Runtime) makeContainerLogMount(opts *kubecontainer.RunContainerOptions,
|
||||
return &mnt, nil
|
||||
}
|
||||
|
||||
func (r *Runtime) newAppcRuntimeApp(pod *api.Pod, c api.Container, requiresPrivileged bool, pullSecrets []api.Secret, manifest *appcschema.PodManifest) error {
|
||||
func (r *Runtime) newAppcRuntimeApp(pod *api.Pod, podIP string, c api.Container, requiresPrivileged bool, pullSecrets []api.Secret, manifest *appcschema.PodManifest) error {
|
||||
if requiresPrivileged && !capabilities.Get().AllowPrivileged {
|
||||
return fmt.Errorf("cannot make %q: running a custom stage1 requires a privileged security context", format.Pod(pod))
|
||||
}
|
||||
|
||||
if err, _ := r.imagePuller.PullImage(pod, &c, pullSecrets); err != nil {
|
||||
return nil
|
||||
}
|
||||
@ -725,7 +723,7 @@ func (r *Runtime) newAppcRuntimeApp(pod *api.Pod, c api.Container, requiresPrivi
|
||||
}
|
||||
|
||||
// TODO: determine how this should be handled for rkt
|
||||
opts, err := r.runtimeHelper.GenerateRunContainerOptions(pod, &c, "")
|
||||
opts, err := r.runtimeHelper.GenerateRunContainerOptions(pod, &c, podIP)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -988,9 +986,9 @@ func (r *Runtime) preparePodArgs(manifest *appcschema.PodManifest, manifestFileN
|
||||
//
|
||||
// On success, it will return a string that represents name of the unit file
|
||||
// and the runtime pod.
|
||||
func (r *Runtime) preparePod(pod *api.Pod, pullSecrets []api.Secret, netnsName string) (string, *kubecontainer.Pod, error) {
|
||||
func (r *Runtime) preparePod(pod *api.Pod, podIP string, pullSecrets []api.Secret, netnsName string) (string, *kubecontainer.Pod, error) {
|
||||
// Generate the appc pod manifest from the k8s pod spec.
|
||||
manifest, err := r.makePodManifest(pod, pullSecrets)
|
||||
manifest, err := r.makePodManifest(pod, podIP, pullSecrets)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
@ -1108,14 +1106,18 @@ func netnsPathFromName(netnsName string) string {
|
||||
return fmt.Sprintf("/var/run/netns/%s", netnsName)
|
||||
}
|
||||
|
||||
func (r *Runtime) setupPodNetwork(pod *api.Pod) (string, error) {
|
||||
// setupPodNetwork creates a network namespace for the given pod and calls
|
||||
// configured NetworkPlugin's setup function on it.
|
||||
// It returns the namespace name, configured IP (if available), and an error if
|
||||
// one occured.
|
||||
func (r *Runtime) setupPodNetwork(pod *api.Pod) (string, string, error) {
|
||||
netnsName := makePodNetnsName(pod.UID)
|
||||
|
||||
// Create a new network namespace for the pod
|
||||
r.execer.Command("ip", "netns", "del", netnsName).Output()
|
||||
_, err := r.execer.Command("ip", "netns", "add", netnsName).Output()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to create pod network namespace: %v", err)
|
||||
return "", "", fmt.Errorf("failed to create pod network namespace: %v", err)
|
||||
}
|
||||
|
||||
// Set up networking with the network plugin
|
||||
@ -1123,7 +1125,11 @@ func (r *Runtime) setupPodNetwork(pod *api.Pod) (string, error) {
|
||||
containerID := kubecontainer.ContainerID{ID: string(pod.UID)}
|
||||
err = r.networkPlugin.SetUpPod(pod.Namespace, pod.Name, containerID)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to set up pod network: %v", err)
|
||||
return "", "", fmt.Errorf("failed to set up pod network: %v", err)
|
||||
}
|
||||
status, err := r.networkPlugin.GetPodNetworkStatus(pod.Namespace, pod.Name, containerID)
|
||||
if err != nil {
|
||||
return "", "", fmt.Errorf("failed to get status of pod network: %v", err)
|
||||
}
|
||||
|
||||
if r.configureHairpinMode {
|
||||
@ -1132,7 +1138,7 @@ func (r *Runtime) setupPodNetwork(pod *api.Pod) (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return netnsName, nil
|
||||
return netnsName, status.IP.String(), nil
|
||||
}
|
||||
|
||||
// RunPod first creates the unit file for a pod, and then
|
||||
@ -1142,15 +1148,16 @@ func (r *Runtime) RunPod(pod *api.Pod, pullSecrets []api.Secret) error {
|
||||
|
||||
var err error
|
||||
var netnsName string
|
||||
var podIP string
|
||||
if !kubecontainer.IsHostNetworkPod(pod) {
|
||||
netnsName, err = r.setupPodNetwork(pod)
|
||||
netnsName, podIP, err = r.setupPodNetwork(pod)
|
||||
if err != nil {
|
||||
r.cleanupPodNetwork(pod)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
name, runtimePod, prepareErr := r.preparePod(pod, pullSecrets, netnsName)
|
||||
name, runtimePod, prepareErr := r.preparePod(pod, podIP, pullSecrets, netnsName)
|
||||
|
||||
// Set container references and generate events.
|
||||
// If preparedPod fails, then send out 'failed' events for each container.
|
||||
@ -2070,7 +2077,6 @@ func (r *Runtime) GetPodStatus(uid kubetypes.UID, name, namespace string) (*kube
|
||||
return nil, fmt.Errorf("couldn't list pods: %v", err)
|
||||
}
|
||||
|
||||
var latestPod *rktapi.Pod
|
||||
var latestRestartCount int = -1
|
||||
|
||||
// In this loop, we group all containers from all pods together,
|
||||
@ -2083,7 +2089,6 @@ func (r *Runtime) GetPodStatus(uid kubetypes.UID, name, namespace string) (*kube
|
||||
}
|
||||
|
||||
if restartCount > latestRestartCount {
|
||||
latestPod = pod
|
||||
latestRestartCount = restartCount
|
||||
}
|
||||
|
||||
@ -2099,13 +2104,10 @@ func (r *Runtime) GetPodStatus(uid kubetypes.UID, name, namespace string) (*kube
|
||||
}
|
||||
}
|
||||
|
||||
if latestPod != nil {
|
||||
// Try to fill the IP info.
|
||||
for _, n := range latestPod.Networks {
|
||||
if n.Name == defaultNetworkName {
|
||||
podStatus.IP = n.Ipv4
|
||||
}
|
||||
}
|
||||
// TODO(euank): this will not work in host networking mode
|
||||
containerID := kubecontainer.ContainerID{ID: string(uid)}
|
||||
if status, err := r.networkPlugin.GetPodNetworkStatus(namespace, name, containerID); err == nil {
|
||||
podStatus.IP = status.IP.String()
|
||||
}
|
||||
|
||||
return podStatus, nil
|
||||
|
@ -19,6 +19,7 @@ package rkt
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"sort"
|
||||
"testing"
|
||||
@ -35,6 +36,8 @@ import (
|
||||
containertesting "k8s.io/kubernetes/pkg/kubelet/container/testing"
|
||||
kubetesting "k8s.io/kubernetes/pkg/kubelet/container/testing"
|
||||
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
|
||||
"k8s.io/kubernetes/pkg/kubelet/network"
|
||||
"k8s.io/kubernetes/pkg/kubelet/network/mock_network"
|
||||
"k8s.io/kubernetes/pkg/kubelet/rkt/mock_os"
|
||||
"k8s.io/kubernetes/pkg/kubelet/types"
|
||||
kubetypes "k8s.io/kubernetes/pkg/types"
|
||||
@ -68,8 +71,7 @@ func mustRktHash(hash string) *appctypes.Hash {
|
||||
}
|
||||
|
||||
func makeRktPod(rktPodState rktapi.PodState,
|
||||
rktPodID, podUID, podName, podNamespace,
|
||||
podIP string, podCreatedAt, podStartedAt int64,
|
||||
rktPodID, podUID, podName, podNamespace string, podCreatedAt, podStartedAt int64,
|
||||
podRestartCount string, appNames, imgIDs, imgNames,
|
||||
containerHashes []string, appStates []rktapi.AppState,
|
||||
exitcodes []int32) *rktapi.Pod {
|
||||
@ -149,7 +151,6 @@ func makeRktPod(rktPodState rktapi.PodState,
|
||||
return &rktapi.Pod{
|
||||
Id: rktPodID,
|
||||
State: rktPodState,
|
||||
Networks: []*rktapi.Network{{Name: defaultNetworkName, Ipv4: podIP}},
|
||||
Apps: apps,
|
||||
Manifest: mustMarshalPodManifest(podManifest),
|
||||
StartedAt: podStartedAt,
|
||||
@ -367,7 +368,7 @@ func TestGetPods(t *testing.T) {
|
||||
[]*rktapi.Pod{
|
||||
makeRktPod(rktapi.PodState_POD_STATE_RUNNING,
|
||||
"uuid-4002", "42", "guestbook", "default",
|
||||
"10.10.10.42", ns(10), ns(10), "7",
|
||||
ns(10), ns(10), "7",
|
||||
[]string{"app-1", "app-2"},
|
||||
[]string{"img-id-1", "img-id-2"},
|
||||
[]string{"img-name-1", "img-name-2"},
|
||||
@ -405,7 +406,7 @@ func TestGetPods(t *testing.T) {
|
||||
[]*rktapi.Pod{
|
||||
makeRktPod(rktapi.PodState_POD_STATE_RUNNING,
|
||||
"uuid-4002", "42", "guestbook", "default",
|
||||
"10.10.10.42", ns(10), ns(20), "7",
|
||||
ns(10), ns(20), "7",
|
||||
[]string{"app-1", "app-2"},
|
||||
[]string{"img-id-1", "img-id-2"},
|
||||
[]string{"img-name-1", "img-name-2"},
|
||||
@ -415,7 +416,7 @@ func TestGetPods(t *testing.T) {
|
||||
),
|
||||
makeRktPod(rktapi.PodState_POD_STATE_EXITED,
|
||||
"uuid-4003", "43", "guestbook", "default",
|
||||
"10.10.10.43", ns(30), ns(40), "7",
|
||||
ns(30), ns(40), "7",
|
||||
[]string{"app-11", "app-22"},
|
||||
[]string{"img-id-11", "img-id-22"},
|
||||
[]string{"img-name-11", "img-name-22"},
|
||||
@ -425,7 +426,7 @@ func TestGetPods(t *testing.T) {
|
||||
),
|
||||
makeRktPod(rktapi.PodState_POD_STATE_EXITED,
|
||||
"uuid-4004", "43", "guestbook", "default",
|
||||
"10.10.10.44", ns(50), ns(60), "8",
|
||||
ns(50), ns(60), "8",
|
||||
[]string{"app-11", "app-22"},
|
||||
[]string{"img-id-11", "img-id-22"},
|
||||
[]string{"img-name-11", "img-name-22"},
|
||||
@ -557,8 +558,11 @@ func TestGetPodsFilters(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPodStatus(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
fr := newFakeRktInterface()
|
||||
fs := newFakeSystemd()
|
||||
fnp := mock_network.NewMockNetworkPlugin(ctrl)
|
||||
fos := &containertesting.FakeOS{}
|
||||
frh := &fakeRuntimeHelper{}
|
||||
r := &Runtime{
|
||||
@ -566,6 +570,7 @@ func TestGetPodStatus(t *testing.T) {
|
||||
systemd: fs,
|
||||
runtimeHelper: frh,
|
||||
os: fos,
|
||||
networkPlugin: fnp,
|
||||
}
|
||||
|
||||
ns := func(seconds int64) int64 {
|
||||
@ -586,7 +591,7 @@ func TestGetPodStatus(t *testing.T) {
|
||||
[]*rktapi.Pod{
|
||||
makeRktPod(rktapi.PodState_POD_STATE_RUNNING,
|
||||
"uuid-4002", "42", "guestbook", "default",
|
||||
"10.10.10.42", ns(10), ns(20), "7",
|
||||
ns(10), ns(20), "7",
|
||||
[]string{"app-1", "app-2"},
|
||||
[]string{"img-id-1", "img-id-2"},
|
||||
[]string{"img-name-1", "img-name-2"},
|
||||
@ -634,7 +639,7 @@ func TestGetPodStatus(t *testing.T) {
|
||||
[]*rktapi.Pod{
|
||||
makeRktPod(rktapi.PodState_POD_STATE_EXITED,
|
||||
"uuid-4002", "42", "guestbook", "default",
|
||||
"10.10.10.42", ns(10), ns(20), "7",
|
||||
ns(10), ns(20), "7",
|
||||
[]string{"app-1", "app-2"},
|
||||
[]string{"img-id-1", "img-id-2"},
|
||||
[]string{"img-name-1", "img-name-2"},
|
||||
@ -644,7 +649,7 @@ func TestGetPodStatus(t *testing.T) {
|
||||
),
|
||||
makeRktPod(rktapi.PodState_POD_STATE_RUNNING, // The latest pod is running.
|
||||
"uuid-4003", "42", "guestbook", "default",
|
||||
"10.10.10.42", ns(10), ns(20), "10",
|
||||
ns(10), ns(20), "10",
|
||||
[]string{"app-1", "app-2"},
|
||||
[]string{"img-id-1", "img-id-2"},
|
||||
[]string{"img-name-1", "img-name-2"},
|
||||
@ -716,9 +721,6 @@ func TestGetPodStatus(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
for i, tt := range tests {
|
||||
testCaseHint := fmt.Sprintf("test case #%d", i)
|
||||
fr.pods = tt.pods
|
||||
@ -738,6 +740,14 @@ func TestGetPodStatus(t *testing.T) {
|
||||
return mockFI, nil
|
||||
}
|
||||
|
||||
if tt.result.IP != "" {
|
||||
fnp.EXPECT().GetPodNetworkStatus("default", "guestbook", kubecontainer.ContainerID{ID: "42"}).
|
||||
Return(&network.PodNetworkStatus{IP: net.ParseIP(tt.result.IP)}, nil)
|
||||
} else {
|
||||
fnp.EXPECT().GetPodNetworkStatus("default", "guestbook", kubecontainer.ContainerID{ID: "42"}).
|
||||
Return(nil, fmt.Errorf("no such network"))
|
||||
}
|
||||
|
||||
status, err := r.GetPodStatus("42", "guestbook", "default")
|
||||
if err != nil {
|
||||
t.Errorf("test case #%d: unexpected error: %v", i, err)
|
||||
@ -1689,7 +1699,7 @@ func TestMakePodManifestAnnotations(t *testing.T) {
|
||||
for i, testCase := range testCases {
|
||||
hint := fmt.Sprintf("case #%d", i)
|
||||
|
||||
result, err := r.makePodManifest(testCase.in, []api.Secret{})
|
||||
result, err := r.makePodManifest(testCase.in, "", []api.Secret{})
|
||||
assert.Equal(t, err, testCase.outerr, hint)
|
||||
if err == nil {
|
||||
sort.Sort(annotationsByName(result.Annotations))
|
||||
|
Loading…
Reference in New Issue
Block a user