ec108a337fa248df4d66cbbfb7c5bb054dbff5d3
[ric-plt/ricdms.git] / xappKubernetesOperator / internal / controller / xappdep_controller.go
1 /*
2 Copyright 2023.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8     http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 package controller
18
19 import (
20         "context"
21
22         "k8s.io/apimachinery/pkg/runtime"
23         ctrl "sigs.k8s.io/controller-runtime"
24         "sigs.k8s.io/controller-runtime/pkg/client"
25
26         depxappv1 "depxapp/api/v1"
27 )
28
29 // XappDepReconciler reconciles a XappDep object
30 type XappDepReconciler struct {
31         client.Client
32         Scheme *runtime.Scheme
33 }
34
35 //+kubebuilder:rbac:groups=depxapp.xapp.com,resources=xappdeps,verbs=get;list;watch;create;update;patch;delete
36 //+kubebuilder:rbac:groups=depxapp.xapp.com,resources=xappdeps/status,verbs=get;update;patch
37 //+kubebuilder:rbac:groups=depxapp.xapp.com,resources=xappdeps/finalizers,verbs=update
38
39 // Reconcile is part of the main kubernetes reconciliation loop which aims to
40 // move the current state of the cluster closer to the desired state.
41 // TODO(user): Modify the Reconcile function to compare the state specified by
42 // the XappDep object against the actual cluster state, and then
43 // perform operations to make the cluster state reflect the state specified by
44 // the user.
45 //
46 // For more details, check Reconcile and its Result here:
47 // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.15.0/pkg/reconcile
48 func (r *XappDepReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
49
50         // TODO(user): your logic here
51
52         return ctrl.Result{}, nil
53
54 }
55
56 // SetupWithManager sets up the controller with the Manager.
57 func (r *XappDepReconciler) SetupWithManager(mgr ctrl.Manager) error {
58         return ctrl.NewControllerManagedBy(mgr).
59                 For(&depxappv1.XappDep{}).
60                 Complete(r)
61 }