|
1 | 1 | # Run `make help` to show usage |
2 | 2 | .DEFAULT_GOAL := help |
3 | 3 |
|
4 | | -HOSTNAME ?= $(shell hostname) |
5 | | -# HOSTNAME is the name of the physical host |
6 | | -export HOSTNAME := $(HOSTNAME) |
7 | | - |
8 | 4 | # Change ports for different kubernetes services |
9 | | -PORT_ETCD ?= 2379 |
10 | | -PORT_KUBELET ?= 10250 |
11 | | -PORT_FLANNEL ?= 8472 |
12 | | -PORT_KUBE_APISERVER ?= 6443 |
13 | | - |
14 | | -export U7S_PORT_ETCD := $(PORT_ETCD) |
15 | | -export U7S_PORT_KUBELET := $(PORT_KUBELET) |
16 | | -export U7S_PORT_FLANNEL := $(PORT_FLANNEL) |
17 | | -export U7S_PORT_KUBE_APISERVER := $(PORT_KUBE_APISERVER) |
18 | | - |
19 | | -HOST_IP ?= $(shell ip --json route get 1 | jq -r .[0].prefsrc) |
20 | | -NODE_NAME ?= u7s-$(HOSTNAME) |
21 | | -NODE_SUBNET ?= $(shell $(CURDIR)/Makefile.d/node-subnet.sh) |
22 | | -# U7S_HOST_IP is the IP address of the physical host. Accessible from other hosts. |
23 | | -export U7S_HOST_IP := $(HOST_IP) |
24 | | -# U7S_NODE_NAME is the host name of the Kubernetes node running in Rootless Docker. |
| 5 | +export PORT_ETCD ?= 2379 |
| 6 | +export PORT_KUBELET ?= 10250 |
| 7 | +export PORT_FLANNEL ?= 8472 |
| 8 | +export PORT_KUBE_APISERVER ?= 6443 |
| 9 | + |
| 10 | +# HOSTNAME is the name of the physical host |
| 11 | +export HOSTNAME ?= $(shell hostname) |
| 12 | +# HOST_IP is the IP address of the physical host. Accessible from other hosts. |
| 13 | +export HOST_IP ?= $(shell ip --json route get 1 | jq -r .[0].prefsrc) |
| 14 | +# NODE_NAME is the host name of the Kubernetes node running in Rootless Docker. |
25 | 15 | # Not accessible from other hosts. |
26 | | -export U7S_NODE_NAME:= $(NODE_NAME) |
27 | | -# U7S_NODE_NAME is the subnet of the Kubernetes node running in Rootless Docker. |
| 16 | +export NODE_NAME ?= u7s-$(HOSTNAME) |
| 17 | +# NODE_SUBNET is the subnet of the Kubernetes node running in Rootless Docker. |
28 | 18 | # Not accessible from other hosts. |
29 | | -export U7S_NODE_SUBNET := $(NODE_SUBNET) |
30 | | -# U7S_NODE_IP is the IP address of the Kubernetes node running in Rootless Docker. |
| 19 | +export NODE_SUBNET ?= $(shell $(CURDIR)/Makefile.d/node-subnet.sh) |
| 20 | +# NODE_IP is the IP address of the Kubernetes node running in Rootless Docker. |
31 | 21 | # Not accessible from other hosts. |
32 | | -export U7S_NODE_IP := $(subst .0/24,.100,$(U7S_NODE_SUBNET)) |
| 22 | +export NODE_IP := $(subst .0/24,.100,$(NODE_SUBNET)) |
33 | 23 |
|
34 | | -CONTAINER_ENGINE ?= $(shell $(CURDIR)/Makefile.d/detect-container-engine.sh CONTAINER_ENGINE) |
35 | | -export CONTAINER_ENGINE := $(CONTAINER_ENGINE) |
| 24 | +export CONTAINER_ENGINE ?= $(shell $(CURDIR)/Makefile.d/detect-container-engine.sh CONTAINER_ENGINE) |
36 | 25 |
|
37 | | -CONTAINER_ENGINE_TYPE ?= $(shell $(CURDIR)/Makefile.d/detect-container-engine.sh CONTAINER_ENGINE_TYPE) |
38 | | -export CONTAINER_ENGINE_TYPE := $(CONTAINER_ENGINE_TYPE) |
| 26 | +export CONTAINER_ENGINE_TYPE ?= $(shell $(CURDIR)/Makefile.d/detect-container-engine.sh CONTAINER_ENGINE_TYPE) |
39 | 27 |
|
40 | 28 | COMPOSE ?= $(shell $(CURDIR)/Makefile.d/detect-container-engine.sh COMPOSE) |
41 | 29 |
|
42 | 30 | NODE_SERVICE_NAME := node |
43 | 31 | NODE_SHELL := $(COMPOSE) exec \ |
44 | | - -e U7S_HOST_IP=$(U7S_HOST_IP) \ |
45 | | - -e U7S_NODE_NAME=$(U7S_NODE_NAME) \ |
46 | | - -e U7S_NODE_SUBNET=$(U7S_NODE_SUBNET) \ |
47 | | - -e U7S_NODE_IP=$(U7S_NODE_IP) \ |
48 | | - -e U7S_PORT_KUBE_APISERVER=$(U7S_PORT_KUBE_APISERVER) \ |
49 | | - -e U7S_PORT_FLANNEL=$(U7S_PORT_FLANNEL) \ |
50 | | - -e U7S_PORT_KUBELET=$(U7S_PORT_KUBELET) \ |
51 | | - -e U7S_PORT_ETCD=$(U7S_PORT_ETCD) \ |
| 32 | + -e HOST_IP=$(HOST_IP) \ |
| 33 | + -e NODE_NAME=$(NODE_NAME) \ |
| 34 | + -e NODE_SUBNET=$(NODE_SUBNET) \ |
| 35 | + -e NODE_IP=$(NODE_IP) \ |
| 36 | + -e PORT_KUBE_APISERVER=$(PORT_KUBE_APISERVER) \ |
| 37 | + -e PORT_FLANNEL=$(PORT_FLANNEL) \ |
| 38 | + -e PORT_KUBELET=$(PORT_KUBELET) \ |
| 39 | + -e PORT_ETCD=$(PORT_ETCD) \ |
52 | 40 | $(NODE_SERVICE_NAME) |
53 | 41 |
|
54 | 42 | ifeq ($(CONTAINER_ENGINE),nerdctl) |
55 | 43 | ifneq (,$(wildcard $(XDG_RUNTIME_DIR)/bypass4netnsd.sock)) |
56 | | - export U7S_B4NN := true |
57 | | - export U7S_B4NN_IGNORE_SUBNETS := ["10.96.0.0/16", "10.244.0.0/16", "$(U7S_NODE_SUBNET)"] |
| 44 | + export BYPASS4NETNS := true |
| 45 | + export BYPASS4NETNS_IGNORE_SUBNETS := ["10.96.0.0/16", "10.244.0.0/16", "$(NODE_SUBNET)"] |
58 | 46 | endif |
59 | 47 | endif |
60 | 48 |
|
|
0 commit comments