Skip to content

Commit 8d35fa5

Browse files
committed
conf(ingress-nginx): re-organize installation
Match the installation process of other platform products, and download the yaml from upstream, adding it to version control.
1 parent cce34f3 commit 8d35fa5

File tree

8 files changed

+804
-57
lines changed

8 files changed

+804
-57
lines changed

platform/ingress-nginx/Makefile

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Default target
2+
.DEFAULT_GOAL := help
3+
4+
# Variables
5+
DEFAULT_VERSION := v1.10.1
6+
VERSION ?= $(DEFAULT_VERSION)
7+
BASE_URL := https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-$(VERSION)/deploy/static/provider/do/deploy.yaml
8+
OUTPUT_YAML := base/deploy.yaml
9+
TEMP_FILE := $(OUTPUT_YAML).tmp
10+
REQUIRED_TOOLS := curl rm cat
11+
12+
# Phony targets
13+
.PHONY: update clean help check-tools
14+
15+
# Target: check-tools
16+
# Description: Ensure all required tools are available
17+
check-tools:
18+
@echo "Checking required tools..."
19+
@missing_tools=; \
20+
for tool in $(REQUIRED_TOOLS); do \
21+
if ! command -v $$tool >/dev/null 2>&1; then \
22+
echo "Error: Required tool '$$tool' is not installed."; \
23+
missing_tools=1; \
24+
fi; \
25+
done; \
26+
if [ -n "$$missing_tools" ]; then \
27+
echo "Please install the missing tools and try again."; \
28+
exit 1; \
29+
fi
30+
@echo "All required tools are available."
31+
32+
# Target: update
33+
# Description: Pull the specified version of YAML from GitHub and save it to OUTPUT_YAML
34+
update: check-tools
35+
@echo "Starting update process..."
36+
@echo "Removing previous $(OUTPUT_YAML)..."
37+
@mkdir -p $(dir $(OUTPUT_YAML))
38+
@rm -f $(OUTPUT_YAML)
39+
40+
@if [ -z "$(VERSION)" ]; then \
41+
echo "No VERSION argument provided, using default version: $(DEFAULT_VERSION)"; \
42+
VERSION=$(DEFAULT_VERSION); \
43+
fi
44+
45+
@echo "Pulling YAML (Version: $(VERSION)) from GitHub..."
46+
@curl -fSL $(BASE_URL) -o $(TEMP_FILE) || { \
47+
echo "Error: Failed to download YAML from $(BASE_URL)"; \
48+
exit 1; \
49+
}
50+
51+
@echo "# This file was autogenerated from $(BASE_URL)" > $(OUTPUT_YAML)
52+
@cat $(TEMP_FILE) >> $(OUTPUT_YAML)
53+
@rm -f $(TEMP_FILE)
54+
@echo "Update completed successfully. YAML saved to $(OUTPUT_YAML)."
55+
56+
# Target: clean
57+
# Description: Remove the generated YAML file
58+
clean:
59+
@echo "Cleaning up generated files..."
60+
@rm -f $(OUTPUT_YAML)
61+
@echo "Cleanup completed."
62+
63+
# Target: help
64+
# Description: Display usage information
65+
help:
66+
@echo "Makefile for managing application YAML"
67+
@echo ""
68+
@echo "Targets:"
69+
@echo " check-tools : Ensure all required tools are available"
70+
@echo " update : Pull the specified version of Argo CD YAML from GitHub"
71+
@echo " clean : Remove the generated YAML file"
72+
@echo " help : Display this help message"

0 commit comments

Comments
 (0)