@@ -158,6 +158,7 @@ func printResources(namespace corev1.Namespace, clientset *kubernetes.Clientset,
158158
159159 namespaceName := namespace .ObjectMeta .Name
160160
161+ nsReplicasets := make (map [string ]* appsv1.ReplicaSet )
161162 nsDeployments := make (map [string ]* appsv1.Deployment )
162163 nsDaemonsets := make (map [string ]* appsv1.DaemonSet )
163164 nsStatefulsets := make (map [string ]* appsv1.StatefulSet )
@@ -197,6 +198,11 @@ func printResources(namespace corev1.Namespace, clientset *kubernetes.Clientset,
197198 continue
198199 }
199200
201+ if len (replica .OwnerReferences ) == 0 {
202+ nsReplicasets [replica .Name ] = replica
203+ continue
204+ }
205+
200206 deployment , deployErr := clientset .AppsV1 ().Deployments (namespace .Name ).Get (context .TODO (), replica .OwnerReferences [0 ].Name , metav1.GetOptions {})
201207 if deployErr != nil {
202208 errorList = append (errorList , deployErr )
@@ -274,6 +280,15 @@ func printResources(namespace corev1.Namespace, clientset *kubernetes.Clientset,
274280 }
275281 }
276282 }
283+
284+ // loop through all the unique ReplicaSets in the namespace
285+ for _ , replica := range nsReplicasets {
286+ found := printVolumes (w , replica .Spec .Template .Spec .Volumes , namespaceName , "replicaset" , replica .Name , verbose )
287+ if found {
288+ sockFound = true
289+ }
290+ }
291+
277292 // loop through all the unique deployments we found for volumes
278293 for _ , deploy := range nsDeployments {
279294 found := printVolumes (w , deploy .Spec .Template .Spec .Volumes , namespaceName , "deployment" , deploy .Name , verbose )
0 commit comments