const SRC=src;
const DEST=dest;
const DOIT=config.apply;
const PURGE=config.purge;
const crdFiles=if config.all {[
    "apiextensions.k8s.io_v1_CustomResourceDefinition_kubevirts.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_migrationpolicies.migrations.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachineclones.clone.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachineclusterinstancetypes.instancetype.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachineclusterpreferences.instancetype.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachineexports.export.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachineinstancemigrations.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachineinstancepresets.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachineinstancereplicasets.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachineinstances.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachineinstancetypes.instancetype.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachinepools.pool.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachinepreferences.instancetype.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachinerestores.snapshot.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachines.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachinesnapshotcontents.snapshot.kubevirt.io.yaml",
    "apiextensions.k8s.io_v1_CustomResourceDefinition_virtualmachinesnapshots.snapshot.kubevirt.io.yaml",
]} else {["apiextensions.k8s.io_v1_CustomResourceDefinition_kubevirts.kubevirt.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}`);
    }
}
