forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch K8s tests to Wolfi by default and make it configurable (elasti…
…c#41222) By default we test Wolfi-based images but there is now an environment variable `IMAGE_MODIFIER` that can be used for specifying different image prefixes when calling the make target. Also, now the test verifies the actual container readiness and deletes resources after itself.
- Loading branch information
Showing
9 changed files
with
19 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,33 @@ | ||
ALL=filebeat metricbeat auditbeat heartbeat | ||
IMAGE_MODIFIER?="-wolfi" | ||
BEAT_VERSION=$(shell head -n 1 ../../libbeat/docs/version.asciidoc | cut -c 17- ) | ||
|
||
.PHONY: all $(ALL) | ||
|
||
all: $(ALL) | ||
|
||
test: all | ||
for FILE in $(shell ls *-kubernetes.yaml); do \ | ||
BEAT=$$(echo $$FILE | cut -d \- -f 1); \ | ||
@for BEAT in $(ALL); do \ | ||
echo; \ | ||
echo "$$BEAT"; \ | ||
FILE="$$BEAT-kubernetes.yaml"; \ | ||
kubectl create -f $$FILE; \ | ||
echo "Testing $$BEAT container for readiness..."; \ | ||
kubectl wait pods -n kube-system -l k8s-app=$$BEAT --for=condition=Ready --timeout=90s; \ | ||
echo "Deleting $$BEAT..."; \ | ||
kubectl delete -f $$FILE; \ | ||
done | ||
|
||
clean: | ||
@for f in $(ALL); do rm -f "$$f-kubernetes.yaml"; done | ||
|
||
$(ALL): | ||
@echo "Generating $@-kubernetes.yaml" | ||
@echo "Generating $@-kubernetes.yaml for version ${BEAT_VERSION} and image modifier '${IMAGE_MODIFIER}'" | ||
@rm -f $@-kubernetes.yaml | ||
@for f in service-account role role-binding configmap deployment daemonset ; do \ | ||
if [ -f "$@/$@-$$f.yaml" ]; then \ | ||
echo "file: $@/$@-$$f.yaml"; \ | ||
sed "s/%VERSION%/${BEAT_VERSION}/g" $@/$@-$$f.yaml >> $@-kubernetes.yaml; \ | ||
cat $@/$@-$$f.yaml | sed "s/%VERSION%/${BEAT_VERSION}/g" | sed "s/%IMAGE_MODIFIER%/${IMAGE_MODIFIER}/g" >> $@-kubernetes.yaml; \ | ||
echo --- >> $@-kubernetes.yaml; \ | ||
fi \ | ||
done |
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
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
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