Skip to content

Commit

Permalink
fix controller names
Browse files Browse the repository at this point in the history
  • Loading branch information
thegridman committed Jan 2, 2025
1 parent 3f9688f commit 9116a92
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 26 deletions.
7 changes: 0 additions & 7 deletions api/v1/coherencejobresource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ func (in *CoherenceJob) GetStatefulSetSpec() (*CoherenceStatefulSetResourceSpec,
return nil, false
}

func (in *CoherenceJob) GetAnnotations() map[string]string {
if in != nil {
return in.Annotations
}
return nil
}

func (in *CoherenceJob) AddAnnotation(key, value string) {
if in != nil {
if in.Annotations == nil {
Expand Down
7 changes: 0 additions & 7 deletions api/v1/coherenceresource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,6 @@ func (in *Coherence) CreateAnnotations() map[string]string {
return annotations
}

func (in *Coherence) GetAnnotations() map[string]string {
if in != nil {
return in.Annotations
}
return nil
}

func (in *Coherence) AddAnnotation(key, value string) {
if in != nil {
if in.Annotations == nil {
Expand Down
10 changes: 5 additions & 5 deletions controllers/coherencejob_controller.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2024, Oracle and/or its affiliates.
* Copyright (c) 2020, 2025, Oracle and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
Expand Down Expand Up @@ -242,10 +242,10 @@ func (in *CoherenceJobReconciler) SetupWithManager(mgr ctrl.Manager, cs clients.
// This is important to ensure, for example, that a ConfigMap is created before the
// StatefulSet that uses it.
reconcilers := []reconciler.SecondaryResourceReconciler{
reconciler.NewConfigMapReconciler(mgr, cs),
secret.NewSecretReconciler(mgr, cs),
reconciler.NewServiceReconciler(mgr, cs),
servicemonitor.NewServiceMonitorReconciler(mgr, cs),
reconciler.NewNamedConfigMapReconciler(mgr, cs, "controllers.JobConfigMap"),
secret.NewNamedSecretReconciler(mgr, cs, "controllers.JobSecret"),
reconciler.NewNamedServiceReconciler(mgr, cs, "controllers.JobService"),
servicemonitor.NewNamedServiceMonitorReconciler(mgr, cs, "controllers.JobServiceMonitor"),
job.NewJobReconciler(mgr, cs),
}

Expand Down
14 changes: 11 additions & 3 deletions controllers/reconciler/simple_reconciler.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2024, Oracle and/or its affiliates.
* Copyright (c) 2020, 2025, Oracle and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
Expand All @@ -21,11 +21,19 @@ import (
var _ reconcile.Reconciler = &SimpleReconciler{}

func NewConfigMapReconciler(mgr manager.Manager, cs clients.ClientSet) SecondaryResourceReconciler {
return NewSimpleReconciler(mgr, cs, "controllers.ConfigMap", coh.ResourceTypeConfigMap, &corev1.ConfigMap{})
return NewNamedConfigMapReconciler(mgr, cs, "controllers.ConfigMap")
}

func NewNamedConfigMapReconciler(mgr manager.Manager, cs clients.ClientSet, name string) SecondaryResourceReconciler {
return NewSimpleReconciler(mgr, cs, name, coh.ResourceTypeConfigMap, &corev1.ConfigMap{})
}

func NewServiceReconciler(mgr manager.Manager, cs clients.ClientSet) SecondaryResourceReconciler {
return NewSimpleReconciler(mgr, cs, "controllers.Service", coh.ResourceTypeService, &corev1.Service{})
return NewNamedServiceReconciler(mgr, cs, "controllers.Service")
}

func NewNamedServiceReconciler(mgr manager.Manager, cs clients.ClientSet, name string) SecondaryResourceReconciler {
return NewSimpleReconciler(mgr, cs, name, coh.ResourceTypeService, &corev1.Service{})
}

// NewSimpleReconciler returns a new SimpleReconciler.
Expand Down
9 changes: 7 additions & 2 deletions controllers/secret/secret_controller.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2024, Oracle and/or its affiliates.
* Copyright (c) 2020, 2025, Oracle and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
Expand Down Expand Up @@ -27,6 +27,11 @@ var _ reconcile.Reconciler = &ReconcileSecret{}

// NewSecretReconciler returns a new Secret reconciler.
func NewSecretReconciler(mgr manager.Manager, cs clients.ClientSet) reconciler.SecondaryResourceReconciler {
return NewNamedSecretReconciler(mgr, cs, controllerName)
}

// NewNamedSecretReconciler returns a new Secret reconciler.
func NewNamedSecretReconciler(mgr manager.Manager, cs clients.ClientSet, name string) reconciler.SecondaryResourceReconciler {
r := &ReconcileSecret{
SimpleReconciler: reconciler.SimpleReconciler{
ReconcileSecondaryResource: reconciler.ReconcileSecondaryResource{
Expand All @@ -37,7 +42,7 @@ func NewSecretReconciler(mgr manager.Manager, cs clients.ClientSet) reconciler.S
},
}

r.SetCommonReconciler(controllerName, mgr, cs)
r.SetCommonReconciler(name, mgr, cs)
return r
}

Expand Down
9 changes: 7 additions & 2 deletions controllers/servicemonitor/servicemonitor_controller.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2024, Oracle and/or its affiliates.
* Copyright (c) 2020, 2025, Oracle and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
Expand Down Expand Up @@ -35,6 +35,11 @@ var _ reconcile.Reconciler = &ReconcileServiceMonitor{}

// NewServiceMonitorReconciler returns a new ServiceMonitor reconciler.
func NewServiceMonitorReconciler(mgr manager.Manager, cs clients.ClientSet) reconciler.SecondaryResourceReconciler {
return NewNamedServiceMonitorReconciler(mgr, cs, controllerName)
}

// NewNamedServiceMonitorReconciler returns a new ServiceMonitor reconciler.
func NewNamedServiceMonitorReconciler(mgr manager.Manager, cs clients.ClientSet, name string) reconciler.SecondaryResourceReconciler {
r := &ReconcileServiceMonitor{
ReconcileSecondaryResource: reconciler.ReconcileSecondaryResource{
Kind: coh.ResourceTypeServiceMonitor,
Expand All @@ -44,7 +49,7 @@ func NewServiceMonitorReconciler(mgr manager.Manager, cs clients.ClientSet) reco
monClient: client.NewForConfigOrDie(mgr.GetConfig()),
}

r.SetCommonReconciler(controllerName, mgr, cs)
r.SetCommonReconciler(name, mgr, cs)
return r
}

Expand Down

0 comments on commit 9116a92

Please sign in to comment.