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

must-gather: add helper pod yaml with compatible secret for <4.6 #977

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 15 additions & 4 deletions must-gather/collection-scripts/gather_ceph_resources
Expand Up @@ -11,15 +11,21 @@ if [ "${BASE_COLLECTION_PATH}" = "" ]; then
fi

CEPH_COLLECTION_PATH="${BASE_COLLECTION_PATH}/ceph"
POD_TEMPLATE="/templates/pod.template"
POD_TEMPLATE_LATEST="/templates/pod.template.latest"
POD_TEMPLATE_STANDARD="/templates/pod.template.standard"

SED_DELIMITER=$(echo -en "\001");
safe_replace () {
sed "s${SED_DELIMITER}${1}${SED_DELIMITER}${2}${SED_DELIMITER}g"
}

apply_helper_pod() {
< ${POD_TEMPLATE} safe_replace "NAMESPACE" "$1" | safe_replace "IMAGE_NAME" "$2" | safe_replace "MUST_GATHER" "$HOSTNAME" > pod_helper.yaml
apply_standard_helper_pod() {
< ${POD_TEMPLATE_STANDARD} safe_replace "NAMESPACE" "$1" | safe_replace "IMAGE_NAME" "$2" | safe_replace "MUST_GATHER" "$HOSTNAME" > pod_helper.yaml
oc apply -f pod_helper.yaml
}

apply_latest_helper_pod() {
< ${POD_TEMPLATE_LATEST} safe_replace "NAMESPACE" "$1" | safe_replace "IMAGE_NAME" "$2" | safe_replace "MUST_GATHER" "$HOSTNAME" > pod_helper.yaml
oc apply -f pod_helper.yaml
}

Expand Down Expand Up @@ -107,7 +113,12 @@ for ns in $namespaces; do
if [ "${operatorImage}" = "" ]; then
echo "not able to find the rook's operator image. Skipping collection of ceph command output" | tee -a "${BASE_COLLECTION_PATH}"/gather-debug.log
elif [[ $cephClusterCount -gt 0 ]]; then
apply_helper_pod "$ns" "$operatorImage"
current_version=$(oc get csv -n "${ns}" --no-headers | awk '{print $5}' | tr -dc '0-9')
if [[ $current_version -ge 460 ]]; then
apply_latest_helper_pod "$ns" "$operatorImage"
else
apply_standard_helper_pod "$ns" "$operatorImage"
fi
fi

COMMAND_OUTPUT_DIR=${CEPH_COLLECTION_PATH}/must_gather_commands
Expand Down
File renamed without changes.
49 changes: 49 additions & 0 deletions must-gather/templates/pod.template.standard
@@ -0,0 +1,49 @@
apiVersion: v1
kind: Pod
metadata:
name: MUST_GATHER-helper
namespace: NAMESPACE
spec:
containers:
- args:
- -g
- --
- /usr/local/bin/toolbox.sh
command:
- /tini
env:
- name: ROOK_ADMIN_SECRET
valueFrom:
secretKeyRef:
key: admin-secret
name: rook-ceph-mon
image: IMAGE_NAME
imagePullPolicy: IfNotPresent
name: must-gather-helper
securityContext:
privileged: true
volumeMounts:
- mountPath: /dev
name: dev
- mountPath: /sys/bus
name: sysbus
- mountPath: /lib/modules
name: libmodules
- name: mon-endpoint-volume
mountPath: /etc/rook
volumes:
- name: dev
hostPath:
path: /dev
- name: sysbus
hostPath:
path: /sys/bus
- name: libmodules
hostPath:
path: /lib/modules
- name: mon-endpoint-volume
configMap:
name: rook-ceph-mon-endpoints
items:
- key: data
path: mon-endpoints