externaltool_controller.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. Copyright 2026 LocoStack.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package controller
  14. import (
  15. "context"
  16. "k8s.io/apimachinery/pkg/runtime"
  17. ctrl "sigs.k8s.io/controller-runtime"
  18. "sigs.k8s.io/controller-runtime/pkg/client"
  19. logf "sigs.k8s.io/controller-runtime/pkg/log"
  20. "github.com/LocoStack/loco-operator/api/v1alpha1"
  21. )
  22. // ExternalToolReconciler reconciles a ExternalTool object
  23. type ExternalToolReconciler struct {
  24. client.Client
  25. Scheme *runtime.Scheme
  26. }
  27. // +kubebuilder:rbac:groups=locostack.com,resources=externaltools,verbs=get;list;watch;create;update;patch;delete
  28. // +kubebuilder:rbac:groups=locostack.com,resources=externaltools/status,verbs=get;update;patch
  29. // +kubebuilder:rbac:groups=locostack.com,resources=externaltools/finalizers,verbs=update
  30. func (r *ExternalToolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
  31. _ = logf.FromContext(ctx)
  32. // TODO(user): your logic here
  33. return ctrl.Result{}, nil
  34. }
  35. // SetupWithManager sets up the controller with the Manager.
  36. func (r *ExternalToolReconciler) SetupWithManager(mgr ctrl.Manager) error {
  37. return ctrl.NewControllerManagedBy(mgr).
  38. For(&v1alpha1.ExternalTool{}).
  39. Named("externaltool").
  40. Complete(r)
  41. }