Repository: tektoncd/operator
Pull request #628 (2022-02-20 08:55:02)

Refactors the mechanism for creating and updating TektonPipeline CR and TektonTrigger CR
# Changes

## Refactoring the TektonPipeline CR
  
- This patch now checks first if there is TektonPipeline CR
    already present, if yes then it checks if there are any
    changes in the instance, if yes then it makes the changes
    and updates the CR, if not then it creates a new CR

 - This patch also removes the polling state mechanism for
    tekton Pipeline CR

---

## Refactoring the TektonTrigger CR

  - This patch now checks first if there is TektonTrigger CR
         already present, if yes then it checks if there are any
         changes in the instance, if yes then it makes the changes
         and updates the CR, if not then it creates a new CR
    
  - This patch also removes the polling state mechanism for
     tekton Trigger CR

---
Signed-off-by: Puneet Punamiya <ppunamiy@redhat.com>

<!-- 🎉🎉🎉 Thank you for the PR!!! 🎉🎉🎉 -->

<!-- Describe your changes here- ideally you can get that description straight from
your descriptive commit message(s)! -->

# Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

- [ ] Includes [tests](https://github.com/tektoncd/community/blob/master/standards.md#principles) (if functionality changed/added)
- [ ] Includes [docs](https://github.com/tektoncd/community/blob/master/standards.md#principles) (if user facing)
- [ ] Commit messages follow [commit message best practices](https://github.com/tektoncd/community/blob/master/standards.md#commit-messages)

_See [the contribution guide](https://github.com/tektoncd/operator/blob/master/CONTRIBUTING.md) for more details._

# Release Notes

<!--
Describe any user facing changes here, or delete this block.

Examples of user facing changes:
- API changes
- Bug fixes
- Any changes in behavior
- Changes requiring upgrade notices or deprecation warnings

For pull requests with a release note:

```release-note
Your release note here
```

For pull requests that require additional action from users switching to the new release, include the string "action required" (case insensitive) in the release note:

```release-note
action required: your release note here
```

For pull requests that don't need to be mentioned at release time, use the `/release-note-none` Prow command to add the `release-note-none` label to the PR. You can also write the string "NONE" as a release note in your PR description:

```release-note
NONE
```
-->


tekton-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by:
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **vincent-pli**
You can assign the PR to them by writing `/assign @vincent-pli` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=tektoncd%2Foperator).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/tektoncd/operator/blob/main/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["vincent-pli"]} -->
tekton-robot: The following is the coverage report on the affected files.
Say `/test pull-tekton-operator-go-coverage` to re-run this coverage report

File | Old Coverage | New Coverage | Delta
---- |:------------:|:------------:|:-----:
[pkg/reconciler/shared/tektonconfig/pipeline/pipeline.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-go-coverage/1495321174706491392/artifacts/line-cov.html#file0) | 56.7% | 48.3% | -8.4

tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-unit-tests | 8bb86695ae0de992f0d03dad767e8bd0b150b233 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-unit-tests/1496002288072790018/) | `/test pull-tekton-operator-unit-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/628). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-unit-tests | 8bb86695ae0de992f0d03dad767e8bd0b150b233 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-unit-tests/1496002288072790018/) | `/test pull-tekton-operator-unit-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/628). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: The following is the coverage report on the affected files.
Say `/test pull-tekton-operator-go-coverage` to re-run this coverage report

File | Old Coverage | New Coverage | Delta
---- |:------------:|:------------:|:-----:
[pkg/reconciler/shared/tektonconfig/pipeline/pipeline.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-go-coverage/1496011347375165443/artifacts/line-cov.html#file0) | 56.7% | 67.7% | 11.0

tekton-robot: The following is the coverage report on the affected files.
Say `/test pull-tekton-operator-go-coverage` to re-run this coverage report

File | Old Coverage | New Coverage | Delta
---- |:------------:|:------------:|:-----:
[pkg/reconciler/shared/tektonconfig/pipeline/pipeline.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-go-coverage/1496052870783438851/artifacts/line-cov.html#file0) | 56.7% | 66.7% | 10.0

PuneetPunamiya: /hold cancel
nikhil-thomas: @PuneetPunamiya we also need similar changes for triggers in the code block following the the changes this patch makes. 

Could you handle that also in this patch.
nikhil-thomas: /approve
tekton-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/tektoncd/operator/pull/628#issuecomment-1053920614" title="Approved">nikhil-thomas</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=tektoncd%2Foperator).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/tektoncd/operator/blob/main/OWNERS)~~ [nikhil-thomas]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
tekton-robot: The following is the coverage report on the affected files.
Say `/test pull-tekton-operator-go-coverage` to re-run this coverage report

File | Old Coverage | New Coverage | Delta
---- |:------------:|:------------:|:-----:
[pkg/reconciler/shared/tektonconfig/pipeline/pipeline.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-go-coverage/1498609721664344066/artifacts/line-cov.html#file0) | 56.7% | 37.1% | -19.6
[pkg/reconciler/shared/tektonconfig/trigger/trigger.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-go-coverage/1498609721664344066/artifacts/line-cov.html#file1) | 71.2% | 37.1% | -34.1

tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-build-tests | 12a8d3ae9dff59b9e4254b5ea614fa06520ce924 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-build-tests/1498609721664344064/) | `/test pull-tekton-operator-build-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/628). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-build-tests | 12a8d3ae9dff59b9e4254b5ea614fa06520ce924 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-build-tests/1498609721664344064/) | `/test pull-tekton-operator-build-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/628). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
nikhil-thomas: /lgtm
tekton-robot: New changes are detected. LGTM label has been removed.
tekton-robot: The following is the coverage report on the affected files.
Say `/test pull-tekton-operator-go-coverage` to re-run this coverage report

File | Old Coverage | New Coverage | Delta
---- |:------------:|:------------:|:-----:
[pkg/reconciler/shared/tektonconfig/pipeline/pipeline.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-go-coverage/1498616517162438656/artifacts/line-cov.html#file0) | 56.7% | 37.1% | -19.6
[pkg/reconciler/shared/tektonconfig/trigger/trigger.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-go-coverage/1498616517162438656/artifacts/line-cov.html#file1) | 71.2% | 37.1% | -34.1

tekton-robot: The following is the coverage report on the affected files.
Say `/test pull-tekton-operator-go-coverage` to re-run this coverage report

File | Old Coverage | New Coverage | Delta
---- |:------------:|:------------:|:-----:
[pkg/reconciler/shared/tektonconfig/pipeline/pipeline.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-go-coverage/1498617774937739266/artifacts/line-cov.html#file0) | 56.7% | 21.4% | -35.3
[pkg/reconciler/shared/tektonconfig/trigger/trigger.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-go-coverage/1498617774937739266/artifacts/line-cov.html#file1) | 71.2% | 21.4% | -49.8

tekton-robot: @PuneetPunamiya: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-build-tests | 12a8d3ae9dff59b9e4254b5ea614fa06520ce924 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-build-tests/1498609721664344064/) | `/test pull-tekton-operator-build-tests`
pull-tekton-operator-unit-tests | d9788f0589bb929d351f20ee2ae4eee4d8377426 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-unit-tests/1498617774937739264/) | `/test pull-tekton-operator-unit-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/628). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: @PuneetPunamiya: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-build-tests | 12a8d3ae9dff59b9e4254b5ea614fa06520ce924 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-build-tests/1498609721664344064/) | `/test pull-tekton-operator-build-tests`
pull-tekton-operator-unit-tests | d9788f0589bb929d351f20ee2ae4eee4d8377426 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-unit-tests/1498617774937739264/) | `/test pull-tekton-operator-unit-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/628). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: @PuneetPunamiya: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-unit-tests | d9788f0589bb929d351f20ee2ae4eee4d8377426 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-unit-tests/1498617774937739264/) | `/test pull-tekton-operator-unit-tests`
pull-tekton-operator-build-tests | d9788f0589bb929d351f20ee2ae4eee4d8377426 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-build-tests/1498617774937739267/) | `/test pull-tekton-operator-build-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/628). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: @PuneetPunamiya: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-unit-tests | d9788f0589bb929d351f20ee2ae4eee4d8377426 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-unit-tests/1498617774937739264/) | `/test pull-tekton-operator-unit-tests`
pull-tekton-operator-build-tests | d9788f0589bb929d351f20ee2ae4eee4d8377426 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-build-tests/1498617774937739267/) | `/test pull-tekton-operator-build-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/628). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: @PuneetPunamiya: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-tekton-operator-build-tests | d3140521904ddf88aee4cdcc2a115252b6567a04 | [link](https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-build-tests/1498620418007764994/) | `/test pull-tekton-operator-build-tests`

[Full PR test history](https://tekton-releases.appspot.com/pr/tektoncd_operator/628). [Your PR dashboard](https://prow.tekton.dev/pr/PuneetPunamiya).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
tekton-robot: The following is the coverage report on the affected files.
Say `/test pull-tekton-operator-go-coverage` to re-run this coverage report

File | Old Coverage | New Coverage | Delta
---- |:------------:|:------------:|:-----:
[pkg/reconciler/shared/tektonconfig/pipeline/pipeline.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-go-coverage/1498624067110965249/artifacts/line-cov.html#file0) | 56.7% | 37.1% | -19.6
[pkg/reconciler/shared/tektonconfig/trigger/trigger.go](https://storage.cloud.google.com/tekton-prow/pr-logs/pull/tektoncd_operator/628/pull-tekton-operator-go-coverage/1498624067110965249/artifacts/line-cov.html#file1) | 71.2% | 37.1% | -34.1


Patch:
diff --git a/Makefile b/Makefile
index 42d357401..6ac2148eb 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ TEKTON_PIPELINE_VERSION ?= latest
 TEKTON_TRIGGERS_VERSION ?= latest
 TEKTON_DASHBOARD_VERSION ?= latest
 TEKTON_RESULTS_VERSION ?= v0.4.0 # latest returns an older version hence hard coding to v0.3.1 for now (tektoncd/results#138)
-PAC_VERSION ?= 0.5.2
+PAC_VERSION ?= 0.5.3
 
 $(BIN)/ko: PACKAGE=github.com/google/ko/cmd/ko
 
diff --git a/docs/TektonPipeline.md b/docs/TektonPipeline.md
index 5e305244b..e8490d332 100644
--- a/docs/TektonPipeline.md
+++ b/docs/TektonPipeline.md
@@ -46,21 +46,6 @@ them as per their need.
     See more in the workspace documentation about [Affinity Assistant](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md#affinity-assistant-and-specifying-workspace-order-in-a-pipeline)
     or more info [here](https://github.com/tektoncd/pipeline/pull/2630).
 
-
-- `disable-home-env-overwrite` (Default: `true`)
-
-    Setting this flag to "false" will allow Tekton to override your Task container's $HOME environment variable.
-
-    See more info [here](https://github.com/tektoncd/pipeline/issues/2013).
-
-
-- `disable-working-directory-overwrite` (Default: `true`)
-
-    Setting this flag to "false" will allow Tekton to override your Task container's working directory.
-
-    See more info [here](https://github.com/tektoncd/pipeline/issues/1836).
-
-
 - `disable-creds-init` (Default: `false`)
 
     Setting this flag to "true" will prevent Tekton scanning attached service accounts and injecting any credentials it
diff --git a/pkg/apis/operator/v1alpha1/tektonpipeline_defaults.go b/pkg/apis/operator/v1alpha1/tektonpipeline_defaults.go
index 631f98af6..bc330dd3c 100644
--- a/pkg/apis/operator/v1alpha1/tektonpipeline_defaults.go
+++ b/pkg/apis/operator/v1alpha1/tektonpipeline_defaults.go
@@ -34,12 +34,15 @@ func (tp *TektonPipeline) SetDefaults(ctx context.Context) {
 }
 
 func (p *PipelineProperties) setDefaults() {
-	if p.DisableHomeEnvOverwrite == nil {
-		p.DisableHomeEnvOverwrite = ptr.Bool(true)
+	// Disabling this for now and will be removed in next release
+	// disabling will hide this from users in TektonConfig/TektonPipeline
+	if p.DisableHomeEnvOverwrite != nil {
+		p.DisableHomeEnvOverwrite = nil
 	}
-	if p.DisableWorkingDirectoryOverwrite == nil {
-		p.DisableWorkingDirectoryOverwrite = ptr.Bool(true)
+	if p.DisableWorkingDirectoryOverwrite != nil {
+		p.DisableWorkingDirectoryOverwrite = nil
 	}
+
 	if p.DisableCredsInit == nil {
 		p.DisableCredsInit = ptr.Bool(false)
 	}
diff --git a/pkg/apis/operator/v1alpha1/tektonpipeline_types.go b/pkg/apis/operator/v1alpha1/tektonpipeline_types.go
index 9d3cc5628..cd9b30f53 100644
--- a/pkg/apis/operator/v1alpha1/tektonpipeline_types.go
+++ b/pkg/apis/operator/v1alpha1/tektonpipeline_types.go
@@ -85,9 +85,13 @@ type Pipeline struct {
 
 // PipelineProperties defines customizable flags for Pipeline Component.
 type PipelineProperties struct {
-	DisableAffinityAssistant                 *bool  `json:"disable-affinity-assistant,omitempty"`
-	DisableHomeEnvOverwrite                  *bool  `json:"disable-home-env-overwrite,omitempty"`
-	DisableWorkingDirectoryOverwrite         *bool  `json:"disable-working-directory-overwrite,omitempty"`
+	DisableAffinityAssistant *bool `json:"disable-affinity-assistant,omitempty"`
+
+	// DEPRECATED:  (Removed in Pipelines v0.33.0): to be removed in next release
+	DisableHomeEnvOverwrite *bool `json:"disable-home-env-overwrite,omitempty"`
+	// DEPRECATED: (Removed in Pipelines v0.33.0): to be removed in next release
+	DisableWorkingDirectoryOverwrite *bool `json:"disable-working-directory-overwrite,omitempty"`
+
 	DisableCredsInit                         *bool  `json:"disable-creds-init,omitempty"`
 	RunningInEnvironmentWithInjectedSidecars *bool  `json:"running-in-environment-with-injected-sidecars,omitempty"`
 	RequireGitSshSecretKnownHosts            *bool  `json:"require-git-ssh-secret-known-hosts,omitempty"`
diff --git a/pkg/reconciler/shared/tektonconfig/pipeline/pipeline.go b/pkg/reconciler/shared/tektonconfig/pipeline/pipeline.go
index 8470fdd35..af914293d 100644
--- a/pkg/reconciler/shared/tektonconfig/pipeline/pipeline.go
+++ b/pkg/reconciler/shared/tektonconfig/pipeline/pipeline.go
@@ -20,83 +20,44 @@ import (
 	"context"
 	"errors"
 	"fmt"
-	"log"
 	"reflect"
 
 	"github.com/tektoncd/operator/pkg/apis/operator/v1alpha1"
 
 	op "github.com/tektoncd/operator/pkg/client/clientset/versioned/typed/operator/v1alpha1"
-	operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/clientset/versioned/typed/operator/v1alpha1"
 	"github.com/tektoncd/operator/pkg/reconciler/common"
 	apierrs "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/util/wait"
-	"knative.dev/pkg/test/logging"
 )
 
-func CreatePipelineCR(ctx context.Context, instance v1alpha1.TektonComponent, client operatorv1alpha1.OperatorV1alpha1Interface) error {
-	configInstance := instance.(*v1alpha1.TektonConfig)
-	if _, err := ensureTektonPipelineExists(ctx, client.TektonPipelines(), configInstance); err != nil {
-		return errors.New(err.Error())
-	}
-	if _, err := waitForTektonPipelineState(ctx, client.TektonPipelines(), v1alpha1.PipelineResourceName,
-		isTektonPipelineReady); err != nil {
-		log.Println("TektonPipeline is not in ready state: ", err)
-		return err
-	}
-	return nil
-}
-
-func ensureTektonPipelineExists(ctx context.Context, clients op.TektonPipelineInterface, config *v1alpha1.TektonConfig) (*v1alpha1.TektonPipeline, error) {
+func EnsureTektonPipelineExists(ctx context.Context, clients op.TektonPipelineInterface, config *v1alpha1.TektonConfig) (*v1alpha1.TektonPipeline, error) {
 	tpCR, err := GetPipeline(ctx, clients, v1alpha1.PipelineResourceName)
-	if err == nil {
-		// if the pipeline spec is changed then update the instance
-		updated := false
-
-		if config.Spec.TargetNamespace != tpCR.Spec.TargetNamespace {
-			tpCR.Spec.TargetNamespace = config.Spec.TargetNamespace
-			updated = true
-		}
-
-		if !reflect.DeepEqual(tpCR.Spec.Pipeline, config.Spec.Pipeline) {
-			tpCR.Spec.Pipeline = config.Spec.Pipeline
-			updated = true
-		}
-
-		if !reflect.DeepEqual(tpCR.Spec.Config, config.Spec.Config) {
-			tpCR.Spec.Config = config.Spec.Config
-			updated = true
-		}
 
-		if tpCR.ObjectMeta.OwnerReferences == nil {
-			ownerRef := *metav1.NewControllerRef(config, config.GroupVersionKind())
-			tpCR.ObjectMeta.OwnerReferences = []metav1.OwnerReference{ownerRef}
-			updated = true
+	if err != nil {
+		if !apierrs.IsNotFound(err) {
+			return nil, err
 		}
-
-		if updated {
-			return clients.Update(ctx, tpCR, metav1.UpdateOptions{})
+		_, err = CreatePipeline(ctx, clients, config)
+		if err != nil {
+			return nil, err
 		}
-
-		return tpCR, err
+		return nil, v1alpha1.RECONCILE_AGAIN_ERR
 	}
 
-	if apierrs.IsNotFound(err) {
-		tpCR = &v1alpha1.TektonPipeline{
-			ObjectMeta: metav1.ObjectMeta{
-				Name: v1alpha1.PipelineResourceName,
-			},
-			Spec: v1alpha1.TektonPipelineSpec{
-				CommonSpec: v1alpha1.CommonSpec{
-					TargetNamespace: config.Spec.TargetNamespace,
-				},
-				Pipeline: config.Spec.Pipeline,
-				Config:   config.Spec.Config,
-			},
-		}
+	tpCR, err = UpdatePipeline(ctx, tpCR, config, clients)
+	if err != nil {
+		return nil, err
+	}
 
-		return clients.Create(ctx, tpCR, metav1.CreateOptions{})
+	ok, err := isTektonPipelineReady(tpCR, err)
+	if err != nil {
+		return nil, err
+	}
+	if !ok {
+		return nil, v1alpha1.RECONCILE_AGAIN_ERR
 	}
+
 	return tpCR, err
 }
 
@@ -104,24 +65,59 @@ func GetPipeline(ctx context.Context, clients op.TektonPipelineInterface, name s
 	return clients.Get(ctx, name, metav1.GetOptions{})
 }
 
-// WaitForTektonPipelineState polls the status of the TektonPipeline called name
-// from client every `interval` until `inState` returns `true` indicating it
-// is done, returns an error or timeout.
-func waitForTektonPipelineState(ctx context.Context, clients op.TektonPipelineInterface, name string,
-	inState func(s *v1alpha1.TektonPipeline, err error) (bool, error)) (*v1alpha1.TektonPipeline, error) {
-	span := logging.GetEmitableSpan(ctx, fmt.Sprintf("WaitForTektonPipelineState/%s/%s", name, "TektonPipelineIsReady"))
-	defer span.End()
-
-	var lastState *v1alpha1.TektonPipeline
-	waitErr := wait.PollImmediate(common.Interval, common.Timeout, func() (bool, error) {
-		lastState, err := clients.Get(ctx, name, metav1.GetOptions{})
-		return inState(lastState, err)
-	})
+func CreatePipeline(ctx context.Context, clients op.TektonPipelineInterface, config *v1alpha1.TektonConfig) (*v1alpha1.TektonPipeline, error) {
+	tpCR := &v1alpha1.TektonPipeline{
+		ObjectMeta: metav1.ObjectMeta{
+			Name: v1alpha1.PipelineResourceName,
+		},
+		Spec: v1alpha1.TektonPipelineSpec{
+			CommonSpec: v1alpha1.CommonSpec{
+				TargetNamespace: config.Spec.TargetNamespace,
+			},
+			Pipeline: config.Spec.Pipeline,
+			Config:   config.Spec.Config,
+		},
+	}
+	_, err := clients.Create(ctx, tpCR, metav1.CreateOptions{})
+	if err != nil {
+		return nil, err
+	}
+	return tpCR, err
+}
+
+func UpdatePipeline(ctx context.Context, tpCR *v1alpha1.TektonPipeline, config *v1alpha1.TektonConfig, clients op.TektonPipelineInterface) (*v1alpha1.TektonPipeline, error) {
+	// if the pipeline spec is changed then update the instance
+	updated := false
+
+	if config.Spec.TargetNamespace != tpCR.Spec.TargetNamespace {
+		tpCR.Spec.TargetNamespace = config.Spec.TargetNamespace
+		updated = true
+	}
+
+	if !reflect.DeepEqual(tpCR.Spec.Pipeline, config.Spec.Pipeline) {
+		tpCR.Spec.Pipeline = config.Spec.Pipeline
+		updated = true
+	}
 
-	if waitErr != nil {
-		return lastState, fmt.Errorf("tektonpipeline %s is not in desired state, got: %+v: %w: For more info Please check TektonPipeline CR status", name, lastState, waitErr)
+	if !reflect.DeepEqual(tpCR.Spec.Config, config.Spec.Config) {
+		tpCR.Spec.Config = config.Spec.Config
+		updated = true
+	}
+
+	if tpCR.ObjectMeta.OwnerReferences == nil {
+		ownerRef := *metav1.NewControllerRef(config, config.GroupVersionKind())
+		tpCR.ObjectMeta.OwnerReferences = []metav1.OwnerReference{ownerRef}
+		updated = true
+	}
+
+	if updated {
+		_, err := clients.Update(ctx, tpCR, metav1.UpdateOptions{})
+		if err != nil {
+			return nil, err
+		}
+		return nil, v1alpha1.RECONCILE_AGAIN_ERR
 	}
-	return lastState, nil
+	return tpCR, nil
 }
 
 // IsTektonPipelineReady will check the status conditions of the TektonPipeline and return true if the TektonPipeline is ready.
diff --git a/pkg/reconciler/shared/tektonconfig/tektonconfig.go b/pkg/reconciler/shared/tektonconfig/tektonconfig.go
index ef6576a0c..3fa2fc518 100644
--- a/pkg/reconciler/shared/tektonconfig/tektonconfig.go
+++ b/pkg/reconciler/shared/tektonconfig/tektonconfig.go
@@ -119,16 +119,19 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, tc *v1alpha1.TektonConfi
 
 	tc.Status.MarkPreInstallComplete()
 
-	// Create TektonPipeline CR
-	if err := pipeline.CreatePipelineCR(ctx, tc, r.operatorClientSet.OperatorV1alpha1()); err != nil {
+	// Ensure if the pipeline CR already exists, if not create Pipeline CR
+	if _, err := pipeline.EnsureTektonPipelineExists(ctx, r.operatorClientSet.OperatorV1alpha1().TektonPipelines(), tc); err != nil {
 		tc.Status.MarkComponentNotReady(fmt.Sprintf("TektonPipeline: %s", err.Error()))
-		r.enqueueAfter(tc, 10*time.Second)
+		if err == v1alpha1.RECONCILE_AGAIN_ERR {
+			r.enqueueAfter(tc, 10*time.Second)
+			return nil
+		}
 		return nil
 	}
 
 	// Create TektonTrigger CR if the profile is all or basic
 	if tc.Spec.Profile == v1alpha1.ProfileAll || tc.Spec.Profile == v1alpha1.ProfileBasic {
-		if err := trigger.CreateTriggerCR(ctx, tc, r.operatorClientSet.OperatorV1alpha1()); err != nil {
+		if _, err := trigger.EnsureTektonTriggerExists(ctx, r.operatorClientSet.OperatorV1alpha1().TektonTriggers(), tc); err != nil {
 			tc.Status.MarkComponentNotReady(fmt.Sprintf("TektonTrigger: %s", err.Error()))
 			r.enqueueAfter(tc, 10*time.Second)
 			return nil
diff --git a/pkg/reconciler/shared/tektonconfig/trigger/trigger.go b/pkg/reconciler/shared/tektonconfig/trigger/trigger.go
index ac29fc276..98d004bc7 100644
--- a/pkg/reconciler/shared/tektonconfig/trigger/trigger.go
+++ b/pkg/reconciler/shared/tektonconfig/trigger/trigger.go
@@ -20,83 +20,44 @@ import (
 	"context"
 	"errors"
 	"fmt"
-	"log"
 	"reflect"
 
 	"github.com/tektoncd/operator/pkg/apis/operator/v1alpha1"
 
+	op "github.com/tektoncd/operator/pkg/client/clientset/versioned/typed/operator/v1alpha1"
 	"github.com/tektoncd/operator/pkg/reconciler/common"
 	apierrs "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/util/wait"
-	"knative.dev/pkg/test/logging"
-
-	op "github.com/tektoncd/operator/pkg/client/clientset/versioned/typed/operator/v1alpha1"
-	operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/clientset/versioned/typed/operator/v1alpha1"
 )
 
-func CreateTriggerCR(ctx context.Context, instance v1alpha1.TektonComponent, client operatorv1alpha1.OperatorV1alpha1Interface) error {
-	configInstance := instance.(*v1alpha1.TektonConfig)
-	if _, err := ensureTektonTriggerExists(ctx, client.TektonTriggers(), configInstance); err != nil {
-		return errors.New(err.Error())
-	}
-	if _, err := waitForTektonTriggerState(ctx, client.TektonTriggers(), v1alpha1.TriggerResourceName,
-		isTektonTriggerReady); err != nil {
-		log.Println("TektonTrigger is not in ready state: ", err)
-		return err
-	}
-	return nil
-}
-
-func ensureTektonTriggerExists(ctx context.Context, clients op.TektonTriggerInterface, config *v1alpha1.TektonConfig) (*v1alpha1.TektonTrigger, error) {
+func EnsureTektonTriggerExists(ctx context.Context, clients op.TektonTriggerInterface, config *v1alpha1.TektonConfig) (*v1alpha1.TektonTrigger, error) {
 	ttCR, err := GetTrigger(ctx, clients, v1alpha1.TriggerResourceName)
-	if err == nil {
-		// if the trigger spec is changed then update the instance
-		updated := false
 
-		if config.Spec.TargetNamespace != ttCR.Spec.TargetNamespace {
-			ttCR.Spec.TargetNamespace = config.Spec.TargetNamespace
-			updated = true
-		}
-
-		if !reflect.DeepEqual(ttCR.Spec.Trigger, config.Spec.Trigger) {
-			ttCR.Spec.Trigger = config.Spec.Trigger
-			updated = true
-		}
-
-		if !reflect.DeepEqual(ttCR.Spec.Config, config.Spec.Config) {
-			ttCR.Spec.Config = config.Spec.Config
-			updated = true
-		}
-
-		if ttCR.ObjectMeta.OwnerReferences == nil {
-			ownerRef := *metav1.NewControllerRef(config, config.GroupVersionKind())
-			ttCR.ObjectMeta.OwnerReferences = []metav1.OwnerReference{ownerRef}
-			updated = true
+	if err != nil {
+		if !apierrs.IsNotFound(err) {
+			return nil, err
 		}
-
-		if updated {
-			return clients.Update(ctx, ttCR, metav1.UpdateOptions{})
+		_, err = CreateTrigger(ctx, clients, config)
+		if err != nil {
+			return nil, err
 		}
+		return nil, v1alpha1.RECONCILE_AGAIN_ERR
+	}
 
-		return ttCR, err
+	ttCR, err = UpdateTrigger(ctx, ttCR, config, clients)
+	if err != nil {
+		return nil, err
 	}
 
-	if apierrs.IsNotFound(err) {
-		ttCR = &v1alpha1.TektonTrigger{
-			ObjectMeta: metav1.ObjectMeta{
-				Name: v1alpha1.TriggerResourceName,
-			},
-			Spec: v1alpha1.TektonTriggerSpec{
-				CommonSpec: v1alpha1.CommonSpec{
-					TargetNamespace: config.Spec.TargetNamespace,
-				},
-				Config:  config.Spec.Config,
-				Trigger: config.Spec.Trigger,
-			},
-		}
-		return clients.Create(ctx, ttCR, metav1.CreateOptions{})
+	ok, err := isTektonTriggerReady(ttCR, err)
+	if err != nil {
+		return nil, err
 	}
+	if !ok {
+		return nil, v1alpha1.RECONCILE_AGAIN_ERR
+	}
+
 	return ttCR, err
 }
 
@@ -104,24 +65,59 @@ func GetTrigger(ctx context.Context, clients op.TektonTriggerInterface, name str
 	return clients.Get(ctx, name, metav1.GetOptions{})
 }
 
-// waitForTektonTriggerState polls the status of the TektonTrigger called name
-// from client every `interval` until `inState` returns `true` indicating it
-// is done, returns an error or timeout.
-func waitForTektonTriggerState(ctx context.Context, clients op.TektonTriggerInterface, name string,
-	inState func(s *v1alpha1.TektonTrigger, err error) (bool, error)) (*v1alpha1.TektonTrigger, error) {
-	span := logging.GetEmitableSpan(ctx, fmt.Sprintf("WaitForTektonTriggerState/%s/%s", name, "TektonTriggerIsReady"))
-	defer span.End()
-
-	var lastState *v1alpha1.TektonTrigger
-	waitErr := wait.PollImmediate(common.Interval, common.Timeout, func() (bool, error) {
-		lastState, err := clients.Get(ctx, name, metav1.GetOptions{})
-		return inState(lastState, err)
-	})
+func CreateTrigger(ctx context.Context, clients op.TektonTriggerInterface, config *v1alpha1.TektonConfig) (*v1alpha1.TektonTrigger, error) {
+	ttCR := &v1alpha1.TektonTrigger{
+		ObjectMeta: metav1.ObjectMeta{
+			Name: v1alpha1.TriggerResourceName,
+		},
+		Spec: v1alpha1.TektonTriggerSpec{
+			CommonSpec: v1alpha1.CommonSpec{
+				TargetNamespace: config.Spec.TargetNamespace,
+			},
+			Config:  config.Spec.Config,
+			Trigger: config.Spec.Trigger,
+		},
+	}
+	_, err := clients.Create(ctx, ttCR, metav1.CreateOptions{})
+	if err != nil {
+		return nil, err
+	}
+	return ttCR, err
+}
+
+func UpdateTrigger(ctx context.Context, ttCR *v1alpha1.TektonTrigger, config *v1alpha1.TektonConfig, clients op.TektonTriggerInterface) (*v1alpha1.TektonTrigger, error) {
+	// if the trigger spec is changed then update the instance
+	updated := false
+
+	if config.Spec.TargetNamespace != ttCR.Spec.TargetNamespace {
+		ttCR.Spec.TargetNamespace = config.Spec.TargetNamespace
+		updated = true
+	}
 
-	if waitErr != nil {
-		return lastState, fmt.Errorf("tektontrigger %s is not in desired state, got: %+v: %w: For more info Please check TektonTrigger CR status", name, lastState, waitErr)
+	if !reflect.DeepEqual(ttCR.Spec.Trigger, config.Spec.Trigger) {
+		ttCR.Spec.Trigger = config.Spec.Trigger
+		updated = true
 	}
-	return lastState, nil
+
+	if !reflect.DeepEqual(ttCR.Spec.Config, config.Spec.Config) {
+		ttCR.Spec.Config = config.Spec.Config
+		updated = true
+	}
+
+	if ttCR.ObjectMeta.OwnerReferences == nil {
+		ownerRef := *metav1.NewControllerRef(config, config.GroupVersionKind())
+		ttCR.ObjectMeta.OwnerReferences = []metav1.OwnerReference{ownerRef}
+		updated = true
+	}
+
+	if updated {
+		_, err := clients.Update(ctx, ttCR, metav1.UpdateOptions{})
+		if err != nil {
+			return nil, err
+		}
+		return nil, v1alpha1.RECONCILE_AGAIN_ERR
+	}
+	return ttCR, nil
 }
 
 // isTektonTriggerReady will check the status conditions of the TektonTrigger and return true if the TektonTrigger is ready.
@@ -170,3 +166,17 @@ func verifyNoTektonTriggerCR(ctx context.Context, clients op.TektonTriggerInterf
 	}
 	return nil
 }
+
+func GetTektonConfig() *v1alpha1.TektonConfig {
+	return &v1alpha1.TektonConfig{
+		ObjectMeta: metav1.ObjectMeta{
+			Name: v1alpha1.ConfigResourceName,
+		},
+		Spec: v1alpha1.TektonConfigSpec{
+			Profile: "all",
+			CommonSpec: v1alpha1.CommonSpec{
+				TargetNamespace: "tekton-pipelines",
+			},
+		},
+	}
+}


Test patch:
diff --git a/pkg/apis/operator/v1alpha1/tektonpipeline_defaults_test.go b/pkg/apis/operator/v1alpha1/tektonpipeline_defaults_test.go
index fd813e724..126fae2e5 100644
--- a/pkg/apis/operator/v1alpha1/tektonpipeline_defaults_test.go
+++ b/pkg/apis/operator/v1alpha1/tektonpipeline_defaults_test.go
@@ -41,8 +41,8 @@ func Test_SetDefaults_PipelineProperties(t *testing.T) {
 	}
 
 	properties := PipelineProperties{
-		DisableHomeEnvOverwrite:                  ptr.Bool(true),
-		DisableWorkingDirectoryOverwrite:         ptr.Bool(true),
+		DisableHomeEnvOverwrite:                  nil,
+		DisableWorkingDirectoryOverwrite:         nil,
 		DisableCredsInit:                         ptr.Bool(false),
 		RunningInEnvironmentWithInjectedSidecars: ptr.Bool(true),
 		RequireGitSshSecretKnownHosts:            ptr.Bool(false),
diff --git a/pkg/reconciler/shared/tektonconfig/pipeline/pipeline_test.go b/pkg/reconciler/shared/tektonconfig/pipeline/pipeline_test.go
index 56305f015..2d9a3948f 100644
--- a/pkg/reconciler/shared/tektonconfig/pipeline/pipeline_test.go
+++ b/pkg/reconciler/shared/tektonconfig/pipeline/pipeline_test.go
@@ -29,8 +29,8 @@ func TestTektonPipelineCreateAndDeleteCR(t *testing.T) {
 	ctx, _, _ := ts.SetupFakeContextWithCancel(t)
 	c := fake.Get(ctx)
 	tConfig := GetTektonConfig()
-	err := CreatePipelineCR(ctx, tConfig, c.OperatorV1alpha1())
-	util.AssertNotEqual(t, err, nil)
+	_, err := EnsureTektonPipelineExists(ctx, c.OperatorV1alpha1().TektonPipelines(), tConfig)
+	util.AssertEqual(t, err.Error(), "reconcile again and proceed")
 	err = TektonPipelineCRDelete(ctx, c.OperatorV1alpha1().TektonPipelines(), v1alpha1.PipelineResourceName)
 	util.AssertEqual(t, err, nil)
 }
diff --git a/pkg/reconciler/shared/tektonconfig/trigger/trigger_test.go b/pkg/reconciler/shared/tektonconfig/trigger/trigger_test.go
index a3f0cee9f..39db2f62b 100644
--- a/pkg/reconciler/shared/tektonconfig/trigger/trigger_test.go
+++ b/pkg/reconciler/shared/tektonconfig/trigger/trigger_test.go
@@ -22,19 +22,15 @@ import (
 	"github.com/tektoncd/operator/pkg/apis/operator/v1alpha1"
 	"github.com/tektoncd/operator/pkg/client/injection/client/fake"
 	util "github.com/tektoncd/operator/pkg/reconciler/common/testing"
-	"github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/pipeline"
 	ts "knative.dev/pkg/reconciler/testing"
 )
 
 func TestTektonTriggerCreateAndDeleteCR(t *testing.T) {
 	ctx, _, _ := ts.SetupFakeContextWithCancel(t)
 	c := fake.Get(ctx)
-	tConfig := pipeline.GetTektonConfig()
-	err := CreateTriggerCR(ctx, tConfig, c.OperatorV1alpha1())
-	util.AssertNotEqual(t, err, nil)
-	// recheck triggers creation
-	err = CreateTriggerCR(ctx, tConfig, c.OperatorV1alpha1())
-	util.AssertNotEqual(t, err, nil)
+	tConfig := GetTektonConfig()
+	_, err := EnsureTektonTriggerExists(ctx, c.OperatorV1alpha1().TektonTriggers(), tConfig)
+	util.AssertEqual(t, err.Error(), "reconcile again and proceed")
 	err = TektonTriggerCRDelete(ctx, c.OperatorV1alpha1().TektonTriggers(), v1alpha1.TriggerResourceName)
 	util.AssertEqual(t, err, nil)
 }