@@ -657,6 +657,41 @@ func (p *DeployableByOlmCheck) cleanUp(ctx context.Context, operatorData operato
657
657
if err := p .writeToFile (ctx , deployment ); err != nil {
658
658
logger .Error (err , "could not write deployment to storage" )
659
659
}
660
+
661
+ pods , err := p .openshiftClient .GetDeploymentPods (ctx , deploymentName , operatorData .InstallNamespace )
662
+ if err != nil {
663
+ logger .Info (fmt .Sprintf ("warning: unable to retrieve deployment pods: %s" , err ))
664
+ continue
665
+ }
666
+
667
+ for _ , pod := range pods {
668
+ jsonManifest , err := json .Marshal (pod .Status )
669
+ if err != nil {
670
+ logger .Error (err , "unable to marshal to json" )
671
+ }
672
+
673
+ filename := fmt .Sprintf ("%s-PodStatus.json" , pod .Name )
674
+ if artifactWriter := artifacts .WriterFromContext (ctx ); artifactWriter != nil {
675
+ if _ , err := artifactWriter .WriteFile (filename , bytes .NewReader (jsonManifest )); err != nil {
676
+ logger .Error (err , "failed to write the PodStatus to the file" )
677
+ }
678
+ }
679
+
680
+ logs , err := p .openshiftClient .GetPodLogs (ctx , pod .Name , pod .Namespace )
681
+ if err != nil {
682
+ logger .Info (fmt .Sprintf ("warning: unable to retrieve pod logs: %s" , err ))
683
+ continue
684
+ }
685
+
686
+ for container , logContents := range logs {
687
+ filename := fmt .Sprintf ("podLogs-%s-%s.json" , pod .Name , container )
688
+ if artifactWriter := artifacts .WriterFromContext (ctx ); artifactWriter != nil {
689
+ if _ , err := artifactWriter .WriteFile (filename , logContents ); err != nil {
690
+ logger .Error (err , "failed to write the pod logs to the file" )
691
+ }
692
+ }
693
+ }
694
+ }
660
695
}
661
696
662
697
logger .V (log .TRC ).Info ("deleting the resources created by DeployableByOLM Check" )
0 commit comments