-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enhance must-gather script to dynamically capture operator details
Signed-off-by: Vibhu Prashar <vibhu.sharma2929@gmail.com>
- Loading branch information
1 parent
24a1a2b
commit a3dbeba
Showing
6 changed files
with
137 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#!/usr/bin/env bash | ||
|
||
# copyright 2023. | ||
# | ||
# 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. | ||
# | ||
|
||
set -eu -o pipefail | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
source "${SCRIPT_DIR}/common" | ||
|
||
BASE_COLLECTION_PATH=$1 | ||
OPERATOR_DEPLOY_NAME="kepler-operator-controller" | ||
|
||
get_catalogsource() { | ||
log "getting catalogsource info for $OPERATOR" | ||
run oc -n "$OPERATOR_NS" get catalogsource "$OPERATOR-catalog" -oyaml "$KEPLER_OPERATOR_INFO_DIR/$OPERATOR-catalogsource.yaml" | ||
} | ||
|
||
get_subscription() { | ||
log "getting subscription info for $OPERATOR" | ||
run oc -n "$OPERATOR_NS" get subscription -l operators.coreos.com/"$OPERATOR"."$OPERATOR_NS"= -oyaml "$KEPLER_OPERATOR_INFO_DIR/$OPERATOR-subscription.yaml" | ||
} | ||
|
||
get_install_plan() { | ||
log "getting installplan info for $OPERATOR" | ||
run oc -n "$OPERATOR_NS" get installplan -l operators.coreos.com/"$OPERATOR"."$OPERATOR_NS"= -oyaml "$KEPLER_OPERATOR_INFO_DIR/$OPERATOR-installplan.yaml" | ||
} | ||
|
||
get_csv() { | ||
log "getting CSV for $OPERATOR" | ||
run oc -n "$OPERATOR_NS" get csv -l operators.coreos.com/"$OPERATOR"."$OPERATOR_NS"= -oyaml "$KEPLER_OPERATOR_INFO_DIR/$OPERATOR-csv.yaml" | ||
} | ||
|
||
get_kepler_operator_deployment_info() { | ||
log "getting deployment info for $OPERATOR" | ||
run oc -n "$OPERATOR_NS" get deployment "$OPERATOR_DEPLOY_NAME" -oyaml "$KEPLER_OPERATOR_INFO_DIR/$OPERATOR-deployment.yaml" | ||
} | ||
|
||
get_kepler_operator_pod_info() { | ||
log "getting pod info for $OPERATOR" | ||
run oc -n "$OPERATOR_NS" get pod \ | ||
-l app.kubernetes.io/component=manager \ | ||
-l app.kubernetes.io/part-of="kepler-operator" \ | ||
-oyaml "$KEPLER_OPERATOR_INFO_DIR/$OPERATOR.yaml" | ||
} | ||
|
||
get_summary() { | ||
run oc -n "$OPERATOR_NS" get catalogsource "$OPERATOR-catalog" -owide "$KEPLER_OPERATOR_INFO_DIR/summary.txt" | ||
echo -e "\n" >>"$KEPLER_OPERATOR_INFO_DIR/summary.txt" | ||
|
||
run oc -n "$OPERATOR_NS" get subscription -owide "$KEPLER_OPERATOR_INFO_DIR/summary.txt" | ||
echo -e "\n" >>"$KEPLER_OPERATOR_INFO_DIR/summary.txt" | ||
|
||
run oc -n "$OPERATOR_NS" get installplan -owide "$KEPLER_OPERATOR_INFO_DIR/summary.txt" | ||
echo -e "\n" >>"$KEPLER_OPERATOR_INFO_DIR/summary.txt" | ||
|
||
run oc -n "$OPERATOR_NS" get csv -owide "$KEPLER_OPERATOR_INFO_DIR/summary.txt" | ||
echo -e "\n" >>"$KEPLER_OPERATOR_INFO_DIR/summary.txt" | ||
|
||
run oc -n "$OPERATOR_NS" get deployment "$OPERATOR_DEPLOY_NAME" -owide "$KEPLER_OPERATOR_INFO_DIR/summary.txt" | ||
echo -e "\n" >>"$KEPLER_OPERATOR_INFO_DIR/summary.txt" | ||
|
||
run oc -n "$OPERATOR_NS" get pod \ | ||
-l app.kubernetes.io/component=manager \ | ||
-l app.kubernetes.io/part-of="kepler-operator" \ | ||
-owide "$KEPLER_OPERATOR_INFO_DIR/summary.txt" | ||
} | ||
|
||
main() { | ||
|
||
KEPLER_OPERATOR_INFO_DIR="$BASE_COLLECTION_PATH/$OPERATOR-info" | ||
mkdir -p "$KEPLER_OPERATOR_INFO_DIR" | ||
|
||
get_subscription | ||
get_catalogsource | ||
get_install_plan | ||
get_csv | ||
get_kepler_operator_deployment_info | ||
get_kepler_operator_pod_info | ||
get_summary | ||
} | ||
|
||
main "$@" |
Oops, something went wrong.