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
f7fd7e96
Commit
f7fd7e96
authored
Jun 24, 2015
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Kubelet: add and modify some logging messsages
This helps debug #6651
parent
befe5450
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
4 deletions
+70
-4
config.go
pkg/kubelet/config/config.go
+2
-0
kubelet.go
pkg/kubelet/kubelet.go
+2
-1
status_manager.go
pkg/kubelet/status_manager.go
+4
-3
doc.go
pkg/kubelet/util/doc.go
+18
-0
format.go
pkg/kubelet/util/format.go
+44
-0
No files found.
pkg/kubelet/config/config.go
View file @
f7fd7e96
...
@@ -27,6 +27,7 @@ import (
...
@@ -27,6 +27,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet"
kubecontainer
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/container"
kubecontainer
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/container"
kubeletTypes
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/types"
kubeletTypes
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/types"
kubeletUtil
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/config"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/config"
utilerrors
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/errors"
utilerrors
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/errors"
...
@@ -186,6 +187,7 @@ func (s *podStorage) Merge(source string, change interface{}) error {
...
@@ -186,6 +187,7 @@ func (s *podStorage) Merge(source string, change interface{}) error {
// recordFirstSeenTime records the first seen time of this pod.
// recordFirstSeenTime records the first seen time of this pod.
func
recordFirstSeenTime
(
pod
*
api
.
Pod
)
{
func
recordFirstSeenTime
(
pod
*
api
.
Pod
)
{
glog
.
V
(
4
)
.
Infof
(
"Receiving a new pod %q"
,
kubeletUtil
.
FormatPodName
(
pod
))
pod
.
Annotations
[
kubelet
.
ConfigFirstSeenAnnotationKey
]
=
kubeletTypes
.
NewTimestamp
()
.
GetString
()
pod
.
Annotations
[
kubelet
.
ConfigFirstSeenAnnotationKey
]
=
kubeletTypes
.
NewTimestamp
()
.
GetString
()
}
}
...
...
pkg/kubelet/kubelet.go
View file @
f7fd7e96
...
@@ -51,6 +51,7 @@ import (
...
@@ -51,6 +51,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/network"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/network"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/rkt"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/rkt"
kubeletTypes
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/types"
kubeletTypes
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/types"
kubeletUtil
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
...
@@ -1390,7 +1391,7 @@ func (kl *Kubelet) SyncPods(allPods []*api.Pod, podSyncTypes map[types.UID]SyncP
...
@@ -1390,7 +1391,7 @@ func (kl *Kubelet) SyncPods(allPods []*api.Pod, podSyncTypes map[types.UID]SyncP
// Handles pod admission.
// Handles pod admission.
pods
:=
kl
.
admitPods
(
allPods
,
podSyncTypes
)
pods
:=
kl
.
admitPods
(
allPods
,
podSyncTypes
)
glog
.
V
(
4
)
.
Infof
(
"Desired
: %#v"
,
pods
)
glog
.
V
(
4
)
.
Infof
(
"Desired
pods: %s"
,
kubeletUtil
.
FormatPodNames
(
pods
)
)
var
err
error
var
err
error
desiredPods
:=
make
(
map
[
types
.
UID
]
empty
)
desiredPods
:=
make
(
map
[
types
.
UID
]
empty
)
...
...
pkg/kubelet/status_manager.go
View file @
f7fd7e96
...
@@ -26,6 +26,7 @@ import (
...
@@ -26,6 +26,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
kubecontainer
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/container"
kubecontainer
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/container"
kubeletTypes
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/types"
kubeletTypes
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/types"
kubeletUtil
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/golang/glog"
"github.com/golang/glog"
)
)
...
@@ -118,7 +119,7 @@ func (s *statusManager) SetPodStatus(pod *api.Pod, status api.PodStatus) {
...
@@ -118,7 +119,7 @@ func (s *statusManager) SetPodStatus(pod *api.Pod, status api.PodStatus) {
s
.
podStatuses
[
podFullName
]
=
status
s
.
podStatuses
[
podFullName
]
=
status
s
.
podStatusChannel
<-
podStatusSyncRequest
{
pod
,
status
}
s
.
podStatusChannel
<-
podStatusSyncRequest
{
pod
,
status
}
}
else
{
}
else
{
glog
.
V
(
3
)
.
Infof
(
"Ignoring same
pod status for %q - old: %+v new: %+v"
,
podFullName
,
oldStatus
,
status
)
glog
.
V
(
3
)
.
Infof
(
"Ignoring same
status for pod %q, status: %+v"
,
kubeletUtil
.
FormatPodName
(
pod
)
,
status
)
}
}
}
}
...
@@ -158,7 +159,7 @@ func (s *statusManager) syncBatch() error {
...
@@ -158,7 +159,7 @@ func (s *statusManager) syncBatch() error {
_
,
err
=
s
.
kubeClient
.
Pods
(
pod
.
Namespace
)
.
UpdateStatus
(
statusPod
)
_
,
err
=
s
.
kubeClient
.
Pods
(
pod
.
Namespace
)
.
UpdateStatus
(
statusPod
)
// TODO: handle conflict as a retry, make that easier too.
// TODO: handle conflict as a retry, make that easier too.
if
err
==
nil
{
if
err
==
nil
{
glog
.
V
(
3
)
.
Infof
(
"Status for pod %q updated successfully"
,
pod
.
Name
)
glog
.
V
(
3
)
.
Infof
(
"Status for pod %q updated successfully"
,
kubeletUtil
.
FormatPodName
(
pod
)
)
return
nil
return
nil
}
}
}
}
...
@@ -171,5 +172,5 @@ func (s *statusManager) syncBatch() error {
...
@@ -171,5 +172,5 @@ func (s *statusManager) syncBatch() error {
// to clear the channel. Even if this delete never runs subsequent container
// to clear the channel. Even if this delete never runs subsequent container
// changes on the node should trigger updates.
// changes on the node should trigger updates.
go
s
.
DeletePodStatus
(
podFullName
)
go
s
.
DeletePodStatus
(
podFullName
)
return
fmt
.
Errorf
(
"error updating status for pod %q: %v"
,
pod
.
Name
,
err
)
return
fmt
.
Errorf
(
"error updating status for pod %q: %v"
,
kubeletUtil
.
FormatPodName
(
pod
)
,
err
)
}
}
pkg/kubelet/util/doc.go
0 → 100644
View file @
f7fd7e96
/*
Copyright 2015 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.
*/
// Utility functions.
package
util
pkg/kubelet/util/format.go
0 → 100644
View file @
f7fd7e96
/*
Copyright 2015 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.
*/
package
util
import
(
"fmt"
"strings"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
)
// FormatPodName returns a string representating a pod in a human readable
// format. This function currently is the same as GetPodFullName in
// kubelet/containers, but may differ in the future. As opposed to
// GetPodFullName, FormatPodName is mainly used for logging.
func
FormatPodName
(
pod
*
api
.
Pod
)
string
{
// Use underscore as the delimiter because it is not allowed in pod name
// (DNS subdomain format), while allowed in the container name format.
return
fmt
.
Sprintf
(
"%s_%s"
,
pod
.
Name
,
pod
.
Namespace
)
}
// FormatPodNames returns a string representating a list of pods in a human
// readable format.
func
FormatPodNames
(
pods
[]
*
api
.
Pod
)
string
{
podStrings
:=
make
([]
string
,
0
,
len
(
pods
))
for
_
,
pod
:=
range
pods
{
podStrings
=
append
(
podStrings
,
FormatPodName
(
pod
))
}
return
fmt
.
Sprintf
(
strings
.
Join
(
podStrings
,
", "
))
}
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