github.com/argoproj-labs/argocd-operator@v0.10.0/controllers/notificationsconfiguration/reconcile.go (about)

     1  // Copyright 2019 ArgoCD Operator Developers
     2  //
     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  //
     7  // 	http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package notificationsconfiguration
    16  
    17  import (
    18  	corev1 "k8s.io/api/core/v1"
    19  	"sigs.k8s.io/controller-runtime/pkg/builder"
    20  
    21  	v1alpha1 "github.com/argoproj-labs/argocd-operator/api/v1alpha1"
    22  )
    23  
    24  // reconcileNotificationsConfigurationResources will reconcile all the resources for the given CR.
    25  func (r *NotificationsConfigurationReconciler) reconcileNotificationsConfigurationResources(cr *v1alpha1.NotificationsConfiguration) error {
    26  
    27  	if err := r.reconcileNotificationsConfigmap(cr); err != nil {
    28  		return err
    29  	}
    30  	return nil
    31  }
    32  
    33  // setResourceWatches will register Watches for each of the supported Resources.
    34  func setResourceWatches(bld *builder.Builder) *builder.Builder {
    35  	// Watch for changes to primary resource NotificationsConfiguration
    36  	bld.For(&v1alpha1.NotificationsConfiguration{})
    37  	// Watch for changes to Configmap sub-resources owned by NotificationsConfigurationController.
    38  	bld.Owns(&corev1.ConfigMap{})
    39  
    40  	return bld
    41  }