chore: ad option to generate single crds #81
2
Makefile
2
Makefile
@ -30,4 +30,4 @@ clean:
|
||||
.PHONY: generate
|
||||
generate:
|
||||
@mkdir -p $(DIST)
|
||||
@./generate.sh
|
||||
@./generate.sh $(handler)
|
||||
|
106
generate.sh
106
generate.sh
@ -28,8 +28,8 @@ generate_all() {
|
||||
gomplate -d source=env:SOURCE -d type=env:TYPE -o "$SOURCE/all-$TYPE.json" -f templates/all.json.tmpl
|
||||
}
|
||||
|
||||
default_openapi_handler() {
|
||||
printf "Processing %s ...\n" $API
|
||||
exec_openapi() {
|
||||
printf "Processing %s ...\n" "$1"
|
||||
prepare
|
||||
(
|
||||
cd "$WORKDIR"
|
||||
@ -40,6 +40,11 @@ default_openapi_handler() {
|
||||
}
|
||||
|
||||
calico_handler() {
|
||||
API=projectcalico.org
|
||||
NAME=calico
|
||||
WORKDIR="${TMP_CRD_DIR}/calico"
|
||||
SOURCE="https://raw.githubusercontent.com/projectcalico/calico/${CALICO_VERSION}/manifests/calico.yaml"
|
||||
|
||||
printf "Processing %s ...\n" $API
|
||||
prepare
|
||||
(
|
||||
@ -60,6 +65,10 @@ calico_handler() {
|
||||
}
|
||||
|
||||
flux_handler() {
|
||||
API=toolkit.fluxcd.io
|
||||
WORKDIR="${TMP_CRD_DIR}/flux"
|
||||
SOURCE="https://github.com/fluxcd/flux2/releases/download/${FLUXCD_VERSION}/crd-schemas.tar.gz"
|
||||
|
||||
printf "Processing %s ...\n" $API
|
||||
mkdir -p "${WORKDIR}"
|
||||
curl -SsfL "${SOURCE}" | tar xz -C "${WORKDIR}"
|
||||
@ -82,6 +91,11 @@ flux_handler() {
|
||||
}
|
||||
|
||||
metallb_handler() {
|
||||
API=metallb.io
|
||||
NAME=metallb
|
||||
WORKDIR="${TMP_CRD_DIR}/$NAME"
|
||||
SOURCE="https://raw.githubusercontent.com/metallb/metallb/${METALLB_VERSION}/charts/metallb/charts/crds/templates/crds.yaml"
|
||||
|
||||
printf "Processing %s ...\n" $API
|
||||
prepare
|
||||
(
|
||||
@ -93,50 +107,56 @@ metallb_handler() {
|
||||
generate_all "$TARGET_DIR"
|
||||
}
|
||||
|
||||
## Calico
|
||||
API=projectcalico.org
|
||||
NAME=calico
|
||||
WORKDIR="${TMP_CRD_DIR}/calico"
|
||||
SOURCE="https://raw.githubusercontent.com/projectcalico/calico/${CALICO_VERSION}/manifests/calico.yaml"
|
||||
calico_handler
|
||||
cnpg_handler() {
|
||||
API=postgresql.cnpg.io
|
||||
NAME=cnpg
|
||||
WORKDIR="${TMP_CRD_DIR}/$NAME"
|
||||
SOURCE="https://github.com/cloudnative-pg/cloudnative-pg/releases/download/${CNPG_VERSION}/cnpg-${CNPG_VERSION##v}.yaml"
|
||||
|
||||
## Flux2
|
||||
API=toolkit.fluxcd.io
|
||||
WORKDIR="${TMP_CRD_DIR}/flux"
|
||||
SOURCE="https://github.com/fluxcd/flux2/releases/download/${FLUXCD_VERSION}/crd-schemas.tar.gz"
|
||||
flux_handler
|
||||
exec_openapi $API
|
||||
}
|
||||
|
||||
## Metallb
|
||||
API=metallb.io
|
||||
NAME=metallb
|
||||
WORKDIR="${TMP_CRD_DIR}/$NAME"
|
||||
SOURCE="https://raw.githubusercontent.com/metallb/metallb/${METALLB_VERSION}/charts/metallb/charts/crds/templates/crds.yaml"
|
||||
metallb_handler
|
||||
certmanager_handler() {
|
||||
API=cert-manager.io
|
||||
NAME=cert-manager
|
||||
WORKDIR="${TMP_CRD_DIR}/$NAME"
|
||||
SOURCE="https://github.com/cert-manager/cert-manager/releases/download/${CERTMANAGER_VERSION}/cert-manager.crds.yaml"
|
||||
|
||||
## Cloudnative-PG
|
||||
API=postgresql.cnpg.io
|
||||
NAME=cnpg
|
||||
WORKDIR="${TMP_CRD_DIR}/$NAME"
|
||||
SOURCE="https://github.com/cloudnative-pg/cloudnative-pg/releases/download/${CNPG_VERSION}/cnpg-${CNPG_VERSION##v}.yaml"
|
||||
default_openapi_handler
|
||||
exec_openapi $API
|
||||
}
|
||||
|
||||
## Cert-Manager
|
||||
API=cert-manager.io
|
||||
NAME=cert-manager
|
||||
WORKDIR="${TMP_CRD_DIR}/$NAME"
|
||||
SOURCE="https://github.com/cert-manager/cert-manager/releases/download/${CERTMANAGER_VERSION}/cert-manager.crds.yaml"
|
||||
default_openapi_handler
|
||||
minio_handler() {
|
||||
API=minio.min.io
|
||||
NAME=minio
|
||||
WORKDIR="${TMP_CRD_DIR}/$NAME"
|
||||
SOURCE="https://raw.githubusercontent.com/minio/operator/${MINIO_VERSION}/resources/base/crds/minio.min.io_tenants.yaml"
|
||||
|
||||
## Minio
|
||||
API=minio.min.io
|
||||
NAME=minio
|
||||
WORKDIR="${TMP_CRD_DIR}/$NAME"
|
||||
SOURCE="https://raw.githubusercontent.com/minio/operator/${MINIO_VERSION}/resources/base/crds/minio.min.io_tenants.yaml"
|
||||
default_openapi_handler
|
||||
exec_openapi $API
|
||||
}
|
||||
|
||||
## K8up
|
||||
API=k8up.io
|
||||
NAME=k8up
|
||||
WORKDIR="${TMP_CRD_DIR}/$NAME"
|
||||
SOURCE="https://github.com/k8up-io/k8up/releases/download/k8up-${K8UP_VERSION}/k8up-crd.yaml"
|
||||
default_openapi_handler
|
||||
k8up_handler() {
|
||||
API=k8up.io
|
||||
NAME=k8up
|
||||
WORKDIR="${TMP_CRD_DIR}/$NAME"
|
||||
SOURCE="https://github.com/k8up-io/k8up/releases/download/k8up-${K8UP_VERSION}/k8up-crd.yaml"
|
||||
|
||||
exec_openapi $API
|
||||
}
|
||||
|
||||
handlers=(
|
||||
calico_handler
|
||||
flux_handler
|
||||
metallb_handler
|
||||
cnpg_handler
|
||||
certmanager_handler
|
||||
minio_handler
|
||||
k8up_handler
|
||||
)
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
for handler in "${handlers[@]}"; do
|
||||
"$handler"
|
||||
done
|
||||
else
|
||||
"$1"_handler
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user