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

introduce upgrade mechanism and add upgrade patch to v1 storage migration #1675

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

jkandasa
Copy link
Member

@jkandasa jkandasa commented Sep 5, 2023

Changes

This PR introduces upgrade mechanism. Which will be executed as two part.

  • PreUpgrade - triggers before applying manifests
  • PostUpgrade - triggers once TektonConfig CR becomes ready state

marks last applied upgrade reference to TektonConfig CR(via status annotation)

In addition to upgrade base code, this PR includes the following fixes

  • fixes: SRVKP-2917 - Handle v1 storage conversion
  • fixes: SRVKP-2935 - Upgrade to version 1.9.x results in the following error: Install failed with message: ... status.storedVersions[0]: Invalid value: "v1alpha1": must appear in spec.versions
  • fixes: SRVKP-3202 - TektonConfig CR displays message " Install failed with message: tektonpipeline pipeline is not in desired state" after pipelines operator upgrade

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

NONE

@jkandasa jkandasa added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 5, 2023
@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Sep 5, 2023
@jkandasa jkandasa marked this pull request as draft September 5, 2023 08:37
@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 5, 2023
@jkandasa
Copy link
Member Author

jkandasa commented Sep 6, 2023

/retest

@jkandasa jkandasa force-pushed the crd_api_version_update branch from 3372a10 to 4f71653 Compare September 6, 2023 07:20
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.

Few questions:

  • Any reason why the generated injection code is removed ? (probably due to the knative.dev/pkg update ?)
  • Any reason to have an upgrade/helper package instead of just having things in upgrade ? (helper is a package name we tend to "not use" because it doesn't really mean anything)

Otherwise I like the PR but I think we need to have some unit-tests at least 👼🏼

@jkandasa
Copy link
Member Author

jkandasa commented Sep 6, 2023

Few questions:

  • Any reason why the generated injection code is removed ? (probably due to the knative.dev/pkg update ?)

Yes, I updated the knative.dev/pkg to get knative.dev/pkg/apiextensions

  • Any reason to have an upgrade/helper package instead of just having things in upgrade ? (helper is a package name we tend to "not use" because it doesn't really mean anything)

In the future, If we want to call storage migration, we can reuse that function.
Thought of keeping reusable functions inside helper package.
Other than that I have no reason.

Otherwise I like the PR but I think we need to have some unit-tests at least 👼🏼

I was waiting for the initial confirmation about this feature to put effort on unit-tests.
Now I can work on unit-tests and other pending works on this PR.
Thanks @vdemeester 😄

@jkandasa jkandasa force-pushed the crd_api_version_update branch 2 times, most recently from 25d5bdf to 6d2c7ea Compare September 7, 2023 11:06
@tektoncd tektoncd deleted a comment from tekton-robot Sep 7, 2023
@tektoncd tektoncd deleted a comment from tekton-robot Sep 7, 2023
@tektoncd tektoncd deleted a comment from tekton-robot Sep 7, 2023
@jkandasa jkandasa force-pushed the crd_api_version_update branch 3 times, most recently from 70138f5 to f63b536 Compare September 8, 2023 07:52
@jkandasa jkandasa marked this pull request as ready for review September 8, 2023 07:52
@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 8, 2023
@tektoncd tektoncd deleted a comment from tekton-robot Sep 8, 2023
@jkandasa jkandasa force-pushed the crd_api_version_update branch from f63b536 to 2d229b1 Compare September 8, 2023 10:57
@tektoncd tektoncd deleted a comment from tekton-robot Sep 8, 2023
@tektoncd tektoncd deleted a comment from tekton-robot Sep 8, 2023
@jkandasa jkandasa force-pushed the crd_api_version_update branch from 2d229b1 to 1c83481 Compare September 9, 2023 00:42
@tektoncd tektoncd deleted a comment from tekton-robot Sep 9, 2023

// performs crd storage version upgrade
// lists all the resources and,
// keeps only one storage version on the crd
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think, this is what we wanted to keep on CR i.e. only 1 version

What I know about the issue is - the fresh installation and old installation can have different version, but we need to update the CRD by removing the old versions and using the new versions. We can't delete and create again, as it will remove user CRs.

Copy link
Member Author

Choose a reason for hiding this comment

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

@piyush-garg My understanding is,

  • storage version should contain latest version and may contain old version too
  • from the migrate package [1], first updating all the resources to latest version
  • then keeps only the latest version under status.storedVersions

[1] - https://github.com/knative/pkg/blob/main/apiextensions/storageversion/migrator.go#L49-L56

Copy link
Contributor

Choose a reason for hiding this comment

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

i am not sure if this will work like this, because just changing the version will not work for tekton resources, spec also needs to handled accordingly.

what i was expecting from this story was to handle the change of this field https://github.com/tektoncd/pipeline/blob/main/config/300-pipeline.yaml#L27

@jkandasa jkandasa force-pushed the crd_api_version_update branch from 1c83481 to 09bf9ac Compare September 11, 2023 07:08
@tektoncd tektoncd deleted a comment from tekton-robot Sep 11, 2023
@concaf
Copy link
Contributor

concaf commented Sep 11, 2023

/kind bug

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 11, 2023
@jkandasa jkandasa force-pushed the crd_api_version_update branch from 09bf9ac to 2b9c36e Compare September 12, 2023 07:37
@tektoncd tektoncd deleted a comment from tekton-robot Sep 12, 2023
@jkandasa jkandasa force-pushed the crd_api_version_update branch from 2b9c36e to 50a319d Compare September 12, 2023 08:40
@tektoncd tektoncd deleted a comment from tekton-robot Sep 12, 2023
@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Sep 12, 2023
@jkandasa jkandasa force-pushed the crd_api_version_update branch from 50a319d to 615f419 Compare September 13, 2023 07:16
@tektoncd tektoncd deleted a comment from tekton-robot Sep 13, 2023
@jkandasa jkandasa force-pushed the crd_api_version_update branch from 615f419 to 5c9b1a3 Compare September 13, 2023 07:17
@piyush-garg
Copy link
Contributor

/approve
/lgtm

we need to properly test this more

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 13, 2023
@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: piyush-garg

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:

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

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 13, 2023
@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/tektonconfig_lifecycle.go 58.8% 69.6% 10.7
pkg/reconciler/shared/tektonconfig/upgrade/helper/storage_version_migrator.go Do not exist 71.4%
pkg/reconciler/shared/tektonconfig/upgrade/post_upgrade.go Do not exist 0.0%
pkg/reconciler/shared/tektonconfig/upgrade/pre_upgrade.go Do not exist 88.5%
pkg/reconciler/shared/tektonconfig/upgrade/upgrade.go Do not exist 85.0%

@jkandasa
Copy link
Member Author

/cherry-pick release-v0.68.x

@tekton-robot
Copy link
Contributor

@jkandasa: once the present PR merges, I will cherry-pick it on top of release-v0.68.x in a new PR and assign it to you.

In response to this:

/cherry-pick release-v0.68.x

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot merged commit 202f9cd into tektoncd:main Sep 13, 2023
2 checks passed
@tekton-robot
Copy link
Contributor

@jkandasa: new pull request created: #1687

In response to this:

/cherry-pick release-v0.68.x

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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. kind/bug Categorizes issue or PR as related to a bug. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. 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