Skip to content

Commit 4e92eac

Browse files
author
Ivan Sim
committed
Fixed exec shell command used in 'restore'
The wildcard expansion needs to happen in the pod's shell. Signed-off-by: Ivan Sim <isim@redhat.com>
1 parent 4f074d7 commit 4e92eac

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,20 @@ plugin:
8282
rm "$(TARGET_PLUGINS_DIR)/kubectl-promdump$${extension}" && \
8383
shasum -a256 $(TARGET_PLUGINS_DIR)/kubectl-promdump-$(BUILD_OS)-$(BUILD_ARCH)-$(VERSION).tar.gz | awk '{print $$1}' > $(TARGET_PLUGINS_DIR)/kubectl-promdump-$(BUILD_OS)-$(BUILD_ARCH)-$(VERSION).tar.gz.sha256
8484

85-
.PHONY: test
86-
test/prometheus-repos:
85+
.PHONY: hack/prometheus-repos
86+
hack/prometheus-repos:
8787
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
8888
helm repo add kube-state-metrics https://kubernetes.github.io/kube-state-metrics
8989
helm repo update
9090

91-
test/prometheus:
91+
.PHONY: hack/prometheus
92+
hack/prometheus:
9293
helm install prometheus prometheus-community/prometheus
9394

9495
HACK_NAMESPACE ?= default
9596
HACK_DATA_DIR ?= /data
96-
.PHONY: hack
97+
98+
.PHONY: hack/deploy
9799
hack/deploy:
98100
pod="$$(kubectl get pods --namespace $(HACK_NAMESPACE) -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")" ;\
99101
kubectl -n "$(HACK_NAMESPACE)" cp -c prometheus-server "$(TARGET_BIN_DIR)/promdump" "$${pod}:$(HACK_DATA_DIR)" ;\

cli/cmd/restore.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ func runRestore(config *config.Config, clientset *k8s.Clientset) error {
5555
}
5656

5757
dataDir := config.GetString("data-dir")
58-
execCmd := []string{"rm", "-rf",
59-
fmt.Sprintf("%s/wal", dataDir),
60-
fmt.Sprintf("%s/chunks_head", dataDir),
61-
}
58+
execCmd := []string{"sh", "-c", fmt.Sprintf("rm -rf %s/*", dataDir)}
6259
if err := clientset.ExecPod(execCmd, os.Stdin, os.Stdout, os.Stderr, false); err != nil {
6360
return err
6461
}

0 commit comments

Comments
 (0)