makes sure crds in chart always up to date and re-org the crds.
Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
This commit is contained in:
parent
f717c3ab0c
commit
c968c19263
|
@ -103,17 +103,17 @@ function generate_cert_secret {
|
||||||
# install Karmada's APIs
|
# install Karmada's APIs
|
||||||
function installCRDs() {
|
function installCRDs() {
|
||||||
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/namespace.yaml"
|
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/namespace.yaml"
|
||||||
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/cluster.karmada.io_clusters.yaml"
|
kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/cluster.karmada.io_clusters.yaml"
|
||||||
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/policy.karmada.io_propagationpolicies.yaml"
|
kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/policy.karmada.io_propagationpolicies.yaml"
|
||||||
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/policy.karmada.io_clusterpropagationpolicies.yaml"
|
kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/policy.karmada.io_clusterpropagationpolicies.yaml"
|
||||||
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/policy.karmada.io_overridepolicies.yaml"
|
kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/policy.karmada.io_overridepolicies.yaml"
|
||||||
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/policy.karmada.io_clusteroverridepolicies.yaml"
|
kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/policy.karmada.io_clusteroverridepolicies.yaml"
|
||||||
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/policy.karmada.io_replicaschedulingpolicies.yaml"
|
kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/policy.karmada.io_replicaschedulingpolicies.yaml"
|
||||||
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/work.karmada.io_works.yaml"
|
kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/work.karmada.io_works.yaml"
|
||||||
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/work.karmada.io_resourcebindings.yaml"
|
kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/work.karmada.io_resourcebindings.yaml"
|
||||||
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/work.karmada.io_clusterresourcebindings.yaml"
|
kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/work.karmada.io_clusterresourcebindings.yaml"
|
||||||
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/multicluster.x-k8s.io_serviceexports.yaml"
|
kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/multicluster.x-k8s.io_serviceexports.yaml"
|
||||||
kubectl apply -f "${REPO_ROOT}/artifacts/deploy/multicluster.x-k8s.io_serviceimports.yaml"
|
kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/multicluster.x-k8s.io_serviceimports.yaml"
|
||||||
}
|
}
|
||||||
|
|
||||||
# generate cert
|
# generate cert
|
||||||
|
|
|
@ -11,4 +11,5 @@ source hack/util.sh
|
||||||
|
|
||||||
echo "Generating with controller-gen"
|
echo "Generating with controller-gen"
|
||||||
util::install_tools ${CONTROLLER_GEN_PKG} ${CONTROLLER_GEN_VER} >/dev/null 2>&1
|
util::install_tools ${CONTROLLER_GEN_PKG} ${CONTROLLER_GEN_VER} >/dev/null 2>&1
|
||||||
controller-gen crd paths=./pkg/apis/... output:crd:dir=./artifacts/deploy
|
controller-gen crd paths=./pkg/apis/... output:crd:dir=./artifacts/crds/bases
|
||||||
|
controller-gen crd paths=./pkg/apis/... output:crd:dir=./charts/_crds
|
||||||
|
|
|
@ -6,8 +6,8 @@ set -o pipefail
|
||||||
|
|
||||||
SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
|
|
||||||
DIFFROOT="${SCRIPT_ROOT}/artifacts/deploy"
|
DIFFROOT="${SCRIPT_ROOT}/artifacts/crds/bases"
|
||||||
TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/artifacts/deploy"
|
TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/artifacts/crds/bases"
|
||||||
_tmp="${SCRIPT_ROOT}/_tmp"
|
_tmp="${SCRIPT_ROOT}/_tmp"
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
|
@ -17,12 +17,24 @@ trap "cleanup" EXIT SIGINT
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
|
ret=0
|
||||||
|
# check if crds in chart up to date.
|
||||||
|
CHART_CRD_PATH="${SCRIPT_ROOT}/charts/_crds"
|
||||||
|
diff -Naupr "${DIFFROOT}" "${CHART_CRD_PATH}" || ret=$?
|
||||||
|
if [[ $ret -eq 0 ]]
|
||||||
|
then
|
||||||
|
echo "${CHART_CRD_PATH} up to date."
|
||||||
|
else
|
||||||
|
echo "${CHART_CRD_PATH} is out of date. Please run hack/update-crdgen.sh"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p "${TMP_DIFFROOT}"
|
mkdir -p "${TMP_DIFFROOT}"
|
||||||
cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}"
|
cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}"
|
||||||
|
|
||||||
bash "${SCRIPT_ROOT}/hack/update-crdgen.sh"
|
bash "${SCRIPT_ROOT}/hack/update-crdgen.sh"
|
||||||
echo "diffing ${DIFFROOT} against freshly generated files"
|
echo "diffing ${DIFFROOT} against freshly generated files"
|
||||||
ret=0
|
|
||||||
diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$?
|
diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$?
|
||||||
cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}"
|
cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}"
|
||||||
if [[ $ret -eq 0 ]]
|
if [[ $ret -eq 0 ]]
|
||||||
|
|
Loading…
Reference in New Issue