Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
ionir: ionir-cloud/ionir@1.0.0
Use ionir
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
Sample example description.
1
2
3
4
5
6
7
version: '2.1'
orbs:
ionir: circleci/ionir@x.y
workflows:
call-ionir:
jobs:
- ionir/clone
This command clones a pvc in a given cluster in real-time
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
clusterId | Ionir cluster ID to run the command | No | '' | string |
clusterUrl | Ionir cluster URL to run the command (without https) | No | '' | string |
destinationHistoryPolicy | History Policy for the clones volume | No | default | string |
destinationNamespace | Namespace for the clones volume | No | '' | string |
destinationPvcName | PVC name for the cloned volume | No | '' | string |
sourceNamespace | Namespace of the source PVC | No | '' | string |
sourceTimeTag | Timetag of the source PVC to be cloned (2019-10-12T07:20:50.52Z) | No | '' | string |
sourceVolumeId | Source PVC Ionir ID | No | '' | string |
This command clones a pvc to a remote k8s cluster in 40s
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
clusterId | Ionir source cluster ID | No | '' | string |
clusterUrl | Ionir cluster URL to run the command (without https) | No | localhost | string |
destinationHistoryPolicy | History Policy for the clones volume | No | default | string |
destinationNamespace | Namespace for the clones volume | No | '' | string |
destinationPvcName | PVC name for the cloned volume | No | '' | string |
destinationStorageClass | StorageClass of the target PVC | No | ionir-default | string |
sourceVolumeId | Source PVC Ionir ID | No | '' | string |
teleClusterId | Ionir cluster ID to pull the volume to from the source (target) | No | '' | string |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
This Orb allows CircleCI users to utilize ionir Kubernetes Native Storage functionality including: - PVC cloning - Cloning back to time in 1s granularity - Teleport between clusters
display:
home_url: https://www.ionir.com
source_url: https://github.com/ionir-cloud/ionir-orb
commands:
clone:
description: |
This command clones a pvc in a given cluster in real-time
parameters:
clusterId:
default: ""
description: Ionir cluster ID to run the command
type: string
clusterUrl:
default: ""
description: Ionir cluster URL to run the command (without https)
type: string
destinationHistoryPolicy:
default: default
description: History Policy for the clones volume
type: string
destinationNamespace:
default: ""
description: Namespace for the clones volume
type: string
destinationPvcName:
default: ""
description: PVC name for the cloned volume
type: string
sourceNamespace:
default: ""
description: Namespace of the source PVC
type: string
sourceTimeTag:
default: ""
description: Timetag of the source PVC to be cloned (2019-10-12T07:20:50.52Z)
type: string
sourceVolumeId:
default: ""
description: Source PVC Ionir ID
type: string
steps:
- run:
command: "validate() {\n \n # shellcheck disable=SC2154\n if curl -o /dev/null --head --silent --fail \"https://${clusterUrl}\" 2> /dev/null ;\n then\n echo \"This URL is ok.\"\n else\n echo \"This URL does not exist.\"\n fi\n\n}\n# Will not run if sourced for bats-core tests.\n# View src/tests for more information.\nORB_TEST_ENV=\"bats-core\"\necho \"$0\"\nif [ \"${0#*$ORB_TEST_ENV}\" = \"$0\" ]; then\n validate\nfi"
environment:
clusterId: <<parameters.clusterId>>
clusterURL: <<parameters.clusterUrl>>
name: Clone_Validate
- run:
command: "Clone() {\n \n echo \"Starting Clone\"\n # shellcheck disable=SC2154\n curl --insecure -s -X POST \"https://${clusterUrl}/api/v1/clusters/${clusterId}/volumes/clone\" -H \"accept: application/json\" -H \"Content-Type: application/json\" -d \"{ \\\"destinationHistoryPolicy\\\": \\\"${destinationHistoryPolicy}\\\", \\\"destinationNamespace\\\": \\\"${destinationNamespace}\\\", \\\"destinationPvcName\\\": \\\"${destinationPvcName}\\\", \\\"sourceNamespace\\\": \\\"${sourceNamespace}\\\", \\\"sourceTimeTag\\\": \\\"${sourceTimeTag}\\\", \\\"sourceVolumeId\\\": \\\"${sourceVolumeIdsure}\\\"}\" \n\n}\n\nClone\n"
environment:
clusterId: <<parameters.clusterId>>
clusterURL: <<parameters.clusterUrl>>
destinationHistoryPolicy: <<parameters.destinationHistoryPolicy>>
destinationNamespace: <<parameters.destinationNamespace>>
destinationPvcName: <<parameters.destinationPvcName>>
sourceNamespace: <<parameters.sourceNamespace>>
sourceTimeTag: <<parameters.sourceTimeTag>>
sourceVolumeId: <<parameters.sourceVolumeId>>
name: Clone_Volume
teleport:
description: |
This command clones a pvc to a remote k8s cluster in 40s
parameters:
clusterId:
default: ""
description: Ionir source cluster ID
type: string
clusterUrl:
default: localhost
description: Ionir cluster URL to run the command (without https)
type: string
destinationHistoryPolicy:
default: default
description: History Policy for the clones volume
type: string
destinationNamespace:
default: ""
description: Namespace for the clones volume
type: string
destinationPvcName:
default: ""
description: PVC name for the cloned volume
type: string
destinationStorageClass:
default: ionir-default
description: StorageClass of the target PVC
type: string
sourceVolumeId:
default: ""
description: Source PVC Ionir ID
type: string
teleClusterId:
default: ""
description: Ionir cluster ID to pull the volume to from the source (target)
type: string
steps:
- run:
command: "validate() {\n \n # shellcheck disable=SC2154\n if curl -o /dev/null --head --silent --fail \"https://${clusterUrl}\" 2> /dev/null ;\n then\n echo \"This URL is ok.\"\n else\n echo \"This URL does not exist.\"\n fi\n\n}\n# Will not run if sourced for bats-core tests.\n# View src/tests for more information.\nORB_TEST_ENV=\"bats-core\"\necho \"$0\"\nif [ \"${0#*$ORB_TEST_ENV}\" = \"$0\" ]; then\n validate\nfi"
environment:
clusterUrl: <<parameters.clusterUrl>>
name: Clone_Validate
- run:
command: "\n\nTeleport() {\n \n echo \"Starting Teleport\"\n # shellcheck disable=SC2154\n curl --insecure -s -X POST \"https://${clusterUrl}/api/v1/clusters/${teleClusterId}/volumes\" -H \"accept: application/json\" -H \"Content-Type: application/json\" -d \"{ \\\"destinationHistoryPolicy\\\": \\\"${destinationHistoryPolicy}\\\", \\\"destinationNamespace\\\": \\\"${destinationNamespace}\\\", \\\"destinationPvcName\\\": \\\"${destinationPvcName}\\\", \\\"destinationStorageClass\\\": \\\"${destinationStorageClass}\\\", \\\"sourceClusterId\\\": \\\"${clusterId}\\\", \\\"sourceVolumeId\\\": \\\"${sourceVolumeId}\\\"}\" \n\n}\n\n\nTeleport\n\n"
environment:
clusterId: <<parameters.clusterId>>
clusterUrl: <<parameters.clusterUrl>>
destinationHistoryPolicy: <<parameters.destinationHistoryPolicy>>
destinationNamespace: <<parameters.destinationNamespace>>
destinationPvcName: <<parameters.destinationPvcName>>
destinationStorageClass: <<parameters.destinationStorageClass>>
sourceVolumeId: <<parameters.sourceVolumeId>>
teleClusterId: <<parameters.teleClusterId>>
name: Teleport-Volume
jobs: {}
examples:
clone:
description: |
Sample example description.
usage:
version: "2.1"
orbs:
ionir: circleci/ionir@x.y
workflows:
call-ionir:
jobs:
- ionir/clone