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): enable bulk upgrade for volumes and spc #1655

Merged
merged 2 commits into from
Apr 8, 2020

Conversation

shubham14bajpai
Copy link
Contributor

@shubham14bajpai shubham14bajpai commented Apr 7, 2020

Signed-off-by: shubham shubham.bajpai@mayadata.io

Ref: openebs/openebs#2701

What this PR does / why we need it:
This PR enables the bulk upgrade option for upgrade jobs where multiple volumes or spc can be upgraded in one job.

Updated job yaml:

---
apiVersion: batch/v1
kind: Job
metadata:
  #VERIFY that you have provided a unique name for this upgrade job.
  #The name can be any valid K8s string for name. This example uses
  #the following convention: jiva-vol-<flattened-from-to-versions>
  name: jiva-vols-160190-busybox

  #VERIFY the value of namespace is same as the namespace where openebs components
  # are installed. You can verify using the command:
  # `kubectl get pods -n <openebs-namespace> -l openebs.io/component-name=maya-apiserver`
  # The above command should return status of the openebs-apiserver.
  namespace: openebs

spec:
  backoffLimit: 4
  template:
    spec:
      # VERIFY the value of serviceAccountName is pointing to service account
      # created within openebs namespace. Use the non-default account.
      # by running `kubectl get sa -n <openebs-namespace>`
      serviceAccountName: openebs-maya-operator
      containers:
      - name:  upgrade
        args:
        - "jiva-volume"

        # --from-version is the current version of the volume
        - "--from-version=1.6.0"

        # --to-version is the version desired upgrade version
        - "--to-version=1.9.0"

        #VERIFY that you have provided the correct list of jiva PV Name
        - "pvc-713e3bb6-afd2-11e9-8e79-42010a800065"
        - "pvc-02320288-22c8-44d4-b5a1-fc37acf2c597"
        
        #Following are optional parameters
        #Log Level
        - "--v=4"
        #DO NOT CHANGE BELOW PARAMETERS
        env:
        - name: OPENEBS_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        tty: true

        # the image version should be same as the --to-version mentioned above
        # in the args of the job
        image: quay.io/openebs/m-upgrade:1.9.0
        imagePullPolicy: Always
      restartPolicy: OnFailure
---

Note: The old way of accepting pv name or spc name through the flags is still supported for upgrading one volume at a time.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:

Checklist:

  • Fixes #
  • Labelled this PR & related issue with documentation tag
  • PR messages has document related information
  • Labelled this PR & related issue with breaking-changes tag
  • PR messages has breaking changes related information
  • Labelled this PR & related issue with requires-upgrade tag
  • PR messages has upgrade related information
  • Commit has unit tests
  • Commit has integration tests

Signed-off-by: shubham <shubham.bajpai@mayadata.io>
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.

Nice work!!

@kmova kmova added pr/release-note PR should be included in release notes pr/documentation-pending labels Apr 7, 2020
@@ -50,11 +50,14 @@ func NewUpgradeCStorSPCJob() *cobra.Command {
Long: cstorSPCUpgradeCmdHelpText,
Example: `upgrade cstor-spc --spc-name <spc-name>`,
Copy link
Contributor

Choose a reason for hiding this comment

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

this example needs a fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

util.CheckErr(options.InitializeDefaults(cmd), util.Fatal)
util.CheckErr(options.RunCStorSPCUpgrade(cmd), util.Fatal)
if options.cstorSPC.spcName != "" {
singleCstorSPCUpgrade(cmd)
Copy link
Contributor

Choose a reason for hiding this comment

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

Cstor should be changed to CStor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

options.resourceKind = "storagePoolClaim"
util.CheckErr(options.RunPreFlightChecks(cmd), util.Fatal)
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 need of passing 'cmd' to RunCStorSPCUpgradeChecks and RunCStorSPCUpgrade.. same may be the case with other checks.. can we remove that if not required

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@vishnuitta vishnuitta left a comment

Choose a reason for hiding this comment

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

few minor comments..
and one point to verify: hope there is fatal in code whenever upgrade fails

}

return nil
}

// RunCStorSPCUpgrade upgrades the given Jiva Volume.
func (u *UpgradeOptions) RunCStorSPCUpgrade(cmd *cobra.Command) error {
klog.V(4).Infof("Started upgrading %s{%s} from %s to %s",
Copy link
Contributor

Choose a reason for hiding this comment

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

lets have similar message for completed upgrade also

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Signed-off-by: shubham <shubham.bajpai@mayadata.io>
Copy link
Contributor

@vishnuitta vishnuitta left a comment

Choose a reason for hiding this comment

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

changes are good

@vishnuitta vishnuitta merged commit 65bde19 into openebs-archive:master Apr 8, 2020
@shubham14bajpai shubham14bajpai deleted the bulk branch October 12, 2020 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/documentation-pending pr/release-note PR should be included in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants