From 9e4385478dae98c671bc5b3e5459406bb396c767 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Wed, 29 Nov 2023 21:03:20 -0800 Subject: [PATCH] Fix import-scrds script Signed-off-by: Tamal Saha --- hack/scripts/import-crds.sh | 110 +++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 47 deletions(-) diff --git a/hack/scripts/import-crds.sh b/hack/scripts/import-crds.sh index b6f6f27f..e07973e3 100755 --- a/hack/scripts/import-crds.sh +++ b/hack/scripts/import-crds.sh @@ -17,6 +17,7 @@ set -eou pipefail crd_dir=${1:-}/apimachinery/crds +update_kubedb_crds=true api_repo_url=https://github.com/kubedb/apimachinery.git api_repo_tag=${KUBEDB_APIMACHINERY_TAG:-master} @@ -25,6 +26,7 @@ if [ "$#" -ne 1 ]; then if [ "${api_repo_tag}" == "master" ]; then echo "Skipping updating kubedb/apimachinery crds" echo "To update use: import-crds.sh " + update_kubedb_crds=false else tmp_dir=$(mktemp -d -t api-XXXXXXXXXX) # always cleanup temp dir @@ -44,56 +46,58 @@ if [ "$#" -ne 1 ]; then fi fi -crd-importer \ - --input=${crd_dir} \ - --out=./charts/kubedb-crds/crds \ - --group=kubedb.com \ - --group=catalog.kubedb.com \ - --group=config.kubedb.com \ - --group=ops.kubedb.com \ - --group=autoscaling.kubedb.com \ - --group=dashboard.kubedb.com \ - --group=postgres.kubedb.com \ - --group=archiver.kubedb.com \ - --group=schema.kubedb.com +if [ "$update_kubedb_crds" = true ]; then + crd-importer \ + --input=${crd_dir} \ + --out=./charts/kubedb-crds/crds \ + --group=kubedb.com \ + --group=catalog.kubedb.com \ + --group=config.kubedb.com \ + --group=ops.kubedb.com \ + --group=autoscaling.kubedb.com \ + --group=dashboard.kubedb.com \ + --group=postgres.kubedb.com \ + --group=archiver.kubedb.com \ + --group=schema.kubedb.com -crd-importer \ - --input=${crd_dir} \ - --out=. --output-yaml=crds/kubedb-crds.yaml \ - --group=kubedb.com \ - --group=catalog.kubedb.com \ - --group=config.kubedb.com \ - --group=ops.kubedb.com \ - --group=autoscaling.kubedb.com \ - --group=dashboard.kubedb.com \ - --group=postgres.kubedb.com \ - --group=archiver.kubedb.com \ - --group=schema.kubedb.com + crd-importer \ + --input=${crd_dir} \ + --out=. --output-yaml=crds/kubedb-crds.yaml \ + --group=kubedb.com \ + --group=catalog.kubedb.com \ + --group=config.kubedb.com \ + --group=ops.kubedb.com \ + --group=autoscaling.kubedb.com \ + --group=dashboard.kubedb.com \ + --group=postgres.kubedb.com \ + --group=archiver.kubedb.com \ + --group=schema.kubedb.com -crd-importer \ - --input=${crd_dir} \ - --out=./charts/kubedb-catalog/crds \ - --group=catalog.kubedb.com + crd-importer \ + --input=${crd_dir} \ + --out=./charts/kubedb-catalog/crds \ + --group=catalog.kubedb.com + + crd-importer \ + --input=${crd_dir} \ + --out=. --output-yaml=crds/kubedb-catalog-crds.yaml \ + --group=catalog.kubedb.com + + crd-importer \ + --input=${crd_dir} \ + --out=./charts/kubedb-ui-server/crds \ + --group=kubedb.com +fi crd-importer \ --input=https://github.com/kubestash/apimachinery/raw/master/crds/addons.kubestash.com_addons.yaml \ --input=https://github.com/kubestash/apimachinery/raw/master/crds/addons.kubestash.com_functions.yaml \ --out=./charts/kubedb-kubestash-catalog/crds -crd-importer \ - --input=${crd_dir} \ - --out=. --output-yaml=crds/kubedb-catalog-crds.yaml \ - --group=catalog.kubedb.com - crd-importer \ --input=https://github.com/kmodules/custom-resources/raw/v0.25.1/crds/metrics.appscode.com_metricsconfigurations.yaml \ --out=./charts/kubedb-metrics/crds -crd-importer \ - --input=${crd_dir} \ - --out=./charts/kubedb-ui-server/crds \ - --group=kubedb.com - crd-importer \ --input=https://github.com/open-viz/apimachinery/raw/v0.0.5/crds/openviz.dev_grafanadashboards.yaml \ --out=./charts/kubedb-grafana-dashboards/crds @@ -104,6 +108,7 @@ crd-importer \ { crd_dir=${1:-}/provider-aws/package/crds + update_aws_crds=true repo_url=https://github.com/kubedb/provider-aws.git repo_tag=${KUBEDB_PROVIDER_AWS_TAG:-main} @@ -112,6 +117,7 @@ crd-importer \ if [ "${repo_tag}" == "main" ]; then echo "Skipping updating kubedb/provider-aws crds" echo "To update use: import-crds.sh " + update_aws_crds=false else tmp_dir=$(mktemp -d -t api-XXXXXXXXXX) # always cleanup temp dir @@ -131,12 +137,15 @@ crd-importer \ fi fi - crd-importer \ - --input=${crd_dir} \ - --out=./charts/kubedb-provider-aws/crds + if [ "$update_aws_crds" = true ]; then + crd-importer \ + --input=${crd_dir} \ + --out=./charts/kubedb-provider-aws/crds + fi } { crd_dir=${1:-}/provider-azure/package/crds + update_azure_crds=true repo_url=https://github.com/kubedb/provider-azure.git repo_tag=${KUBEDB_PROVIDER_AZURE_TAG:-main} @@ -145,6 +154,7 @@ crd-importer \ if [ "${repo_tag}" == "main" ]; then echo "Skipping updating kubedb/provider-azure crds" echo "To update use: import-crds.sh " + update_azure_crds=false else tmp_dir=$(mktemp -d -t api-XXXXXXXXXX) # always cleanup temp dir @@ -164,12 +174,15 @@ crd-importer \ fi fi - crd-importer \ - --input=${crd_dir} \ - --out=./charts/kubedb-provider-azure/crds + if [ "$update_azure_crds" = true ]; then + crd-importer \ + --input=${crd_dir} \ + --out=./charts/kubedb-provider-azure/crds + fi } { crd_dir=${1:-}/provider-gcp/package/crds + update_gcp_crds=true repo_url=https://github.com/kubedb/provider-gcp.git repo_tag=${KUBEDB_PROVIDER_GCP_TAG:-main} @@ -178,6 +191,7 @@ crd-importer \ if [ "${repo_tag}" == "main" ]; then echo "Skipping updating kubedb/provider-gcp crds" echo "To update use: import-crds.sh " + update_gcp_crds=false else tmp_dir=$(mktemp -d -t api-XXXXXXXXXX) # always cleanup temp dir @@ -197,7 +211,9 @@ crd-importer \ fi fi - crd-importer \ - --input=${crd_dir} \ - --out=./charts/kubedb-provider-gcp/crds + if [ "$update_gcp_crds" = true ]; then + crd-importer \ + --input=${crd_dir} \ + --out=./charts/kubedb-provider-gcp/crds + fi }