diff --git a/charts/external-snapshotter/.helmignore b/charts/external-snapshotter/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/charts/external-snapshotter/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/external-snapshotter/Chart.yaml b/charts/external-snapshotter/Chart.yaml new file mode 100644 index 000000000..e4dbe9910 --- /dev/null +++ b/charts/external-snapshotter/Chart.yaml @@ -0,0 +1,21 @@ +apiVersion: v2 +name: external-snapshotter +description: A Helm chart for Kubernetes +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.0.1 +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "6.0.1" diff --git a/charts/external-snapshotter/crds/external-snapshotter.crds.yaml b/charts/external-snapshotter/crds/external-snapshotter.crds.yaml new file mode 100644 index 000000000..3874955e1 --- /dev/null +++ b/charts/external-snapshotter/crds/external-snapshotter.crds.yaml @@ -0,0 +1,155 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: snapshot-controller + namespace: kube-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: snapshot-controller-leaderelection + namespace: kube-system +rules: + - apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - watch + - list + - delete + - update + - create +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: snapshot-controller-runner +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 +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: snapshot-controller-leaderelection + namespace: kube-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: snapshot-controller-leaderelection +subjects: + - kind: ServiceAccount + name: snapshot-controller +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: snapshot-controller-role +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: snapshot-controller-runner +subjects: + - kind: ServiceAccount + name: snapshot-controller + namespace: kube-system +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: snapshot-controller + namespace: kube-system +spec: + minReadySeconds: 15 + replicas: 2 + selector: + matchLabels: + app: snapshot-controller + strategy: + rollingUpdate: + maxSurge: 0 + maxUnavailable: 1 + type: RollingUpdate + template: + metadata: + labels: + app: snapshot-controller + spec: + containers: + - args: + - --v=5 + - --leader-election=true + image: gcr.io/k8s-staging-sig-storage/snapshot-controller:v6.0.1 + imagePullPolicy: IfNotPresent + name: snapshot-controller + serviceAccountName: snapshot-controller diff --git a/charts/external-snapshotter/templates/snapshot-controller.yaml b/charts/external-snapshotter/templates/snapshot-controller.yaml new file mode 100644 index 000000000..c2ad69834 --- /dev/null +++ b/charts/external-snapshotter/templates/snapshot-controller.yaml @@ -0,0 +1,151 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: snapshot-controller +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: snapshot-controller-leaderelection +rules: + - apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - watch + - list + - delete + - update + - create +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: snapshot-controller-runner +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 +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: snapshot-controller-leaderelection +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: snapshot-controller-leaderelection +subjects: + - kind: ServiceAccount + name: snapshot-controller +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: snapshot-controller-role +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: snapshot-controller-runner +subjects: + - kind: ServiceAccount + name: snapshot-controller + namespace: kube-system +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: snapshot-controller +spec: + minReadySeconds: 15 + replicas: 2 + selector: + matchLabels: + app: snapshot-controller + strategy: + rollingUpdate: + maxSurge: 0 + maxUnavailable: 1 + type: RollingUpdate + template: + metadata: + labels: + app: snapshot-controller + spec: + containers: + - args: + - --v=5 + - --leader-election=true + image: gcr.io/k8s-staging-sig-storage/snapshot-controller:v6.0.1 + imagePullPolicy: IfNotPresent + name: snapshot-controller + serviceAccountName: snapshot-controller diff --git a/charts/external-snapshotter/values.yaml b/charts/external-snapshotter/values.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/release-tools/update-helm-charts.sh b/release-tools/update-helm-charts.sh new file mode 100644 index 000000000..2e0c4d914 --- /dev/null +++ b/release-tools/update-helm-charts.sh @@ -0,0 +1,19 @@ +# update crds +rm charts/external-snapshotter/crds/* +kubectl kustomize deploy/kubernetes/snapshot-controller | yq 'del(.metadata.creationTimestamp)' > charts/external-snapshotter/crds/external-snapshotter.crds.yaml + +# update templates +rm charts/external-snapshotter/templates/* +kubectl kustomize deploy/kubernetes/snapshot-controller | yq 'del(.metadata.namespace)' > charts/external-snapshotter/templates/snapshot-controller.yaml + +cp charts/external-snapshotter/Chart.yaml .tmp.Chart.yaml + +# update version +yq '.version | capture("(?P[0-9]$)") | .n tag= "!!int" | load(".tmp.Chart.yaml") * {"version": (load(".tmp.Chart.yaml") | .version | capture("(?P[0-9]+\.[0-9]+\.)[0-9]+$") | .n) + .n + 1}' .tmp.Chart.yaml > charts/external-snapshotter/Chart.yaml + +cp charts/external-snapshotter/Chart.yaml .tmp.Chart.yaml + +# update appVersion +kubectl kustomize deploy/kubernetes/snapshot-controller | yq 'select(.kind == "Deployment") | .spec.template.spec.containers[] | select(.name == "snapshot-controller") | .image | capture(".*v(?P[0-9\.]+)") | load(".tmp.Chart.yaml") * {"appVersion": .n}' > charts/external-snapshotter/Chart.yaml + +rm .tmp.Chart.yaml