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

feat(upgrade): add support for UpgradeTask CR #11

Merged
merged 5 commits into from
Jul 2, 2020

Conversation

shubham14bajpai
Copy link
Contributor

@shubham14bajpai shubham14bajpai commented Jun 26, 2020

This PR adds support for upgrades via UpgradeTask CRs. This enables users to create UpgradeTask CRs for the resources to be upgraded and group them using labels. Then a job can be launched with the env UPGRADE_TASK_LABEL which will list and upgrade the resources sequentially. For more details refer: https://github.com/openebs/openebs/blob/master/contribute/design/1.x/upgrade/volume-pools-upgrade.md

This PR also fixes the issue: openebs/openebs#3069
Now the upgrade job does not defaults to quay.io/openebs as the prefix but will take whatever the prefix was on the previous version as default.

Sample test result:

  • for pools each cspi similar upgradetask CR will be generated.
apiVersion: openebs.io/v1alpha1
kind: UpgradeTask
metadata:
  creationTimestamp: "2020-06-26T09:39:16Z"
  labels:
    resource: cstorPool-xqd89
  generation: 6
  name: upgrade-cstor-cspi-cspc-stripe-wx49
  namespace: openebs
  resourceVersion: "5395"
  selfLink: /apis/openebs.io/v1alpha1/namespaces/openebs/upgradetasks/upgrade-cstor-cspi-cspc-stripe-wx49
  uid: 85a934a6-97f6-43fc-9355-73ff69d08315
spec:
  cstorPoolInstance:
    cspiName: cspc-stripe-wx49
  fromVersion: 1.10.0
  imagePrefix: ""
  imageTag: 1.11.0
  toVersion: 1.11.0
status:
  completedTime: "2020-06-26T09:40:27Z"
  phase: Success
  retries: 0
  startTime: "2020-06-26T09:39:16Z"
  upgradeDetailedStatuses:
  - lastUpdatedAt: "2020-06-26T09:39:16Z"
    message: Pre-upgrade steps were successful
    phase: Completed
    startTime: "2020-06-26T09:39:16Z"
    step: PRE_UPGRADE
  - lastUpdatedAt: "2020-06-26T09:40:27Z"
    message: Pool upgarde was successful
    phase: Completed
    startTime: "2020-06-26T09:39:16Z"
    step: POOL_INSTANCE_UPGRADE
  • for volumes similar upgradetask CR will be generated.
apiVersion: openebs.io/v1alpha1
kind: UpgradeTask
metadata:
  creationTimestamp: "2020-06-26T09:43:30Z"
  generation: 9
  labels:
    resource: cstorVolume-z5Qdh
  name: upgrade-cstor-csi-volume-pvc-ce7fc00f-3476-4a4a-950a-bc45aa52e5ce
  namespace: openebs
  resourceVersion: "6056"
  selfLink: /apis/openebs.io/v1alpha1/namespaces/openebs/upgradetasks/upgrade-cstor-csi-volume-pvc-ce7fc00f-3476-4a4a-950a-bc45aa52e5ce
  uid: 60895e97-3086-422f-8567-d7f348765561
spec:
  cstorVolume:
    pvName: pvc-ce7fc00f-3476-4a4a-950a-bc45aa52e5ce
  fromVersion: 1.10.0
  imagePrefix: ""
  imageTag: ""
  toVersion: 1.11.0
status:
  completedTime: "2020-06-26T09:45:14Z"
  phase: Success
  retries: 0
  startTime: "2020-06-26T09:43:38Z"
  upgradeDetailedStatuses:
  - lastUpdatedAt: "2020-06-26T09:43:38Z"
    message: Pre-upgrade steps were successful
    phase: Completed
    startTime: "2020-06-26T09:43:38Z"
    step: PRE_UPGRADE
  - lastUpdatedAt: "2020-06-26T09:43:49Z"
    message: Replica upgrade was successful
    phase: Completed
    startTime: "2020-06-26T09:43:38Z"
    step: REPLICA_UPGRADE
  - lastUpdatedAt: "2020-06-26T09:45:14Z"
    message: Target upgrade was successful
    phase: Completed
    startTime: "2020-06-26T09:43:49Z"
    step: TARGET_UPGRADE

Copy link
Contributor

@kmova kmova left a comment

Choose a reason for hiding this comment

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

Looks good to me. We can merge after @sagarkrsd is ok with this as well.

@kmova
Copy link
Contributor

kmova commented Jun 29, 2020

@shubham14bajpai - could you also update this PR with any tests that were performed.

Copy link

@sagarkrsd sagarkrsd left a comment

Choose a reason for hiding this comment

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

Looks good to me. Some minor comments only.

pkg/upgrade/upgrader/cstor_volume.go Outdated Show resolved Hide resolved
pkg/upgrade/upgrader/cstor_volume.go Outdated Show resolved Hide resolved
pkg/upgrade/upgrader/upgradetask.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants