Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
42da186b
Commit
42da186b
authored
Sep 21, 2018
by
Brad Hoekstra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address review comments
parent
c4ec40ec
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
27 additions
and
31 deletions
+27
-31
pod_specs.go
pkg/api/testing/pod_specs.go
+2
-2
serialization_test.go
pkg/api/testing/serialization_test.go
+1
-1
defaults_test.go
pkg/apis/apps/v1/defaults_test.go
+3
-3
defaults_test.go
pkg/apis/apps/v1beta1/defaults_test.go
+1
-1
defaults_test.go
pkg/apis/apps/v1beta2/defaults_test.go
+3
-3
fuzzer.go
pkg/apis/core/fuzzer/fuzzer.go
+2
-1
types.go
pkg/apis/core/types.go
+0
-5
defaults.go
pkg/apis/core/v1/defaults.go
+1
-2
defaults_test.go
pkg/apis/extensions/v1beta1/defaults_test.go
+2
-2
helpers_test.go
pkg/kubectl/cmd/util/helpers_test.go
+2
-1
common_test.go
pkg/kubelet/config/common_test.go
+2
-2
file_linux_test.go
pkg/kubelet/config/file_linux_test.go
+1
-1
http_test.go
pkg/kubelet/config/http_test.go
+1
-1
kubelet_pods.go
pkg/kubelet/kubelet_pods.go
+3
-3
storage_test.go
pkg/registry/core/pod/storage/storage_test.go
+3
-3
No files found.
pkg/api/testing/pod_specs.go
View file @
42da186b
...
@@ -24,7 +24,7 @@ import (
...
@@ -24,7 +24,7 @@ import (
// DeepEqualSafePodSpec returns a PodSpec which is ready to be used with apiequality.Semantic.DeepEqual
// DeepEqualSafePodSpec returns a PodSpec which is ready to be used with apiequality.Semantic.DeepEqual
func
DeepEqualSafePodSpec
()
api
.
PodSpec
{
func
DeepEqualSafePodSpec
()
api
.
PodSpec
{
grace
:=
int64
(
30
)
grace
:=
int64
(
30
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
return
api
.
PodSpec
{
return
api
.
PodSpec
{
RestartPolicy
:
api
.
RestartPolicyAlways
,
RestartPolicy
:
api
.
RestartPolicyAlways
,
DNSPolicy
:
api
.
DNSClusterFirst
,
DNSPolicy
:
api
.
DNSClusterFirst
,
...
@@ -38,7 +38,7 @@ func DeepEqualSafePodSpec() api.PodSpec {
...
@@ -38,7 +38,7 @@ func DeepEqualSafePodSpec() api.PodSpec {
// V1DeepEqualSafePodSpec returns a PodSpec which is ready to be used with apiequality.Semantic.DeepEqual
// V1DeepEqualSafePodSpec returns a PodSpec which is ready to be used with apiequality.Semantic.DeepEqual
func
V1DeepEqualSafePodSpec
()
v1
.
PodSpec
{
func
V1DeepEqualSafePodSpec
()
v1
.
PodSpec
{
grace
:=
int64
(
30
)
grace
:=
int64
(
30
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
return
v1
.
PodSpec
{
return
v1
.
PodSpec
{
RestartPolicy
:
v1
.
RestartPolicyAlways
,
RestartPolicy
:
v1
.
RestartPolicyAlways
,
DNSPolicy
:
v1
.
DNSClusterFirst
,
DNSPolicy
:
v1
.
DNSClusterFirst
,
...
...
pkg/api/testing/serialization_test.go
View file @
42da186b
...
@@ -214,7 +214,7 @@ func TestRoundTripTypes(t *testing.T) {
...
@@ -214,7 +214,7 @@ func TestRoundTripTypes(t *testing.T) {
// decoded without information loss or mutation.
// decoded without information loss or mutation.
func
TestEncodePtr
(
t
*
testing
.
T
)
{
func
TestEncodePtr
(
t
*
testing
.
T
)
{
grace
:=
int64
(
30
)
grace
:=
int64
(
30
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
pod
:=
&
api
.
Pod
{
pod
:=
&
api
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
"name"
:
"foo"
},
Labels
:
map
[
string
]
string
{
"name"
:
"foo"
},
...
...
pkg/apis/apps/v1/defaults_test.go
View file @
42da186b
...
@@ -39,7 +39,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
...
@@ -39,7 +39,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
defaultLabels
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
defaultLabels
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
maxUnavailable
:=
intstr
.
FromInt
(
1
)
maxUnavailable
:=
intstr
.
FromInt
(
1
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
defaultTemplate
:=
v1
.
PodTemplateSpec
{
defaultTemplate
:=
v1
.
PodTemplateSpec
{
Spec
:
v1
.
PodSpec
{
Spec
:
v1
.
PodSpec
{
DNSPolicy
:
v1
.
DNSClusterFirst
,
DNSPolicy
:
v1
.
DNSClusterFirst
,
...
@@ -178,7 +178,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
...
@@ -178,7 +178,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
var
defaultReplicas
int32
=
1
var
defaultReplicas
int32
=
1
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
defaultTemplate
:=
v1
.
PodTemplateSpec
{
defaultTemplate
:=
v1
.
PodTemplateSpec
{
Spec
:
v1
.
PodSpec
{
Spec
:
v1
.
PodSpec
{
DNSPolicy
:
v1
.
DNSClusterFirst
,
DNSPolicy
:
v1
.
DNSClusterFirst
,
...
@@ -291,7 +291,7 @@ func TestSetDefaultDeployment(t *testing.T) {
...
@@ -291,7 +291,7 @@ func TestSetDefaultDeployment(t *testing.T) {
defaultIntOrString
:=
intstr
.
FromString
(
"25%"
)
defaultIntOrString
:=
intstr
.
FromString
(
"25%"
)
differentIntOrString
:=
intstr
.
FromInt
(
5
)
differentIntOrString
:=
intstr
.
FromInt
(
5
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
defaultTemplate
:=
v1
.
PodTemplateSpec
{
defaultTemplate
:=
v1
.
PodTemplateSpec
{
Spec
:
v1
.
PodSpec
{
Spec
:
v1
.
PodSpec
{
DNSPolicy
:
v1
.
DNSClusterFirst
,
DNSPolicy
:
v1
.
DNSClusterFirst
,
...
...
pkg/apis/apps/v1beta1/defaults_test.go
View file @
42da186b
...
@@ -38,7 +38,7 @@ func TestSetDefaultDeployment(t *testing.T) {
...
@@ -38,7 +38,7 @@ func TestSetDefaultDeployment(t *testing.T) {
defaultIntOrString
:=
intstr
.
FromString
(
"25%"
)
defaultIntOrString
:=
intstr
.
FromString
(
"25%"
)
differentIntOrString
:=
intstr
.
FromInt
(
5
)
differentIntOrString
:=
intstr
.
FromInt
(
5
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
defaultTemplate
:=
v1
.
PodTemplateSpec
{
defaultTemplate
:=
v1
.
PodTemplateSpec
{
Spec
:
v1
.
PodSpec
{
Spec
:
v1
.
PodSpec
{
DNSPolicy
:
v1
.
DNSClusterFirst
,
DNSPolicy
:
v1
.
DNSClusterFirst
,
...
...
pkg/apis/apps/v1beta2/defaults_test.go
View file @
42da186b
...
@@ -39,7 +39,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
...
@@ -39,7 +39,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
defaultLabels
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
defaultLabels
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
maxUnavailable
:=
intstr
.
FromInt
(
1
)
maxUnavailable
:=
intstr
.
FromInt
(
1
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
defaultTemplate
:=
v1
.
PodTemplateSpec
{
defaultTemplate
:=
v1
.
PodTemplateSpec
{
Spec
:
v1
.
PodSpec
{
Spec
:
v1
.
PodSpec
{
DNSPolicy
:
v1
.
DNSClusterFirst
,
DNSPolicy
:
v1
.
DNSClusterFirst
,
...
@@ -178,7 +178,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
...
@@ -178,7 +178,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
var
defaultReplicas
int32
=
1
var
defaultReplicas
int32
=
1
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
defaultTemplate
:=
v1
.
PodTemplateSpec
{
defaultTemplate
:=
v1
.
PodTemplateSpec
{
Spec
:
v1
.
PodSpec
{
Spec
:
v1
.
PodSpec
{
DNSPolicy
:
v1
.
DNSClusterFirst
,
DNSPolicy
:
v1
.
DNSClusterFirst
,
...
@@ -291,7 +291,7 @@ func TestSetDefaultDeployment(t *testing.T) {
...
@@ -291,7 +291,7 @@ func TestSetDefaultDeployment(t *testing.T) {
defaultIntOrString
:=
intstr
.
FromString
(
"25%"
)
defaultIntOrString
:=
intstr
.
FromString
(
"25%"
)
differentIntOrString
:=
intstr
.
FromInt
(
5
)
differentIntOrString
:=
intstr
.
FromInt
(
5
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
defaultTemplate
:=
v1
.
PodTemplateSpec
{
defaultTemplate
:=
v1
.
PodTemplateSpec
{
Spec
:
v1
.
PodSpec
{
Spec
:
v1
.
PodSpec
{
DNSPolicy
:
v1
.
DNSClusterFirst
,
DNSPolicy
:
v1
.
DNSClusterFirst
,
...
...
pkg/apis/core/fuzzer/fuzzer.go
View file @
42da186b
...
@@ -23,6 +23,7 @@ import (
...
@@ -23,6 +23,7 @@ import (
fuzz
"github.com/google/gofuzz"
fuzz
"github.com/google/gofuzz"
corev1
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/api/resource"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
...
@@ -85,7 +86,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
...
@@ -85,7 +86,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
s
.
SchedulerName
=
core
.
DefaultSchedulerName
s
.
SchedulerName
=
core
.
DefaultSchedulerName
}
}
if
s
.
EnableServiceLinks
==
nil
{
if
s
.
EnableServiceLinks
==
nil
{
enableServiceLinks
:=
core
.
DefaultEnableServiceLinks
enableServiceLinks
:=
core
v1
.
DefaultEnableServiceLinks
s
.
EnableServiceLinks
=
&
enableServiceLinks
s
.
EnableServiceLinks
=
&
enableServiceLinks
}
}
},
},
...
...
pkg/apis/core/types.go
View file @
42da186b
...
@@ -2604,11 +2604,6 @@ type PodSpec struct {
...
@@ -2604,11 +2604,6 @@ type PodSpec struct {
EnableServiceLinks
*
bool
EnableServiceLinks
*
bool
}
}
const
(
// The default value for enableServiceLinks attribute.
DefaultEnableServiceLinks
=
true
)
// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
// pod's hosts file.
// pod's hosts file.
type
HostAlias
struct
{
type
HostAlias
struct
{
...
...
pkg/apis/core/v1/defaults.go
View file @
42da186b
...
@@ -23,7 +23,6 @@ import (
...
@@ -23,7 +23,6 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/intstr"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/util/parsers"
"k8s.io/kubernetes/pkg/util/parsers"
utilpointer
"k8s.io/utils/pointer"
utilpointer
"k8s.io/utils/pointer"
...
@@ -184,7 +183,7 @@ func SetDefaults_PodSpec(obj *v1.PodSpec) {
...
@@ -184,7 +183,7 @@ func SetDefaults_PodSpec(obj *v1.PodSpec) {
obj
.
SchedulerName
=
v1
.
DefaultSchedulerName
obj
.
SchedulerName
=
v1
.
DefaultSchedulerName
}
}
if
obj
.
EnableServiceLinks
==
nil
{
if
obj
.
EnableServiceLinks
==
nil
{
enableServiceLinks
:=
core
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
obj
.
EnableServiceLinks
=
&
enableServiceLinks
obj
.
EnableServiceLinks
=
&
enableServiceLinks
}
}
}
}
...
...
pkg/apis/extensions/v1beta1/defaults_test.go
View file @
42da186b
...
@@ -40,7 +40,7 @@ import (
...
@@ -40,7 +40,7 @@ import (
func
TestSetDefaultDaemonSetSpec
(
t
*
testing
.
T
)
{
func
TestSetDefaultDaemonSetSpec
(
t
*
testing
.
T
)
{
defaultLabels
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
defaultLabels
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
defaultTemplate
:=
v1
.
PodTemplateSpec
{
defaultTemplate
:=
v1
.
PodTemplateSpec
{
Spec
:
v1
.
PodSpec
{
Spec
:
v1
.
PodSpec
{
DNSPolicy
:
v1
.
DNSClusterFirst
,
DNSPolicy
:
v1
.
DNSClusterFirst
,
...
@@ -167,7 +167,7 @@ func TestSetDefaultDeployment(t *testing.T) {
...
@@ -167,7 +167,7 @@ func TestSetDefaultDeployment(t *testing.T) {
defaultIntOrString
:=
intstr
.
FromInt
(
1
)
defaultIntOrString
:=
intstr
.
FromInt
(
1
)
differentIntOrString
:=
intstr
.
FromInt
(
5
)
differentIntOrString
:=
intstr
.
FromInt
(
5
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
period
:=
int64
(
v1
.
DefaultTerminationGracePeriodSeconds
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
defaultTemplate
:=
v1
.
PodTemplateSpec
{
defaultTemplate
:=
v1
.
PodTemplateSpec
{
Spec
:
v1
.
PodSpec
{
Spec
:
v1
.
PodSpec
{
DNSPolicy
:
v1
.
DNSClusterFirst
,
DNSPolicy
:
v1
.
DNSClusterFirst
,
...
...
pkg/kubectl/cmd/util/helpers_test.go
View file @
42da186b
...
@@ -24,6 +24,7 @@ import (
...
@@ -24,6 +24,7 @@ import (
"syscall"
"syscall"
"testing"
"testing"
"k8s.io/api/core/v1"
apiequality
"k8s.io/apimachinery/pkg/api/equality"
apiequality
"k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/meta"
...
@@ -39,7 +40,7 @@ import (
...
@@ -39,7 +40,7 @@ import (
func
TestMerge
(
t
*
testing
.
T
)
{
func
TestMerge
(
t
*
testing
.
T
)
{
grace
:=
int64
(
30
)
grace
:=
int64
(
30
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
tests
:=
[]
struct
{
tests
:=
[]
struct
{
obj
runtime
.
Object
obj
runtime
.
Object
fragment
string
fragment
string
...
...
pkg/kubelet/config/common_test.go
View file @
42da186b
...
@@ -37,7 +37,7 @@ func noDefault(*core.Pod) error { return nil }
...
@@ -37,7 +37,7 @@ func noDefault(*core.Pod) error { return nil }
func
TestDecodeSinglePod
(
t
*
testing
.
T
)
{
func
TestDecodeSinglePod
(
t
*
testing
.
T
)
{
grace
:=
int64
(
30
)
grace
:=
int64
(
30
)
enableServiceLinks
:=
core
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
pod
:=
&
v1
.
Pod
{
pod
:=
&
v1
.
Pod
{
TypeMeta
:
metav1
.
TypeMeta
{
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
""
,
APIVersion
:
""
,
...
@@ -101,7 +101,7 @@ func TestDecodeSinglePod(t *testing.T) {
...
@@ -101,7 +101,7 @@ func TestDecodeSinglePod(t *testing.T) {
func
TestDecodePodList
(
t
*
testing
.
T
)
{
func
TestDecodePodList
(
t
*
testing
.
T
)
{
grace
:=
int64
(
30
)
grace
:=
int64
(
30
)
enableServiceLinks
:=
core
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
pod
:=
&
v1
.
Pod
{
pod
:=
&
v1
.
Pod
{
TypeMeta
:
metav1
.
TypeMeta
{
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
""
,
APIVersion
:
""
,
...
...
pkg/kubelet/config/file_linux_test.go
View file @
42da186b
...
@@ -140,7 +140,7 @@ type testCase struct {
...
@@ -140,7 +140,7 @@ type testCase struct {
func
getTestCases
(
hostname
types
.
NodeName
)
[]
*
testCase
{
func
getTestCases
(
hostname
types
.
NodeName
)
[]
*
testCase
{
grace
:=
int64
(
30
)
grace
:=
int64
(
30
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
return
[]
*
testCase
{
return
[]
*
testCase
{
{
{
lock
:
&
sync
.
Mutex
{},
lock
:
&
sync
.
Mutex
{},
...
...
pkg/kubelet/config/http_test.go
View file @
42da186b
...
@@ -129,7 +129,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
...
@@ -129,7 +129,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
nodeName
:=
"different-value"
nodeName
:=
"different-value"
grace
:=
int64
(
30
)
grace
:=
int64
(
30
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
var
testCases
=
[]
struct
{
var
testCases
=
[]
struct
{
desc
string
desc
string
pods
runtime
.
Object
pods
runtime
.
Object
...
...
pkg/kubelet/kubelet_pods.go
View file @
42da186b
...
@@ -488,7 +488,7 @@ var masterServices = sets.NewString("kubernetes")
...
@@ -488,7 +488,7 @@ var masterServices = sets.NewString("kubernetes")
// getServiceEnvVarMap makes a map[string]string of env vars for services a
// getServiceEnvVarMap makes a map[string]string of env vars for services a
// pod in namespace ns should see.
// pod in namespace ns should see.
func
(
kl
*
Kubelet
)
getServiceEnvVarMap
(
ns
string
,
enableServiceLinks
*
bool
)
(
map
[
string
]
string
,
error
)
{
func
(
kl
*
Kubelet
)
getServiceEnvVarMap
(
ns
string
,
enableServiceLinks
bool
)
(
map
[
string
]
string
,
error
)
{
var
(
var
(
serviceMap
=
make
(
map
[
string
]
*
v1
.
Service
)
serviceMap
=
make
(
map
[
string
]
*
v1
.
Service
)
m
=
make
(
map
[
string
]
string
)
m
=
make
(
map
[
string
]
string
)
...
@@ -522,7 +522,7 @@ func (kl *Kubelet) getServiceEnvVarMap(ns string, enableServiceLinks *bool) (map
...
@@ -522,7 +522,7 @@ func (kl *Kubelet) getServiceEnvVarMap(ns string, enableServiceLinks *bool) (map
if
_
,
exists
:=
serviceMap
[
serviceName
];
!
exists
{
if
_
,
exists
:=
serviceMap
[
serviceName
];
!
exists
{
serviceMap
[
serviceName
]
=
service
serviceMap
[
serviceName
]
=
service
}
}
}
else
if
service
.
Namespace
==
ns
&&
*
enableServiceLinks
{
}
else
if
service
.
Namespace
==
ns
&&
enableServiceLinks
{
serviceMap
[
serviceName
]
=
service
serviceMap
[
serviceName
]
=
service
}
}
}
}
...
@@ -550,7 +550,7 @@ func (kl *Kubelet) makeEnvironmentVariables(pod *v1.Pod, container *v1.Container
...
@@ -550,7 +550,7 @@ func (kl *Kubelet) makeEnvironmentVariables(pod *v1.Pod, container *v1.Container
// To avoid this users can: (1) wait between starting a service and starting; or (2) detect
// To avoid this users can: (1) wait between starting a service and starting; or (2) detect
// missing service env var and exit and be restarted; or (3) use DNS instead of env vars
// missing service env var and exit and be restarted; or (3) use DNS instead of env vars
// and keep trying to resolve the DNS name of the service (recommended).
// and keep trying to resolve the DNS name of the service (recommended).
serviceEnv
,
err
:=
kl
.
getServiceEnvVarMap
(
pod
.
Namespace
,
pod
.
Spec
.
EnableServiceLinks
)
serviceEnv
,
err
:=
kl
.
getServiceEnvVarMap
(
pod
.
Namespace
,
*
pod
.
Spec
.
EnableServiceLinks
)
if
err
!=
nil
{
if
err
!=
nil
{
return
result
,
err
return
result
,
err
}
}
...
...
pkg/registry/core/pod/storage/storage_test.go
View file @
42da186b
...
@@ -61,7 +61,7 @@ func newStorage(t *testing.T) (*REST, *BindingREST, *StatusREST, *etcdtesting.Et
...
@@ -61,7 +61,7 @@ func newStorage(t *testing.T) (*REST, *BindingREST, *StatusREST, *etcdtesting.Et
func
validNewPod
()
*
api
.
Pod
{
func
validNewPod
()
*
api
.
Pod
{
grace
:=
int64
(
30
)
grace
:=
int64
(
30
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
return
&
api
.
Pod
{
return
&
api
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
,
Name
:
"foo"
,
...
@@ -834,7 +834,7 @@ func TestEtcdUpdateScheduled(t *testing.T) {
...
@@ -834,7 +834,7 @@ func TestEtcdUpdateScheduled(t *testing.T) {
}
}
grace
:=
int64
(
30
)
grace
:=
int64
(
30
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
podIn
:=
api
.
Pod
{
podIn
:=
api
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
,
Name
:
"foo"
,
...
@@ -936,7 +936,7 @@ func TestEtcdUpdateStatus(t *testing.T) {
...
@@ -936,7 +936,7 @@ func TestEtcdUpdateStatus(t *testing.T) {
expected
:=
podStart
expected
:=
podStart
expected
.
ResourceVersion
=
"2"
expected
.
ResourceVersion
=
"2"
grace
:=
int64
(
30
)
grace
:=
int64
(
30
)
enableServiceLinks
:=
api
.
DefaultEnableServiceLinks
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
expected
.
Spec
.
TerminationGracePeriodSeconds
=
&
grace
expected
.
Spec
.
TerminationGracePeriodSeconds
=
&
grace
expected
.
Spec
.
RestartPolicy
=
api
.
RestartPolicyAlways
expected
.
Spec
.
RestartPolicy
=
api
.
RestartPolicyAlways
expected
.
Spec
.
DNSPolicy
=
api
.
DNSClusterFirst
expected
.
Spec
.
DNSPolicy
=
api
.
DNSClusterFirst
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment