Skip to content

Commit 0457872

Browse files
Merge pull request #265 from rewantsoni/mapping
controllers: create clientprofilemapping required for DR
2 parents 7d92043 + 9b51095 commit 0457872

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

internal/controller/storageclient_controller.go

+15
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,21 @@ func (r *StorageClientReconciler) reconcilePhases() (ctrl.Result, error) {
235235
}); err != nil {
236236
return reconcile.Result{}, fmt.Errorf("failed to reconcile cephConnection: %v", err)
237237
}
238+
case "ClientProfileMapping":
239+
clientProfileMapping := &csiopv1a1.ClientProfileMapping{}
240+
clientProfileMapping.Name = eResource.Name
241+
clientProfileMapping.Namespace = r.OperatorNamespace
242+
if _, err := controllerutil.CreateOrUpdate(r.ctx, r.Client, clientProfileMapping, func() error {
243+
if err := r.own(clientProfileMapping); err != nil {
244+
return fmt.Errorf("failed to own clientProfileMapping resource: %v", err)
245+
}
246+
if err := json.Unmarshal(eResource.Data, &clientProfileMapping.Spec); err != nil {
247+
return fmt.Errorf("failed to unmarshall clientProfileMapping spec: %v", err)
248+
}
249+
return nil
250+
}); err != nil {
251+
return reconcile.Result{}, fmt.Errorf("failed to reconcile clientProfileMapping: %v", err)
252+
}
238253
case "Secret":
239254
data := map[string]string{}
240255
if err := json.Unmarshal(eResource.Data, &data); err != nil {

0 commit comments

Comments
 (0)