summaryrefslogtreecommitdiff
path: root/hack/generate-crds.sh
diff options
context:
space:
mode:
authorCongrool <chpzhangyifei@qq.com>2022-03-16 21:00:36 +0800
committervincentgoat <linguohui1@huawei.com>2022-05-19 15:51:00 +0800
commit1d9e20f26477396742b3772341e2f494a40ffd16 (patch)
tree3bb42311a61499f661ce2e546035431fc214d25e /hack/generate-crds.sh
parentupdate vendor for controller-runtime@v0.10.3 (diff)
downloadkubeedge-1d9e20f26477396742b3772341e2f494a40ffd16.tar.gz
init nodegroup
Signed-off-by: Congrool <chpzhangyifei@qq.com> Signed-off-by: Congrool <chpzhangyifei@zju.edu.cn>
Diffstat (limited to 'hack/generate-crds.sh')
-rwxr-xr-xhack/generate-crds.sh18
1 files changed, 14 insertions, 4 deletions
diff --git a/hack/generate-crds.sh b/hack/generate-crds.sh
index 167260499..ec3534047 100755
--- a/hack/generate-crds.sh
+++ b/hack/generate-crds.sh
@@ -22,6 +22,7 @@ CRD_VERSIONS=v1
CRD_OUTPUTS=build/crds
DEVICES_VERSION=v1alpha2
RELIABLESYNCS_VERSION=v1alpha1
+GROUPING_VERSION=v1alpha1
HELM_CRDS_DIR=manifests/charts/cloudcore/crds
ROUTER_DIR=build/crds/router
@@ -67,21 +68,30 @@ function :gen:crds: {
$(which controller-gen) paths="./..." ${_crdOptions} output:crd:artifacts:config=${_tmpdir}
}
+# remove the last element if it ends with "s", i.e: devicemodels -> devicemodel
+function remove_suffix_s {
+ if [ "${1: -1}" == "s" ]; then
+ echo ${1%?}
+ fi
+}
+
function :copy:to:destination {
# rename files, copy files
mkdir -p ${CRD_OUTPUTS}/devices
mkdir -p ${CRD_OUTPUTS}/reliablesyncs
+ mkdir -p ${CRD_OUTPUTS}/grouping
for entry in `ls /tmp/crds/*.yaml`; do
CRD_NAME=$(echo ${entry} | cut -d'.' -f3 | cut -d'_' -f2)
if [ "$CRD_NAME" == "devices" ] || [ "$CRD_NAME" == "devicemodels" ]; then
- # remove the last element if it ends with "s",i.e: devicemodels -> devicemodel
- if [ "${CRD_NAME: -1}" == "s" ]; then
- CRD_NAME=${CRD_NAME%?}
- fi
+ CRD_NAME=$(remove_suffix_s "$CRD_NAME")
cp -v ${entry} ${CRD_OUTPUTS}/devices/devices_${DEVICES_VERSION}_${CRD_NAME}.yaml
cp -v ${entry} ${HELM_CRDS_DIR}/devices_${DEVICES_VERSION}_${CRD_NAME}.yaml
+ elif [ "$CRD_NAME" == "edgeapplications" ] || [ "$CRD_NAME" == "nodegroups" ]; then
+ CRD_NAME=$(remove_suffix_s "$CRD_NAME")
+ cp -v ${entry} ${CRD_OUTPUTS}/grouping/grouping_${GROUPING_VERSION}_${CRD_NAME}.yaml
+ cp -v ${entry} ${HELM_CRDS_DIR}/grouping_${GROUPING_VERSION}_${CRD_NAME}.yaml
elif [ "$CRD_NAME" == "clusterobjectsyncs" ]; then
cp -v ${entry} ${CRD_OUTPUTS}/reliablesyncs/cluster_objectsync_${RELIABLESYNCS_VERSION}.yaml
cp -v ${entry} ${HELM_CRDS_DIR}/cluster_objectsync_${RELIABLESYNCS_VERSION}.yaml