mirror of
https://github.com/sailor-sh/CK-X.git
synced 2026-02-14 09:29:53 +00:00
use exact match for sidecar container
This commit is contained in:
@@ -7,7 +7,7 @@ VOLUME_NAME=$(kubectl get pod multi-container-pod -n multi-container -o jsonpath
|
||||
if [[ "$VOLUME_NAME" == "log-volume" ]]; then
|
||||
# Volume exists, now check if it's mounted in both containers
|
||||
MAIN_CONTAINER_MOUNT=$(kubectl get pod multi-container-pod -n multi-container -o jsonpath='{.spec.containers[?(@.name=="main-container")].volumeMounts[?(@.name=="log-volume")]}' 2>/dev/null)
|
||||
SIDECAR_CONTAINER_MOUNT=$(kubectl get pod multi-container-pod -n multi-container -o jsonpath='{.spec.containers[?(@.name=="sidecar-container")].volumeMounts[?(@.name=="log-volume")]}' 2>/dev/null)
|
||||
SIDECAR_CONTAINER_MOUNT=$(kubectl get pod multi-container-pod -n multi-container -o jsonpath='{.spec.containers[?(@.name=="sidecar-container")].volumeMounts[?(@.name=="log-volume")].mountPath}' 2>/dev/null)
|
||||
|
||||
if [[ "$MAIN_CONTAINER_MOUNT" == *"/var/log"* && "$SIDECAR_CONTAINER_MOUNT" == "/var/log" ]]; then
|
||||
# Both containers have the volume mounted at the correct path
|
||||
|
||||
Reference in New Issue
Block a user