WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 301d093

Browse files
committed
fix: apply* Makefile targets receive Kubeconfig location directly
Makefile targets read env vars slightly differently than we might set them on the outside. The issue is that the targets run in an own shell session.
1 parent b1f7ba5 commit 301d093

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kubernetes/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ apply-namespaces: ## Apply all namespaces defined in YAML files (of specific DIR
3737
\( $(call generate_skip_dirs_through_prune) \) -prune -o \
3838
\( -type f \( -name "*.yaml" -o -name "*.yml" \) \) -print \
3939
| xargs grep --files-with-matches "^kind: *Namespace" \
40-
| xargs --no-run-if-empty --max-args=1 $(KUBECTL) apply --filename
40+
| xargs --no-run-if-empty -I{} sh -c 'KUBECONFIG="$(KUBECONFIG)" $(KUBECTL) apply --filename "{}"'
4141

4242
apply-all: ## Apply all resources (also namespaces) defined in YAML files (of specific DIR if specified)
4343
@echo "Applying all Kubernetes manifests from $(TARGET_DIR)/ (excluding SKIP_DIRS $(SKIP_DIRS))..."
4444
@find $(TARGET_DIR) \
4545
\( $(call generate_skip_dirs_through_prune) \) -prune -o \
4646
\( -type f \( -name "*.yaml" -o -name "*.yml" \) \) -print \
47-
| xargs --no-run-if-empty --max-args=1 $(KUBECTL) apply --filename
47+
| xargs --no-run-if-empty -I{} sh -c 'KUBECONFIG="$(KUBECONFIG)" $(KUBECTL) apply --filename "{}"'
4848

4949
apply: apply-namespaces apply-all ## Apply first namespaces and then all resources defined in YAML files (of specific DIR if specified)
5050

0 commit comments

Comments
 (0)