-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathMakefile
More file actions
224 lines (183 loc) · 8.99 KB
/
Copy pathMakefile
File metadata and controls
224 lines (183 loc) · 8.99 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# Valid cluster types for 'make deploy <cluster-type>'
VALID_CLUSTER_TYPES := fencing-ipi fencing-agent fencing-assisted arbiter-ipi arbiter-agent arbiter-kcli fencing-kcli sno-ipi sno-agent
# Handle 'make deploy <cluster-type>' pattern
# When 'deploy' is first, validate any following arguments are valid cluster types
ifeq (deploy,$(firstword $(MAKECMDGOALS)))
DEPLOY_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
ifneq ($(DEPLOY_ARGS),)
INVALID_ARGS := $(filter-out $(VALID_CLUSTER_TYPES),$(DEPLOY_ARGS))
ifneq ($(INVALID_ARGS),)
$(error Unknown cluster type: '$(INVALID_ARGS)'. Run 'make help' for more information.)
endif
endif
endif
# Handle 'make doctor <cluster-type>' pattern
# When 'doctor' is first, following cluster types select strict validation for
# that deployment; the cluster-type goals themselves are neutralized below so
# they don't trigger an actual deployment.
ifeq (doctor,$(firstword $(MAKECMDGOALS)))
DOCTOR_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
ifneq ($(DOCTOR_ARGS),)
DOCTOR_INVALID_ARGS := $(filter-out $(VALID_CLUSTER_TYPES),$(DOCTOR_ARGS))
ifneq ($(DOCTOR_INVALID_ARGS),)
$(error Unknown cluster type: '$(DOCTOR_INVALID_ARGS)'. Run 'make help' for more information.)
endif
endif
endif
create:
@./aws-hypervisor/scripts/create.sh
deploy:
@$(MAKE) create init inventory
init:
@./aws-hypervisor/scripts/init.sh
destroy:
@./aws-hypervisor/scripts/destroy.sh
start:
@./aws-hypervisor/scripts/start.sh
stop:
@./aws-hypervisor/scripts/stop.sh
force-stop:
@./aws-hypervisor/scripts/force-stop.sh
redeploy-cluster:
@./openshift-clusters/scripts/redeploy-cluster.sh
shutdown-cluster:
@./openshift-clusters/scripts/shutdown-cluster.sh
startup-cluster:
@./openshift-clusters/scripts/startup-cluster.sh
clean:
@./openshift-clusters/scripts/clean.sh
full-clean:
@./openshift-clusters/scripts/full-clean.sh
clean-spoke:
@./openshift-clusters/scripts/clean-spoke.sh
clean-mutable-topology:
@./openshift-clusters/scripts/clean-mutable-topology.sh $(EXTRA_ARGS)
ssh:
@./aws-hypervisor/scripts/ssh.sh
status:
@./openshift-clusters/scripts/status.sh
# Alias kept for muscle memory: 'make info' output is part of 'make status'
info: status
inventory:
@./aws-hypervisor/scripts/inventory.sh
# Sync config/ files to canonical locations before targets that consume them.
create init redeploy-cluster \
baremetal-adopt baremetal-fencing-agent: sync-config
sync-config:
@bash -c 'set -e; source ./common.sh; sync_config_files; \
if [ "$${CONFIG_SYNC_ERRORS:-0}" -gt 0 ]; then \
echo "sync-config: $${CONFIG_SYNC_ERRORS} file(s) failed to sync." >&2; exit 1; \
elif [ "$${CONFIG_SYNCED_COUNT:-0}" -eq 0 ]; then \
echo "Config files: everything up to date."; \
fi'
doctor:
@./openshift-clusters/scripts/doctor.sh $(DOCTOR_ARGS)
ifeq (doctor,$(firstword $(MAKECMDGOALS)))
# Cluster types after 'doctor' are arguments to doctor.sh, not deployments
$(VALID_CLUSTER_TYPES):
@:
else
$(VALID_CLUSTER_TYPES): sync-config
fencing-ipi:
@./openshift-clusters/scripts/deploy-cluster.sh --topology fencing --method ipi
fencing-agent:
@./openshift-clusters/scripts/deploy-cluster.sh --topology fencing --method agent
arbiter-ipi:
@./openshift-clusters/scripts/deploy-cluster.sh --topology arbiter --method ipi
arbiter-agent:
@./openshift-clusters/scripts/deploy-cluster.sh --topology arbiter --method agent
sno-ipi:
@./openshift-clusters/scripts/deploy-cluster.sh --topology sno --method ipi
sno-agent:
@./openshift-clusters/scripts/deploy-cluster.sh --topology sno --method agent
arbiter-kcli:
@./openshift-clusters/scripts/deploy-cluster.sh --topology arbiter --method kcli
fencing-kcli:
@./openshift-clusters/scripts/deploy-cluster.sh --topology fencing --method kcli
fencing-assisted:
@$(MAKE) fencing-ipi
@./openshift-clusters/scripts/deploy-fencing-assisted.sh
endif
keep-instance:
@../helpers/keep-instance.sh '$(DAYS)'
baremetal-adopt:
@./openshift-clusters/scripts/baremetal-adopt.sh
baremetal-verify:
@./openshift-clusters/scripts/baremetal-adopt.sh --verify-only
baremetal-fencing-agent:
@./openshift-clusters/scripts/deploy-baremetal.sh
baremetal-wizard:
@./openshift-clusters/scripts/baremetal-wizard.sh
sno-to-3node:
@./openshift-clusters/scripts/sno-to-3node.sh $(EXTRA_ARGS)
patch-nodes:
@./openshift-clusters/scripts/patch-nodes.sh
get-tnf-logs:
@./openshift-clusters/scripts/get-tnf-logs.sh
help:
@echo "Available commands:"
@echo ""
@echo "Instance Lifecycle Management:"
@echo " deploy - Create, initialize, and update inventory for new EC2 instance"
@echo " deploy <cluster-type>- Deploy EC2 instance AND deploy the specified cluster type"
@echo " Valid types: $(VALID_CLUSTER_TYPES)"
@echo " create - Create new EC2 instance"
@echo " init - Initialize deployed instance"
@echo " start - Start stopped EC2 instance"
@echo " stop - Stop running EC2 instance gracefully (interactive cluster handling)"
@echo " force-stop - Force stop EC2 instance immediately (no cluster checks)"
@echo " destroy - Completely destroy EC2 instance and all resources"
@echo ""
@echo "Instance Utils:"
@echo " ssh - SSH into the EC2 instance"
@echo " status - Show status dashboard (instance, cluster VMs, proxy, cluster API)"
@echo " info - Alias for status"
@echo " inventory - Update inventory.ini with current instance IP"
@echo " doctor - Validate configuration and prerequisites (read-only)"
@echo " doctor <cluster-type>- Validate strictly for a specific cluster type"
@echo " keep-instance - Tag instance with keep-N retention (default: 2, max: 5)"
@echo " Usage: make keep-instance or make keep-instance DAYS=5"
@echo " sync-config - Sync files from config/ to their canonical locations"
@echo " (runs automatically before deploy and cluster targets)"
@echo ""
@echo "OpenShift Cluster Deployment:"
@echo " fencing-ipi - Deploy fencing IPI cluster (non-interactive)"
@echo " fencing-agent - Deploy fencing Agent cluster (non-interactive) (WIP Experimental)"
@echo " arbiter-ipi - Deploy arbiter IPI cluster (non-interactive)"
@echo " arbiter-agent - Deploy arbiter Agent cluster (non-interactive)"
@echo " arbiter-kcli - Deploy arbiter cluster using kcli (non-interactive)"
@echo " fencing-kcli - Deploy fencing cluster using kcli (non-interactive)"
@echo " fencing-assisted - Deploy hub + spoke TNF cluster via assisted installer"
@echo " sno-ipi - Deploy Single Node OpenShift (SNO) IPI cluster (non-interactive)"
@echo " sno-agent - Deploy Single Node OpenShift (SNO) Agent cluster (non-interactive)"
@echo " sno-to-3node - Transition existing SNO cluster to 3-node HA (platform:none)"
@echo " Examples:"
@echo " make sno-to-3node EXTRA_ARGS=\"-e stop_before_transition_confirm=true\""
@echo " make sno-to-3node EXTRA_ARGS=\"-vv\""
@echo ""
@echo "OpenShift Cluster Management:"
@echo " redeploy-cluster - Redeploy OpenShift cluster using dev-scripts make redeploy"
@echo " shutdown-cluster - Shutdown OpenShift cluster VMs in orderly fashion"
@echo " startup-cluster - Start up OpenShift cluster VMs and proxy container"
@echo " clean - Clean OpenShift cluster and remove local cluster state"
@echo " full-clean - Fully clean instance cache, cluster, and remove local cluster state"
@echo " clean-spoke - Clean spoke cluster resources (VMs, network, auth) from assisted installer"
@echo " clean-mutable-topology - Remove master-1/2 VMs, disks, DHCP/DNS entries (sno-to-3node cleanup)"
@echo " Examples:"
@echo " make clean-mutable-topology EXTRA_ARGS=\"-vv\""
@echo " make clean-mutable-topology EXTRA_ARGS=\"-e force_cleanup=true\""
@echo " patch-nodes - Build resource-agents RPM and patch cluster nodes (default version: 4.11)"
@echo ""
@echo "Baremetal Adoption:"
@echo " baremetal-adopt - Adopt baremetal nodes: validate BMC + generate dev-scripts artifacts"
@echo " baremetal-fencing-agent - Deploy TNF cluster on adopted baremetal nodes via provisioning host"
@echo " baremetal-verify - Verify BMC credentials for adopted baremetal nodes (no artifacts)"
@echo " baremetal-wizard - Interactive wizard to create baremetal node inventory"
@echo ""
@echo "Cluster Utilities:"
@echo " get-tnf-logs - Collect pacemaker and etcd logs from cluster nodes"
@echo ""
@echo "Advanced Usage:"
@echo " Some commands accept EXTRA_ARGS to pass additional options to underlying tools:"
@echo " - sno-to-3node and clean-mutable-topology: pass Ansible extra vars/verbosity"
@echo " Example: make sno-to-3node EXTRA_ARGS=\"-e my_var=value -vv\""