Files
addons/crd/keda/index.rhai
2024-03-20 06:56:44 +01:00

37 lines
1.2 KiB
Plaintext

const VERSION="2.13.1";
const SRC=src;
const DEST=dest;
const DOIT=config.apply;
const sourcesDir=`https://github.com/kedacore/keda/releases/download/v${VERSION}`;
const sources=[
`keda-${VERSION}-crds.yaml`
];
const crdFiles=[
"apiextensions.k8s.io_v1_CustomResourceDefinition_cloudeventsources.eventing.keda.sh.yaml",
"apiextensions.k8s.io_v1_CustomResourceDefinition_clustertriggerauthentications.keda.sh.yaml",
"apiextensions.k8s.io_v1_CustomResourceDefinition_scaledjobs.keda.sh.yaml",
"apiextensions.k8s.io_v1_CustomResourceDefinition_scaledobjects.keda.sh.yaml",
"apiextensions.k8s.io_v1_CustomResourceDefinition_triggerauthentications.keda.sh.yaml",
];
fn pre_pack() {
for file in global::sources {
shell(`curl -sL ${global::sourcesDir}/${file} > ${global::SRC}/keda-crds.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::DOIT {
return;
}
for file in global::crdFiles {
shell(`kubectl delete -f ${global::SRC}/${file}`);
}
}