Skip to content

Commit

Permalink
[OpenShit] Fix forbidden error for communitytasks
Browse files Browse the repository at this point in the history
  • Loading branch information
savitaashture committed Nov 19, 2021
1 parent a55812a commit a41e99d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pkg/reconciler/openshift/tektonaddon/tektonaddon.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
tektonaddonreconciler "github.com/tektoncd/operator/pkg/client/injection/reconciler/operator/v1alpha1/tektonaddon"
"github.com/tektoncd/operator/pkg/reconciler/common"
tektonaddon "github.com/tektoncd/operator/pkg/reconciler/openshift/tektonaddon/pipelinetemplates"
"go.uber.org/zap"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -186,7 +187,7 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ta *v1alpha1.TektonAddon
}

if !exist {
return r.ensureClusterTasks(ctx, ta)
return r.ensureClusterTasks(ctx, ta, logger)
}
} else {
// if disabled then delete the installer Set if exist
Expand Down Expand Up @@ -332,7 +333,7 @@ func (r *Reconciler) ensurePipelineTemplates(ctx context.Context, ta *v1alpha1.T
return nil
}

func (r *Reconciler) ensureClusterTasks(ctx context.Context, ta *v1alpha1.TektonAddon) error {
func (r *Reconciler) ensureClusterTasks(ctx context.Context, ta *v1alpha1.TektonAddon, logger *zap.SugaredLogger) error {
clusterTaskManifest := r.manifest
// Read clusterTasks from ko data
if err := applyAddons(&clusterTaskManifest, "02-clustertasks"); err != nil {
Expand All @@ -346,15 +347,17 @@ func (r *Reconciler) ensureClusterTasks(ctx context.Context, ta *v1alpha1.Tekton
communityClusterTaskManifest := r.manifest

if err := r.appendCommunityTarget(ctx, &communityClusterTaskManifest, ta); err != nil {
return err
}
// Continue if failed to resolve community task URL.
// (Ex: on disconnected cluster community tasks won't be reachable because of proxy).
logger.Error("Failed to get community task ", err)
} else {
if err := r.communityTransform(ctx, &communityClusterTaskManifest, ta); err != nil {
return err
}

if err := r.communityTransform(ctx, &communityClusterTaskManifest, ta); err != nil {
return err
clusterTaskManifest = clusterTaskManifest.Append(communityClusterTaskManifest)
}

clusterTaskManifest = clusterTaskManifest.Append(communityClusterTaskManifest)

if err := createInstallerSet(ctx, r.operatorClientSet, ta, clusterTaskManifest,
r.version, clusterTaskInstallerSet, "addon-clustertasks"); err != nil {
return err
Expand Down

0 comments on commit a41e99d

Please sign in to comment.