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

Add Blueprint and integration test app for CockroachDB #1585

Merged
merged 56 commits into from
Sep 7, 2022

Conversation

r4rajat
Copy link
Contributor

@r4rajat r4rajat commented Aug 4, 2022

Signed-off-by: Rajat Gupta Rajat.11605708@lpu.in

Change Overview

Add Blueprint for CockroachDB for Full Cluster Backup, Restore and Deletion of the Backup

Commands used in Blueprint

  • For Backup
> BACKUP INTO 's3://{PATH}?AWS_ACCESS_KEY_ID={KEY ID}&AWS_SECRET_ACCESS_KEY={SECRET ACCESS KEY}';
  • For Restore
> RESTORE FROM LATEST IN 's3://{PATH}?AWS_ACCESS_KEY_ID={KEY ID}&AWS_SECRET_ACCESS_KEY={SECRET ACCESS KEY}';

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

Test Plan

  • Take Backup
# Find profile name
$ kubectl get profile -n kanister
NAME               AGE
s3-profile-drnw9   2m

# Find client secret name
$ kubectl get secrets -n cockroachdb
NAME                                        TYPE                 DATA   AGE
cockroachdb-release-ca-secret               Opaque               2      6h38m
cockroachdb-release-client-secret           kubernetes.io/tls    3      6h38m       <<---
cockroachdb-release-node-secret             kubernetes.io/tls    3      6h38m
sh.helm.release.v1.cockroachdb-release.v1   helm.sh/release.v1   1      6h38m

# Create Actionset
# Please make sure the value of blueprint matches with the name of blueprint that we have created already
$ kanctl create actionset --action backup --namespace kanister --blueprint cockroachdb-blueprint --statefulset cockroachdb/cockroachdb-release --profile kanister/s3-profile-drnw9 --secrets cockroachSecret=cockroachdb/cockroachdb-release-client-secret
actionset backup-4hzxn created

$ kubectl describe actionsets -n kanister backup-4hzxn
Name:         backup-4hzxn
Namespace:    kanister
Labels:       <none>
Annotations:  <none>
API Version:  cr.kanister.io/v1alpha1
Kind:         ActionSet
..
..
Events:
  Type    Reason           Age   From                 Message
  ----    ------           ----  ----                 -------
  Normal  Started Action   28s   Kanister Controller  Executing action backup
  Normal  Started Phase    28s   Kanister Controller  Executing phase backupToS3
  Normal  Ended Phase      14s   Kanister Controller  Completed phase backupToS3
  Normal  Update Complete  14s   Kanister Controller  Updated ActionSet 'backup-4hzxn' Status->complete
  • Restore Data
$ kanctl --namespace kanister create actionset --action restore --from "backup-4hzxn"
actionset restore-backup-4hzxn-2xhsr created

$ kubectl describe actionsets -n kanister restore-backup-4hzxn-2xhsr
Name:         restore-backup-4hzxn-2xhsr
Namespace:    kanister
Labels:       <none>
Annotations:  <none>
API Version:  cr.kanister.io/v1alpha1
Kind:         ActionSet
..
..
Events:
  Type    Reason           Age   From                 Message
  ----    ------           ----  ----                 -------
  Normal  Started Action   41s   Kanister Controller  Executing action restore
  Normal  Started Phase    41s   Kanister Controller  Executing phase restoreFromS3
  Normal  Ended Phase      21s   Kanister Controller  Completed phase restoreFromS3
  Normal  Update Complete  21s   Kanister Controller  Updated ActionSet 'restore-backup-4hzxn-2xhsr' Status->complete
  • Delete Backup
$ kanctl --namespace kanister create actionset --action delete --from backup-4hzxn --namespacetargets kanister
actionset delete-backup-4hzxn-6w2nr created

$ kubectl describe actionsets -n kanister delete-backup-4hzxn-6w2nr
Name:         delete-backup-4hzxn-6w2nr
Namespace:    kanister
Labels:       <none>
Annotations:  <none>
API Version:  cr.kanister.io/v1alpha1
Kind:         ActionSet
..
..
Events:
  Type    Reason           Age   From                 Message
  ----    ------           ----  ----                 -------
  Normal  Started Action   64s   Kanister Controller  Executing action delete
  Normal  Started Phase    64s   Kanister Controller  Executing phase deleteFromS3Store
  Normal  Ended Phase      40s   Kanister Controller  Completed phase deleteFromS3Store
  Normal  Update Complete  40s   Kanister Controller  Updated ActionSet 'delete-backup-4hzxn-6w2nr' Status->complete
  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

@r4rajat r4rajat changed the title Added Blueprint for CockroachDB Add Blueprint for CockroachDB Aug 5, 2022
@pavannd1
Copy link
Contributor

pavannd1 commented Aug 5, 2022

Hi Rajat, welcome to the team and thanks for your first contribution.
Please add the following to the PR description: issue #1361, briefly describe the process/commands used in the blueprint and a detailed test plan.
As a follow up we would have to add an integration test to cover this blueprint.

examples/cockroachdb/README.md Outdated Show resolved Hide resolved
examples/cockroachdb/README.md Outdated Show resolved Hide resolved
examples/cockroachdb/README.md Show resolved Hide resolved
examples/cockroachdb/cockroachdb-blueprint.yaml Outdated Show resolved Hide resolved
examples/cockroachdb/cockroachdb-blueprint.yaml Outdated Show resolved Hide resolved
examples/cockroachdb/cockroachdb-blueprint.yaml Outdated Show resolved Hide resolved
@ihcsim ihcsim mentioned this pull request Aug 29, 2022
Signed-off-by: Rajat Gupta <Rajat.11605708@lpu.in>
Signed-off-by: Rajat Gupta <Rajat.11605708@lpu.in>
Signed-off-by: Rajat Gupta <Rajat.11605708@lpu.in>
- Use KubeTask instead of KubeExec to spin a secure client pod on demand and run commands for backup and restore actions
- Use ghcr.io/kanisterio/kanister-tools:0.81.0 image instead of ghcr.io/kanisterio/postgres-kanister-tools:0.81.0 for delete action

Signed-off-by: Rajat Gupta <Rajat.11605708@lpu.in>
- Update README.md with updated commands
- Fix typos

Signed-off-by: Rajat Gupta <Rajat.11605708@lpu.in>
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
- Remove sleep time
- Reduced Backup To duration from System Time - 10s to System Time - 1s

Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
- Add --wait flag in helm chart installation implementation

Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
- Add --wait flag in helm chart installation implementation

Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
examples/cockroachdb/README.md Show resolved Hide resolved
examples/cockroachdb/client-secure.yaml Show resolved Hide resolved
pkg/app/cockroachdb.go Outdated Show resolved Hide resolved
pkg/app/cockroachdb.go Outdated Show resolved Hide resolved
pkg/app/cockroachdb.go Show resolved Hide resolved
pkg/app/cockroachdb.go Outdated Show resolved Hide resolved
pkg/app/cockroachdb.go Outdated Show resolved Hide resolved
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
pkg/app/cockroachdb.go Outdated Show resolved Hide resolved
r4rajat and others added 4 commits September 7, 2022 14:23
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
…add-cockroachdb-blueprint

# Conflicts:
#	pkg/app/cockroachdb.go
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
examples/cockroachdb/README.md Outdated Show resolved Hide resolved
examples/cockroachdb/README.md Outdated Show resolved Hide resolved
examples/cockroachdb/README.md Outdated Show resolved Hide resolved
pkg/app/cockroachdb.go Outdated Show resolved Hide resolved
pkg/app/cockroachdb.go Show resolved Hide resolved
pkg/app/cockroachdb.go Show resolved Hide resolved
r4rajat and others added 5 commits September 7, 2022 15:23
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
@r4rajat r4rajat added kueue and removed kueue labels Sep 7, 2022
@r4rajat r4rajat added the kueue label Sep 7, 2022
@viveksinghggits viveksinghggits changed the title Add Blueprint for CockroachDB Add Blueprint and integration test app for CockroachDB Sep 7, 2022
@mergify mergify bot merged commit 122d3d2 into kanisterio:master Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CockroachDB Blueprint
5 participants