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 new integration test for CSI Snapshot Blueprint #1208

Merged
merged 236 commits into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
236 commits
Select commit Hold shift + click to select a range
d4fb11b
Added new function CreateCSISnapshot
shlokc9 Dec 27, 2021
a611202
Fixed the instantiated values for kubeCli and dynCli
shlokc9 Dec 27, 2021
12bb95e
Added waitForReady=true as the default
shlokc9 Dec 27, 2021
c61c169
Added apiGroup snapshot.storage.k8s.io in cluster-role for kanister-o…
shlokc9 Dec 28, 2021
ebf0dd7
Added documentation for Create CSI VolumeSnapshot Func
shlokc9 Dec 28, 2021
cfc04eb
Changed namespace to a required arg
shlokc9 Dec 28, 2021
4b6dd11
Rasults of running gofmt
shlokc9 Dec 28, 2021
719db52
Reverting changes to return type of snapshotter.Create()
shlokc9 Dec 28, 2021
f6aa6a8
Added new function RestoreCSISnapshot
shlokc9 Dec 29, 2021
f41d49a
Changed snapShotter -> snapshotter
shlokc9 Dec 30, 2021
1c6cd0c
grouped imports and added the comment for 'waitForReady'
shlokc9 Dec 30, 2021
6570c1d
Updates suggested in docs/functions.rst
shlokc9 Dec 30, 2021
3320c41
Changed snapshot name argument to optional argument and added a defau…
shlokc9 Dec 30, 2021
376e7a3
reviewer comments
shlokc9 Dec 30, 2021
4dad68d
Changes suggested in reviewer comments
shlokc9 Dec 30, 2021
64ba80d
gofmt update
shlokc9 Dec 30, 2021
49c7919
Merge branch 'func-create-csi-snapshot' of https://github.com/kaniste…
shlokc9 Dec 30, 2021
88d2221
gofmt update
shlokc9 Dec 30, 2021
36c1264
Merge branch 'func-create-csi-snapshot' of https://github.com/kaniste…
shlokc9 Dec 30, 2021
d4731e5
Fixed failed to render outputartifact template 'snapshotInfo' issue
shlokc9 Dec 30, 2021
ec69009
Merge branch 'func-create-csi-snapshot' of https://github.com/kaniste…
shlokc9 Dec 30, 2021
5404f42
Merge branch 'func-restore-csi-snapshot' of https://github.com/kanist…
shlokc9 Dec 30, 2021
ca5c0bf
Updated const comments and function description in documentation
shlokc9 Dec 31, 2021
5d7d94a
Updated const comments
shlokc9 Dec 31, 2021
dba3c4d
Updated the return obj for the function
shlokc9 Dec 31, 2021
63b62ef
Declared and used const for outputartifact keys
shlokc9 Dec 31, 2021
9d59a1b
Added documentation for RestoreCSISnapshot function
shlokc9 Dec 31, 2021
f18e0ac
Merged origin/fun-restore-csi-snapshot into this branch
shlokc9 Dec 31, 2021
0a8cfe9
Merge branch 'func-create-csi-snapshot' of https://github.com/kaniste…
shlokc9 Dec 31, 2021
27343b4
Minor changes in docs/functions.rst
shlokc9 Dec 31, 2021
e400c09
Merged origin/func-create-csi-snapshot in this branch
shlokc9 Dec 31, 2021
725bd84
Updated the rules in clusterrole
shlokc9 Dec 31, 2021
d7fa353
Merge branch 'func-create-csi-snapshot' of https://github.com/kaniste…
shlokc9 Dec 31, 2021
40f3532
Updated the rules in clusterrole
shlokc9 Dec 31, 2021
fb932b7
added asterisk again in helm/kanister-operator/templates/rbac.yaml
shlokc9 Dec 31, 2021
44c4034
Updated rules in clusterrole to check Travis CI failure
shlokc9 Dec 31, 2021
0577ab2
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 3, 2022
4c01b91
Created a test suite for CreateCSISanpshot func
shlokc9 Jan 3, 2022
f0d0cca
Updated the testcase
shlokc9 Jan 3, 2022
fc11edd
Resolved the error in testcase
shlokc9 Jan 4, 2022
793c8c8
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 4, 2022
8531044
Updated the create snapshot testcase
shlokc9 Jan 4, 2022
6546b76
removed AddKnownTypeWithName
shlokc9 Jan 4, 2022
c845d60
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 4, 2022
52c74f2
Added test suite for RestoreCSISnapshot func
shlokc9 Jan 4, 2022
587683e
Updated the CreateCSISnapshot testcase
shlokc9 Jan 4, 2022
cda73ff
gofmt update
shlokc9 Jan 4, 2022
c5ef65c
golang-ci: fixed whitespace
shlokc9 Jan 4, 2022
b9b2e4a
Reviewer comments
shlokc9 Jan 4, 2022
f42508f
Reviewer comments
shlokc9 Jan 4, 2022
09311f5
Updated the testcase for RestoreCSISnapshot function
shlokc9 Jan 4, 2022
16ce0de
Updated the testcase for CreateCSiSnapshot function
shlokc9 Jan 4, 2022
439ff57
Updated the createPVC method in testcase
shlokc9 Jan 4, 2022
f61cb00
Merge branch 'func-restore-csi-snapshot' of https://github.com/kanist…
shlokc9 Jan 4, 2022
9c73c69
Merged create and restore functions in this branch
shlokc9 Jan 4, 2022
427ad77
Fixed RBAC YAML
shlokc9 Jan 4, 2022
567557f
Fixed RBAC YAML
shlokc9 Jan 4, 2022
ed277cf
Merge branch 'func-create-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 4, 2022
665bc89
Merge branch 'func-restore-csi-snapshot' of https://github.com/kanist…
shlokc9 Jan 4, 2022
f296e8a
Added the DeleteCSISnapshot function
shlokc9 Jan 5, 2022
6d411cd
Merge branch 'func-delete-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 5, 2022
9bb731d
Added RBAC updates
shlokc9 Jan 5, 2022
1c87146
Added testcase for DeleteCSISnapshot function
shlokc9 Jan 5, 2022
64af1ae
Merge branch 'func-delete-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 5, 2022
567072e
gofmt fix
shlokc9 Jan 5, 2022
57a3cea
Merge branch 'func-delete-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 5, 2022
5a73ed6
Added documentation for DeleteCSISnapshot function
shlokc9 Jan 5, 2022
f4e8fc1
Merged func-delete-csi-snapshot in this branch
shlokc9 Jan 5, 2022
83732fb
fixed issue in docs/functions.rst
shlokc9 Jan 5, 2022
7247dd5
Updated the namespace in testcase
shlokc9 Jan 5, 2022
4ca3b78
Merge branch 'func-delete-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 5, 2022
e76a9a1
Added default context timeout
shlokc9 Jan 6, 2022
7890ac3
Merge branch 'func-create-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 6, 2022
a3db760
Fixed the time.Minute issue
shlokc9 Jan 6, 2022
4ffe8cb
Fixed the time.Minute issue
shlokc9 Jan 6, 2022
21a1259
Updated the defer cancel()
shlokc9 Jan 6, 2022
41303f2
Merge branch 'func-create-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 6, 2022
8c48eb7
Added a custom error for create
shlokc9 Jan 6, 2022
237738e
Merge branch 'func-create-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 6, 2022
e8d2755
Returned the custom error
shlokc9 Jan 6, 2022
cbf3b3f
Merge branch 'func-create-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 6, 2022
ec96556
Updated the error msg
shlokc9 Jan 6, 2022
a00700d
Merge branch 'func-create-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 6, 2022
bcd4f6a
Removed the timeout code snippet
shlokc9 Jan 6, 2022
aedeeec
Added validations for volumeMode and accessMode
shlokc9 Jan 6, 2022
a7b3605
Removed unnecessary const for default timeout and import for time pac…
shlokc9 Jan 6, 2022
e82c3cd
Added the DeadlineExceeded error check and corrected the imports
shlokc9 Jan 7, 2022
8e9ecdc
Updated the logic to validate volume mode
shlokc9 Jan 7, 2022
e57fdae
context update
shlokc9 Jan 7, 2022
1ddaad6
context update
shlokc9 Jan 7, 2022
7e4b9d0
Merge branch 'func-delete-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 7, 2022
eb0778f
Merge branch 'func-restore-csi-snapshot' of https://github.com/kanist…
shlokc9 Jan 7, 2022
5417d7e
Merge branch 'func-create-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 7, 2022
163a290
Fixed the validateVolumeModeArg method
shlokc9 Jan 7, 2022
69fded3
Merge branch 'func-restore-csi-snapshot' of https://github.com/kanist…
shlokc9 Jan 7, 2022
772177f
Updated the testcase for validate methods
shlokc9 Jan 7, 2022
9fda6f4
Added testcase for arg validation
shlokc9 Jan 7, 2022
8bde13e
Added blank spaces
shlokc9 Jan 7, 2022
380bb1e
Merge branch 'func-restore-csi-snapshot' of https://github.com/kanist…
shlokc9 Jan 7, 2022
3dbffd8
gofmt updates
shlokc9 Jan 7, 2022
5d0daa9
resolved merge conflict
shlokc9 Jan 7, 2022
97c106f
Added Note in the docs
shlokc9 Jan 7, 2022
8ff9a9a
resolved merge conflict
shlokc9 Jan 7, 2022
1343339
Added table driven testcases for validate methods
shlokc9 Jan 10, 2022
fccbf8a
Removed multiple context.Background() calls and removed the validate …
shlokc9 Jan 10, 2022
8239084
merged master in this branch
shlokc9 Jan 10, 2022
2aa3078
merged func-delete-csi-snapshot branch in this branch
shlokc9 Jan 10, 2022
4cfd36a
merged func-restore-csi-snapshot branch in this branch
shlokc9 Jan 10, 2022
f3bea5a
style: Add whitespace in error messages
shlokc9 Jan 11, 2022
3983d85
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 11, 2022
2610d65
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 11, 2022
4605950
Merge branch 'func-delete-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 11, 2022
c74cef8
Merge branch 'func-restore-csi-snapshot' of https://github.com/kanist…
shlokc9 Jan 11, 2022
7c81cef
refactor: Update const names in test files
shlokc9 Jan 11, 2022
4c31993
refactor: Update length of random alphanumeric suffix to 5 characters
shlokc9 Jan 11, 2022
9080748
refactor: Merge func-restore-csi-snapshot branch in this branch
shlokc9 Jan 11, 2022
dab84e1
refactor: Update const in test file
shlokc9 Jan 11, 2022
ce04126
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 12, 2022
997f0f5
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 12, 2022
6bf2824
style: Add CSI Snapshot funcs MySQL example blueprint
shlokc9 Jan 12, 2022
37d201f
style: Updates in the example README
shlokc9 Jan 12, 2022
e90bde2
style: Update title
shlokc9 Jan 12, 2022
9876812
style: typo in Prerequisites
shlokc9 Jan 12, 2022
1dedace
style: Fix multiple typos
shlokc9 Jan 12, 2022
a7674eb
style: Update helm command
shlokc9 Jan 12, 2022
275b2af
style: Fix title, blueprint note and 'Backup application data' descri…
shlokc9 Jan 12, 2022
fad50f7
style: Remove unnecessary quotation marks
shlokc9 Jan 12, 2022
3967a7f
style: Update blueprint note
shlokc9 Jan 12, 2022
0d8ccb1
refactor: Update argument validation methods
shlokc9 Jan 12, 2022
6ca687d
Merge branch 'func-restore-csi-snapshot' of https://github.com/kanist…
shlokc9 Jan 12, 2022
00b57ee
style: Fix typo in a comment
shlokc9 Jan 12, 2022
38a4727
Merge branch 'func-restore-csi-snapshot' of https://github.com/kanist…
shlokc9 Jan 12, 2022
2313701
fix: Update create blueprint command
shlokc9 Jan 12, 2022
02db135
style: fix grammatical typos and readme header syntax
shlokc9 Jan 12, 2022
2df24a5
style: Fix create blueprint note with correct blueprint file name
shlokc9 Jan 12, 2022
3497d2e
style: Update README as per reviewer comments
shlokc9 Jan 13, 2022
2ba8b72
style: Explain --pvc argument
shlokc9 Jan 13, 2022
77ae13b
style: Update introduction as per reviewer comment
shlokc9 Jan 13, 2022
ad54666
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 13, 2022
081621f
Merge func-delete-csi-snapshot in this branch
shlokc9 Jan 13, 2022
152bb72
Merge branch 'K10-9150-example-blueprint-csi-snapshot-funcs' of https…
shlokc9 Jan 13, 2022
f3ea9c1
refactor: Update call to validate methods in restore unit test
shlokc9 Jan 13, 2022
b76b92d
refactor: Update restore test case as per reviewer comment
shlokc9 Jan 13, 2022
3822bf5
refactor: Update CreateCSiSnapshot function and the test case
shlokc9 Jan 13, 2022
375a6fa
refactor: Revert random alphanumeric string length
shlokc9 Jan 13, 2022
81c685e
fix: gofmt error
shlokc9 Jan 13, 2022
b6e436a
refactor: Update CreateCSiSnapshot function and the test case
shlokc9 Jan 13, 2022
56be2a2
refactor: Update CreateCSiSnapshot function and the test case
shlokc9 Jan 13, 2022
328cf73
refactor: Update CreateCSiSnapshot function and the test case
shlokc9 Jan 13, 2022
1ea8cd7
refactor: Update CreateCSiSnapshot function and the test case
shlokc9 Jan 13, 2022
dd05912
Merge branch 'refactor-create-csi-snapshot' of https://github.com/kan…
shlokc9 Jan 13, 2022
009339e
refactor: Moved code out of Exec method
shlokc9 Jan 13, 2022
88d2a8d
chore: Update signature of the restoreCSISnapshot method
shlokc9 Jan 13, 2022
261f91d
refactor: Revert CreateCSISnapshot Func changes in this PR
shlokc9 Jan 13, 2022
133d17c
refactor: Update create snapshot unit test
shlokc9 Jan 13, 2022
9905ad8
Merge branch 'func-restore-csi-snapshot' of https://github.com/kanist…
shlokc9 Jan 13, 2022
1f726d5
Merge branch 'refactor-create-csi-snapshot' of https://github.com/kan…
shlokc9 Jan 13, 2022
8921c0e
Merge branch 'refactor-create-csi-snapshot' of https://github.com/kan…
shlokc9 Jan 13, 2022
496ec43
fix: CI failure
shlokc9 Jan 13, 2022
eac747a
Merge branch 'func-restore-csi-snapshot' of https://github.com/kanist…
shlokc9 Jan 13, 2022
30d80e8
chore: Comment update
shlokc9 Jan 14, 2022
f391ebc
Merge branch 'refactor-create-csi-snapshot' of https://github.com/kan…
shlokc9 Jan 14, 2022
1448697
Merge branch 'refactor-create-csi-snapshot' of https://github.com/kan…
shlokc9 Jan 14, 2022
5ace33c
Merge branch 'func-restore-csi-snapshot' of https://github.com/kanist…
shlokc9 Jan 14, 2022
0fc7681
Merge branch 'func-delete-csi-snapshot' of https://github.com/kaniste…
shlokc9 Jan 14, 2022
7479886
Merge branch 'master' into K10-9150-example-blueprint-csi-snapshot-funcs
mergify[bot] Jan 18, 2022
4799a3e
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 19, 2022
7148495
Update example README as per reviewer comments
shlokc9 Jan 19, 2022
d7ce5ca
Merge branch 'K10-9150-example-blueprint-csi-snapshot-funcs' of https…
shlokc9 Jan 19, 2022
d19fd55
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 19, 2022
22a5b98
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 20, 2022
f62043e
Update KubeOps function to allow create & delete for core group resou…
shlokc9 Jan 20, 2022
1eb8482
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 20, 2022
a48e199
Add test case for KubeOps Delete core group resource
shlokc9 Jan 20, 2022
40f66c0
Remove core group permissions from clusterrole
shlokc9 Jan 20, 2022
8b49b79
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 20, 2022
7b71566
Update KubeOps Delete operation to wait for resource to be deleted
shlokc9 Jan 21, 2022
11cea6b
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 21, 2022
438d12e
Update testcase for kubeops delete on core group resource
shlokc9 Jan 21, 2022
25a89ee
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 21, 2022
b0c6083
Update KubeOps test to use existing svc spec
shlokc9 Jan 21, 2022
e66d013
Update poll.Wait logic for waiting on delete operation to complete
shlokc9 Jan 21, 2022
76d5e27
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 21, 2022
18dd0a4
Fix gofmt issues
shlokc9 Jan 21, 2022
9f6248a
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 21, 2022
081f03b
Update wait.Poll to poll.Wait method & pass context from parent
shlokc9 Jan 21, 2022
a3a07e6
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 21, 2022
ab765b7
Update as per reviewer comments
shlokc9 Jan 21, 2022
9cf7bbe
Update example with Time Log application
shlokc9 Jan 23, 2022
9d7af32
Replace namespace mysql with time-log
shlokc9 Jan 23, 2022
e86247f
Handle error from Delete() and add comment for using poll.Wait()
shlokc9 Jan 23, 2022
27a21fe
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 23, 2022
7b10430
Add waitForResourceDeletion function
shlokc9 Jan 23, 2022
e81575e
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 23, 2022
8f61c2b
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 24, 2022
b58a592
Remove redundant check for error
shlokc9 Jan 24, 2022
428b87e
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 24, 2022
56cc65b
Merge master into this branch
shlokc9 Jan 24, 2022
be88a84
Merge branch 'K10-9150-example-blueprint-csi-snapshot-funcs' of https…
shlokc9 Jan 24, 2022
131aadd
Add integration test for CSI snapshot blueprint
shlokc9 Jan 24, 2022
2d21c46
Fix curl not found and unused string return from execCommmand method
shlokc9 Jan 25, 2022
810894c
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 25, 2022
c1f3428
Update base build image
shlokc9 Jan 25, 2022
bcc717e
Merge kubectl apply statements
shlokc9 Jan 25, 2022
54fb9f6
Update comment in integration_register.go
shlokc9 Jan 25, 2022
d9632f4
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 25, 2022
4255292
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 25, 2022
3d06c3c
Merge branch 'K10-9150-example-blueprint-csi-snapshot-funcs' of https…
shlokc9 Jan 25, 2022
2ed4ce0
Revert createPhase method in kubeops_test.go
shlokc9 Jan 26, 2022
eb54b86
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 26, 2022
b3e5d2b
Merge branch 'K10-9150-example-blueprint-csi-snapshot-funcs' of https…
shlokc9 Jan 26, 2022
f373371
Update KubeOps test
shlokc9 Jan 27, 2022
16cecd0
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 27, 2022
4ff6e69
Update README as per reviewer comments
shlokc9 Jan 27, 2022
35fe260
Merge branch 'K10-9150-example-blueprint-csi-snapshot-funcs' of https…
shlokc9 Jan 27, 2022
1a18101
Add comment to explain the waitForResourceDeletion function
shlokc9 Jan 27, 2022
2d00472
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 27, 2022
a26d93f
Merge branch 'K10-9150-example-blueprint-csi-snapshot-funcs' of https…
shlokc9 Jan 27, 2022
447ef45
Separate CSI driver setup in new target
shlokc9 Jan 27, 2022
d46a145
Update in install_csi_hostpath_driver method
shlokc9 Jan 27, 2022
dd97832
Update comment for waitForResourceDeletion
shlokc9 Jan 28, 2022
1aaab0a
Remove default storageclass patch
shlokc9 Jan 28, 2022
74223bd
Merge branch 'kubeops-update' of https://github.com/kanisterio/kanist…
shlokc9 Jan 28, 2022
c3dc9a0
Merge master in this branch
shlokc9 Jan 28, 2022
0f7df55
Update the default storageclass
shlokc9 Jan 28, 2022
bb55409
Merge branch 'K10-9150-example-blueprint-csi-snapshot-funcs' of https…
shlokc9 Jan 28, 2022
fa295bf
Move default storageclass setup from shell script to integration test
shlokc9 Jan 31, 2022
da22ab7
Add storageClassName field in PVC manifest of CSISnapshot integration…
shlokc9 Jan 31, 2022
ed6733b
Remove patch steps from CSISnapshot integration test
shlokc9 Jan 31, 2022
fe81556
Run CSI driver install before minio setup in Travis CI
shlokc9 Jan 31, 2022
db0e6cc
Merge branch 'master' of https://github.com/kanisterio/kanister into …
shlokc9 Jan 31, 2022
3557701
Install CSI hostpath driver in kind cluster that we setup in CI (#1212)
Jan 31, 2022
4858139
Rename test app & convert raw string manifests to Go structs
shlokc9 Feb 1, 2022
622fe06
Add comment for app struct
shlokc9 Feb 1, 2022
222ab77
Merge branch 'master' into csi-snapshot-funcs-integration-test
mergify[bot] Feb 3, 2022
7f528c6
Resolve merge conflict: Add TimeLogCSI to SHORT_APPS
shlokc9 Feb 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
before_script:
- docker pull kindest/node:v1.21.1
- make start-kind
- make install-csi-hostpath-driver
- make install-minio
script:
- make integration-test
Expand All @@ -67,5 +68,5 @@ jobs:
if [[ "$EXIT_STATUS" -eq 0 ]] && [[ "$TRAVIS_BRANCH" == "master" ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
sudo chown "$USER":"$USER" "$HOME"/.docker -R
docker login ghcr.io -u "$GITHUB_USERNAME" -p "$GITHUB_TOKEN"
./build/push_images.sh
./build/push_images.sh
fi
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ IMAGE_NAME := $(BIN)

IMAGE := $(REGISTRY)/$(IMAGE_NAME)

BUILD_IMAGE ?= ghcr.io/kanisterio/build:v0.0.16
BUILD_IMAGE ?= ghcr.io/kanisterio/build:v0.0.17

# tag 0.1.0 is, 0.0.1 (latest) + gh + aws + helm binary
DOCS_BUILD_IMAGE ?= ghcr.io/kanisterio/docker-sphinx:0.2.0
Expand Down Expand Up @@ -265,6 +265,9 @@ tiller:
install-minio:
@$(MAKE) run CMD='-c "./build/minio.sh install_minio"'

install-csi-hostpath-driver:
@$(MAKE) run CMD='-c "./build/local_kubernetes.sh install_csi_hostpath_driver"'

uninstall-minio:
@$(MAKE) run CMD='-c "./build/minio.sh uninstall_minio"'

Expand Down
2 changes: 1 addition & 1 deletion build/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ TEST_TIMEOUT="30m"
# Set default options
TEST_OPTIONS="-tags=integration -timeout ${TEST_TIMEOUT} -check.suitep ${DOP}"
# Regex to match apps to run in short mode
SHORT_APPS="^PostgreSQL$|^MySQL$|Elasticsearch|^MongoDB$|Maria|^MSSQL$"
SHORT_APPS="^PostgreSQL$|^MySQL$|Elasticsearch|^MongoDB$|Maria|^MSSQL$|^TimeLogCSI$"
# OCAPPS has all the apps that are to be tested against openshift cluster
OC_APPS3_11="MysqlDBDepConfig$|MongoDBDepConfig$|PostgreSQLDepConfig$"
OC_APPS4_4="MysqlDBDepConfig4_4|MongoDBDepConfig4_4|PostgreSQLDepConfig4_4"
Expand Down
22 changes: 22 additions & 0 deletions build/local_kubernetes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export KUBE_VERSION=${KUBE_VERSION:-"v1.21.1"}
export KIND_VERSION=${KIND_VERSION:-"v0.11.1"}
export LOCAL_CLUSTER_NAME=${LOCAL_CLUSTER_NAME:-"kanister"}
export LOCAL_PATH_PROV_VERSION="v0.0.11"
export SNAPSHOTTER_VERSION="v5.0.0"
declare -a REQUIRED_BINS=( docker jq go )

if command -v apt-get
Expand Down Expand Up @@ -61,6 +62,23 @@ start_localkube() {
wait_for_pods
}

install_csi_hostpath_driver() {
# Install VolumeSnapshot CRDs
kubectl apply -fhttps://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${SNAPSHOTTER_VERSION}/client/config/crd/snapshot.storage.k8s.io_{volumesnapshots.yaml,volumesnapshotclasses.yaml,volumesnapshotcontents.yaml}

# Create snapshot controller
kubectl apply -fhttps://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${SNAPSHOTTER_VERSION}/deploy/kubernetes/snapshot-controller/{rbac-snapshot-controller.yaml,setup-snapshot-controller.yaml}

# Deploy the CSI Hostpath Driver
cd /tmp
git clone https://github.com/kubernetes-csi/csi-driver-host-path.git
cd csi-driver-host-path
./deploy/kubernetes-1.21/deploy.sh

# Create StorageClass
kubectl apply -f ./examples/csi-storageclass.yaml
}

stop_localkube() {
if ! command -v kind
then
Expand Down Expand Up @@ -127,6 +145,7 @@ Where operation is one of the following:
get_localkube: installs kind
start_localkube : localkube start
stop_localkube : localkube stop
install_csi_hostpath_driver : installs CSI hostpath driver
EOM
exit 1
}
Expand All @@ -138,6 +157,9 @@ case "${1}" in
get_localkube)
time -p get_localkube
;;
install_csi_hostpath_driver)
time -p install_csi_hostpath_driver
;;
start_localkube)
time -p start_localkube
;;
Expand Down
2 changes: 1 addition & 1 deletion docker/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM alpine:3.10.5

LABEL maintainer="Tom Manville<tom@kasten.io>"

RUN apk add --update --no-cache ca-certificates bash git docker jq \
RUN apk add --update --no-cache ca-certificates bash git docker curl jq \
&& update-ca-certificates \
&& rm -rf /var/cache/apk/*

Expand Down
241 changes: 241 additions & 0 deletions pkg/app/csi-snapshot.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
// Copyright 2022 The Kanister Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package app

import (
"context"

"github.com/pkg/errors"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"

crv1alpha1 "github.com/kanisterio/kanister/pkg/apis/cr/v1alpha1"
"github.com/kanisterio/kanister/pkg/field"
"github.com/kanisterio/kanister/pkg/kube"
"github.com/kanisterio/kanister/pkg/log"
)

// Integration test app for CSI Snapshot functions
type TimeLogCSI struct {
cli kubernetes.Interface
namespace string
name string
deployment appsv1.Deployment
pvc v1.PersistentVolumeClaim
}

// NewTimeLogCSI instantiates the TimeLogCSI integration test app
func NewTimeLogCSI(name string) App {
return &TimeLogCSI{
name: name,
}
}

// Init initialises kubernetes CLI
func (tlc *TimeLogCSI) Init(ctx context.Context) error {
cfg, err := kube.LoadConfig()
if err != nil {
return err
}
tlc.cli, err = kubernetes.NewForConfig(cfg)
if err != nil {
return err
}
return nil
}

// Install deploys the TimeLogCSI App Deployment and PVC
func (tlc *TimeLogCSI) Install(ctx context.Context, namespace string) error {
tlc.namespace = namespace
pvcObj := tlc.getAppPersistentVolumeClaimObj()
pvc, err := tlc.cli.CoreV1().PersistentVolumeClaims(namespace).Create(ctx, pvcObj, metav1.CreateOptions{})
if err != nil {
return err
}
log.Print("PVC created successfully", field.M{"app": tlc.name, "pvc": pvc.Name})
tlc.pvc = *pvc
deploymentObj := tlc.getAppDeploymentObj()
deployment, err := tlc.cli.AppsV1().Deployments(namespace).Create(ctx, deploymentObj, metav1.CreateOptions{})
if err != nil {
return err
}
tlc.deployment = *deployment
log.Print("Deployment created successfully", field.M{"app": tlc.name, "deployment": deployment.Name})
return nil
}

// Reset deletes the log file present at the volume mount path
func (tlc *TimeLogCSI) Reset(ctx context.Context) error {
log.Print("Resetting the application.", field.M{"app": tlc.name})

removeLogFileCmd := []string{"sh", "-c", "rm /var/log/time.log"}
stderr, err := tlc.execCommand(ctx, removeLogFileCmd)
if err != nil {
return errors.Wrapf(err, "Error while deleting log file: %s", stderr)
}

log.Print("Reset of the application was successful.", field.M{"app": tlc.name})
return nil
}

// IsReady waits for the App Deployment to be in 'Ready' state
func (tlc *TimeLogCSI) IsReady(ctx context.Context) (bool, error) {
log.Print("Waiting for the application to be ready.", field.M{"app": tlc.name})
ctx, cancel := context.WithTimeout(ctx, mssqlWaitTimeout)
defer cancel()

err := kube.WaitOnDeploymentReady(ctx, tlc.cli, tlc.namespace, tlc.deployment.Name)
if err != nil {
return false, err
}
log.Print("Application instance is ready.", field.M{"app": tlc.name})
return true, nil
}

// Object defines the objectReference that will be used to create actions in blueprint
func (tlc *TimeLogCSI) Object() crv1alpha1.ObjectReference {
return crv1alpha1.ObjectReference{
Kind: "deployment",
Name: tlc.name,
Namespace: tlc.namespace,
}
}

// Uninstall removes the TimeLogCSI app from the cluster
func (tlc *TimeLogCSI) Uninstall(ctx context.Context) error {
err := tlc.cli.CoreV1().Namespaces().Delete(ctx, tlc.namespace, metav1.DeleteOptions{})
if err != nil {
return err
}
log.Print("Namespace deleted successfully", field.M{"app": tlc.name})
return nil
}

// Ping is used to check the connection with Deployment Pod
func (tlc *TimeLogCSI) Ping(ctx context.Context) error {
log.Print("Pinging the application.", field.M{"app": tlc.name})

listDirectories := []string{"sh", "-c", "ls /var/log"}
stderr, err := tlc.execCommand(ctx, listDirectories)
if err != nil {
return errors.Wrapf(err, "Error while Pinging the application %s", stderr)
}

log.Print("Ping to the application was success.", field.M{"app": tlc.name})
return nil
}

func (tlc *TimeLogCSI) Insert(ctx context.Context) error {
return nil
}

func (tlc *TimeLogCSI) Initialize(ctx context.Context) error {
return nil
}

func (tlc *TimeLogCSI) Count(ctx context.Context) (int, error) {
return 3, nil
}

func (tlc *TimeLogCSI) Secrets() map[string]crv1alpha1.ObjectReference {
return nil
}

func (tlc *TimeLogCSI) ConfigMaps() map[string]crv1alpha1.ObjectReference {
return nil
}

func (tlc *TimeLogCSI) GetClusterScopedResources(ctx context.Context) []crv1alpha1.ObjectReference {
return nil
}

func (tlc *TimeLogCSI) execCommand(ctx context.Context, command []string) (string, error) {
podname, containername, err := kube.GetPodContainerFromDeployment(ctx, tlc.cli, tlc.namespace, tlc.name)
if err != nil || podname == "" {
return "", errors.Wrapf(err, "Error getting pod and containername %s.", tlc.name)
}
_, stderr, err := kube.Exec(tlc.cli, tlc.namespace, podname, containername, command, nil)
return stderr, err
}

func (tlc TimeLogCSI) getAppDeploymentObj() *appsv1.Deployment {
depReplicas := int32(1)
deployment := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: tlc.name,
},
Spec: appsv1.DeploymentSpec{
Replicas: &depReplicas,
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"app": tlc.name},
},
Template: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"app": tlc.name},
},
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Name: "test-container",
Image: "ghcr.io/kanisterio/kanister-tools:0.72.0",
Command: []string{"sh", "-c"},
Args: []string{"while true; do for x in $(seq 1200); do date >> /var/log/time.log; sleep 1; done; truncate /var/log/time.log --size 0; done"},
VolumeMounts: []v1.VolumeMount{
{
Name: "data",
MountPath: "/var/log",
},
},
},
},
Volumes: []v1.Volume{
{
Name: "data",
VolumeSource: v1.VolumeSource{
PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{
ClaimName: "time-log-pvc",
},
},
},
},
},
},
},
}
return deployment
}

func (tlc TimeLogCSI) getAppPersistentVolumeClaimObj() *v1.PersistentVolumeClaim {
storageClassName := "csi-hostpath-sc"
pvc := &v1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{
Name: "time-log-pvc",
Labels: map[string]string{"app": tlc.name},
},
Spec: v1.PersistentVolumeClaimSpec{
StorageClassName: &storageClassName,
AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce},
Resources: v1.ResourceRequirements{
Requests: v1.ResourceList{
v1.ResourceStorage: *resource.NewQuantity(1073741824, resource.BinarySI),
},
},
},
}
return pvc
}
Loading