Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less verbose logging #908

Merged
merged 2 commits into from
Apr 14, 2020
Merged

Less verbose logging #908

merged 2 commits into from
Apr 14, 2020

Conversation

mogren
Copy link
Contributor

@mogren mogren commented Apr 10, 2020

Issue #, if available:
Having a watch print the whole pod spec is too verbose

Description of changes:

  • Print just the pod status, not the whole spec
  • make format
  • Fixed two comments

One log line before:

{"level":"debug","ts":"2020-04-10T17:43:11.091Z","caller":"k8sapi/discovery.go:216","msg":"Update for pod hello3-6d565cc9b6-ltrhb: 
{Phase:Running Conditions:[{Type:Initialized Status:True LastProbeTime:0001-01-01 00:00:00 +0000 UTC LastTransitionTime:2020-04-10 17:43:09 +0000 UTC Reason: Message:} {Type:Ready Status:True LastProbeTime:0001-01-01 00:00:00 +0000 UTC LastTransitionTime:2020-04-10 17:43:11 +0000 UTC Reason: Message:} {Type:ContainersReady Status:True LastProbeTime:0001-01-01 00:00:00 +0000 UTC LastTransitionTime:2020-04-10 17:43:11 +0000 UTC Reason: Message:} {Type:PodScheduled Status:True LastProbeTime:0001-01-01 00:00:00 +0000 UTC LastTransitionTime:2020-04-10 17:43:09 +0000 UTC Reason: Message:}] Message: Reason: NominatedNodeName: HostIP:10.10.23.150 PodIP:10.10.2.224 StartTime:2020-04-10 17:43:09 +0000 UTC InitContainerStatuses:[] ContainerStatuses:[{Name:hello3 State:{Waiting:nil Running:&ContainerStateRunning{StartedAt:2020-04-10 17:43:10 +0000 UTC,} Terminated:nil} LastTerminationState:{Waiting:nil Running:nil Terminated:nil} Ready:true RestartCount:0 Image:gcr.io/google-samples/hello-go-gke:1.0 ImageID:docker-pullable://gcr.io/google-samples/hello-go-gke@sha256:4ea9cd3d35f81fc91bdebca3fae50c180a1048be0613ad0f811595365040396e ContainerID:docker://6fb38d4ba26a9fbb9286e43660d0007ae5163a7a0998e9f4c1faffa4d52d2ed7}] QOSClass:BestEffort}, 
{Volumes:[{Name:default-token-sxdn6 VolumeSource:{HostPath:nil EmptyDir:nil GCEPersistentDisk:nil AWSElasticBlockStore:nil GitRepo:nil Secret:&SecretVolumeSource{SecretName:default-token-sxdn6,Items:[],DefaultMode:*420,Optional:nil,} NFS:nil ISCSI:nil Glusterfs:nil PersistentVolumeClaim:nil RBD:nil FlexVolume:nil Cinder:nil CephFS:nil Flocker:nil DownwardAPI:nil FC:nil AzureFile:nil ConfigMap:nil VsphereVolume:nil Quobyte:nil AzureDisk:nil PhotonPersistentDisk:nil Projected:nil PortworxVolume:nil ScaleIO:nil StorageOS:nil}}] InitContainers:[] Containers:[{Name:hello3 Image:gcr.io/google-samples/hello-go-gke:1.0 Command:[] Args:[] WorkingDir: Ports:[{Name:http HostPort:0 ContainerPort:80 Protocol:TCP HostIP:}] EnvFrom:[] Env:[] Resources:{Limits:map[] Requests:map[]} VolumeMounts:[{Name:default-token-sxdn6 ReadOnly:true MountPath:/var/run/secrets/kubernetes.io/serviceaccount SubPath: MountPropagation:<nil>}] VolumeDevices:[] LivenessProbe:nil ReadinessProbe:nil Lifecycle:nil TerminationMessagePath:/dev/termination-log TerminationMessagePolicy:File ImagePullPolicy:IfNotPresent SecurityContext:nil Stdin:false StdinOnce:false TTY:false}] RestartPolicy:Always TerminationGracePeriodSeconds:0xc00051aed8 ActiveDeadlineSeconds:<nil> DNSPolicy:ClusterFirst NodeSelector:map[] ServiceAccountName:default DeprecatedServiceAccount:default AutomountServiceAccountToken:<nil> NodeName:ip-10-10-23-150.us-west-2.compute.internal HostNetwork:false HostPID:false HostIPC:false ShareProcessNamespace:<nil> SecurityContext:&PodSecurityContext{SELinuxOptions:nil,RunAsUser:nil,RunAsNonRoot:nil,SupplementalGroups:[],FSGroup:nil,RunAsGroup:nil,Sysctls:[],} ImagePullSecrets:[] Hostname: Subdomain: Affinity:nil SchedulerName:default-scheduler Tolerations:[{Key:node.kubernetes.io/not-ready Operator:Exists Value: Effect:NoExecute TolerationSeconds:0xc00051af90} {Key:node.kubernetes.io/unreachable Operator:Exists Value: Effect:NoExecute TolerationSeconds:0xc00051afb0}] HostAliases:[] PriorityClassName: Priority:0xc00051afc0 DNSConfig:nil ReadinessGates:[]}"}

Logs after:

{"level":"debug","ts":"2020-04-10T19:56:12.604Z","caller":"k8sapi/discovery.go:216","msg":"Update for pod hello-6c9c9df6cd-rdvrn: Pending"}
{"level":"debug","ts":"2020-04-10T19:56:13.004Z","caller":"k8sapi/discovery.go:216","msg":"Update for pod hello-6c9c9df6cd-jvj8f: Pending"}
{"level":"debug","ts":"2020-04-10T19:56:13.404Z","caller":"k8sapi/discovery.go:216","msg":"Update for pod hello-6c9c9df6cd-klqvn: Running"}
{"level":"debug","ts":"2020-04-10T19:56:13.804Z","caller":"k8sapi/discovery.go:216","msg":"Update for pod hello-6c9c9df6cd-fqjnn: Running"}

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

This output is very verbose, just the name and status is enough.
Copy link
Contributor

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, good little change. ++

@@ -254,7 +254,7 @@ func (d *Controller) handlePodUpdate(key string) error {
d.workerPodsLock.Lock()
defer d.workerPodsLock.Unlock()

log.Debugf("Update for pod %s: %+v, %+v", podName, pod.Status, pod.Spec)
log.Debugf("Update for pod %s: %v", podName, pod.Status.Phase)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

@jaypipes
Copy link
Contributor

@mogren @SaranBalaji90 the integrations tests are failing on this PR with the following:

go: github.com/aws/amazon-vpc-cni-k8s/test/integration tested by
	github.com/aws/amazon-vpc-cni-k8s/test/integration.test imports
	github.com/kubernetes/kubernetes/staging/src/k8s.io/api/core/v1: github.com/kubernetes/kubernetes/staging/src/k8s.io/[email protected]: parsing go.mod:
	module declares its path as: k8s.io/api
	        but was required as: github.com/kubernetes/kubernetes/staging/src/k8s.io/api

I don't think there's anything in this PR that changed the integration tests at all, so I presume the above was either introduced with either an upstream (in the testing framework) change that we're now bringing in or it is transient. I tried to re-run the integration tests for this PR but apparently I no longer have write permissions on the VPC CNI CircleCI repo and therefore cannot trigger a re-run :(

@mogren mogren merged commit 2af93d1 into aws:master Apr 14, 2020
@mogren mogren deleted the less-verbose-logging branch September 4, 2020 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants