-
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.
POWERMON-199: fix gather power-monitoring-operator info (#353)
Signed-off-by: Vimal Kumar <vimal78@gmail.com>
- Loading branch information
Showing
3 changed files
with
124 additions
and
6 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 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,98 @@ | ||
#!/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 | ||
|
||
KEPLER_OPERATOR_NS="openshift-operators" | ||
|
||
get_catalogsource() { | ||
log "getting catalogsource info for kepler-operator" | ||
run oc -n "$KEPLER_OPERATOR_NS" get catalogsource kepler-operator-catalog -oyaml "$POWER_MONITORING_OPERATOR_INFO_DIR/kepler-operator-catalogsource.yaml" | ||
} | ||
|
||
get_subscription() { | ||
log "getting subscription info for power-monitoring-operator" | ||
run oc -n "$KEPLER_OPERATOR_NS" get subscription -l operators.coreos.com/power-monitoring-operator.openshift-operators= -oyaml "$POWER_MONITORING_OPERATOR_INFO_DIR/power-monitoring-operator-subscription.yaml" | ||
} | ||
|
||
get_install_plan() { | ||
log "getting installplan info for power-monitoring-operator" | ||
run oc -n "$KEPLER_OPERATOR_NS" get installplan -l operators.coreos.com/power-monitoring-operator.openshift-operators= -oyaml "$POWER_MONITORING_OPERATOR_INFO_DIR/kepler-operator-installplan.yaml" | ||
} | ||
|
||
get_csv() { | ||
log "getting CSV for power-monitoring-operator" | ||
run oc -n "$KEPLER_OPERATOR_NS" get csv -l operators.coreos.com/power-monitoring-operator.openshift-operators= -oyaml "$POWER_MONITORING_OPERATOR_INFO_DIR/power-monitoring-operator-csv.yaml" | ||
} | ||
|
||
get_kepler_operator_deployment_info() { | ||
KEPLER_OPERATOR_DEPLOY="kepler-operator-controller" | ||
log "getting deployment info for kepler-operator" | ||
run oc -n "$KEPLER_OPERATOR_NS" get deployment "$KEPLER_OPERATOR_DEPLOY" -oyaml "$POWER_MONITORING_OPERATOR_INFO_DIR/kepler-operator-deployment.yaml" | ||
} | ||
|
||
get_kepler_operator_pod_info() { | ||
log "getting pod info for kepler-operator" | ||
run oc -n "$KEPLER_OPERATOR_NS" get pod \ | ||
-l app.kubernetes.io/component=manager \ | ||
-l app.kubernetes.io/part-of=kepler-operator \ | ||
-oyaml "$POWER_MONITORING_OPERATOR_INFO_DIR/kepler-operator.yaml" | ||
} | ||
|
||
get_summary() { | ||
run oc -n "$KEPLER_OPERATOR_NS" get catalogsource kepler-operator-catalog -owide "$POWER_MONITORING_OPERATOR_INFO_DIR/summary.txt" | ||
echo -e "\n" >>"$POWER_MONITORING_OPERATOR_INFO_DIR/summary.txt" | ||
|
||
run oc -n "$KEPLER_OPERATOR_NS" get subscription -owide "$POWER_MONITORING_OPERATOR_INFO_DIR/summary.txt" | ||
echo -e "\n" >>"$POWER_MONITORING_OPERATOR_INFO_DIR/summary.txt" | ||
|
||
run oc -n "$KEPLER_OPERATOR_NS" get installplan -owide "$POWER_MONITORING_OPERATOR_INFO_DIR/summary.txt" | ||
echo -e "\n" >>"$POWER_MONITORING_OPERATOR_INFO_DIR/summary.txt" | ||
|
||
run oc -n "$KEPLER_OPERATOR_NS" get csv -owide "$POWER_MONITORING_OPERATOR_INFO_DIR/summary.txt" | ||
echo -e "\n" >>"$POWER_MONITORING_OPERATOR_INFO_DIR/summary.txt" | ||
|
||
KEPLER_OPERATOR_DEPLOY="kepler-operator-controller" | ||
run oc -n "$KEPLER_OPERATOR_NS" get deployment "$KEPLER_OPERATOR_DEPLOY" -owide "$POWER_MONITORING_OPERATOR_INFO_DIR/summary.txt" | ||
echo -e "\n" >>"$POWER_MONITORING_OPERATOR_INFO_DIR/summary.txt" | ||
|
||
run oc -n "$KEPLER_OPERATOR_NS" get pod \ | ||
-l app.kubernetes.io/component=manager \ | ||
-l app.kubernetes.io/part-of=kepler-operator \ | ||
-owide "$POWER_MONITORING_OPERATOR_INFO_DIR/summary.txt" | ||
} | ||
|
||
main() { | ||
|
||
POWER_MONITORING_OPERATOR_INFO_DIR="$BASE_COLLECTION_PATH/power-monitoring-operator-info" | ||
mkdir -p "$POWER_MONITORING_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 "$@" |