Skip to content

Commit

Permalink
Fix k8s template link versioning
Browse files Browse the repository at this point in the history
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
  • Loading branch information
ChrsMark committed Oct 13, 2022
1 parent d5cfe6f commit d0f5f17
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
18 changes: 10 additions & 8 deletions deploy/kubernetes/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ALL=elastic-agent-standalone elastic-agent-managed
BEAT_VERSION=$(shell head -n 1 ../../version/docs/version.asciidoc | cut -c 17- )
BRANCH_VERSION=$(shell sed -n '2p' ../../version/docs/version.asciidoc | cut -c 14- )

#variables needed for ci-create-kubernetes-templates-pull-request
ELASTIC_AGENT_REPO=kibana
Expand All @@ -9,7 +10,7 @@ ELASTIC_AGENT_BRANCH=update-k8s-templates-$(shell date "+%Y%m%d%H%M%S")

.PHONY: generate-k8s $(ALL)
generate-k8s: $(ALL)

test: generate-k8s
for FILE in $(shell ls *-kubernetes.yaml); do \
BEAT=$$(echo $$FILE | cut -d \- -f 1); \
Expand All @@ -19,21 +20,21 @@ test: generate-k8s
clean:
@for f in $(ALL); do rm -f "$$f-kubernetes.yaml"; done

$(ALL):
$(ALL):
ifdef WITHOUTCONFIG
@echo "Generating $@-kubernetes-without-configmap.yaml"
@rm -f $@-kubernetes-without-configmap.yaml
@for f in $(shell ls $@/*.yaml | grep -v daemonset-configmap); do \
sed "s/%VERSION%/VERSION/g" $$f >> $@-kubernetes-without-configmap.yaml; \
sed -e "s/%VERSION%/VERSION/g" -e "s/%BRANCH%/${BRANCH_VERSION}/g" $$f >> $@-kubernetes-without-configmap.yaml; \
echo --- >> $@-kubernetes-without-configmap.yaml; \
done
else
@echo "Generating $@-kubernetes.yaml"
@rm -f $@-kubernetes.yaml
@echo "Generating $@-kubernetes.yaml"
@rm -f $@-kubernetes.yaml
@for f in $(shell ls $@/*.yaml); do \
sed "s/%VERSION%/${BEAT_VERSION}/g" $$f >> $@-kubernetes.yaml; \
sed -e "s/%VERSION%/${BEAT_VERSION}/g" -e "s/%BRANCH%/${BRANCH_VERSION}/g" $$f >> $@-kubernetes.yaml; \
echo --- >> $@-kubernetes.yaml; \
done
done
endif

CHDIR_SHELL := $(SHELL)
Expand All @@ -47,7 +48,7 @@ endef
ci-clone-kibana-repository:
git clone git@github.com:elastic/kibana.git
cp $(FILE_REPO) $(ELASTIC_AGENT_REPO)/$(ELASTIC_AGENT_REPO_PATH)

## ci-create-kubernetes-templates-pull-request : Create the pull request for the kubernetes templates
$(eval HASDIFF =$(shell sh -c "git status | grep $(FILE_REPO) | wc -l"))
.PHONY: ci-create-kubernetes-templates-pull-request
Expand Down Expand Up @@ -79,6 +80,7 @@ else
--head $(ELASTIC_AGENT_BRANCH) \
--reviewer elastic/obs-cloudnative-monitoring
endif

else
echo "No differences found with kibana git repository"
endif
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/elastic-agent-standalone-kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ spec:
# - -c
# - >-
# mkdir -p /etc/elastic-agent/inputs.d &&
# wget -O - https://github.com/elastic/elastic-agent/archive/8.3.0.tar.gz | tar xz -C /etc/elastic-agent/inputs.d --strip=5 "elastic-agent-main/deploy/kubernetes/elastic-agent-standalone/templates.d"
# wget -O - https://github.com/elastic/elastic-agent/archive/main.tar.gz | tar xz -C /etc/elastic-agent/inputs.d --strip=5 "elastic-agent-main/deploy/kubernetes/elastic-agent-standalone/templates.d"
# volumeMounts:
# - name: external-inputs
# mountPath: /etc/elastic-agent/inputs.d
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
# - -c
# - >-
# mkdir -p /etc/elastic-agent/inputs.d &&
# wget -O - https://github.com/elastic/elastic-agent/archive/%VERSION%.tar.gz | tar xz -C /etc/elastic-agent/inputs.d --strip=5 "elastic-agent-main/deploy/kubernetes/elastic-agent-standalone/templates.d"
# wget -O - https://github.com/elastic/elastic-agent/archive/%BRANCH%.tar.gz | tar xz -C /etc/elastic-agent/inputs.d --strip=5 "elastic-agent-main/deploy/kubernetes/elastic-agent-standalone/templates.d"
# volumeMounts:
# - name: external-inputs
# mountPath: /etc/elastic-agent/inputs.d
Expand Down

0 comments on commit d0f5f17

Please sign in to comment.