Skip to content

Commit

Permalink
rook got k8s-1.17 provider and functional test of vm snapshot with st…
Browse files Browse the repository at this point in the history
…orage

Signed-off-by: Michael Henriksen <[email protected]>
  • Loading branch information
mhenriks committed Jun 5, 2020
1 parent a4f014b commit ea0a1f7
Show file tree
Hide file tree
Showing 13 changed files with 2,894 additions and 0 deletions.
17 changes: 17 additions & 0 deletions hack/cluster-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ metadata:
name: ${namespace}
EOF

if [[ $KUBEVIRT_PROVIDER == "k8s-1.17" ]]; then
_kubectl apply -f ${KUBEVIRT_DIR}/manifests/testing/external-snapshotter
_kubectl apply -f ${KUBEVIRT_DIR}/manifests/testing/rook/common.yaml
_kubectl apply -f ${KUBEVIRT_DIR}/manifests/testing/rook/operator.yaml
_kubectl apply -f ${KUBEVIRT_DIR}/manifests/testing/rook/cluster.yaml
_kubectl apply -f ${KUBEVIRT_DIR}/manifests/testing/rook/pool.yaml
fi

# Deploy infra for testing first
_kubectl create -f ${MANIFESTS_OUT_DIR}/testing

Expand Down Expand Up @@ -101,4 +109,13 @@ until _kubectl wait -n kubevirt kv kubevirt --for condition=Available --timeout
sleep 1m
done

if [[ $KUBEVIRT_PROVIDER == "k8s-1.17" ]]; then
# wait for ceph
until _kubectl get cephblockpools -n rook-ceph replicapool -o jsonpath='{.status.phase}' | grep Ready; do
((count++)) && ((count == 20)) && echo "Ceph not ready in time" && exit 1
echo "Error waiting for Ceph to be Ready, sleeping 1m and retrying"
sleep 30
done
fi

echo "Done"
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# RBAC file for the snapshot controller.
apiVersion: v1
kind: ServiceAccount
metadata:
name: snapshot-controller

---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
# rename if there are conflicts
name: snapshot-controller-runner
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents"]
verbs: ["create", "get", "list", "watch", "update", "delete"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots/status"]
verbs: ["update"]

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: snapshot-controller-role
subjects:
- kind: ServiceAccount
name: snapshot-controller
# replace with non-default namespace name
namespace: default
roleRef:
kind: ClusterRole
# change the name also here if the ClusterRole gets renamed
name: snapshot-controller-runner
apiGroup: rbac.authorization.k8s.io

---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: default # TODO: replace with the namespace you want for your controller
name: snapshot-controller-leaderelection
rules:
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "watch", "list", "delete", "update", "create"]

---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: snapshot-controller-leaderelection
namespace: default # TODO: replace with the namespace you want for your controller
subjects:
- kind: ServiceAccount
name: snapshot-controller
namespace: default # TODO: replace with the namespace you want for your controller
roleRef:
kind: Role
name: snapshot-controller-leaderelection
apiGroup: rbac.authorization.k8s.io

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This YAML file shows how to deploy the snapshot controller

---
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: snapshot-controller
spec:
serviceName: "snapshot-controller"
replicas: 1
selector:
matchLabels:
app: snapshot-controller
template:
metadata:
labels:
app: snapshot-controller
spec:
serviceAccount: snapshot-controller
containers:
- name: snapshot-controller
image: quay.io/k8scsi/snapshot-controller:v2.0.1
args:
- "--v=5"
- "--leader-election=false"
imagePullPolicy: Always
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/260"
creationTimestamp: null
name: volumesnapshotclasses.snapshot.storage.k8s.io
spec:
additionalPrinterColumns:
- JSONPath: .driver
name: Driver
type: string
- JSONPath: .deletionPolicy
description: Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass
should be deleted when its bound VolumeSnapshot is deleted.
name: DeletionPolicy
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: snapshot.storage.k8s.io
names:
kind: VolumeSnapshotClass
listKind: VolumeSnapshotClassList
plural: volumesnapshotclasses
singular: volumesnapshotclass
preserveUnknownFields: false
scope: Cluster
subresources: {}
validation:
openAPIV3Schema:
description: VolumeSnapshotClass specifies parameters that a underlying storage
system uses when creating a volume snapshot. A specific VolumeSnapshotClass
is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses
are non-namespaced
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/sig-architecture/api-conventions.md#resources'
type: string
deletionPolicy:
description: deletionPolicy determines whether a VolumeSnapshotContent created
through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot
is deleted. Supported values are "Retain" and "Delete". "Retain" means
that the VolumeSnapshotContent and its physical snapshot on underlying
storage system are kept. "Delete" means that the VolumeSnapshotContent
and its physical snapshot on underlying storage system are deleted. Required.
enum:
- Delete
- Retain
type: string
driver:
description: driver is the name of the storage driver that handles this
VolumeSnapshotClass. Required.
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/sig-architecture/api-conventions.md#types-kinds'
type: string
parameters:
additionalProperties:
type: string
description: parameters is a key-value map with storage driver specific
parameters for creating snapshots. These values are opaque to Kubernetes.
type: object
required:
- deletionPolicy
- driver
type: object
version: v1beta1
versions:
- name: v1beta1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading

0 comments on commit ea0a1f7

Please sign in to comment.