diff --git a/artifacts/deploy/cluster.karmada.io_clusters.yaml b/artifacts/crds/bases/cluster.karmada.io_clusters.yaml similarity index 100% rename from artifacts/deploy/cluster.karmada.io_clusters.yaml rename to artifacts/crds/bases/cluster.karmada.io_clusters.yaml diff --git a/artifacts/deploy/multicluster.x-k8s.io_serviceexports.yaml b/artifacts/crds/bases/multicluster.x-k8s.io_serviceexports.yaml similarity index 100% rename from artifacts/deploy/multicluster.x-k8s.io_serviceexports.yaml rename to artifacts/crds/bases/multicluster.x-k8s.io_serviceexports.yaml diff --git a/artifacts/deploy/multicluster.x-k8s.io_serviceimports.yaml b/artifacts/crds/bases/multicluster.x-k8s.io_serviceimports.yaml similarity index 100% rename from artifacts/deploy/multicluster.x-k8s.io_serviceimports.yaml rename to artifacts/crds/bases/multicluster.x-k8s.io_serviceimports.yaml diff --git a/artifacts/deploy/policy.karmada.io_clusteroverridepolicies.yaml b/artifacts/crds/bases/policy.karmada.io_clusteroverridepolicies.yaml similarity index 100% rename from artifacts/deploy/policy.karmada.io_clusteroverridepolicies.yaml rename to artifacts/crds/bases/policy.karmada.io_clusteroverridepolicies.yaml diff --git a/artifacts/deploy/policy.karmada.io_clusterpropagationpolicies.yaml b/artifacts/crds/bases/policy.karmada.io_clusterpropagationpolicies.yaml similarity index 100% rename from artifacts/deploy/policy.karmada.io_clusterpropagationpolicies.yaml rename to artifacts/crds/bases/policy.karmada.io_clusterpropagationpolicies.yaml diff --git a/artifacts/deploy/policy.karmada.io_overridepolicies.yaml b/artifacts/crds/bases/policy.karmada.io_overridepolicies.yaml similarity index 100% rename from artifacts/deploy/policy.karmada.io_overridepolicies.yaml rename to artifacts/crds/bases/policy.karmada.io_overridepolicies.yaml diff --git a/artifacts/deploy/policy.karmada.io_propagationpolicies.yaml b/artifacts/crds/bases/policy.karmada.io_propagationpolicies.yaml similarity index 100% rename from artifacts/deploy/policy.karmada.io_propagationpolicies.yaml rename to artifacts/crds/bases/policy.karmada.io_propagationpolicies.yaml diff --git a/artifacts/deploy/policy.karmada.io_replicaschedulingpolicies.yaml b/artifacts/crds/bases/policy.karmada.io_replicaschedulingpolicies.yaml similarity index 100% rename from artifacts/deploy/policy.karmada.io_replicaschedulingpolicies.yaml rename to artifacts/crds/bases/policy.karmada.io_replicaschedulingpolicies.yaml diff --git a/artifacts/deploy/work.karmada.io_clusterresourcebindings.yaml b/artifacts/crds/bases/work.karmada.io_clusterresourcebindings.yaml similarity index 100% rename from artifacts/deploy/work.karmada.io_clusterresourcebindings.yaml rename to artifacts/crds/bases/work.karmada.io_clusterresourcebindings.yaml diff --git a/artifacts/deploy/work.karmada.io_resourcebindings.yaml b/artifacts/crds/bases/work.karmada.io_resourcebindings.yaml similarity index 100% rename from artifacts/deploy/work.karmada.io_resourcebindings.yaml rename to artifacts/crds/bases/work.karmada.io_resourcebindings.yaml diff --git a/artifacts/deploy/work.karmada.io_works.yaml b/artifacts/crds/bases/work.karmada.io_works.yaml similarity index 100% rename from artifacts/deploy/work.karmada.io_works.yaml rename to artifacts/crds/bases/work.karmada.io_works.yaml diff --git a/hack/deploy-karmada.sh b/hack/deploy-karmada.sh index 82d449c0c..4cce3d1d4 100755 --- a/hack/deploy-karmada.sh +++ b/hack/deploy-karmada.sh @@ -103,17 +103,17 @@ function generate_cert_secret { # install Karmada's APIs function installCRDs() { 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/deploy/policy.karmada.io_propagationpolicies.yaml" - kubectl apply -f "${REPO_ROOT}/artifacts/deploy/policy.karmada.io_clusterpropagationpolicies.yaml" - kubectl apply -f "${REPO_ROOT}/artifacts/deploy/policy.karmada.io_overridepolicies.yaml" - kubectl apply -f "${REPO_ROOT}/artifacts/deploy/policy.karmada.io_clusteroverridepolicies.yaml" - kubectl apply -f "${REPO_ROOT}/artifacts/deploy/policy.karmada.io_replicaschedulingpolicies.yaml" - kubectl apply -f "${REPO_ROOT}/artifacts/deploy/work.karmada.io_works.yaml" - kubectl apply -f "${REPO_ROOT}/artifacts/deploy/work.karmada.io_resourcebindings.yaml" - kubectl apply -f "${REPO_ROOT}/artifacts/deploy/work.karmada.io_clusterresourcebindings.yaml" - kubectl apply -f "${REPO_ROOT}/artifacts/deploy/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/cluster.karmada.io_clusters.yaml" + kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/policy.karmada.io_propagationpolicies.yaml" + kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/policy.karmada.io_clusterpropagationpolicies.yaml" + kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/policy.karmada.io_overridepolicies.yaml" + kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/policy.karmada.io_clusteroverridepolicies.yaml" + kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/policy.karmada.io_replicaschedulingpolicies.yaml" + kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/work.karmada.io_works.yaml" + kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/work.karmada.io_resourcebindings.yaml" + kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/work.karmada.io_clusterresourcebindings.yaml" + kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/multicluster.x-k8s.io_serviceexports.yaml" + kubectl apply -f "${REPO_ROOT}/artifacts/crds/bases/multicluster.x-k8s.io_serviceimports.yaml" } # generate cert diff --git a/hack/update-crdgen.sh b/hack/update-crdgen.sh index c77317f88..b9754ebbe 100755 --- a/hack/update-crdgen.sh +++ b/hack/update-crdgen.sh @@ -11,4 +11,5 @@ source hack/util.sh echo "Generating with controller-gen" 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 diff --git a/hack/verify-crdgen.sh b/hack/verify-crdgen.sh index cadde00b8..2a2777008 100755 --- a/hack/verify-crdgen.sh +++ b/hack/verify-crdgen.sh @@ -6,8 +6,8 @@ set -o pipefail SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. -DIFFROOT="${SCRIPT_ROOT}/artifacts/deploy" -TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/artifacts/deploy" +DIFFROOT="${SCRIPT_ROOT}/artifacts/crds/bases" +TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/artifacts/crds/bases" _tmp="${SCRIPT_ROOT}/_tmp" cleanup() { @@ -17,12 +17,24 @@ trap "cleanup" EXIT SIGINT 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}" cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}" bash "${SCRIPT_ROOT}/hack/update-crdgen.sh" echo "diffing ${DIFFROOT} against freshly generated files" -ret=0 + diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$? cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}" if [[ $ret -eq 0 ]]