@@ -149,6 +149,7 @@ func (d *ProjectStatusDescriber) MakeGraph(namespace string) (osgraph.Graph, set
149
149
buildedges .AddAllInputOutputEdges (g )
150
150
buildedges .AddAllBuildEdges (g )
151
151
appsedges .AddAllTriggerEdges (g )
152
+ kubeedges .AddAllTriggerEdges (g )
152
153
appsedges .AddAllDeploymentEdges (g )
153
154
appsedges .AddAllVolumeClaimEdges (g )
154
155
imageedges .AddAllImageStreamRefEdges (g )
@@ -228,7 +229,7 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error
228
229
printLines (out , "" , 0 , describeServiceInServiceGroup (f , service , exposes ... )... )
229
230
230
231
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 {
232
233
return graphview .MaxRecentContainerRestartsForRC (g , rc )
233
234
})... )
234
235
}
@@ -237,6 +238,10 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error
237
238
printLines (out , indent , 1 , describeStatefulSetInServiceGroup (local , node )... )
238
239
}
239
240
241
+ for _ , node := range service .Deployments {
242
+ printLines (out , indent , 1 , describeDeploymentInServiceGroup (local , node )... )
243
+ }
244
+
240
245
rcNode:
241
246
for _ , rcNode := range service .FulfillingRCs {
242
247
for _ , coveredDC := range service .FulfillingDCs {
@@ -267,7 +272,7 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error
267
272
268
273
for _ , standaloneDC := range standaloneDCs {
269
274
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 {
271
276
return graphview .MaxRecentContainerRestartsForRC (g , rc )
272
277
})... )
273
278
}
@@ -508,6 +513,8 @@ func (f namespacedFormatter) ResourceName(obj interface{}) string {
508
513
return namespaceNameWithType ("hpa" , t .HorizontalPodAutoscaler .Name , t .HorizontalPodAutoscaler .Namespace , f .currentNamespace , f .hideNamespace )
509
514
case * kubegraph.StatefulSetNode :
510
515
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 )
511
518
case * kubegraph.PersistentVolumeClaimNode :
512
519
return namespaceNameWithType ("pvc" , t .PersistentVolumeClaim .Name , t .PersistentVolumeClaim .Namespace , f .currentNamespace , f .hideNamespace )
513
520
@@ -550,36 +557,67 @@ func describeAllProjectsOnServer(f formatter, server string) string {
550
557
return fmt .Sprintf ("Showing all projects on server %s\n " , server )
551
558
}
552
559
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 }
555
562
556
563
includeLastPass := deploy .ActiveDeployment == nil
557
564
if len (deploy .Images ) == 1 {
558
565
format := "%s deploys %s %s"
559
- if deploy .Deployment .DeploymentConfig .Spec .Test {
566
+ if deploy .DeploymentConfig .DeploymentConfig .Spec .Test {
560
567
format = "%s test deploys %s %s"
561
568
}
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 ))}
563
570
if len (lines [0 ]) > 120 && strings .Contains (lines [0 ], " <- " ) {
564
571
segments := strings .SplitN (lines [0 ], " <- " , 2 )
565
572
lines [0 ] = segments [0 ] + " <-"
566
573
lines = append (lines , segments [1 ])
567
574
}
568
575
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 )... )
570
577
return lines
571
578
}
572
579
573
580
format := "%s deploys %s"
574
- if deploy .Deployment .DeploymentConfig .Spec .Test {
581
+ if deploy .DeploymentConfig .DeploymentConfig .Spec .Test {
575
582
format = "%s test deploys %s"
576
583
}
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 ), "" )}
578
614
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 ))
580
616
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)...)
582
619
}
620
+
583
621
return lines
584
622
}
585
623
@@ -1026,7 +1064,7 @@ func describeSourceInPipeline(source *buildapi.BuildSource) (string, bool) {
1026
1064
return "" , false
1027
1065
}
1028
1066
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 {
1030
1068
if dcNode == nil {
1031
1069
return nil
1032
1070
}
@@ -1050,7 +1088,7 @@ func describeDeployments(f formatter, dcNode *appsgraph.DeploymentConfigNode, ac
1050
1088
if restartFn != nil {
1051
1089
restartCount = restartFn (deployment )
1052
1090
}
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 ))
1054
1092
switch {
1055
1093
case count == - 1 :
1056
1094
if appsutil .IsCompleteDeployment (deployment .ReplicationController ) {
@@ -1065,7 +1103,7 @@ func describeDeployments(f formatter, dcNode *appsgraph.DeploymentConfigNode, ac
1065
1103
return out
1066
1104
}
1067
1105
1068
- func describeDeploymentStatus (rc * kapi.ReplicationController , first , test bool , restartCount int32 ) string {
1106
+ func describeDeploymentConfigDeploymentStatus (rc * kapi.ReplicationController , first , test bool , restartCount int32 ) string {
1069
1107
timeAt := strings .ToLower (formatRelativeTime (rc .CreationTimestamp .Time ))
1070
1108
status := appsutil .DeploymentStatusFor (rc )
1071
1109
version := appsutil .DeploymentVersionFor (rc )
@@ -1099,6 +1137,11 @@ func describeDeploymentStatus(rc *kapi.ReplicationController, first, test bool,
1099
1137
}
1100
1138
}
1101
1139
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
+
1102
1145
func describeStatefulSetStatus (p * kapps.StatefulSet ) string {
1103
1146
timeAt := strings .ToLower (formatRelativeTime (p .CreationTimestamp .Time ))
1104
1147
// 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 {
1402
1445
1403
1446
func (l * deploymentLoader ) AddToGraph (g osgraph.Graph ) error {
1404
1447
for i := range l .items {
1405
- appsgraph .EnsureDeploymentNode (g , & l .items [i ])
1448
+ kubegraph .EnsureDeploymentNode (g , & l .items [i ])
1406
1449
}
1407
1450
1408
1451
return nil
0 commit comments