forked from Azure/azure-service-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcosmosdbsqldatabase_controller.go
32 lines (24 loc) · 1.11 KB
/
cosmosdbsqldatabase_controller.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
package controllers
import (
"context"
ctrl "sigs.k8s.io/controller-runtime"
"github.com/Azure/azure-service-operator/api/v1alpha1"
)
// CosmosDBSQLDatabaseReconciler reconciles a CosmosDB SQL Database object
type CosmosDBSQLDatabaseReconciler struct {
Reconciler *AsyncReconciler
}
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=cosmosdbsqldatabases,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={cosmosdbsqldatabases/status,cosmosdbsqldatabases/finalizers},verbs=get;update;patch
// Reconcile function does the main reconciliation loop of the operator
func (r *CosmosDBSQLDatabaseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &v1alpha1.CosmosDBSQLDatabase{})
}
// SetupWithManager sets up the controller functions
func (r *CosmosDBSQLDatabaseReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&v1alpha1.CosmosDBSQLDatabase{}).
Complete(r)
}