make cluster-config
This commit is contained in:
@@ -20,12 +20,17 @@ Then run
|
||||
make release
|
||||
```
|
||||
|
||||
Then run, follow the instructions
|
||||
```
|
||||
make cluster-config
|
||||
```
|
||||
|
||||
## Flashing
|
||||
|
||||
#### USB Drive
|
||||
1. `make release`
|
||||
2. Format the USB in vfat
|
||||
3. Copy out/[RELEASE].img.gz and out/board.itb your usb drive's root
|
||||
3. Copy out/[RELEASE].img.gz and out/board.itb to your usb drive's root
|
||||
4. Run
|
||||
```
|
||||
usb start
|
||||
|
||||
26
configs/cluster.env.default
Normal file
26
configs/cluster.env.default
Normal file
@@ -0,0 +1,26 @@
|
||||
# Required
|
||||
KUBERNETES_VERSION=v1.35.3
|
||||
NODE_NAME=monok8s-master
|
||||
APISERVER_ADVERTISE_ADDRESS=192.168.1.50
|
||||
|
||||
# Optional but strongly recommended
|
||||
CLUSTER_NAME=monok8s
|
||||
POD_SUBNET=10.244.0.0/16
|
||||
SERVICE_SUBNET=10.96.0.0/12
|
||||
CLUSTER_DOMAIN=cluster.local
|
||||
|
||||
# Optional
|
||||
# Extra API server SANs, comma-separated
|
||||
SANS=127.0.0.1,localhost,monok8s-master
|
||||
|
||||
# Single-node mode: allow workloads on the control plane
|
||||
ALLOW_SCHEDULING_ON_CONTROL_PLANE=yes
|
||||
|
||||
# CRI-O socket
|
||||
CONTAINER_RUNTIME_ENDPOINT=unix:///var/run/crio/crio.sock
|
||||
|
||||
# Usually leave this alone
|
||||
KUBECONFIG_USER_HOME=/root
|
||||
|
||||
# Emergency override only
|
||||
SKIP_IMAGE_CHECK=no
|
||||
22
makefile
22
makefile
@@ -16,6 +16,11 @@ KUBELET_BIN := $(PACKAGES_DIR)/kubernetes/kubelet
|
||||
KUBEADM_BIN := $(PACKAGES_DIR)/kubernetes/kubeadm
|
||||
KUBECTL_BIN := $(PACKAGES_DIR)/kubernetes/kubectl
|
||||
|
||||
CONFIGS_DIR := configs
|
||||
SCRIPTS_DIR := scripts
|
||||
CLUSTER_ENV_DEFAULT := $(CONFIGS_DIR)/cluster.env.default
|
||||
CLUSTER_ENV := $(OUT_DIR)/cluster.env
|
||||
|
||||
BOARD_ITB := $(OUT_DIR)/board.itb
|
||||
INITRAMFS := $(OUT_DIR)/initramfs.cpio.gz
|
||||
RELEASE_IMAGE := $(OUT_DIR)/monok8s-$(TAG).img.gz
|
||||
@@ -101,9 +106,6 @@ $(KUBEADM_BIN): | $(PACKAGES_DIR)
|
||||
$(KUBECTL_BIN): | $(PACKAGES_DIR)
|
||||
curl -L -o $@ "https://dl.k8s.io/$(KUBE_VERSION)/bin/linux/$(ARCH)/kubectl"
|
||||
|
||||
$(KUBEADM_BIN): | $(PACKAGES_DIR)
|
||||
curl -L -o $@ "https://dl.k8s.io/$(KUBE_VERSION)/bin/linux/$(ARCH)/kubeadm"
|
||||
|
||||
$(BUSYBOX_TAR): | $(PACKAGES_DIR)
|
||||
curl -L -o $@ "https://github.com/mirror/busybox/archive/refs/tags/$(BUSYBOX_VERSION).tar.gz"
|
||||
|
||||
@@ -217,6 +219,17 @@ check-functions:
|
||||
@echo "Missing functions:"
|
||||
@comm -23 /tmp/called.txt /tmp/defined.txt || true
|
||||
|
||||
# ---- cluster targets ------------------------------------------------------------
|
||||
|
||||
cluster-config: $(CLUSTER_ENV_DEFAULT) $(SCRIPTS_DIR)/merge-env.sh | $(OUT_DIR)
|
||||
sh $(SCRIPTS_DIR)/merge-env.sh $(CLUSTER_ENV_DEFAULT) $(CLUSTER_ENV)
|
||||
|
||||
cluster-defconfig: $(CLUSTER_ENV_DEFAULT) | $(OUT_DIR)
|
||||
cp $(CLUSTER_ENV_DEFAULT) $(CLUSTER_ENV)
|
||||
|
||||
cluster-print:
|
||||
@cat $(CLUSTER_ENV)
|
||||
|
||||
# ---- User targets ------------------------------------------------------------
|
||||
|
||||
release: $(RELEASE_IMAGE)
|
||||
@@ -240,4 +253,5 @@ distclean: clean
|
||||
pkgclean:
|
||||
rm -rf $(PACKAGES_DIR)
|
||||
|
||||
.PHONY: release kernel initramfs itb build-base clean distclean
|
||||
.PHONY: release kernel initramfs itb build-base clean distclean pkgclean \
|
||||
cluster-config cluster-defconfig cluster-print
|
||||
|
||||
45
scripts/merge-env.sh
Executable file
45
scripts/merge-env.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
INPUT="${1:?input file required}"
|
||||
OUTPUT="${2:?output file required}"
|
||||
|
||||
mkdir -p "$(dirname "$OUTPUT")"
|
||||
|
||||
awk '
|
||||
function trim(s) {
|
||||
sub(/^[[:space:]]+/, "", s)
|
||||
sub(/[[:space:]]+$/, "", s)
|
||||
return s
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
for (k in ENVIRON) {
|
||||
env[k] = ENVIRON[k]
|
||||
}
|
||||
}
|
||||
|
||||
/^[[:space:]]*#/ || /^[[:space:]]*$/ {
|
||||
print
|
||||
next
|
||||
}
|
||||
|
||||
{
|
||||
line = $0
|
||||
eq = index(line, "=")
|
||||
|
||||
if (eq == 0) {
|
||||
print line
|
||||
next
|
||||
}
|
||||
|
||||
key = trim(substr(line, 1, eq - 1))
|
||||
val = substr(line, eq + 1)
|
||||
|
||||
if (key in env) {
|
||||
print key "=" env[key]
|
||||
} else {
|
||||
print line
|
||||
}
|
||||
}
|
||||
' "$INPUT" > "$OUTPUT"
|
||||
Reference in New Issue
Block a user