deis / builder

Git server and application builder for Deis Workflow
https://deis.com
MIT License
40 stars 41 forks source link

better error message when pod goes into failed state #391

Closed bacongobbler closed 8 years ago

bacongobbler commented 8 years ago

refs deis/charts#310

Whenever a pod fails to be deployed, the builder dumps the entire pod manifest which is completely unreadable for the user. We should format this into a presentable error so users know what to look for.

An example:

Step 9 : EXPOSE 80        
---> Using cache        
---> fe3ae61c2ce7        
Successfully built fe3ae61c2ce7        
Pushing to registry        
Build complete.        
Launching App...        
remote: 2016/07/20 18:54:39 Error running git receive hook [watching events for builder pod startup (Giving up; pod went into failed status:         
remote: &api.Pod{TypeMeta:unversioned.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:api.ObjectMeta{Name:"dockerbuild-test-656351115-0c483886-a1a3e834", GenerateName:"", Namespace:"deis", SelfLink:"/api/v1/namespaces/deis/pods/dockerbuild-test-656351115-0c483886-a1a3e834", UID:"44348c30-4eab-11e6-8625-080027242396", ResourceVersion:"10688", Generation:0, CreationTimestamp:unversioned.Time{Time:time.Time{sec:63604637617, nsec:0, loc:(*time.Location)(0x22f70a0)}}, DeletionTimestamp:(*unversioned.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string{"heritage":"dockerbuild-test-656351115-0c483886-a1a3e834"}, Annotations:map[string]string(nil)}, Spec:api.PodSpec{Volumes:[]api.Volume{api.Volume{Name:"objectstorage-keyfile", VolumeSource:api.VolumeSource{HostPath:(*api.HostPathVolumeSource)(nil), EmptyDir:(*api.EmptyDirVolumeSource)(nil), GCEPersistentDisk:(*api.GCEPersistentDiskVolumeSource)(nil), AWSElasticBlockStore:(*api.AWSElasticBlockStoreVolumeSource)(nil), GitRepo:(*api.GitRepoVolumeSource)(nil), Secret:(*api.SecretVolumeSource)(0xc820518b60), NFS:(*api.NFSVolumeSource)(nil), ISCSI:(*api.ISCSIVolumeSource)(nil), Glusterfs:(*api.GlusterfsVolumeSource)(nil), PersistentVolumeClaim:(*api.PersistentVolumeClaimVolumeSource)(nil), RBD:(*api.RBDVolumeSource)(nil), FlexVolume:(*api.FlexVolumeSource)(nil), Cinder:(*api.CinderVolumeSource)(nil), CephFS:(*api.CephFSVolumeSource)(nil), Flocker:(*api.FlockerVolumeSource)(nil), DownwardAPI:(*api.DownwardAPIVolumeSource)(nil), FC:(*api.FCVolumeSource)(nil), AzureFile:(*api.AzureFileVolumeSource)(nil), ConfigMap:(*api.ConfigMapVolumeSource)(nil)}}, api.Volume{Name:"docker-socket", VolumeSource:api.VolumeSource{HostPath:(*api.HostPathVolumeSource)(0xc820518b80), EmptyDir:(*api.EmptyDirVolumeSource)(nil), GCEPersistentDisk:(*api.GCEPersistentDiskVolumeSource)(nil), AWSElasticBlockStore:(*api.AWSElasticBlockStoreVolumeSource)(nil), GitRepo:(*api.GitRepoVolumeSource)(nil), Secret:(*api.SecretVolumeSource)(nil), NFS:(*api.NFSVolumeSource)(nil), ISCSI:(*api.ISCSIVolumeSource)(nil), Glusterfs:(*api.GlusterfsVolumeSource)(nil), PersistentVolumeClaim:(*api.PersistentVolumeClaimVolumeSource)(nil), RBD:(*api.RBDVolumeSource)(nil), FlexVolume:(*api.FlexVolumeSource)(nil), Cinder:(*api.CinderVolumeSource)(nil), CephFS:(*api.CephFSVolumeSource)(nil), Flocker:(*api.FlockerVolumeSource)(nil), DownwardAPI:(*api.DownwardAPIVolumeSource)(nil), FC:(*api.FCVolumeSource)(nil), AzureFile:(*api.AzureFileVolumeSource)(nil), ConfigMap:(*api.ConfigMapVolumeSource)(nil)}}, api.Volume{Name:"default-token-n0teb", VolumeSource:api.VolumeSource{HostPath:(*api.HostPathVolumeSource)(nil), EmptyDir:(*api.EmptyDirVolumeSource)(nil), GCEPersistentDisk:(*api.GCEPersistentDiskVolumeSource)(nil), AWSElasticBlockStore:(*api.AWSElasticBlockStoreVolumeSource)(nil), GitRepo:(*api.GitRepoVolumeSource)(nil), Secret:(*api.SecretVolumeSource)(0xc820518bd0), NFS:(*api.NFSVolumeSource)(nil), ISCSI:(*api.ISCSIVolumeSource)(nil), Glusterfs:(*api.GlusterfsVolumeSource)(nil), PersistentVolumeClaim:(*api.PersistentVolumeClaimVolumeSource)(nil), RBD:(*api.RBDVolumeSource)(nil), FlexVolume:(*api.FlexVolumeSource)(nil), Cinder:(*api.CinderVolumeSource)(nil), CephFS:(*api.CephFSVolumeSource)(nil), Flocker:(*api.FlockerVolumeSource)(nil), DownwardAPI:(*api.DownwardAPIVolumeSource)(nil), FC:(*api.FCVolumeSource)(nil), AzureFile:(*api.AzureFileVolumeSource)(nil), ConfigMap:(*api.ConfigMapVolumeSource)(nil)}}}, Containers:[]api.Container{api.Container{Name:"deis-dockerbuilder", Image:"quay.io/deisci/dockerbuilder:git-453a29a", Command:[]string(nil), Args:[]string(nil), WorkingDir:"", Ports:[]api.ContainerPort(nil), Env:[]api.EnvVar{api.EnvVar{Name:"DEIS_KUBERNETES_DEPLOYMENTS", Value:"1", ValueFrom:(*api.EnvVarSource)(nil)}, api.EnvVar{Name:"TAR_PATH", Value:"home/test-656351115:git-0c483886/tar", ValueFrom:(*api.EnvVarSource)(nil)}, api.EnvVar{Name:"IMG_NAME", Value:"test-656351115:git-0c483886", ValueFrom:(*api.EnvVarSource)(nil)}, api.EnvVar{Name:"BUILDER_STORAGE", Value:"minio", ValueFrom:(*api.EnvVarSource)(nil)}, api.EnvVar{Name:"DEIS_REGISTRY_PROXY_PORT", Value:"5555", ValueFrom:(*api.EnvVarSource)(nil)}}, Resources:api.ResourceRequirements{Limits:api.ResourceList(nil), Requests:api.ResourceList(nil)}, VolumeMounts:[]api.VolumeMount{api.VolumeMount{Name:"objectstorage-keyfile", ReadOnly:true, MountPath:"/var/run/secrets/deis/objectstore/creds"}, api.VolumeMount{Name:"docker-socket", ReadOnly:false, MountPath:"/var/run/docker.sock"}, api.VolumeMount{Name:"default-token-n0teb", ReadOnly:true, MountPath:"/var/run/secrets/kubernetes.io/serviceaccount"}}, LivenessProbe:(*api.Probe)(nil), ReadinessProbe:(*api.Probe)(nil), Lifecycle:(*api.Lifecycle)(nil), TerminationMessagePath:"/dev/termination-log", ImagePullPolicy:"Always", SecurityContext:(*api.SecurityContext)(nil), Stdin:false, StdinOnce:false, TTY:false}}, RestartPolicy:"Never", TerminationGracePeriodSeconds:(*int64)(0xc820518c20), ActiveDeadlineSeconds:(*int64)(nil), DNSPolicy:"ClusterFirst", NodeSelector:map[string]string(nil), ServiceAccountName:"default", NodeName:"kubernetes-node-1", SecurityContext:(*api.PodSecurityContext)(0xc8200f2140), ImagePullSecrets:[]api.LocalObjectReference(nil)}, Status:api.PodStatus{Phase:"Failed", Conditions:[]api.PodCondition{api.PodCondition{Type:"Ready", Status:"False", LastProbeTime:unversioned.Time{Time:time.Time{sec:0, nsec:0, loc:(*time.Location)(nil)}}, LastTransitionTime:unversioned.Time{Time:time.Time{sec:63604637618, nsec:0, loc:(*time.Location)(0x22f70a0)}}, Reason:"ContainersNotReady", Message:"containers with unready status: [deis-dockerbuilder]"}}, Message:"", Reason:"", HostIP:"10.245.1.3", PodIP:"10.246.58.26", StartTime:(*unversioned.Time)(0xc820463b60), ContainerStatuses:[]api.ContainerStatus{api.ContainerStatus{Name:"deis-dockerbuilder", State:api.ContainerState{Waiting:(*api.ContainerStateWaiting)(nil), Running:(*api.ContainerStateRunning)(nil), Terminated:(*api.ContainerStateTerminated)(0xc8201008c0)}, LastTerminationState:api.ContainerState{Waiting:(*api.ContainerStateWaiting)(nil), Running:(*api.ContainerStateRunning)(nil), Terminated:(*api.ContainerStateTerminated)(nil)}, Ready:false, RestartCount:0, Image:"quay.io/deisci/dockerbuilder:git-453a29a", ImageID:"docker://sha256:d90e1a53a33d8a1866acb1f7a9a5b6dcc3b3e3f3265efc25a65a6e55e07abfa3", ContainerID:"docker://47be6c49db41305891032a75d11e3065e9c6d3dcc8efa949bf7326b6a35f5111"}}}})]        
To ssh://git@deis-builder.k8s.local:2222/test-656351115.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://git@deis-builder.k8s.local:2222/test-656351115.git'
kmala commented 8 years ago

Fixed in #404