@@ -98,6 +98,7 @@ func (d *ProjectStatusDescriber) MakeGraph(namespace string) (osgraph.Graph, set
98
98
& horizontalPodAutoscalerLoader {namespace : namespace , lister : d .KubeClient .Autoscaling ()},
99
99
& deploymentLoader {namespace : namespace , lister : d .KubeClient .Extensions ()},
100
100
& replicasetLoader {namespace : namespace , lister : d .KubeClient .Extensions ()},
101
+ & daemonsetLoader {namespace : namespace , lister : d .KubeClient .Extensions ()},
101
102
// TODO check swagger for feature enablement and selectively add bcLoader and buildLoader
102
103
// then remove errors.TolerateNotFoundError method.
103
104
& bcLoader {namespace : namespace , lister : d .BuildClient },
@@ -203,6 +204,9 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error
203
204
standaloneDeployments , coveredByDeployments := graphview .AllDeployments (g , coveredNodes )
204
205
coveredNodes .Insert (coveredByDeployments .List ()... )
205
206
207
+ standaloneStatefulSets , coveredByStatefulSets := graphview .AllStatefulSets (g , coveredNodes )
208
+ coveredNodes .Insert (coveredByStatefulSets .List ()... )
209
+
206
210
standaloneRCs , coveredByRCs := graphview .AllReplicationControllers (g , coveredNodes )
207
211
coveredNodes .Insert (coveredByRCs .List ()... )
208
212
@@ -212,6 +216,9 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error
212
216
standaloneImages , coveredByImages := graphview .AllImagePipelinesFromBuildConfig (g , coveredNodes )
213
217
coveredNodes .Insert (coveredByImages .List ()... )
214
218
219
+ standaloneDaemonSets , coveredByDaemonSets := graphview .AllDaemonSets (g , coveredNodes )
220
+ coveredNodes .Insert (coveredByDaemonSets .List ()... )
221
+
215
222
standalonePods , coveredByPods := graphview .AllPods (g , coveredNodes )
216
223
coveredNodes .Insert (coveredByPods .List ()... )
217
224
@@ -318,6 +325,15 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error
318
325
})... )
319
326
}
320
327
328
+ for _ , standaloneStatefulSet := range standaloneStatefulSets {
329
+ if ! standaloneStatefulSet .StatefulSet .Found () {
330
+ continue
331
+ }
332
+
333
+ fmt .Fprintln (out )
334
+ printLines (out , indent , 0 , describeStatefulSetInServiceGroup (f , standaloneStatefulSet )... )
335
+ }
336
+
321
337
for _ , standaloneImage := range standaloneImages {
322
338
fmt .Fprintln (out )
323
339
lines := describeStandaloneBuildGroup (f , standaloneImage , namespace )
@@ -343,6 +359,15 @@ func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error
343
359
printLines (out , indent , 0 , describeRSInServiceGroup (f , standaloneRS .RS )... )
344
360
}
345
361
362
+ for _ , standaloneDaemonSet := range standaloneDaemonSets {
363
+ if ! standaloneDaemonSet .DaemonSet .Found () {
364
+ continue
365
+ }
366
+
367
+ fmt .Fprintln (out )
368
+ printLines (out , indent , 0 , describeDaemonSetInServiceGroup (f , standaloneDaemonSet )... )
369
+ }
370
+
346
371
monopods , err := filterBoringPods (standalonePods )
347
372
if err != nil {
348
373
return err
@@ -586,6 +611,9 @@ func (f namespacedFormatter) ResourceName(obj interface{}) string {
586
611
case * kubegraph.PersistentVolumeClaimNode :
587
612
return namespaceNameWithType ("pvc" , t .PersistentVolumeClaim .Name , t .PersistentVolumeClaim .Namespace , f .currentNamespace , f .hideNamespace )
588
613
614
+ case * kubegraph.DaemonSetNode :
615
+ return namespaceNameWithType ("daemonset" , t .DaemonSet .Name , t .DaemonSet .Namespace , f .currentNamespace , f .hideNamespace )
616
+
589
617
case * imagegraph.ImageStreamNode :
590
618
return namespaceNameWithType ("is" , t .ImageStream .Name , t .ImageStream .Namespace , f .currentNamespace , f .hideNamespace )
591
619
case * imagegraph.ImageStreamTagNode :
@@ -723,6 +751,42 @@ func describeStatefulSetInServiceGroup(f formatter, node graphview.StatefulSet)
723
751
return lines
724
752
}
725
753
754
+ func describeDaemonSetInServiceGroup (f formatter , node graphview.DaemonSet ) []string {
755
+ local := namespacedFormatter {currentNamespace : node .DaemonSet .DaemonSet .Namespace }
756
+ includeLastPass := false
757
+
758
+ if len (node .Images ) == 1 {
759
+ format := "%s manages %s %s"
760
+ lines := []string {fmt .Sprintf (format , f .ResourceName (node .DaemonSet ), describeImageInPipeline (local , node .Images [0 ], node .DaemonSet .DaemonSet .Namespace ), "" )}
761
+ if len (lines [0 ]) > 120 && strings .Contains (lines [0 ], " <- " ) {
762
+ segments := strings .SplitN (lines [0 ], " <- " , 2 )
763
+ lines [0 ] = segments [0 ] + " <-"
764
+ lines = append (lines , segments [1 ])
765
+ }
766
+
767
+ lines = append (lines , indentLines (" " , describeAdditionalBuildDetail (node .Images [0 ].Build , node .Images [0 ].LastSuccessfulBuild , node .Images [0 ].LastUnsuccessfulBuild , node .Images [0 ].ActiveBuilds , node .Images [0 ].DestinationResolved , includeLastPass )... )... )
768
+ lines = append (lines , describeDaemonSetStatus (node .DaemonSet .DaemonSet ))
769
+ return lines
770
+ }
771
+
772
+ images := []string {}
773
+ for _ , container := range node .DaemonSet .DaemonSet .Spec .Template .Spec .Containers {
774
+ images = append (images , container .Image )
775
+ }
776
+ imagesWithoutTriggers := ""
777
+ if len (node .Images ) == 0 {
778
+ imagesWithoutTriggers = strings .Join (images , "," )
779
+ }
780
+ format := "%s manages %s"
781
+ lines := []string {fmt .Sprintf (format , f .ResourceName (node .DaemonSet ), imagesWithoutTriggers )}
782
+ for _ , image := range node .Images {
783
+ lines = append (lines , describeImageInPipeline (local , image , node .DaemonSet .DaemonSet .Namespace ))
784
+ lines = append (lines , indentLines (" " , describeAdditionalBuildDetail (image .Build , image .LastSuccessfulBuild , image .LastUnsuccessfulBuild , image .ActiveBuilds , image .DestinationResolved , includeLastPass )... )... )
785
+ }
786
+ lines = append (lines , describeDaemonSetStatus (node .DaemonSet .DaemonSet ))
787
+ return lines
788
+ }
789
+
726
790
func describeRCInServiceGroup (f formatter , rcNode * kubegraph.ReplicationControllerNode ) []string {
727
791
if rcNode .ReplicationController .Spec .Template == nil {
728
792
return []string {}
@@ -1282,6 +1346,12 @@ func describeStatefulSetStatus(p *kapps.StatefulSet) string {
1282
1346
return fmt .Sprintf ("created %s ago%s" , timeAt , describePodSummaryInline (int32 (p .Status .Replicas ), int32 (p .Status .Replicas ), int32 (p .Spec .Replicas ), false , 0 ))
1283
1347
}
1284
1348
1349
+ func describeDaemonSetStatus (ds * kapisext.DaemonSet ) string {
1350
+ timeAt := strings .ToLower (formatRelativeTime (ds .CreationTimestamp .Time ))
1351
+ replicaSetRevision := ds .Generation
1352
+ return fmt .Sprintf ("generation #%d running for %s%s" , replicaSetRevision , timeAt , describePodSummaryInline (ds .Status .NumberReady , ds .Status .NumberAvailable , ds .Status .DesiredNumberScheduled , false , 0 ))
1353
+ }
1354
+
1285
1355
func describeRCStatus (rc * kapi.ReplicationController ) string {
1286
1356
timeAt := strings .ToLower (formatRelativeTime (rc .CreationTimestamp .Time ))
1287
1357
return fmt .Sprintf ("rc/%s created %s ago%s" , rc .Name , timeAt , describePodSummaryInline (rc .Status .ReadyReplicas , rc .Status .Replicas , rc .Spec .Replicas , false , 0 ))
@@ -1590,6 +1660,30 @@ func (l *deploymentLoader) AddToGraph(g osgraph.Graph) error {
1590
1660
return nil
1591
1661
}
1592
1662
1663
+ type daemonsetLoader struct {
1664
+ namespace string
1665
+ lister kapisextclient.DaemonSetsGetter
1666
+ items []kapisext.DaemonSet
1667
+ }
1668
+
1669
+ func (l * daemonsetLoader ) Load () error {
1670
+ list , err := l .lister .DaemonSets (l .namespace ).List (metav1.ListOptions {})
1671
+ if err != nil {
1672
+ return err
1673
+ }
1674
+
1675
+ l .items = list .Items
1676
+ return nil
1677
+ }
1678
+
1679
+ func (l * daemonsetLoader ) AddToGraph (g osgraph.Graph ) error {
1680
+ for i := range l .items {
1681
+ kubegraph .EnsureDaemonSetNode (g , & l .items [i ])
1682
+ }
1683
+
1684
+ return nil
1685
+ }
1686
+
1593
1687
type replicasetLoader struct {
1594
1688
namespace string
1595
1689
lister kapisextclient.ReplicaSetsGetter
0 commit comments