restoreViaPlugin tries to restore the cluster using a plugin if available and enabled. Returns true if a restore plugin was found and any error encountered.
( ctx context.Context, cluster *apiv1.Cluster, plugin *apiv1.PluginConfiguration, )
| 1058 | // restoreViaPlugin tries to restore the cluster using a plugin if available and enabled. |
| 1059 | // Returns true if a restore plugin was found and any error encountered. |
| 1060 | func restoreViaPlugin( |
| 1061 | ctx context.Context, |
| 1062 | cluster *apiv1.Cluster, |
| 1063 | plugin *apiv1.PluginConfiguration, |
| 1064 | ) (*restore.RestoreResponse, error) { |
| 1065 | contextLogger := log.FromContext(ctx) |
| 1066 | |
| 1067 | plugins := repository.New() |
| 1068 | defer plugins.Close() |
| 1069 | |
| 1070 | pluginEnabledSet := stringset.New() |
| 1071 | pluginEnabledSet.Put(plugin.Name) |
| 1072 | pClient, err := pluginClient.NewClient(ctx, pluginEnabledSet) |
| 1073 | if err != nil { |
| 1074 | contextLogger.Error(err, "Error while loading required plugins") |
| 1075 | return nil, err |
| 1076 | } |
| 1077 | defer pClient.Close(ctx) |
| 1078 | |
| 1079 | return pClient.Restore(ctx, cluster) |
| 1080 | } |