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(migrate): add support for spc to cspc migration #4

Merged
merged 10 commits into from
Jun 4, 2020

Conversation

shubham14bajpai
Copy link
Contributor

@shubham14bajpai shubham14bajpai commented May 20, 2020

Signed-off-by: shubham [email protected]

This PR adds the support for migrating spc to cspc using a k8s job.
Sample job yaml

---
apiVersion: batch/v1
kind: Job
metadata:
  name: migrate-spc-sparse-claim
  namespace: openebs
spec:
  backoffLimit: 0
  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:  migrate
        args:
        - "cstor-spc"
        # name of the spc that is to be migrated
        - "--spc-name=sparse-claim"

        #Following are optional parameters
        #Log Level
        - "--v=4"
        #DO NOT CHANGE BELOW PARAMETERS
        env:
        - name: OPENEBS_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        tty: true
        image: openebs/migrate-amd64:ci
      restartPolicy: Never
---

Sample job logs:

mayadata:setup$ k logs -f migrate-spc-sparse-claim-2x4bv
I0520 10:00:53.212255       1 pool.go:73] Migrating spc sparse-claim to cspc
I0520 10:00:53.401079       1 pool.go:334] Updating bdc bdc-17771e05-1c55-43ef-abb3-39dcc36472d4 with cspc labels & finalizer.
I0520 10:00:53.427844       1 pool.go:334] Updating bdc bdc-d9e6b0ff-c951-4081-903e-56bb71900adf with cspc labels & finalizer.
I0520 10:00:53.459935       1 pool.go:102] Creating equivalent cspc for spc sparse-claim
I0520 10:00:59.221476       1 pool.go:367] Updating bdc bdc-17771e05-1c55-43ef-abb3-39dcc36472d4 with cspc ownerRef.
I0520 10:00:59.233294       1 pool.go:367] Updating bdc bdc-d9e6b0ff-c951-4081-903e-56bb71900adf with cspc ownerRef.
I0520 10:00:59.510423       1 pool.go:221] Migrating csp sparse-claim-dzr2 to cspi sparse-claim-mbo2
I0520 10:00:59.510448       1 pool.go:282] Scaling down deployemnt sparse-claim-mbo2
I0520 10:01:25.674512       1 pool.go:395] Updating cvr pvc-9cf5a405-12c0-4522-b031-7816425f443f-sparse-claim-mbo2 with cspi sparse-claim-dzr2 info.
I0520 10:01:25.798889       1 pool.go:80] Successfully migrated spc sparse-claim to cspc

cmd/util/env.go Outdated Show resolved Hide resolved
Copy link

@mittachaitu mittachaitu left a comment

Choose a reason for hiding this comment

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

Provided comments

cmd/migrate/executor/options.go Outdated Show resolved Hide resolved
cmd/migrate/executor/pool.go Outdated Show resolved Hide resolved
pkg/migrate/cstor/pool.go Show resolved Hide resolved
pkg/migrate/cstor/pool.go Outdated Show resolved Hide resolved
pkg/migrate/cstor/pool.go Show resolved Hide resolved
pkg/migrate/cstor/cspc_generator.go Outdated Show resolved Hide resolved
pkg/migrate/cstor/pool.go Outdated Show resolved Hide resolved
pkg/migrate/cstor/pool.go Outdated Show resolved Hide resolved
pkg/migrate/cstor/pool.go Show resolved Hide resolved
pkg/migrate/cstor/pool.go Outdated Show resolved Hide resolved
Copy link

@mittachaitu mittachaitu left a comment

Choose a reason for hiding this comment

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

Provided few comments PTAL.

pkg/migrate/cstor/cspc_generator.go Outdated Show resolved Hide resolved
pkg/migrate/cstor/cspc_generator.go Show resolved Hide resolved
pkg/migrate/cstor/pool.go Outdated Show resolved Hide resolved
pkg/migrate/cstor/pool.go Outdated Show resolved Hide resolved
pkg/migrate/cstor/pool.go Show resolved Hide resolved
pkg/migrate/cstor/pool.go Outdated Show resolved Hide resolved
Copy link

@mittachaitu mittachaitu 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.. didn't looked deeply into build scripts

Copy link

@prateekpandey14 prateekpandey14 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

@sonasingh46 sonasingh46 left a comment

Choose a reason for hiding this comment

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

lgtm

@prateekpandey14 prateekpandey14 merged commit cac3155 into openebs-archive:master Jun 4, 2020
@shubham14bajpai shubham14bajpai deleted the migrate branch August 19, 2020 05:46
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.

4 participants