-
Notifications
You must be signed in to change notification settings - Fork 16
Task/csi 3503 add verification scrips only #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 4 commits
626d54e
afcb83e
1dbf067
4842511
9a306b8
a511e92
368a389
97ed4dd
5f63716
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ WORKDIR $WORKDIR | |
COPY Makefile . | ||
|
||
RUN go get github.com/onsi/ginkgo/[email protected] \ | ||
&& go get github.com/mikefarah/yq/v4 \ | ||
&& make kustomize \ | ||
&& make controller-gen | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,72 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
#!/bin/bash -e | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
# | ||||||||||||||||||||||||||||||||||||||||||||||
# Copyright 2019 IBM Corp. | ||||||||||||||||||||||||||||||||||||||||||||||
# | ||||||||||||||||||||||||||||||||||||||||||||||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||||||||||||||||||||
# you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||||||||||||||||||||
# You may obtain a copy of the License at | ||||||||||||||||||||||||||||||||||||||||||||||
# | ||||||||||||||||||||||||||||||||||||||||||||||
# http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||||||||||||||||||||
# | ||||||||||||||||||||||||||||||||||||||||||||||
# Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||||||||||||||||||||
# distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||||||||||||||||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||||||||||||||||||||
# See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||||||||||||||||||||
# limitations under the License. | ||||||||||||||||||||||||||||||||||||||||||||||
# | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
source hack/project_info.sh | ||||||||||||||||||||||||||||||||||||||||||||||
roles_yaml_path=config/rbac/role.yaml | ||||||||||||||||||||||||||||||||||||||||||||||
origin_crd_yaml_path=config/crd/bases/csi.ibm.com_ibmblockcsis.yaml | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
check_generation (){ | ||||||||||||||||||||||||||||||||||||||||||||||
echo "check generation" | ||||||||||||||||||||||||||||||||||||||||||||||
project_dirname=ibm-block-csi-operator | ||||||||||||||||||||||||||||||||||||||||||||||
cd .. | ||||||||||||||||||||||||||||||||||||||||||||||
cp -r $project_dirname ./$project_dirname-expected | ||||||||||||||||||||||||||||||||||||||||||||||
cd $project_dirname-expected/ | ||||||||||||||||||||||||||||||||||||||||||||||
make update | ||||||||||||||||||||||||||||||||||||||||||||||
cd .. | ||||||||||||||||||||||||||||||||||||||||||||||
diff -qr --exclude=bin $project_dirname $project_dirname-expected/ | ||||||||||||||||||||||||||||||||||||||||||||||
rm -rf $project_dirname-expected/ | ||||||||||||||||||||||||||||||||||||||||||||||
cd $project_dirname | ||||||||||||||||||||||||||||||||||||||||||||||
ArbelNathan marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+23
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
would this work? less |
||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
verify_full_operator_yaml_is_aligned(){ | ||||||||||||||||||||||||||||||||||||||||||||||
echo "check full operator yaml alignment" | ||||||||||||||||||||||||||||||||||||||||||||||
declare -A yaml_kinds_by_origin_yaml_path=( | ||||||||||||||||||||||||||||||||||||||||||||||
["config/rbac/role.yaml"]="ClusterRole" | ||||||||||||||||||||||||||||||||||||||||||||||
["config/crd/bases/csi.ibm.com_ibmblockcsis.yaml"]="CustomResourceDefinition" | ||||||||||||||||||||||||||||||||||||||||||||||
oriyarde marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||
["config/rbac/service_account.yaml"]="ServiceAccount" | ||||||||||||||||||||||||||||||||||||||||||||||
["config/rbac/role_binding.yaml"]="ClusterRoleBinding" | ||||||||||||||||||||||||||||||||||||||||||||||
["config/manager/manager.yaml"]="Deployment" | ||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||
for orignial_yaml in ${!yaml_kinds_by_origin_yaml_path[@]}; do | ||||||||||||||||||||||||||||||||||||||||||||||
export resource_type=${yaml_kinds_by_origin_yaml_path[${orignial_yaml}]} | ||||||||||||||||||||||||||||||||||||||||||||||
diff <(yq e '... comments=""' $orignial_yaml) <(yq eval '(. | select(.kind == env(resource_type)))' $operator_yaml_path) | ||||||||||||||||||||||||||||||||||||||||||||||
done | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
verify_no_roles_diff (){ | ||||||||||||||||||||||||||||||||||||||||||||||
echo "check roles alignment" | ||||||||||||||||||||||||||||||||||||||||||||||
are_manifest_files_exsists_in_current_csi_version | ||||||||||||||||||||||||||||||||||||||||||||||
csv_files=$(get_csv_files) | ||||||||||||||||||||||||||||||||||||||||||||||
for csv_file in $csv_files; do | ||||||||||||||||||||||||||||||||||||||||||||||
diff <(yq e .rules $roles_yaml_path) <(yq e .spec.install.spec.clusterPermissions[0].rules $csv_file) | ||||||||||||||||||||||||||||||||||||||||||||||
done | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
verify_no_crds_diff (){ | ||||||||||||||||||||||||||||||||||||||||||||||
echo "check crds alignment" | ||||||||||||||||||||||||||||||||||||||||||||||
are_manifest_files_exsists_in_current_csi_version | ||||||||||||||||||||||||||||||||||||||||||||||
crd_files=$(get_bundle_crds) | ||||||||||||||||||||||||||||||||||||||||||||||
for crd_file in $crd_files; do | ||||||||||||||||||||||||||||||||||||||||||||||
diff $origin_crd_yaml_path $crd_file | ||||||||||||||||||||||||||||||||||||||||||||||
done | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
check_generation | ||||||||||||||||||||||||||||||||||||||||||||||
verify_full_operator_yaml_is_aligned | ||||||||||||||||||||||||||||||||||||||||||||||
verify_no_roles_diff | ||||||||||||||||||||||||||||||||||||||||||||||
verify_no_crds_diff |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash -e | ||
|
||
# | ||
# Copyright 2019 IBM Corp. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
operator_yaml_path=deploy/installer/generated/ibm-block-csi-operator.yaml | ||
|
||
get_current_csi_version (){ | ||
current_csi_version=$(cat version/version.go | grep -i driverversion | awk -F = '{print $2}') | ||
echo ${current_csi_version//\"} | ||
} | ||
|
||
are_manifest_files_exsists_in_current_csi_version (){ | ||
oriyarde marked this conversation as resolved.
Show resolved
Hide resolved
|
||
current_csi_version=$(get_current_csi_version) | ||
if ! compgen -G "${PWD}/deploy/olm-catalog/*/$current_csi_version" > /dev/null; then | ||
exit 0 | ||
fi | ||
} | ||
|
||
get_csv_files (){ | ||
current_csi_version=$(get_current_csi_version) | ||
ls deploy/olm-catalog/*/$current_csi_version/manifests/ibm-block-csi-operator.v$current_csi_version.clusterserviceversion.yaml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please avoid wildcards There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still see the wildcard.
oriyarde marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
get_bundle_crds (){ | ||
current_csi_version=$(get_current_csi_version) | ||
oriyarde marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ls deploy/olm-catalog/*/$current_csi_version/manifests/csi.ibm.com_ibmblockcsis.yaml | ||
} |
Uh oh!
There was an error while loading. Please reload this page.