-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
125 lines (105 loc) · 3.8 KB
/
Makefile
File metadata and controls
125 lines (105 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Makefile for interlink Helm chart
CHART_DIR := interlink
EXAMPLES_DIR := $(CHART_DIR)/examples
HELM := helm
# Default target
.PHONY: help
help:
@echo "Available targets:"
@echo " lint - Run helm lint on the chart"
@echo " test - Run all tests (lint + template validation)"
@echo " test-templates - Test helm templates against all examples"
@echo " test-examples - Test individual example files"
@echo " clean - Clean generated files"
@echo " publish - Publish chart using chartpress"
@echo " reset - Reset chart to development state"
# Lint the chart
.PHONY: lint
lint:
@echo "Running helm lint..."
$(HELM) lint $(CHART_DIR)/
# Test helm templates against all examples
.PHONY: test-templates
test-templates:
@echo "Testing helm templates against examples..."
@for example in $(EXAMPLES_DIR)/*.yaml; do \
echo "Testing $$example..."; \
$(HELM) template test-release $(CHART_DIR) --values $$example > /dev/null || exit 1; \
echo "✓ $$example passed"; \
done
@echo "All template tests passed!"
# Test individual examples
.PHONY: test-edge-rest
test-edge-rest:
@echo "Testing edge with REST example..."
$(HELM) template test-edge-rest $(CHART_DIR) --values $(EXAMPLES_DIR)/edge_with_rest.yaml
.PHONY: test-edge-socket
test-edge-socket:
@echo "Testing edge with socket example..."
$(HELM) template test-edge-socket $(CHART_DIR) --values $(EXAMPLES_DIR)/edge_with_socket.yaml
.PHONY: test-extra-volumes
test-extra-volumes:
@echo "Testing extra volumes example..."
$(HELM) template test-extra-volumes $(CHART_DIR) --values $(EXAMPLES_DIR)/test-extra-volumes.yaml
.PHONY: test-examples
test-examples: test-edge-rest test-edge-socket test-extra-volumes
# Dry run installations
.PHONY: dry-run-edge-rest
dry-run-edge-rest:
@echo "Dry run: edge with REST..."
$(HELM) install --dry-run --debug test-edge-rest $(CHART_DIR) --values $(EXAMPLES_DIR)/edge_with_rest.yaml
.PHONY: dry-run-edge-socket
dry-run-edge-socket:
@echo "Dry run: edge with socket..."
$(HELM) install --dry-run --debug test-edge-socket $(CHART_DIR) --values $(EXAMPLES_DIR)/edge_with_socket.yaml
.PHONY: dry-run-extra-volumes
dry-run-extra-volumes:
@echo "Dry run: extra volumes..."
$(HELM) install --dry-run --debug test-extra-volumes $(CHART_DIR) --values $(EXAMPLES_DIR)/test-extra-volumes.yaml
.PHONY: dry-run-all
dry-run-all: dry-run-edge-rest dry-run-edge-socket dry-run-extra-volumes
# Run all tests
.PHONY: test
test: lint test-templates
@echo "All tests passed! ✓"
# Chart publishing
.PHONY: publish
publish:
@echo "Publishing chart..."
chartpress --push
.PHONY: reset
reset:
@echo "Resetting chart to development state..."
chartpress --reset
# Clean generated files
.PHONY: clean
clean:
@echo "Cleaning generated files..."
@rm -f $(CHART_DIR)/charts/*.tgz 2>/dev/null || true
@rm -rf $(CHART_DIR)/charts/*/. 2>/dev/null || true
# Development helpers
.PHONY: template-default
template-default:
@echo "Templating with default values..."
$(HELM) template test-default $(CHART_DIR)
.PHONY: install-local
install-local:
@echo "Installing chart locally for testing..."
$(HELM) install --create-namespace -n interlink-test test-local $(CHART_DIR)
.PHONY: uninstall-local
uninstall-local:
@echo "Uninstalling local test chart..."
$(HELM) uninstall test-local -n interlink-test || true
kubectl delete namespace interlink-test || true
# Validation helpers
.PHONY: validate-values
validate-values:
@echo "Validating values.yaml syntax..."
@python3 -c "import yaml; yaml.safe_load(open('$(CHART_DIR)/values.yaml'))" && echo "✓ values.yaml is valid"
.PHONY: validate-examples
validate-examples:
@echo "Validating example YAML files..."
@for example in $(EXAMPLES_DIR)/*.yaml; do \
echo "Validating $$example..."; \
python3 -c "import yaml; yaml.safe_load(open('$$example'))" && echo "✓ $$example is valid"; \
done