Skip to content

Commit

Permalink
Fixes addon component deletion
Browse files Browse the repository at this point in the history
If clustertask and pipelines templates are disabled then
due to return statement it used to return early without
executing remaning code.

Signed-off-by: Shivam Mukhade <[email protected]>
  • Loading branch information
Shivam Mukhade authored and tekton-robot committed Sep 24, 2021
1 parent 0390095 commit 0ffff66
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
13 changes: 13 additions & 0 deletions pkg/apis/operator/v1alpha1/tektonaddon_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package v1alpha1

import (
"reflect"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
duckv1 "knative.dev/pkg/apis/duck/v1"
)
Expand Down Expand Up @@ -65,6 +67,17 @@ type TektonAddonStatus struct {
AddonsInstallerSet map[string]string `json:"installerSets,omitempty"`
}

// Addon defines the field to customize Addon component
type Addon struct {
// Params is the list of params passed for Addon customization
// +optional
Params []Param `json:"params,omitempty"`
}

func (a Addon) IsEmpty() bool {
return reflect.DeepEqual(a, Addon{})
}

// TektonAddonsList contains a list of TektonAddon
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type TektonAddonList struct {
Expand Down
8 changes: 6 additions & 2 deletions pkg/reconciler/openshift/tektonaddon/tektonaddon.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ta *v1alpha1.TektonAddon
}
} else {
// if disabled then delete the installer Set if exist
return r.deleteInstallerSet(ctx, ta, clusterTaskInstallerSet)
if err := r.deleteInstallerSet(ctx, ta, clusterTaskInstallerSet); err != nil {
return err
}
}

err := r.checkComponentStatus(ctx, ta, clusterTaskInstallerSet)
Expand All @@ -207,7 +209,9 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ta *v1alpha1.TektonAddon
}
} else {
// if disabled then delete the installer Set if exist
return r.deleteInstallerSet(ctx, ta, pipelinesTemplateInstallerSet)
if err := r.deleteInstallerSet(ctx, ta, pipelinesTemplateInstallerSet); err != nil {
return err
}
}

err = r.checkComponentStatus(ctx, ta, pipelinesTemplateInstallerSet)
Expand Down

0 comments on commit 0ffff66

Please sign in to comment.