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
0a4308f6
Unverified
Commit
0a4308f6
authored
Mar 05, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 05, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74529 from liggitt/kubelet-service-links-error
Kubelet service links error
parents
e330c012
4ac08be2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
34 deletions
+60
-34
kubelet_pods.go
pkg/kubelet/kubelet_pods.go
+5
-5
kubelet_pods_test.go
pkg/kubelet/kubelet_pods_test.go
+55
-29
No files found.
pkg/kubelet/kubelet_pods.go
View file @
0a4308f6
...
@@ -546,11 +546,11 @@ func (kl *Kubelet) getServiceEnvVarMap(ns string, enableServiceLinks bool) (map[
...
@@ -546,11 +546,11 @@ func (kl *Kubelet) getServiceEnvVarMap(ns string, enableServiceLinks bool) (map[
// Make the environment variables for a pod in the given namespace.
// Make the environment variables for a pod in the given namespace.
func
(
kl
*
Kubelet
)
makeEnvironmentVariables
(
pod
*
v1
.
Pod
,
container
*
v1
.
Container
,
podIP
string
)
([]
kubecontainer
.
EnvVar
,
error
)
{
func
(
kl
*
Kubelet
)
makeEnvironmentVariables
(
pod
*
v1
.
Pod
,
container
*
v1
.
Container
,
podIP
string
)
([]
kubecontainer
.
EnvVar
,
error
)
{
var
result
[]
kubecontainer
.
EnvVar
if
pod
.
Spec
.
EnableServiceLinks
==
nil
{
enableServiceLinks
:=
v1
.
DefaultEnableServiceLinks
return
nil
,
fmt
.
Errorf
(
"nil pod.spec.enableServiceLinks encountered, cannot construct envvars"
)
if
pod
.
Spec
.
EnableServiceLinks
!=
nil
{
enableServiceLinks
=
*
pod
.
Spec
.
EnableServiceLinks
}
}
var
result
[]
kubecontainer
.
EnvVar
// Note: These are added to the docker Config, but are not included in the checksum computed
// Note: These are added to the docker Config, but are not included in the checksum computed
// by kubecontainer.HashContainer(...). That way, we can still determine whether an
// by kubecontainer.HashContainer(...). That way, we can still determine whether an
// v1.Container is already running by its hash. (We don't want to restart a container just
// v1.Container is already running by its hash. (We don't want to restart a container just
...
@@ -560,7 +560,7 @@ func (kl *Kubelet) makeEnvironmentVariables(pod *v1.Pod, container *v1.Container
...
@@ -560,7 +560,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
,
e
nableServiceLinks
)
serviceEnv
,
err
:=
kl
.
getServiceEnvVarMap
(
pod
.
Namespace
,
*
pod
.
Spec
.
E
nableServiceLinks
)
if
err
!=
nil
{
if
err
!=
nil
{
return
result
,
err
return
result
,
err
}
}
...
...
pkg/kubelet/kubelet_pods_test.go
View file @
0a4308f6
This diff is collapsed.
Click to expand it.
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