@@ -149,6 +149,7 @@ func (d *ProjectStatusDescriber) MakeGraph(namespace string) (osgraph.Graph, set
149149 buildedges .AddAllInputOutputEdges (g )
150150 buildedges .AddAllBuildEdges (g )
151151 appsedges .AddAllTriggerEdges (g )
152+ kubeedges .AddAllTriggerEdges (g )
152153 appsedges .AddAllDeploymentEdges (g )
153154 appsedges .AddAllVolumeClaimEdges (g )
154155 imageedges .AddAllImageStreamRefEdges (g )
@@ -228,7 +229,7 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error
228229 printLines (out , "" , 0 , describeServiceInServiceGroup (f , service , exposes ... )... )
229230
230231 for _ , dcPipeline := range service .DeploymentConfigPipelines {
231- printLines (out , indent , 1 , describeDeploymentInServiceGroup (local , dcPipeline , func (rc * kubegraph.ReplicationControllerNode ) int32 {
232+ printLines (out , indent , 1 , describeDeploymentConfigInServiceGroup (local , dcPipeline , func (rc * kubegraph.ReplicationControllerNode ) int32 {
232233 return graphview .MaxRecentContainerRestartsForRC (g , rc )
233234 })... )
234235 }
@@ -237,6 +238,10 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error
237238 printLines (out , indent , 1 , describeStatefulSetInServiceGroup (local , node )... )
238239 }
239240
241+ for _ , node := range service .Deployments {
242+ printLines (out , indent , 1 , describeDeploymentInServiceGroup (local , node )... )
243+ }
244+
240245 rcNode:
241246 for _ , rcNode := range service .FulfillingRCs {
242247 for _ , coveredDC := range service .FulfillingDCs {
@@ -267,7 +272,7 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error
267272
268273 for _ , standaloneDC := range standaloneDCs {
269274 fmt .Fprintln (out )
270- printLines (out , indent , 0 , describeDeploymentInServiceGroup (f , standaloneDC , func (rc * kubegraph.ReplicationControllerNode ) int32 {
275+ printLines (out , indent , 0 , describeDeploymentConfigInServiceGroup (f , standaloneDC , func (rc * kubegraph.ReplicationControllerNode ) int32 {
271276 return graphview .MaxRecentContainerRestartsForRC (g , rc )
272277 })... )
273278 }
@@ -508,6 +513,8 @@ func (f namespacedFormatter) ResourceName(obj interface{}) string {
508513 return namespaceNameWithType ("hpa" , t .HorizontalPodAutoscaler .Name , t .HorizontalPodAutoscaler .Namespace , f .currentNamespace , f .hideNamespace )
509514 case * kubegraph.StatefulSetNode :
510515 return namespaceNameWithType ("statefulset" , t .StatefulSet .Name , t .StatefulSet .Namespace , f .currentNamespace , f .hideNamespace )
516+ case * kubegraph.DeploymentNode :
517+ return namespaceNameWithType ("deployment" , t .Deployment .Name , t .Deployment .Namespace , f .currentNamespace , f .hideNamespace )
511518 case * kubegraph.PersistentVolumeClaimNode :
512519 return namespaceNameWithType ("pvc" , t .PersistentVolumeClaim .Name , t .PersistentVolumeClaim .Namespace , f .currentNamespace , f .hideNamespace )
513520
@@ -550,36 +557,67 @@ func describeAllProjectsOnServer(f formatter, server string) string {
550557 return fmt .Sprintf ("Showing all projects on server %s\n " , server )
551558}
552559
553- func describeDeploymentInServiceGroup (f formatter , deploy graphview.DeploymentConfigPipeline , restartFn func (* kubegraph.ReplicationControllerNode ) int32 ) []string {
554- local := namespacedFormatter {currentNamespace : deploy .Deployment .DeploymentConfig .Namespace }
560+ func describeDeploymentConfigInServiceGroup (f formatter , deploy graphview.DeploymentConfigPipeline , restartFn func (* kubegraph.ReplicationControllerNode ) int32 ) []string {
561+ local := namespacedFormatter {currentNamespace : deploy .DeploymentConfig .DeploymentConfig .Namespace }
555562
556563 includeLastPass := deploy .ActiveDeployment == nil
557564 if len (deploy .Images ) == 1 {
558565 format := "%s deploys %s %s"
559- if deploy .Deployment .DeploymentConfig .Spec .Test {
566+ if deploy .DeploymentConfig .DeploymentConfig .Spec .Test {
560567 format = "%s test deploys %s %s"
561568 }
562- lines := []string {fmt .Sprintf (format , f .ResourceName (deploy .Deployment ), describeImageInPipeline (local , deploy .Images [0 ], deploy .Deployment .DeploymentConfig .Namespace ), describeDeploymentConfigTrigger (deploy .Deployment .DeploymentConfig ))}
569+ lines := []string {fmt .Sprintf (format , f .ResourceName (deploy .DeploymentConfig ), describeImageInPipeline (local , deploy .Images [0 ], deploy .DeploymentConfig .DeploymentConfig .Namespace ), describeDeploymentConfigTrigger (deploy .DeploymentConfig .DeploymentConfig ))}
563570 if len (lines [0 ]) > 120 && strings .Contains (lines [0 ], " <- " ) {
564571 segments := strings .SplitN (lines [0 ], " <- " , 2 )
565572 lines [0 ] = segments [0 ] + " <-"
566573 lines = append (lines , segments [1 ])
567574 }
568575 lines = append (lines , indentLines (" " , describeAdditionalBuildDetail (deploy .Images [0 ].Build , deploy .Images [0 ].LastSuccessfulBuild , deploy .Images [0 ].LastUnsuccessfulBuild , deploy .Images [0 ].ActiveBuilds , deploy .Images [0 ].DestinationResolved , includeLastPass )... )... )
569- lines = append (lines , describeDeployments (local , deploy .Deployment , deploy .ActiveDeployment , deploy .InactiveDeployments , restartFn , maxDisplayDeployments )... )
576+ lines = append (lines , describeDeploymentConfigDeployments (local , deploy .DeploymentConfig , deploy .ActiveDeployment , deploy .InactiveDeployments , restartFn , maxDisplayDeployments )... )
570577 return lines
571578 }
572579
573580 format := "%s deploys %s"
574- if deploy .Deployment .DeploymentConfig .Spec .Test {
581+ if deploy .DeploymentConfig .DeploymentConfig .Spec .Test {
575582 format = "%s test deploys %s"
576583 }
577- lines := []string {fmt .Sprintf (format , f .ResourceName (deploy .Deployment ), describeDeploymentConfigTrigger (deploy .Deployment .DeploymentConfig ))}
584+ lines := []string {fmt .Sprintf (format , f .ResourceName (deploy .DeploymentConfig ), describeDeploymentConfigTrigger (deploy .DeploymentConfig .DeploymentConfig ))}
585+ for _ , image := range deploy .Images {
586+ lines = append (lines , describeImageInPipeline (local , image , deploy .DeploymentConfig .DeploymentConfig .Namespace ))
587+ lines = append (lines , indentLines (" " , describeAdditionalBuildDetail (image .Build , image .LastSuccessfulBuild , image .LastUnsuccessfulBuild , image .ActiveBuilds , image .DestinationResolved , includeLastPass )... )... )
588+ lines = append (lines , describeDeploymentConfigDeployments (local , deploy .DeploymentConfig , deploy .ActiveDeployment , deploy .InactiveDeployments , restartFn , maxDisplayDeployments )... )
589+ }
590+ return lines
591+ }
592+
593+ func describeDeploymentInServiceGroup (f formatter , deploy graphview.Deployment ) []string {
594+ local := namespacedFormatter {currentNamespace : deploy .Deployment .Deployment .Namespace }
595+ // TODO: Figure out what this is
596+ includeLastPass := false
597+
598+ if len (deploy .Images ) == 1 {
599+ format := "%s deploys %s %s"
600+ lines := []string {fmt .Sprintf (format , f .ResourceName (deploy .Deployment ), describeImageInPipeline (local , deploy .Images [0 ], deploy .Deployment .Deployment .Namespace ), "" )}
601+ if len (lines [0 ]) > 120 && strings .Contains (lines [0 ], " <- " ) {
602+ segments := strings .SplitN (lines [0 ], " <- " , 2 )
603+ lines [0 ] = segments [0 ] + " <-"
604+ lines = append (lines , segments [1 ])
605+ }
606+ lines = append (lines , indentLines (" " , describeAdditionalBuildDetail (deploy .Images [0 ].Build , deploy .Images [0 ].LastSuccessfulBuild , deploy .Images [0 ].LastUnsuccessfulBuild , deploy .Images [0 ].ActiveBuilds , deploy .Images [0 ].DestinationResolved , includeLastPass )... )... )
607+ // TODO: Add replica sets as deployments
608+ // lines = append(lines, describeDeploymentConfigDeployments(local, deploy.DeploymentConfig, deploy.ActiveDeployment, deploy.InactiveDeployments, restartFn, maxDisplayDeployments)...)
609+ return lines
610+ }
611+
612+ format := "%s deploys %s"
613+ lines := []string {fmt .Sprintf (format , f .ResourceName (deploy .Deployment ), "" )}
578614 for _ , image := range deploy .Images {
579- lines = append (lines , describeImageInPipeline (local , image , deploy .Deployment .DeploymentConfig .Namespace ))
615+ lines = append (lines , describeImageInPipeline (local , image , deploy .Deployment .Deployment .Namespace ))
580616 lines = append (lines , indentLines (" " , describeAdditionalBuildDetail (image .Build , image .LastSuccessfulBuild , image .LastUnsuccessfulBuild , image .ActiveBuilds , image .DestinationResolved , includeLastPass )... )... )
581- lines = append (lines , describeDeployments (local , deploy .Deployment , deploy .ActiveDeployment , deploy .InactiveDeployments , restartFn , maxDisplayDeployments )... )
617+ // TODO: Add replica sets as deployments
618+ // lines = append(lines, describeDeploymentConfigDeployments(local, deploy.DeploymentConfig, deploy.ActiveDeployment, deploy.InactiveDeployments, restartFn, maxDisplayDeployments)...)
582619 }
620+
583621 return lines
584622}
585623
@@ -1026,7 +1064,7 @@ func describeSourceInPipeline(source *buildapi.BuildSource) (string, bool) {
10261064 return "" , false
10271065}
10281066
1029- func describeDeployments (f formatter , dcNode * appsgraph.DeploymentConfigNode , activeDeployment * kubegraph.ReplicationControllerNode , inactiveDeployments []* kubegraph.ReplicationControllerNode , restartFn func (* kubegraph.ReplicationControllerNode ) int32 , count int ) []string {
1067+ func describeDeploymentConfigDeployments (f formatter , dcNode * appsgraph.DeploymentConfigNode , activeDeployment * kubegraph.ReplicationControllerNode , inactiveDeployments []* kubegraph.ReplicationControllerNode , restartFn func (* kubegraph.ReplicationControllerNode ) int32 , count int ) []string {
10301068 if dcNode == nil {
10311069 return nil
10321070 }
@@ -1050,7 +1088,7 @@ func describeDeployments(f formatter, dcNode *appsgraph.DeploymentConfigNode, ac
10501088 if restartFn != nil {
10511089 restartCount = restartFn (deployment )
10521090 }
1053- out = append (out , describeDeploymentStatus (deployment .ReplicationController , i == 0 , dcNode .DeploymentConfig .Spec .Test , restartCount ))
1091+ out = append (out , describeDeploymentConfigDeploymentStatus (deployment .ReplicationController , i == 0 , dcNode .DeploymentConfig .Spec .Test , restartCount ))
10541092 switch {
10551093 case count == - 1 :
10561094 if appsutil .IsCompleteDeployment (deployment .ReplicationController ) {
@@ -1065,7 +1103,7 @@ func describeDeployments(f formatter, dcNode *appsgraph.DeploymentConfigNode, ac
10651103 return out
10661104}
10671105
1068- func describeDeploymentStatus (rc * kapi.ReplicationController , first , test bool , restartCount int32 ) string {
1106+ func describeDeploymentConfigDeploymentStatus (rc * kapi.ReplicationController , first , test bool , restartCount int32 ) string {
10691107 timeAt := strings .ToLower (formatRelativeTime (rc .CreationTimestamp .Time ))
10701108 status := appsutil .DeploymentStatusFor (rc )
10711109 version := appsutil .DeploymentVersionFor (rc )
@@ -1099,6 +1137,11 @@ func describeDeploymentStatus(rc *kapi.ReplicationController, first, test bool,
10991137 }
11001138}
11011139
1140+ func describeDeploymentStatus (d * kapisext.Deployment ) string {
1141+ timeAt := strings .ToLower (formatRelativeTime (d .CreationTimestamp .Time ))
1142+ return fmt .Sprintf ("created %s ago%s" , timeAt , describePodSummaryInline (int32 (d .Status .Replicas ), int32 (d .Status .Replicas ), int32 (d .Spec .Replicas ), false , 0 ))
1143+ }
1144+
11021145func describeStatefulSetStatus (p * kapps.StatefulSet ) string {
11031146 timeAt := strings .ToLower (formatRelativeTime (p .CreationTimestamp .Time ))
11041147 // TODO: Replace first argument in describePodSummaryInline with ReadyReplicas once that's a thing for pet sets.
@@ -1402,7 +1445,7 @@ func (l *deploymentLoader) Load() error {
14021445
14031446func (l * deploymentLoader ) AddToGraph (g osgraph.Graph ) error {
14041447 for i := range l .items {
1405- appsgraph .EnsureDeploymentNode (g , & l .items [i ])
1448+ kubegraph .EnsureDeploymentNode (g , & l .items [i ])
14061449 }
14071450
14081451 return nil
0 commit comments