@@ -21,6 +21,7 @@ import (
2121 "fmt"
2222
2323 clientset "k8s.io/client-go/kubernetes"
24+ "k8s.io/kubernetes/test/e2e/framework"
2425)
2526
2627const (
@@ -58,7 +59,7 @@ func (r *OperatorDeployment) getPodSelector() string {
5859 r .deploymentName , r .daemonsetName )
5960}
6061
61- func (OperatorDeployment ) setEnableMetadata (value bool ) error {
62+ func (r * OperatorDeployment ) setEnableMetadata (value bool ) error {
6263 command := []string {
6364 "operatorconfigs.csi.ceph.io" ,
6465 OperatorConfigName ,
@@ -73,6 +74,22 @@ func (OperatorDeployment) setEnableMetadata(value bool) error {
7374 return err
7475 }
7576
77+ // restart the pods so that the new configuration is activated
78+ framework .Logf ("enableMetadata has been set to %t, restarting Ceph-CSI pods" , value )
79+ podLabels := r .getPodSelector ()
80+ err = deletePodWithLabel (podLabels , cephCSINamespace , false )
81+ if err != nil {
82+ return fmt .Errorf ("failed to delete pods with labels (%s): %w" , podLabels , err )
83+ }
84+ err = waitForDaemonSets (r .daemonsetName , cephCSINamespace , r .clientSet , deployTimeout )
85+ if err != nil {
86+ return fmt .Errorf ("timeout waiting for daemonset pods: %w" , err )
87+ }
88+ err = waitForDeploymentComplete (r .clientSet , r .deploymentName , cephCSINamespace , deployTimeout )
89+ if err != nil {
90+ return fmt .Errorf ("timeout waiting for deployment to be in running state: %w" , err )
91+ }
92+
7693 return nil
7794}
7895
0 commit comments