Skip to content

Commit

Permalink
remove addondeploymentconfig creation (#209)
Browse files Browse the repository at this point in the history
* remove addondeploymentconfig creation

Signed-off-by: Sherin Varughese <shvarugh@redhat.com>

* remove unused function

Signed-off-by: Sherin Varughese <shvarugh@redhat.com>

---------

Signed-off-by: Sherin Varughese <shvarugh@redhat.com>
  • Loading branch information
SherinV committed Jul 2, 2024
1 parent 3d97318 commit 4271ee7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 93 deletions.
9 changes: 0 additions & 9 deletions controllers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
addonv1alpha1 "open-cluster-management.io/api/addon/v1alpha1"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
)

Expand Down Expand Up @@ -63,10 +62,6 @@ func getImagePullSecretName() string {
return "search-pull-secret"
}

func getClusterManagementAddonName() string {
return "search-collector"
}

func getDefaultDBConfig(varName string) string {
value, okay := dbDefaultMap[varName]
if okay {
Expand Down Expand Up @@ -565,10 +560,6 @@ func DeploymentEquals(current, new *appsv1.Deployment) bool {
return equality.Semantic.DeepEqual(current.Spec, new.Spec)
}

func AddonDeploymentConfigEquals(current, new *addonv1alpha1.AddOnDeploymentConfig) bool {
return equality.Semantic.DeepEqual(current.Spec, new.Spec)
}

// update status condition in search instance
func updateStatusCondition(instance *searchv1alpha1.Search, podList *corev1.PodList) {
var podCondition metav1.Condition
Expand Down
64 changes: 0 additions & 64 deletions controllers/create_addondeploymentconfig.go

This file was deleted.

15 changes: 6 additions & 9 deletions controllers/search_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ func (r *SearchReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
}
return ctrl.Result{}, err
}
// Start the addon framework part of search controller.
// This is in charge of approving CertificateSigningRequest for managed clusters.
once.Do(func() {
addon.CreateAddonOnce(ctx, instance)
})

// Update status
if strings.HasPrefix(req.Name, "Pod/") {
podName := strings.Split(req.Name, "/")[1]
Expand Down Expand Up @@ -157,11 +163,6 @@ func (r *SearchReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
log.Error(err, "GlobalSearchUserClusterRole setup failed")
return *result, err
}
result, err = r.createAddOnDeploymentConfig(ctx, r.NewAddOnDeploymentConfig(instance))
if result != nil {
log.Error(err, "AddOnDeploymentConfig setup failed")
return *result, err
}
result, err = r.createRoleBinding(ctx, r.ClusterRoleBinding(instance))
if result != nil {
log.Error(err, "ClusterRoleBinding setup failed")
Expand Down Expand Up @@ -246,10 +247,6 @@ func (r *SearchReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
return *result, err
}

once.Do(func() {
addon.CreateAddonOnce(ctx, instance)
})

cleanOnce.Do(func() {
// delete legacy servicemonitor setup
// Starting with ACM 2.9, ServiceMonitors are created in the open-cluster-management namespace.
Expand Down
11 changes: 0 additions & 11 deletions controllers/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,6 @@ func TestSearch_controller(t *testing.T) {
t.Errorf("Failed to get serviceaccount %s: %v", getRoleBindingName(), err)
}

//check for AddonDeploymentConfig
adc := &addonv1alpha1.AddOnDeploymentConfig{}
err = cl.Get(context.TODO(), types.NamespacedName{
Name: getClusterManagementAddonName(),
Namespace: namespace,
}, adc)

if err != nil {
t.Errorf("Failed to get AddOnDeploymentConfig %s: %v", getClusterManagementAddonName(), err)
}

//check for PVC
pvc := &corev1.PersistentVolumeClaim{}
storageClassName := search.Spec.DBStorage.StorageClassName
Expand Down

0 comments on commit 4271ee7

Please sign in to comment.