Skip to content

Commit

Permalink
chore: add CheCluster v2
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha committed Mar 17, 2022
1 parent 58f3f01 commit 2e3741b
Show file tree
Hide file tree
Showing 36 changed files with 5,872 additions and 623 deletions.
8 changes: 1 addition & 7 deletions .github/bin/check-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,10 @@ checkCRDs() {

# files to check
local checluster_CRD_V1="config/crd/bases/org_v1_che_crd.yaml"
local chebackupserverconfiguration_CRD_V1="config/crd/bases/org.eclipse.che_chebackupserverconfigurations_crd.yaml"
local checlusterbackup_CRD_V1="config/crd/bases/org.eclipse.che_checlusterbackups_crd.yaml"
local checlusterrestore_CRD_V1="config/crd/bases/org.eclipse.che_checlusterrestores_crd.yaml"

changedFiles=($(cd ${ROOT_PROJECT_DIR}; git diff --name-only))
# Check if there are any difference in the crds. If yes, then fail check.
if [[ " ${changedFiles[*]} " =~ $checluster_CRD_V1 ]] || \
[[ " ${changedFiles[*]} " =~ $chebackupserverconfiguration_CRD_V1 ]] || \
[[ " ${changedFiles[*]} " =~ $checlusterbackup_CRD_V1 ]] || \
[[ " ${changedFiles[*]} " =~ $checlusterrestore_CRD_V1 ]]
if [[ " ${changedFiles[*]} " =~ $checluster_CRD_V1 ]]
then
echo "[ERROR] CRD file is not up to date: ${BASH_REMATCH}"
echo "[ERROR] Run 'make update-resources -s' to regenerate CRD files."
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ manifests: controller-gen add-license-download ## Generate WebhookConfiguration,
rm -rf "$(ECLIPSE_CHE_CRD_V1).bak"

# remove v1alphav2 version from crd files
yq -rYi "del(.spec.versions[1])" "$(ECLIPSE_CHE_CRD_V1)"
yq -rYi "del(.spec.versions[2])" "$(ECLIPSE_CHE_CRD_V1)"

$(MAKE) add-license $$(find ./config/crd -not -path "./vendor/*" -name "*.yaml")

Expand Down Expand Up @@ -502,9 +502,8 @@ bundle: generate manifests kustomize ## Generate bundle manifests and metadata,
# Example such annotation: +operator-sdk:csv:customresourcedefinitions:order=0
# Let's copy this sorted CRDs to the bundle cluster service version file.
BASE_CSV="config/manifests/bases/che-operator.clusterserviceversion.yaml"
CRD_API=$$(yq -c '.spec.customresourcedefinitions.owned' $${BASE_CSV})
CRD_API=$$(yq '.spec.customresourcedefinitions.owned' $${BASE_CSV} | yq -r 'del(.[] | select(.version == "v2alpha1"))')
yq -riSY ".spec.customresourcedefinitions.owned = $$CRD_API" "$${NEW_CSV}"
yq -riSY "del(.spec.customresourcedefinitions.owned[] | select(.version == \"v2alpha1\"))" "$${NEW_CSV}"

# Format code.
yq -rY "." "$${NEW_CSV}" > "$${NEW_CSV}.old"
Expand Down
11 changes: 11 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,15 @@ resources:
kind: CheCluster
path: github.com/eclipse-che/che-operator/api/v2alpha1
version: v2alpha1
- api:
crdVersion: v1
namespaced: true
domain: eclipse.che
group: org
kind: CheCluster
path: github.com/eclipse-che/che-operator/api/v2
version: v2
webhooks:
conversion: true
webhookVersion: v1
version: "3"
Loading

0 comments on commit 2e3741b

Please sign in to comment.