From 560d184ed358827358cbe849970d106d9f095d0b Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Mon, 25 Mar 2024 06:29:32 +0100 Subject: [PATCH] Fix defaultConfig regression The script condition failed if there were additional files. Adding an sample key and kuttl test to ensure there is no future regression. --- config/samples/swift_v1beta1_swift.yaml | 3 +++ templates/common/ring-sync.sh | 2 +- .../kuttl/tests/basic-deploy/01-assert-deploy-swift.yaml | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/config/samples/swift_v1beta1_swift.yaml b/config/samples/swift_v1beta1_swift.yaml index fb0a842d..2aeab31f 100644 --- a/config/samples/swift_v1beta1_swift.yaml +++ b/config/samples/swift_v1beta1_swift.yaml @@ -12,3 +12,6 @@ spec: replicas: 1 passwordSelectors: service: SwiftPassword + defaultConfigOverwrite: + 01-proxy-server.conf: | + # Additional proxy config diff --git a/templates/common/ring-sync.sh b/templates/common/ring-sync.sh index 28556588..11442186 100755 --- a/templates/common/ring-sync.sh +++ b/templates/common/ring-sync.sh @@ -15,7 +15,7 @@ for s in account-server \ object-server \ object-expirer \ proxy-server; do - if [ -e /var/lib/config-data/default/*${s}*.conf ]; then + if $(ls -1 /var/lib/config-data/default/ | grep -q "${s}"); then [ ! -d /etc/swift/${s}.conf.d ] && mkdir /etc/swift/${s}.conf.d cp -t /etc/swift/${s}.conf.d/ /var/lib/config-data/default/*${s}*.conf fi diff --git a/tests/kuttl/tests/basic-deploy/01-assert-deploy-swift.yaml b/tests/kuttl/tests/basic-deploy/01-assert-deploy-swift.yaml index 3816c4ea..71695105 100644 --- a/tests/kuttl/tests/basic-deploy/01-assert-deploy-swift.yaml +++ b/tests/kuttl/tests/basic-deploy/01-assert-deploy-swift.yaml @@ -141,3 +141,11 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert commands: - script: $SWIFT_KUTTL_DIR/../common/scripts/check_ring_rebalance_output.sh +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +commands: + - script: | + podname=$(oc get pod -n $NAMESPACE -l component=swift-proxy | grep Running | cut -f 1 -d " ") + files=$(oc rsh -n $NAMESPACE -c proxy-server "$podname" /bin/sh -c "ls -1 /etc/swift/proxy-server.conf.d/") + echo "$files" | grep -ze "00-proxy-server.conf.*01-proxy-server.conf"