-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(snapshot): add snapshot support for LVM PV (#12)
Signed-off-by: Akhil Mohan <[email protected]>
- Loading branch information
Showing
50 changed files
with
3,457 additions
and
676 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add support for create/delete snapshot for LVM localPV |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
kind: VolumeSnapshotClass | ||
apiVersion: snapshot.storage.k8s.io/v1 | ||
metadata: | ||
name: lvm-localpv-snapclass | ||
annotations: | ||
snapshot.storage.kubernetes.io/is-default-class: "true" | ||
driver: local.csi.openebs.io | ||
deletionPolicy: Delete | ||
--- | ||
apiVersion: snapshot.storage.k8s.io/v1 | ||
kind: VolumeSnapshot | ||
metadata: | ||
name: lvm-localpv-snap | ||
spec: | ||
volumeSnapshotClassName: lvm-localpv-snapclass | ||
source: | ||
persistentVolumeClaimName: csi-lvmpvc |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
|
||
|
||
############################################## | ||
########### ############ | ||
########### LVMSnapshot CRD ############ | ||
########### ############ | ||
############################################## | ||
|
||
# LVMSnapshot CRD is autogenerated via `make manifests` command. | ||
# Do the modification in the code and run the `make manifests` command | ||
# to generate the CRD definition | ||
|
||
--- | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.2.8 | ||
creationTimestamp: null | ||
name: lvmsnapshots.local.openebs.io | ||
spec: | ||
group: local.openebs.io | ||
names: | ||
kind: LVMSnapshot | ||
listKind: LVMSnapshotList | ||
plural: lvmsnapshots | ||
singular: lvmsnapshot | ||
preserveUnknownFields: false | ||
scope: Namespaced | ||
validation: | ||
openAPIV3Schema: | ||
description: LVMSnapshot represents an LVM Snapshot of the lvm volume | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: VolumeInfo defines LVM info | ||
properties: | ||
capacity: | ||
description: Capacity of the volume | ||
minLength: 1 | ||
type: string | ||
ownerNodeID: | ||
description: OwnerNodeID is the Node ID where the volume group is present | ||
which is where the volume has been provisioned. OwnerNodeID can not | ||
be edited after the volume has been provisioned. | ||
minLength: 1 | ||
type: string | ||
shared: | ||
description: Shared specifies whether the volume can be shared among | ||
multiple pods. If it is not set to "yes", then the LVM LocalPV Driver | ||
will not allow the volumes to be mounted by more than one pods. | ||
enum: | ||
- "yes" | ||
- "no" | ||
type: string | ||
volGroup: | ||
description: VolGroup specifies the name of the volume group where the | ||
volume has been created. | ||
minLength: 1 | ||
type: string | ||
required: | ||
- capacity | ||
- ownerNodeID | ||
- volGroup | ||
type: object | ||
status: | ||
description: SnapStatus string that reflects if the snapshot was created | ||
successfully | ||
properties: | ||
state: | ||
type: string | ||
type: object | ||
required: | ||
- spec | ||
- status | ||
type: object | ||
version: v1alpha1 | ||
versions: | ||
- name: v1alpha1 | ||
served: true | ||
storage: true | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
Copyright 2021 The OpenEBS 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 v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +genclient | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +resource:path=lvmsnapshot | ||
|
||
// LVMSnapshot represents an LVM Snapshot of the lvm volume | ||
type LVMSnapshot struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec VolumeInfo `json:"spec"` | ||
Status SnapStatus `json:"status"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +resource:path=lvmsnapshots | ||
|
||
// LVMSnapshotList is a list of LVMSnapshot resources | ||
type LVMSnapshotList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata"` | ||
|
||
Items []LVMSnapshot `json:"items"` | ||
} | ||
|
||
// SnapStatus string that reflects if the snapshot was created successfully | ||
type SnapStatus struct { | ||
State string `json:"state,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.