@@ -786,15 +786,11 @@ func setupInitContainer(podTemplateSpec *corev1.PodTemplateSpec, Image string, i
786786
787787// DeleteOwnerReferencesForResources used to delete any outstanding owner references
788788// Ideally we should be removing the owner reference wherever the CR is not controller for the resource
789- func DeleteOwnerReferencesForResources (ctx context.Context , client splcommon.ControllerClient , cr splcommon.MetaObject , smartstore * enterpriseApi. SmartStoreSpec , instanceType InstanceType ) error {
789+ func DeleteOwnerReferencesForResources (ctx context.Context , client splcommon.ControllerClient , cr splcommon.MetaObject , instanceType InstanceType ) error {
790790 var err error
791791 reqLogger := log .FromContext (ctx )
792792 scopedLog := reqLogger .WithName ("DeleteOwnerReferencesForResources" ).WithValues ("kind" , cr .GetObjectKind ().GroupVersionKind ().Kind , "name" , cr .GetName (), "namespace" , cr .GetNamespace ())
793793
794- if smartstore != nil {
795- _ = DeleteOwnerReferencesForS3SecretObjects (ctx , client , cr , smartstore )
796- }
797-
798794 // Delete references to Default secret object
799795 defaultSecretName := splcommon .GetNamespaceScopedSecretName (cr .GetNamespace ())
800796 _ , err = splutil .RemoveSecretOwnerRef (ctx , client , defaultSecretName , cr )
@@ -838,7 +834,7 @@ func DeleteOwnerReferencesForS3SecretObjects(ctx context.Context, client splcomm
838834
839835 volList := smartstore .VolList
840836 for _ , volume := range volList {
841- if volume .SecretRef != "" {
837+ if volume .SecretRef != "" && volume . SecretRef != splcommon . GetNamespaceScopedSecretName ( cr . GetNamespace ()) {
842838 _ , err = splutil .RemoveSecretOwnerRef (ctx , client , volume .SecretRef , cr )
843839 if err == nil {
844840 scopedLog .Info ("Removed references for Secret Object" , "secret" , volume .SecretRef )
0 commit comments