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

feat: implement snapshots as tarballs #430

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file modified charts/latest/csi-driver-nfs-v0.0.0.tgz
Binary file not shown.
16 changes: 16 additions & 0 deletions charts/latest/csi-driver-nfs/templates/csi-nfs-controller.yaml
Expand Up @@ -63,6 +63,22 @@ spec:
resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }}
securityContext:
wozniakjan marked this conversation as resolved.
Show resolved Hide resolved
readOnlyRootFilesystem: true
{{- if .Values.externalSnapshotter.enabled }}
- name: csi-snapshotter
image: "{{ .Values.image.csiSnapshotter.repository }}:{{ .Values.image.csiSnapshotter.tag }}"
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
- "--leader-election-namespace={{ .Release.Namespace }}"
- "--leader-election"
env:
- name: ADDRESS
value: /csi/csi.sock
imagePullPolicy: {{ .Values.image.csiSnapshotter.pullPolicy }}
volumeMounts:
- name: socket-dir
mountPath: /csi
{{- end }}
- name: liveness-probe
image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}"
args:
Expand Down
@@ -0,0 +1,51 @@
{{- if .Values.externalSnapshotter.enabled -}}
# This YAML file shows how to deploy the snapshot controller

# The snapshot controller implements the control loop for CSI snapshot functionality.
# It should be installed as part of the base Kubernetes distribution in an appropriate
# namespace for components implementing base system functionality. For installing with
# Vanilla Kubernetes, kube-system makes sense for the namespace.
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: {{ .Values.externalSnapshotter.name }}
namespace: {{ .Release.Namespace }}
{{ include "nfs.labels" . | indent 2 }}
app: {{ .Values.externalSnapshotter.name }}
{{- with .Values.externalSnapshotter.labels }}
{{ . | toYaml | indent 4 }}
{{- end }}
{{- with .Values.externalSnapshotter.annotations }}
annotations:
{{ . | toYaml | indent 4 }}
{{- end }}
spec:
replicas: {{ .Values.externalSnapshotter.controller.replicas }}
selector:
matchLabels:
app: {{ .Values.externalSnapshotter.name }}
# the snapshot controller won't be marked as ready if the v1 CRDs are unavailable
# in #504 the snapshot-controller will exit after around 7.5 seconds if it
# can't find the v1 CRDs so this value should be greater than that
minReadySeconds: 15
strategy:
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: {{ .Values.externalSnapshotter.name }}
spec:
serviceAccountName: {{ .Values.externalSnapshotter.name }}
containers:
- name: {{ .Values.externalSnapshotter.name }}
image: {{ .Values.image.externalSnapshotter.repository }}:{{ .Values.image.externalSnapshotter.tag }}
args:
- "--v=5"
- "--leader-election=true"
- "--leader-election-namespace={{ .Release.Namespace }}"
imagePullPolicy: {{ .Values.image.externalSnapshotter.pullPolicy }}
{{- end -}}
11 changes: 11 additions & 0 deletions charts/latest/csi-driver-nfs/templates/rbac-csi-nfs.yaml
Expand Up @@ -32,6 +32,17 @@ rules:
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
{{- if .Values.externalSnapshotter.enabled }}
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotclasses", "volumesnapshots"]
verbs: ["get", "list", "watch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents"]
verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents/status"]
verbs: ["get", "update", "patch"]
{{- end }}
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
Expand Down
@@ -0,0 +1,93 @@
{{- if .Values.externalSnapshotter.enabled -}}
# RBAC file for the snapshot controller.
#
# The snapshot controller implements the control loop for CSI snapshot functionality.
# It should be installed as part of the base Kubernetes distribution in an appropriate
# namespace for components implementing base system functionality. For installing with
# Vanilla Kubernetes, kube-system makes sense for the namespace.
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.externalSnapshotter.name }}
namespace: {{ .Release.Namespace }}
{{ include "nfs.labels" . | indent 2 }}

---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Values.externalSnapshotter.name }}-runner
{{ include "nfs.labels" . | indent 2 }}
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- 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", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents/status"]
verbs: ["patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots"]
verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots/status"]
verbs: ["update", "patch"]
{{- if .Values.externalSnapshotter.enabledDistributedSnapshotting }}
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
{{- end }}
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Values.externalSnapshotter.name }}-role
{{ include "nfs.labels" . | indent 2 }}
subjects:
- kind: ServiceAccount
name: {{ .Values.externalSnapshotter.name }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ .Values.externalSnapshotter.name }}-runner
apiGroup: rbac.authorization.k8s.io

---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Values.externalSnapshotter.name }}-leaderelection
namespace: {{ .Release.Namespace }}
{{ include "nfs.labels" . | indent 2 }}
rules:
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "watch", "list", "delete", "update", "create"]

---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Values.externalSnapshotter.name }}-leaderelection
namespace: {{ .Release.Namespace }}
{{ include "nfs.labels" . | indent 2 }}
subjects:
- kind: ServiceAccount
name: {{ .Values.externalSnapshotter.name }}
roleRef:
kind: Role
name: {{ .Values.externalSnapshotter.name }}-leaderelection
apiGroup: rbac.authorization.k8s.io
{{- end -}}
@@ -0,0 +1,146 @@
{{- if .Values.externalSnapshotter.enabled -}}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
api-approved.kubernetes.io: https://github.com/kubernetes-csi/external-snapshotter/pull/665
name: volumesnapshotclasses.snapshot.storage.k8s.io
spec:
group: snapshot.storage.k8s.io
names:
kind: VolumeSnapshotClass
listKind: VolumeSnapshotClassList
plural: volumesnapshotclasses
shortNames: [vsclass, vsclasses]
singular: volumesnapshotclass
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .driver
name: Driver
type: string
- description: Determines whether a VolumeSnapshotContent created through
the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot
is deleted.
jsonPath: .deletionPolicy
name: DeletionPolicy
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
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
served: true
storage: true
subresources: {}
- additionalPrinterColumns:
- jsonPath: .driver
name: Driver
type: string
- description: Determines whether a VolumeSnapshotContent created through
the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot
is deleted.
jsonPath: .deletionPolicy
name: DeletionPolicy
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
# This indicates the v1beta1 version of the custom resource is deprecated.
# API requests to this version receive a warning in the server response.
deprecated: true
# This overrides the default warning returned to clients making v1beta1 API requests.
deprecationWarning: snapshot.storage.k8s.io/v1beta1 VolumeSnapshotClass is deprecated;
use snapshot.storage.k8s.io/v1 VolumeSnapshotClass
schema:
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
served: false
storage: false
subresources: {}
status:
acceptedNames:
kind: ''
plural: ''
conditions: []
storedVersions: []
{{- end -}}