Skip to content
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

Draft
wants to merge 17 commits into
base: develop
Choose a base branch
from

Conversation

matancarmeli7
Copy link
Contributor

This PR is also related to CSI-3315

@@ -3,1088 +3,1089 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor

@oriyarde oriyarde Oct 31, 2021

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

Copy link
Contributor Author

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

Copy link
Contributor

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]>
hack/get_yq.sh Outdated Show resolved Hide resolved
hack/get_yq.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@oriyarde oriyarde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
?

Signed-off-by: matancarmeli7 <[email protected]>
#

get_latest_csi_version (){
latest_csi_version=$(cat version/version.go | grep -i driverversion | awk -F = '{print $2}')
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes so I can do here like I did here and avoid code dup

Copy link
Contributor

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

Makefile Show resolved Hide resolved
Comment on lines 25 to 26
"ibm-block-csi-operator-community"
"ibm-block-csi-operator"
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

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]>
@@ -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: |-
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is "${0##*/}"

Copy link
Contributor

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?)

Comment on lines +24 to +25
yaml_file=$1
required_lables=$2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 (){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
merge_yamls (){
merge_yamls_into_first (){

?

Comment on lines +19 to +22
get_current_csi_version (){
current_csi_version=$(cat version/version.go | grep -i driverversion | awk -F = '{print $2}')
echo ${current_csi_version//\"}
}
Copy link
Contributor

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
Copy link
Contributor

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 (){
Copy link
Contributor

@oriyarde oriyarde Nov 7, 2021

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants