-
Notifications
You must be signed in to change notification settings - Fork 16
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
Task/csi 3417 add full generation for roles editing #220
base: develop
Are you sure you want to change the base?
Task/csi 3417 add full generation for roles editing #220
Conversation
Signed-off-by: matancarmeli7 <[email protected]>
Signed-off-by: matancarmeli7 <[email protected]>
Signed-off-by: matancarmeli7 <[email protected]>
Signed-off-by: matancarmeli7 <[email protected]>
Signed-off-by: matancarmeli7 <[email protected]>
Signed-off-by: matancarmeli7 <[email protected]>
Signed-off-by: matancarmeli7 <[email protected]>
Signed-off-by: matancarmeli7 <[email protected]>
Signed-off-by: matancarmeli7 <[email protected]>
Signed-off-by: matancarmeli7 <[email protected]>
@@ -3,1088 +3,1089 @@ kind: CustomResourceDefinition | |||
metadata: | |||
annotations: | |||
controller-gen.kubebuilder.io/version: v0.4.1 | |||
creationTimestamp: null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the deal here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it relates that I changed the labels generation I guess, I don't think that it has any impact
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean because it was merged with kustomize and now it is merged with yq?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does yq even know about the creationTimestamp
field?
yq is not related to k8s, unlike operator-sdk/kustomize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because yq doesn't remove it and I think customize does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then sounds like customize is better
Signed-off-by: matancarmeli7 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: matancarmeli7 <[email protected]>
hack/update-roles-in-csv.sh
Outdated
# | ||
|
||
get_latest_csi_version (){ | ||
latest_csi_version=$(cat version/version.go | grep -i driverversion | awk -F = '{print $2}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
potential code dup detected with #157
please put it in a common place in both PRs, so we could at least keep track of the duplications using file and dir paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I follow, but ok
hack/update-roles-in-csv.sh
Outdated
"ibm-block-csi-operator-community" | ||
"ibm-block-csi-operator" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already maintain the bundle names, please move them to a common place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mean that wildcard is better. I meant that we should maintain explicit "consts"/list of the bundle names/paths in one common place
Signed-off-by: matancarmeli7 <[email protected]>
Signed-off-by: matancarmeli7 <[email protected]>
Signed-off-by: matancarmeli7 <[email protected]>
Signed-off-by: matancarmeli7 <[email protected]>
@@ -16,7 +16,7 @@ metadata: | |||
description: "Run IBM block storage CSI driver." | |||
repository: https://github.com/IBM/ibm-block-csi-operator | |||
support: IBM | |||
alm-examples: >- | |||
alm-examples: |- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this file changed manually or automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is manually
align_crds | ||
} | ||
|
||
if [[ "${0##*/}" == "update-yamls-with-the-same-content.sh" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is "${0##*/}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(any chance to make it English?)
yaml_file=$1 | ||
required_lables=$2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yaml_file=$1 | |
required_lables=$2 | |
target_yaml_path=$1 | |
lables_yaml_path=$2 |
["config/rbac/role.yaml"]="config/rbac/patches/role_labels_patch.yaml" | ||
["config/crd/bases/csi.ibm.com_ibmblockcsis.yaml"]="config/crd/patches/labels_patch.yaml" | ||
) | ||
merge_yamls (){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge_yamls (){ | |
merge_yamls_into_first (){ |
?
get_current_csi_version (){ | ||
current_csi_version=$(cat version/version.go | grep -i driverversion | awk -F = '{print $2}') | ||
echo ${current_csi_version//\"} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this a common function with other files?
@@ -0,0 +1,67 @@ | |||
#!/bin/bash -e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update-yamls-with-the-same-content.sh
is long. how about:
sync-common-yaml-contents.sh
echo ${current_csi_version//\"} | ||
} | ||
|
||
are_csv_files_exsists_in_current_csi_version (){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exist*
I would also use for
instead of in
csv_files=$(get_csv_files) | ||
for csv_file in $csv_files | ||
do | ||
yq eval-all 'select(fileIndex==0).spec.install.spec.clusterPermissions[0].rules = select(fileIndex==1).rules | select(fi==0)' $csv_file config/rbac/role.yaml -i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is too long
are_csv_files_exsists_in_current_csi_version (){ | ||
current_csi_version=$(get_current_csi_version) | ||
if ! compgen -G "${PWD}/deploy/olm-catalog/*/$current_csi_version" > /dev/null; then | ||
exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the function name implies it is a boolean function, but this line shows that the function is not boolean.
please change this function to be boolean
} | ||
|
||
align_roles (){ | ||
are_csv_files_exsists_in_current_csi_version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function call seems to be duplicated. please move it outside
This PR is also related to CSI-3315