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

[minor] Add parameter to limit collection of some MAS instances #474

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
adding a parameter --mas-instance-ids to the must-gather command to specify one or more instances to collect data from.
when specified this only data from these instance will be collected along with data for Mongo and the cluster data.

this is to avoid collecting instance details for different customers in case of multi tennant environment.

when specified, only data from this/these instance(s) will be collected along with data for Mongo and the cluster data.
1 change: 1 addition & 0 deletions docs/commands/must-gather.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Usage
- `--no-pod-logs` Skip collection of pod logs, greatly speeds up must-gather collection time when pod logs are not required
- `--artifactory-token ARTIFACTORY_TOKEN` Provide a token for Artifactory to automatically upload the file to `ARTIFACTORY_UPLOAD_DIRECTORY`
- `--artifactory-upload-directory ARTIFACTORY_UPLOAD_DIRECTORY` Working URL to the root directory in Artifactory where the must-gather file should be uploaded
- `--mas-instance-ids` Collects the data for the specifed MAS instances, if not specified will collect for all MAS instances on the cluster

Content
-------------------------------------------------------------------------------
Expand Down
13 changes: 10 additions & 3 deletions image/cli/mascli/functions/must_gather
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Collection Options (Optional):
-k, --keep-files Do not delete individual files after creating the must-gather compressed tar archive
--summary-only Perform a much faster must-gather that only gathers high level summary of resources in the cluster
--no-pod-logs Skip collection of pod logs, greatly speeds up must-gather collection time when pod logs are not required
--mas-instance-ids Collects the data for the specifed MAS instances, if not specified will collect for all MAS instances on the cluster

Artifactory Upload (Optional):
--artifactory-token ${COLOR_YELLOW}ARTIFACTORY_TOKEN${TEXT_RESET} Provide a token for Artifactory to automatically upload the file to ARTIFACTORY_UPLOAD_DIR
Expand Down Expand Up @@ -55,6 +56,9 @@ function mustgather() {
--no-logs|--no-pod-logs)
POD_LOGS=false
;;
--mas-instance-ids)
MAS_INSTANCE_IDS=$1; shift
;;
--artifactory-token)
ARTIFACTORY_TOKEN=$1; shift
;;
Expand Down Expand Up @@ -151,10 +155,13 @@ function mustgather() {
$MG_SCRIPT_DIR/mg-collect-mongoce $MONGOCE_NAMESPACE $OUTPUT_DIR
done

if [[ -z $MAS_INSTANCE_IDS ]]
then
# Find MAS instances
# -----------------------------------------------------------------------------
MAS_INSTANCE_IDS=$(oc get suite --all-namespaces --ignore-not-found -o jsonpath='{.items[*].metadata.name}')
fi

# Find MAS instances
# -----------------------------------------------------------------------------
MAS_INSTANCE_IDS=$(oc get suite --all-namespaces --ignore-not-found -o jsonpath='{.items[*].metadata.name}')
echo ""
for MAS_INSTANCE_ID in $MAS_INSTANCE_IDS
do
Expand Down