-
Notifications
You must be signed in to change notification settings - Fork 29
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
Do not redefine the global $resources variable #23
Conversation
9e03265
to
ed2249d
Compare
collection-scripts/gather_crds
Outdated
for resource in "${resources[@]}"; do | ||
run_bg /usr/bin/oc adm inspect --dest-dir must-gather "${resource}" | ||
for resource in "${crds[@]}"; do | ||
run_bg /usr/bin/oc get crd "$resource" > "${BASE_COLLECTION_PATH}/crd/${resource}.yaml" |
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.
-1: I don't think this is not going to output the yaml like we want should be oc get crd "$resource" -o yaml
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.
Makes sense, updating it!
collection-scripts/gather_crs
Outdated
while read -r ocresource; do | ||
ocobject=$(echo "$ocresource" | awk '{print $1}') | ||
ocproject=$(echo "$ocresource" | awk '{print $2}') | ||
if [ -z "${ocproject}" ]||[ "${ocproject}" == "<none>" ]; then | ||
object_collection_path=${BASE_COLLECTION_PATH}/cluster-scoped-resources/${resource} | ||
if [ -n "${ocproject}" ]||[ "${ocproject}" != "<none>" ]; 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.
-1: This should not be an or (||
) but an and (&&
)
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.
right, not sure why I have this leftover here, but yes, when I change -z to -n I intended to change the and
condition as well! Updating it!
This patch fixes in the first place the usage of the "resources" variable. The purpose of this variable is to define a set of k8s related services that should be collected for each namespace; for this reason it's defined in common.sh and exported, so it can be used in any script that is sourced by "gather_run". Instead of using the same "$resources" variable that is used a lot in the collection-scripts, this change customizes the variable name used to collect CR(s) and apiservices, and it avoids collisions with other 'get_resources' happening in other namespaces. In addition, this patch fixes the way CRD(s) are collected: they are global and shouldn't be collected "per namespace", hence they're now collected within the "crd/" folder created in the root must-gather directory. Signed-off-by: Francesco Pantano <[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.
/lgtm
This patch fixes in the first place the usage of the
resources
variable.The purpose of this variable is to define a set of
k8s
related servicesthat should be collected for each
namespace
; for this reason it'sdefined in
common.sh
and exported, so it can be used in any scriptthat is sourced by
gather_run
.Instead of using the same
$resources
variable that is used a lot in thecollection-scripts, this change customizes the variable name used to collect
CR(s)
andapiservices
, and it avoids collisions with otherget_resources
happening in other
namespaces
.In addition, this patch fixes the way
CRD(s)
are collected: they are globaland shouldn't be collected
per-namespace
, hence they're now collectedwithin the
crd/
folder created in the rootmust-gather
directory.