Repository: tektoncd/operator
Pull request #157 (2020-09-23 06:19:44)

Fixes tektonpipline status conditions update
Fixes tektonpipline status conditions update

Fixes https://github.com/tektoncd/operator/issues/155

Removes upgrade eligible status conditions as it is not a part of the operator implementation in master branch.

<!-- 🎉🎉🎉 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)
- [X] 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
```
-->
```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 **nikhil-thomas**
You can assign the PR to them by writing `/assign @nikhil-thomas` 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":["nikhil-thomas"]} -->
vdemeester: /approve
tekton-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/tektoncd/operator/pull/157#issuecomment-697166472" title="Approved">vdemeester</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)~~ [vdemeester]

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":[]} -->

Patch:
diff --git a/pkg/apis/operator/v1alpha1/common.go b/pkg/apis/operator/v1alpha1/common.go
index 182e2b5b2..eba9f4734 100644
--- a/pkg/apis/operator/v1alpha1/common.go
+++ b/pkg/apis/operator/v1alpha1/common.go
@@ -29,9 +29,6 @@ const (
 	// DeploymentsAvailable is a Condition indicating whether or not the Deployments of
 	// the respective component have come up successfully.
 	DeploymentsAvailable apis.ConditionType = "DeploymentsAvailable"
-	// VersionMigrationEligible is a Condition indicating whether or not the current version of
-	// Tekton component is eligible to upgrade or downgrade to the specified version.
-	VersionMigrationEligible apis.ConditionType = "VersionMigrationEligible"
 )
 
 // TektonComponent is a common interface for accessing meta, spec and status of all known types.
@@ -65,12 +62,6 @@ type TektonComponentStatus interface {
 	// it's waiting for deployments.
 	MarkDeploymentsNotReady()
 
-	// MarkVersionMigrationEligible marks the VersionMigrationEligible status as true.
-	MarkVersionMigrationEligible()
-	// MarkVersionMigrationNotEligible marks the VersionMigrationEligible status as false with
-	// the given message.
-	MarkVersionMigrationNotEligible(msg string)
-
 	// MarkDependenciesInstalled marks the DependenciesInstalled status as true.
 	MarkDependenciesInstalled()
 	// MarkDependencyInstalling marks the DependenciesInstalled status as false with the
diff --git a/pkg/apis/operator/v1alpha1/tektonpipeline_lifecycle.go b/pkg/apis/operator/v1alpha1/tektonpipeline_lifecycle.go
index 14fb4e5b7..23ab6b384 100644
--- a/pkg/apis/operator/v1alpha1/tektonpipeline_lifecycle.go
+++ b/pkg/apis/operator/v1alpha1/tektonpipeline_lifecycle.go
@@ -25,7 +25,6 @@ var (
 		DependenciesInstalled,
 		DeploymentsAvailable,
 		InstallSucceeded,
-		VersionMigrationEligible,
 	)
 )
 
@@ -67,19 +66,6 @@ func (tps *TektonPipelineStatus) MarkInstallFailed(msg string) {
 		"Install failed with message: %s", msg)
 }
 
-// MarkVersionMigrationEligible marks the VersionMigrationEligible status as false with given message.
-func (tps *TektonPipelineStatus) MarkVersionMigrationEligible() {
-	pipelineCondSet.Manage(tps).MarkTrue(VersionMigrationEligible)
-}
-
-// MarkVersionMigrationNotEligible marks the DeploymentsAvailable status as true.
-func (tps *TektonPipelineStatus) MarkVersionMigrationNotEligible(msg string) {
-	pipelineCondSet.Manage(tps).MarkFalse(
-		VersionMigrationEligible,
-		"Error",
-		"Version migration is not eligible with message: %s", msg)
-}
-
 // MarkDeploymentsAvailable marks the DeploymentsAvailable status as true.
 func (tps *TektonPipelineStatus) MarkDeploymentsAvailable() {
 	pipelineCondSet.Manage(tps).MarkTrue(DeploymentsAvailable)


Test patch:
diff --git a/pkg/apis/operator/v1alpha1/tektonpipeline_lifecycle_test.go b/pkg/apis/operator/v1alpha1/tektonpipeline_lifecycle_test.go
index 0f3196d7f..6d4951b91 100644
--- a/pkg/apis/operator/v1alpha1/tektonpipeline_lifecycle_test.go
+++ b/pkg/apis/operator/v1alpha1/tektonpipeline_lifecycle_test.go
@@ -43,8 +43,6 @@ func TestTektonPipelineHappyPath(t *testing.T) {
 	apistest.CheckConditionOngoing(tp, DeploymentsAvailable, t)
 	apistest.CheckConditionOngoing(tp, InstallSucceeded, t)
 
-	tp.MarkVersionMigrationEligible()
-
 	// Install succeeds.
 	tp.MarkInstallSucceeded()
 	// Dependencies are assumed successful too.
@@ -79,8 +77,6 @@ func TestTektonPipelineErrorPath(t *testing.T) {
 	apistest.CheckConditionOngoing(tp, DeploymentsAvailable, t)
 	apistest.CheckConditionOngoing(tp, InstallSucceeded, t)
 
-	tp.MarkVersionMigrationEligible()
-
 	// Install fails.
 	tp.MarkInstallFailed("test")
 	apistest.CheckConditionOngoing(tp, DependenciesInstalled, t)
@@ -140,11 +136,3 @@ func TestTektonPipelineExternalDependency(t *testing.T) {
 	apistest.CheckConditionOngoing(tp, DeploymentsAvailable, t)
 	apistest.CheckConditionSucceeded(tp, InstallSucceeded, t)
 }
-
-func TestTektonPipelineVersionMigrationNotEligible(t *testing.T) {
-	tp := &TektonPipelineStatus{}
-	tp.InitializeConditions()
-
-	tp.MarkVersionMigrationNotEligible("Version migration not eligible.")
-	apistest.CheckConditionFailed(tp, VersionMigrationEligible, t)
-}