const VERSION="7.0"; const SRC=src; const DEST=dest; const DOIT=config.apply; const PURGE=config.purge; const crdFiles=[ "apiextensions.k8s.io_v1_CustomResourceDefinition_volumesnapshotclasses.snapshot.storage.k8s.io.yaml", "apiextensions.k8s.io_v1_CustomResourceDefinition_volumesnapshotcontents.snapshot.storage.k8s.io.yaml", "apiextensions.k8s.io_v1_CustomResourceDefinition_volumesnapshots.snapshot.storage.k8s.io.yaml", ]; fn pre_install() { if ! global::DOIT { return; } for file in global::crdFiles { shell(`kubectl replace -f ${global::SRC}/${file} || kubectl create -f ${global::SRC}/${file}`); } } fn post_destroy() { if ! global::PURGE { return; } for file in global::crdFiles { shell(`kubectl delete -f ${global::SRC}/${file}`); } } fn pre_pack() { shell(`kubectl kustomize https://github.com/kubernetes-csi/external-snapshotter//client/config/crd/?ref=release-${global::VERSION} > ${global::SRC}/volsnap.yaml`); }