Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors TektonTriggers to use TektonInstallerSet #408

Merged
merged 4 commits into from
Sep 20, 2021

Conversation

sm43
Copy link
Member

@sm43 sm43 commented Sep 13, 2021

Updates Triggers reconciler to use TektonInstallerSet

This updates the triggers reconciler to use TektonInstallerSet
for installation, this would allow change of TargetNamespace and
deletion of obsolete resources on upgrades.


Add AllDeploymentsReady Conditions in TektonInstallerSet

If there is any other deployment other than controller and
webhook then it will be missed by installer set for checking the
status so this adds another condition which marks the status of
any other deployment other than controller and webhook.

Signed-off-by: Shivam Mukhade [email protected]

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Sep 13, 2021
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 13, 2021
@tekton-robot
Copy link
Contributor

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/apis/operator/v1alpha1/tektoninstallerset_lifecycle.go 62.5% 59.3% -3.2
pkg/apis/operator/v1alpha1/tektontrigger_lifecycle.go 76.5% 37.5% -39.0

@sm43 sm43 force-pushed the refactor-triggers branch from 73df580 to 4b5add8 Compare September 13, 2021 06:03
@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 13, 2021
@tekton-robot
Copy link
Contributor

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/apis/operator/v1alpha1/tektoninstallerset_lifecycle.go 62.5% 59.3% -3.2
pkg/apis/operator/v1alpha1/tektontrigger_lifecycle.go 76.5% 37.5% -39.0
pkg/reconciler/common/deployments.go 94.4% 0.0% -94.4
pkg/reconciler/common/install.go 61.8% 0.0% -61.8
pkg/reconciler/common/releases.go 61.8% 32.4% -29.4
pkg/reconciler/common/stages.go 67.9% 21.4% -46.4

@sm43 sm43 force-pushed the refactor-triggers branch from 4b5add8 to 70fe2a0 Compare September 13, 2021 06:23
@tekton-robot
Copy link
Contributor

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/apis/operator/v1alpha1/tektoninstallerset_lifecycle.go 62.5% 59.3% -3.2
pkg/apis/operator/v1alpha1/tektontrigger_lifecycle.go 76.5% 37.5% -39.0

@sm43 sm43 force-pushed the refactor-triggers branch from 70fe2a0 to a9694cc Compare September 13, 2021 06:50
@tekton-robot
Copy link
Contributor

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/apis/operator/v1alpha1/tektoninstallerset_lifecycle.go 62.5% 59.3% -3.2
pkg/apis/operator/v1alpha1/tektontrigger_lifecycle.go 76.5% 37.5% -39.0
pkg/reconciler/common/deployments.go 94.4% 0.0% -94.4
pkg/reconciler/common/install.go 61.8% 0.0% -61.8
pkg/reconciler/common/releases.go 61.8% 32.4% -29.4
pkg/reconciler/common/stages.go 67.9% 21.4% -46.4

@nikhil-thomas
Copy link
Member

/approve

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 13, 2021
@nikhil-thomas
Copy link
Member

@sm43 the reconciler is much simpler now 👍
could we remove the commented lines.

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not have a huge test coverage, and this PR removes quite some too, most likely we should port the test to the new struct to make sure we are still covered.

@sm43
Copy link
Member Author

sm43 commented Sep 14, 2021

We do not have a huge test coverage, and this PR removes quite some too, most likely we should port the test to the new struct to make sure we are still covered.

@vdemeester yeah test coverage is less. I was going to address it once refactoring is done, but it make sense to start as if there is a bug we will catch.
I will add test cases for new code then we can refactor rest of the code.
cc @nikhil-thomas

@sm43 sm43 force-pushed the refactor-triggers branch from a9694cc to b52d522 Compare September 14, 2021 04:30
@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 14, 2021
@tekton-robot
Copy link
Contributor

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/apis/operator/v1alpha1/tektontrigger_lifecycle.go 76.5% 34.4% -42.1

@sm43 sm43 changed the title Refactors TektonTriggers to use TektonInstallerSet [WIP] Refactors TektonTriggers to use TektonInstallerSet Sep 14, 2021
@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 14, 2021
@sm43 sm43 force-pushed the refactor-triggers branch from b52d522 to a9694cc Compare September 14, 2021 08:25
@sm43 sm43 changed the title [WIP] Refactors TektonTriggers to use TektonInstallerSet Refactors TektonTriggers to use TektonInstallerSet Sep 15, 2021
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 15, 2021
@tekton-robot
Copy link
Contributor

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/apis/operator/v1alpha1/tektoninstallerset_lifecycle.go 62.5% 59.3% -3.2
pkg/apis/operator/v1alpha1/tektontrigger_lifecycle.go 76.5% 37.5% -39.0
pkg/reconciler/common/deployments.go 94.4% 0.0% -94.4
pkg/reconciler/common/install.go 61.8% 0.0% -61.8
pkg/reconciler/common/releases.go 61.8% 32.4% -29.4
pkg/reconciler/common/stages.go 67.9% 21.4% -46.4
pkg/reconciler/common/utils.go Do not exist 78.6%
pkg/reconciler/kubernetes/tektoninstallerset/install.go 0.0% 80.9% 80.9

@sm43
Copy link
Member Author

sm43 commented Sep 15, 2021

/test pull-tekton-operator-integration-tests

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nikhil-thomas, vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [nikhil-thomas,vdemeester]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sm43 sm43 force-pushed the refactor-triggers branch from 1b6fed2 to bbffb93 Compare September 16, 2021 05:17
@tekton-robot
Copy link
Contributor

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/apis/operator/v1alpha1/tektoninstallerset_lifecycle.go 62.5% 59.3% -3.2
pkg/apis/operator/v1alpha1/tektontrigger_lifecycle.go 76.5% 37.5% -39.0
pkg/reconciler/common/deployments.go 94.4% 0.0% -94.4
pkg/reconciler/common/install.go 61.8% 0.0% -61.8
pkg/reconciler/common/releases.go 61.8% 32.4% -29.4
pkg/reconciler/common/stages.go 67.9% 21.4% -46.4
pkg/reconciler/common/utils.go Do not exist 78.6%
pkg/reconciler/kubernetes/tektoninstallerset/install.go 0.0% 80.9% 80.9

@sm43 sm43 force-pushed the refactor-triggers branch from bbffb93 to f0e4446 Compare September 16, 2021 06:18
@tekton-robot
Copy link
Contributor

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/apis/operator/v1alpha1/tektoninstallerset_lifecycle.go 62.5% 59.3% -3.2
pkg/apis/operator/v1alpha1/tektontrigger_lifecycle.go 76.5% 37.5% -39.0
pkg/reconciler/common/deployments.go 94.4% 0.0% -94.4
pkg/reconciler/common/install.go 61.8% 0.0% -61.8
pkg/reconciler/common/releases.go 61.8% 32.4% -29.4
pkg/reconciler/common/stages.go 67.9% 21.4% -46.4
pkg/reconciler/common/utils.go Do not exist 78.6%
pkg/reconciler/kubernetes/tektoninstallerset/install.go 0.0% 80.9% 80.9

@sm43 sm43 force-pushed the refactor-triggers branch from f0e4446 to 4520944 Compare September 20, 2021 03:54
@tekton-robot
Copy link
Contributor

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/apis/operator/v1alpha1/tektoninstallerset_lifecycle.go 62.5% 59.3% -3.2
pkg/apis/operator/v1alpha1/tektontrigger_lifecycle.go 76.5% 37.5% -39.0
pkg/reconciler/common/deployments.go 94.4% 0.0% -94.4
pkg/reconciler/common/install.go 61.8% 0.0% -61.8
pkg/reconciler/common/releases.go 61.8% 32.4% -29.4
pkg/reconciler/common/stages.go 67.9% 21.4% -46.4
pkg/reconciler/common/utils.go Do not exist 78.6%
pkg/reconciler/kubernetes/tektoninstallerset/install.go 0.0% 80.9% 80.9

Comment on lines +30 to +43
func FetchVersionFromCRD(manifest mf.Manifest, releaseLabel string) (string, error) {
crds := manifest.Filter(mf.CRDs)
if len(crds.Resources()) == 0 {
return "", fmt.Errorf("failed to find crds to get release version")
}

crd := crds.Resources()[0]
version, ok := crd.GetLabels()[releaseLabel]
if !ok {
return version, fmt.Errorf("failed to find release label on crd")
}

return version, nil
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this good.

As a future improvement, how about reading the version from the "info" configMap example.

May be we can set it as unknown, if the configMap is not available.

What do you think.
if you think that could be a useful improvement, then could you create an issue (#good-first-issue, #help-wanted) to capture it.

else, i am curious to know why. and feel free to resolve this 🙂 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this comment ☝️ is not a blocker.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created #413

@nikhil-thomas
Copy link
Member

LGTM

Shivam Mukhade added 4 commits September 20, 2021 13:53
If there is any other deployment other than controller and
webhook then it will be missed by installer set for checking the
status so this adds another condition which marks the status of
any other deployment other than controller and webhook.

Signed-off-by: Shivam Mukhade <[email protected]>
This updates the triggers reconciler to use TektonInstallerSet
for installation, this would allow change of TargetNamespace and
deletion of obsolete resources on upgrades.

Signed-off-by: Shivam Mukhade <[email protected]>
This adds new test for installer and removes old obsolete
tests from common pkg.

Signed-off-by: Shivam Mukhade <[email protected]>
@sm43 sm43 force-pushed the refactor-triggers branch from 4520944 to 98def76 Compare September 20, 2021 08:43
@tekton-robot
Copy link
Contributor

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/apis/operator/v1alpha1/tektoninstallerset_lifecycle.go 62.5% 59.3% -3.2
pkg/apis/operator/v1alpha1/tektontrigger_lifecycle.go 76.5% 37.5% -39.0
pkg/reconciler/common/deployments.go 94.4% 0.0% -94.4
pkg/reconciler/common/install.go 61.8% 0.0% -61.8
pkg/reconciler/common/releases.go 61.8% 32.4% -29.4
pkg/reconciler/common/stages.go 67.9% 21.4% -46.4
pkg/reconciler/common/utils.go Do not exist 78.6%
pkg/reconciler/kubernetes/tektoninstallerset/install.go 0.0% 80.9% 80.9

@nikhil-thomas
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 20, 2021
@tekton-robot tekton-robot merged commit a3d2802 into tektoncd:main Sep 20, 2021
@sm43 sm43 deleted the refactor-triggers branch September 20, 2021 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants