mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-22 01:56:16 +00:00
Log contents of pods on creation/update/deletion in controllers
This commit is contained in:
parent
4e00333f9b
commit
59b1f5b8b5
@ -310,7 +310,7 @@ func (dc *DeploymentController) addPod(obj interface{}) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("Pod %s created.", pod.Name)
|
glog.V(4).Infof("Pod %s created: %+v.", pod.Name, pod)
|
||||||
if d := dc.getDeploymentForPod(pod); d != nil {
|
if d := dc.getDeploymentForPod(pod); d != nil {
|
||||||
dc.enqueueDeployment(d)
|
dc.enqueueDeployment(d)
|
||||||
}
|
}
|
||||||
@ -324,11 +324,11 @@ func (dc *DeploymentController) updatePod(old, cur interface{}) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
curPod := cur.(*api.Pod)
|
curPod := cur.(*api.Pod)
|
||||||
glog.V(4).Infof("Pod %s updated.", curPod.Name)
|
oldPod := old.(*api.Pod)
|
||||||
|
glog.V(4).Infof("Pod %s updated %+v -> %+v.", curPod.Name, oldPod, curPod)
|
||||||
if d := dc.getDeploymentForPod(curPod); d != nil {
|
if d := dc.getDeploymentForPod(curPod); d != nil {
|
||||||
dc.enqueueDeployment(d)
|
dc.enqueueDeployment(d)
|
||||||
}
|
}
|
||||||
oldPod := old.(*api.Pod)
|
|
||||||
if !api.Semantic.DeepEqual(oldPod, curPod) {
|
if !api.Semantic.DeepEqual(oldPod, curPod) {
|
||||||
if oldD := dc.getDeploymentForPod(oldPod); oldD != nil {
|
if oldD := dc.getDeploymentForPod(oldPod); oldD != nil {
|
||||||
dc.enqueueDeployment(oldD)
|
dc.enqueueDeployment(oldD)
|
||||||
@ -357,7 +357,7 @@ func (dc *DeploymentController) deletePod(obj interface{}) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("Pod %s deleted.", pod.Name)
|
glog.V(4).Infof("Pod %s deleted: %+v.", pod.Name, pod)
|
||||||
if d := dc.getDeploymentForPod(pod); d != nil {
|
if d := dc.getDeploymentForPod(pod); d != nil {
|
||||||
dc.enqueueDeployment(d)
|
dc.enqueueDeployment(d)
|
||||||
}
|
}
|
||||||
|
@ -289,6 +289,7 @@ func isReplicaSetMatch(pod *api.Pod, rs *extensions.ReplicaSet) bool {
|
|||||||
// When a pod is created, enqueue the replica set that manages it and update it's expectations.
|
// When a pod is created, enqueue the replica set that manages it and update it's expectations.
|
||||||
func (rsc *ReplicaSetController) addPod(obj interface{}) {
|
func (rsc *ReplicaSetController) addPod(obj interface{}) {
|
||||||
pod := obj.(*api.Pod)
|
pod := obj.(*api.Pod)
|
||||||
|
glog.V(4).Infof("Pod %s created: %+v.", pod.Name, pod)
|
||||||
|
|
||||||
rs := rsc.getPodReplicaSet(pod)
|
rs := rsc.getPodReplicaSet(pod)
|
||||||
if rs == nil {
|
if rs == nil {
|
||||||
@ -319,6 +320,8 @@ func (rsc *ReplicaSetController) updatePod(old, cur interface{}) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
curPod := cur.(*api.Pod)
|
curPod := cur.(*api.Pod)
|
||||||
|
oldPod := old.(*api.Pod)
|
||||||
|
glog.V(4).Infof("Pod %s updated %+v -> %+v.", curPod.Name, oldPod, curPod)
|
||||||
rs := rsc.getPodReplicaSet(curPod)
|
rs := rsc.getPodReplicaSet(curPod)
|
||||||
if rs == nil {
|
if rs == nil {
|
||||||
return
|
return
|
||||||
@ -328,7 +331,6 @@ func (rsc *ReplicaSetController) updatePod(old, cur interface{}) {
|
|||||||
glog.Errorf("Couldn't get key for replication controller %#v: %v", rs, err)
|
glog.Errorf("Couldn't get key for replication controller %#v: %v", rs, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
oldPod := old.(*api.Pod)
|
|
||||||
|
|
||||||
if curPod.DeletionTimestamp != nil && oldPod.DeletionTimestamp == nil {
|
if curPod.DeletionTimestamp != nil && oldPod.DeletionTimestamp == nil {
|
||||||
// when a pod is deleted gracefully it's deletion timestamp is first modified to reflect a grace period,
|
// when a pod is deleted gracefully it's deletion timestamp is first modified to reflect a grace period,
|
||||||
@ -373,6 +375,7 @@ func (rsc *ReplicaSetController) deletePod(obj interface{}) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
glog.V(4).Infof("Pod %s deleted: %+v.", pod.Name, pod)
|
||||||
if rs := rsc.getPodReplicaSet(pod); rs != nil {
|
if rs := rsc.getPodReplicaSet(pod); rs != nil {
|
||||||
rsKey, err := controller.KeyFunc(rs)
|
rsKey, err := controller.KeyFunc(rs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user