diff --git a/Makefile b/Makefile index f0a7e421e..7590602e5 100644 --- a/Makefile +++ b/Makefile @@ -321,3 +321,6 @@ swagger-gen: check-license-header: ./hack/licence/header-check.sh + +check-install-def: + ./hack/utils/installdefinition.sh diff --git a/charts/vela-core/templates/defwithtemplate/raw.yaml b/charts/vela-core/templates/defwithtemplate/raw.yaml index b356f043a..d2ce4275c 100644 --- a/charts/vela-core/templates/defwithtemplate/raw.yaml +++ b/charts/vela-core/templates/defwithtemplate/raw.yaml @@ -5,7 +5,7 @@ metadata: annotations: definition.oam.dev/description: "raw allow users to specify raw K8s object in properties" name: raw - namespace: vela-system + namespace: {{.Values.systemDefinitionNamespace}} spec: workload: type: autodetects.core.oam.dev diff --git a/contribute/developer-guide.md b/contribute/developer-guide.md index a249cfc87..5028f4d03 100644 --- a/contribute/developer-guide.md +++ b/contribute/developer-guide.md @@ -78,8 +78,13 @@ Firstly make sure your cluster has CRDs, below is the command that can help inst make core-install ``` -Run locally: +To ensure you have created vela-system namespace and install definitions of necessary module. +you can run the command: +```shell script +make check-install-def +``` +And then run locally: ```shell script make core-run ``` diff --git a/hack/utils/installdefinition.sh b/hack/utils/installdefinition.sh new file mode 100755 index 000000000..b98839189 --- /dev/null +++ b/hack/utils/installdefinition.sh @@ -0,0 +1,26 @@ +#! /bin/bash +DEF_PATH="charts/vela-core/templates/defwithtemplate" + +function check_install() { + res=`kubectl get namespace -A | grep vela-system` + if [ -n "$res" ];then + echo 'vela-system namespace exist' + else + echo 'vela-system namespace do not exist' + echo 'creating vela-system namespace ...' + kubectl create namespace vela-system + fi + echo "applying definitions ..." + cd $DEF_PATH + + for file in *.yaml ; + do + echo "Info: changing "$DEF_PATH"/"$file + sed -i.bak "s#namespace: {{.Values.systemDefinitionNamespace}}#namespace: vela-system#g" $file + kubectl apply -f $file + rm $file + mv $file".bak" $file + done +} + +check_install diff --git a/vela-templates/internal/definitions/raw.yaml b/vela-templates/internal/definitions/raw.yaml index 71d4c208e..f83a2167b 100644 --- a/vela-templates/internal/definitions/raw.yaml +++ b/vela-templates/internal/definitions/raw.yaml @@ -4,7 +4,7 @@ metadata: annotations: definition.oam.dev/description: "raw allow users to specify raw K8s object in properties" name: raw - namespace: vela-system + namespace: {{.Values.systemDefinitionNamespace}} spec: workload: type: autodetects.core.oam.dev