Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ ignore: |
manifests/
vendor/
compiled/
tests/golden/
26 changes: 26 additions & 0 deletions class/csi-external-snapshotter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@ parameters:
- ${_base_directory}/component/app.jsonnet
input_type: jsonnet
output_path: .
# crd kustomize
- input_paths:
- ${_base_directory}/component/crd.jsonnet
input_type: jsonnet
output_path: ${_base_directory}/manifests/crd
- input_paths:
- ${_kustomize_wrapper}
input_type: external
output_path: .
env_vars:
INPUT_DIR: ${_base_directory}/manifests/crd
args:
- \${compiled_target_dir}/${_instance}/10_kustomize/crd
# controller kustomize
- input_paths:
- ${_base_directory}/component/kustomization.jsonnet
input_type: jsonnet
output_path: ${_base_directory}/manifests/snapshot-controller
- input_paths:
- ${_kustomize_wrapper}
input_type: external
output_path: .
env_vars:
INPUT_DIR: ${_base_directory}/manifests/snapshot-controller
args:
- \${compiled_target_dir}/${_instance}/10_kustomize/snapshot-controller
- input_paths:
- ${_base_directory}/component/main.jsonnet
input_type: jsonnet
Expand Down
11 changes: 11 additions & 0 deletions class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,15 @@ parameters:
csi_external_snapshotter:
=_metadata:
multi_tenant: true

namespace: syn-csi-external-snapshotter

manifestVersion: ${csi_external_snapshotter:images:external-snapshotter:tag}

images:
external-snapshotter:
registry: registry.k8s.io
repository: sig-storage/snapshot-controller
tag: v8.6.0

kustomizeInput: {}
10 changes: 9 additions & 1 deletion component/app.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ local inv = kap.inventory();
local params = inv.parameters.csi_external_snapshotter;
local argocd = import 'lib/argocd.libjsonnet';

local app = argocd.App('csi-external-snapshotter', params.namespace);
local app = argocd.App('csi-external-snapshotter', params.namespace) {
spec+: {
syncPolicy+: {
syncOptions+: [
'ServerSideApply=true',
],
},
},
};

local appPath =
local project = std.get(std.get(app, 'spec', {}), 'project', 'syn');
Expand Down
10 changes: 10 additions & 0 deletions component/crd.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
local com = import 'lib/commodore.libjsonnet';
local kap = import 'lib/kapitan.libjsonnet';

local inv = kap.inventory();
local params = inv.parameters.csi_external_snapshotter;

com.Kustomization(
'https://github.com/kubernetes-csi/external-snapshotter/client/config/crd',
params.manifestVersion,
)
26 changes: 26 additions & 0 deletions component/kustomization.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
local com = import 'lib/commodore.libjsonnet';
local kap = import 'lib/kapitan.libjsonnet';

local inv = kap.inventory();
local params = inv.parameters.csi_external_snapshotter;

com.Kustomization(
'https://github.com/kubernetes-csi/external-snapshotter/deploy/kubernetes/snapshot-controller',
params.manifestVersion,
{
'registry.k8s.io/sig-storage/snapshot-controller': {
newTag: params.images['external-snapshotter'].tag,
newName: '%(registry)s/%(repository)s' % params.images['external-snapshotter'],
},
},
{
namePrefix: 'syn-csi-',
namespace: params.namespace,
labels: [ {
pairs: {
'app.kubernetes.io/managed-by': 'commodore',
'app.kubernetes.io/part-of': 'csi-external-snapshotter',
},
} ],
} + com.makeMergeable(params.kustomizeInput)
)
12 changes: 9 additions & 3 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
// main template for csi-external-snapshotter
local kap = import 'lib/kapitan.libjsonnet';
local kube = import 'lib/kube.libjsonnet';
local inv = kap.inventory();
// The hiera parameters for the component
local params = inv.parameters.csi_external_snapshotter;

// Define outputs below
assert
!std.member([ 'openshift4', 'oke' ], inv.parameters.facts.distribution)
: 'Component must not be enabled on OpenShift, since the snapshot-controller and VolumeSnapshot CRDs are managed by OpenShift';

{
'00_namespace': kube.Namespace(params.namespace) {
metadata: {
name: params.namespace,
},
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
spec:
syncPolicy:
syncOptions:
- ServerSideApply=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: syn-csi-external-snapshotter
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
api-approved.kubernetes.io: https://github.com/kubernetes-csi/external-snapshotter/pull/1337
controller-gen.kubebuilder.io/version: v0.15.0
name: volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io
spec:
group: groupsnapshot.storage.k8s.io
names:
kind: VolumeGroupSnapshotClass
listKind: VolumeGroupSnapshotClassList
plural: volumegroupsnapshotclasses
shortNames:
- vgsclass
- vgsclasses
singular: volumegroupsnapshotclass
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .driver
name: Driver
type: string
- description: Determines whether a VolumeGroupSnapshotContent created through
the VolumeGroupSnapshotClass should be deleted when its bound VolumeGroupSnapshot
is deleted.
jsonPath: .deletionPolicy
name: DeletionPolicy
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
description: |-
VolumeGroupSnapshotClass specifies parameters that a underlying storage system
uses when creating a volume group snapshot. A specific VolumeGroupSnapshotClass
is used by specifying its name in a VolumeGroupSnapshot object.
VolumeGroupSnapshotClasses 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 VolumeGroupSnapshotContent created
through the VolumeGroupSnapshotClass should be deleted when its bound
VolumeGroupSnapshot is deleted.
Supported values are "Retain" and "Delete".
"Retain" means that the VolumeGroupSnapshotContent and its physical group
snapshot on underlying storage system are kept.
"Delete" means that the VolumeGroupSnapshotContent and its physical group
snapshot on underlying storage system are deleted.
Required.
enum:
- Delete
- Retain
type: string
x-kubernetes-validations:
- message: deletionPolicy is immutable once set
rule: self == oldSelf
driver:
description: |-
Driver is the name of the storage driver expected to handle this VolumeGroupSnapshotClass.
Required.
type: string
x-kubernetes-validations:
- message: driver is immutable once set
rule: self == oldSelf
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
metadata:
type: object
parameters:
additionalProperties:
type: string
description: |-
Parameters is a key-value map with storage driver specific parameters for
creating group snapshots.
These values are opaque to Kubernetes and are passed directly to the driver.
type: object
x-kubernetes-validations:
- message: parameters are immutable once set
rule: self == oldSelf
required:
- deletionPolicy
- driver
type: object
served: true
storage: false
subresources: {}
- additionalPrinterColumns:
- jsonPath: .driver
name: Driver
type: string
- description: Determines whether a VolumeGroupSnapshotContent created through
the VolumeGroupSnapshotClass should be deleted when its bound VolumeGroupSnapshot
is deleted.
jsonPath: .deletionPolicy
name: DeletionPolicy
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
deprecated: true
name: v1beta1
schema:
openAPIV3Schema:
description: |-
VolumeGroupSnapshotClass specifies parameters that a underlying storage system
uses when creating a volume group snapshot. A specific VolumeGroupSnapshotClass
is used by specifying its name in a VolumeGroupSnapshot object.
VolumeGroupSnapshotClasses 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 VolumeGroupSnapshotContent created
through the VolumeGroupSnapshotClass should be deleted when its bound
VolumeGroupSnapshot is deleted.
Supported values are "Retain" and "Delete".
"Retain" means that the VolumeGroupSnapshotContent and its physical group
snapshot on underlying storage system are kept.
"Delete" means that the VolumeGroupSnapshotContent and its physical group
snapshot on underlying storage system are deleted.
Required.
enum:
- Delete
- Retain
type: string
driver:
description: |-
Driver is the name of the storage driver expected to handle this VolumeGroupSnapshotClass.
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
metadata:
type: object
parameters:
additionalProperties:
type: string
description: |-
Parameters is a key-value map with storage driver specific parameters for
creating group snapshots.
These values are opaque to Kubernetes and are passed directly to the driver.
type: object
required:
- deletionPolicy
- driver
type: object
served: true
storage: false
subresources: {}
- additionalPrinterColumns:
- jsonPath: .driver
name: Driver
type: string
- description: Determines whether a VolumeGroupSnapshotContent created through
the VolumeGroupSnapshotClass should be deleted when its bound VolumeGroupSnapshot
is deleted.
jsonPath: .deletionPolicy
name: DeletionPolicy
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta2
schema:
openAPIV3Schema:
description: |-
VolumeGroupSnapshotClass specifies parameters that a underlying storage system
uses when creating a volume group snapshot. A specific VolumeGroupSnapshotClass
is used by specifying its name in a VolumeGroupSnapshot object.
VolumeGroupSnapshotClasses 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 VolumeGroupSnapshotContent created
through the VolumeGroupSnapshotClass should be deleted when its bound
VolumeGroupSnapshot is deleted.
Supported values are "Retain" and "Delete".
"Retain" means that the VolumeGroupSnapshotContent and its physical group
snapshot on underlying storage system are kept.
"Delete" means that the VolumeGroupSnapshotContent and its physical group
snapshot on underlying storage system are deleted.
Required.
enum:
- Delete
- Retain
type: string
x-kubernetes-validations:
- message: deletionPolicy is immutable once set
rule: self == oldSelf
driver:
description: |-
Driver is the name of the storage driver expected to handle this VolumeGroupSnapshotClass.
Required.
type: string
x-kubernetes-validations:
- message: driver is immutable once set
rule: self == oldSelf
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
metadata:
type: object
parameters:
additionalProperties:
type: string
description: |-
Parameters is a key-value map with storage driver specific parameters for
creating group snapshots.
These values are opaque to Kubernetes and are passed directly to the driver.
type: object
x-kubernetes-validations:
- message: parameters are immutable once set
rule: self == oldSelf
required:
- deletionPolicy
- driver
type: object
served: true
storage: true
subresources: {}
Loading
Loading