mirror of
https://github.com/mariadb-operator/mariadb-operator.git
synced 2025-08-08 06:35:58 +00:00
Added spec and indexer for PhysicalBackup
This commit is contained in:
@ -2,13 +2,14 @@ package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
mariadbv1alpha1 "github.com/mariadb-operator/mariadb-operator/api/v1alpha1"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||
|
||||
k8sv1alpha1 "github.com/mariadb-operator/mariadb-operator/api/v1alpha1"
|
||||
)
|
||||
|
||||
// PhysicalBackupReconciler reconciles a PhysicalBackup object
|
||||
@ -30,8 +31,14 @@ func (r *PhysicalBackupReconciler) Reconcile(ctx context.Context, req ctrl.Reque
|
||||
}
|
||||
|
||||
// SetupWithManager sets up the controller with the Manager.
|
||||
func (r *PhysicalBackupReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||
return ctrl.NewControllerManagedBy(mgr).
|
||||
For(&k8sv1alpha1.PhysicalBackup{}).
|
||||
Complete(r)
|
||||
func (r *PhysicalBackupReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error {
|
||||
builder := ctrl.NewControllerManagedBy(mgr).
|
||||
For(&mariadbv1alpha1.PhysicalBackup{}).
|
||||
Owns(&batchv1.Job{})
|
||||
|
||||
if err := mariadbv1alpha1.IndexPhysicalBackup(ctx, mgr, builder, r.Client); err != nil {
|
||||
return fmt.Errorf("error indexing PhysicalBackup: %v", err)
|
||||
}
|
||||
|
||||
return builder.Complete(r)
|
||||
}
|
||||
|
Reference in New Issue
Block a user