Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

migrate from container linux to flatcar linux #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*.bundle
.cache/
/chain/chain.ipxe
CoreOS_Image_Signing_Key.asc
coreos_production_pxe_image.cpio.gz
coreos_production_pxe_image.cpio.gz.sig
coreos_production_pxe.vmlinuz
coreos_production_pxe.vmlinuz.sig
Flatcar_Image_Signing_Key.asc
flatcar_production_pxe_image.cpio.gz
flatcar_production_pxe_image.cpio.gz.sig
flatcar_production_pxe.vmlinuz
flatcar_production_pxe.vmlinuz.sig
/discoveryC/discoveryC
/discoveryC/dist/
/ectl/ectl
Expand Down Expand Up @@ -61,13 +61,13 @@ coreos_production_pxe.vmlinuz.sig
*.idea
image.aci
*.iml
/matchbox/assets/coreos/1*
/matchbox/assets/coreos/1353.7.0/
/matchbox/assets/coreos/container.json
/matchbox/assets/coreos/current
/matchbox/assets/coreos/current/
/matchbox/assets/coreos/image-id.json
/matchbox/assets/coreos/task-import-snapshot.json
/matchbox/assets/flatcar/1*
/matchbox/assets/flatcar/1353.7.0/
/matchbox/assets/flatcar/container.json
/matchbox/assets/flatcar/current
/matchbox/assets/flatcar/current/
/matchbox/assets/flatcar/image-id.json
/matchbox/assets/flatcar/task-import-snapshot.json
/matchbox/assets/discoveryC/discoveryC
/matchbox/assets/keys
/node-agent/node-agent
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ matrix:
#before_script:
# - make assets
# - sudo -E make aci_core
# - sudo -E make container_linux
# - sudo -E make flatcar
# - make config

#script:
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ config:
touch $(HOME)/.config/enjoliver/config.env
touch $(HOME)/.config/enjoliver/config.json

container_linux: acserver
$(MAKE) -C aci/aci-container-linux install
flatcar: acserver
$(MAKE) -C aci/aci-flatcar install
./runtime/runtime.rkt run --set-env=COMMIT_ID=$(shell git log --pretty=format:'%h' -n 1) \
--volume enjoliver,kind=host,source=$(CWD),readOnly=false \
--stage1-path=$(CWD)/runtime/rkt/stage1-fly.aci --insecure-options=all \
--interactive enjoliver.local/container-linux:latest
--interactive enjoliver.local/flatcar:latest
pkill -F runtime/acserver.pid || true

dev_setup:
Expand All @@ -124,7 +124,7 @@ dev_setup:
su -m $(MY_USER) -c "make -C $(CWD) front"
su -m $(MY_USER) -c "make -C $(CWD) assets"
$(MAKE) -C $(CWD) aci
$(MAKE) -C $(CWD) container_linux
$(MAKE) -C $(CWD) flatcar
su -m $(MY_USER) -c "make -C $(CWD) validate"
su -m $(MY_USER) -c "make -C $(CWD) config"
chown -R $(MY_USER): $(CWD)
Expand Down
2 changes: 1 addition & 1 deletion aci/aci-dnsmasq/runlevels/builder/10.builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ mkdir -pv ${TFTP_DIR}
curl -fL -o ${TFTP_DIR}/undionly.kpxe http://boot.ipxe.org/undionly.kpxe
ln -sv ${TFTP_DIR}/undionly.kpxe ${TFTP_DIR}/undionly.kpxe.0

curl -fL -o ${TFTP_DIR}/grub.efi https://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe_grub.efi
curl -fL -o ${TFTP_DIR}/grub.efi https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_pxe_grub.efi

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ACI=$(PROJECT)/aci

DEBIAN=debian
UPX=upx
TARGET=container-linux
TARGET=flatcar

default: install

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: enjoliver.local/container-linux:latest
name: enjoliver.local/flatcar:latest
aci:
dependencies:
- enjoliver.local/upx:latest
app:
exec:
- /usr/bin/make
- -C
- /enjoliver/matchbox/assets/coreos
- /enjoliver/matchbox/assets/flatcar
- re
mountPoints:
- name: enjoliver
path: /enjoliver
readOnly: false
readOnly: false
20 changes: 10 additions & 10 deletions discoveryC/bootinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ type BootInfo struct {
}

const (
coreosConfigUrl = "coreos.config.url="
flatcarConfigUrl = "flatcar.config.url="
uuidField = "uuid="
macField = "mac="
rawQueryPrefix = "REQUEST_RAW_QUERY="
)

// in the /proc/cmdline parse the line to get the coreos config url
func getCoreosConfigUrl(b []byte) (string, error) {
// in the /proc/cmdline parse the line to get the flatcar config url
func getFlatcarConfigUrl(b []byte) (string, error) {
cmdline := string(b)
glog.V(2).Infof("get %s in %q", coreosConfigUrl, cmdline)
glog.V(2).Infof("get %s in %q", flatcarConfigUrl, cmdline)
for i, word := range strings.Fields(cmdline) {
if strings.Contains(word, coreosConfigUrl) {
line := strings.Split(word, coreosConfigUrl)[1]
glog.V(2).Infof("found %q at word %d", coreosConfigUrl, i)
if strings.Contains(word, flatcarConfigUrl) {
line := strings.Split(word, flatcarConfigUrl)[1]
glog.V(2).Infof("found %q at word %d", flatcarConfigUrl, i)
return line, nil
}
}
return "", fmt.Errorf("Cannot find %q", coreosConfigUrl)
return "", fmt.Errorf("Cannot find %q", flatcarConfigUrl)
}

// randomID is the current boot ID
Expand Down Expand Up @@ -91,9 +91,9 @@ func (c *Config) ParseCommandLine() (bootInfo BootInfo, err error) {
glog.Errorf("fail to read %s", err)
return bootInfo, err
}
url, err := getCoreosConfigUrl(b)
url, err := getFlatcarConfigUrl(b)
if err != nil {
glog.Errorf("fail to get CoreOS Config Url %s", err)
glog.Errorf("fail to get Flatcar Config Url %s", err)
return bootInfo, err
}
return c.getBootInfoFromUrl(url)
Expand Down
2 changes: 1 addition & 1 deletion discoveryC/tests/proc/cmdline0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootflags=rw mount.usrflags=ro coreos.autologin coreos.config.url=http://172.20.0.1:8080/ignition?uuid=2023e709-39b4-47d7-8905-e8be3e6bc2c6&mac=52-54-00-0d-bd-31 coreos.first_boot coreos.oem.id=pxe
rootflags=rw mount.usrflags=ro flatcar.autologin flatcar.config.url=http://172.20.0.1:8080/ignition?uuid=2023e709-39b4-47d7-8905-e8be3e6bc2c6&mac=52-54-00-0d-bd-31 flatcar.first_boot flatcar.oem.id=pxe
2 changes: 1 addition & 1 deletion discoveryC/tests/proc/cmdline1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootflags=rw mount.usrflags=ro coreos.autologin coreos.config.url=http://172.20.0.1:8080/ignition?uuid=ee378e7b-1575-425d-a6d6-e0dadb9f31a0&mac=52-54-00-90-c3-9f coreos.first_boot coreos.oem.id=pxe
rootflags=rw mount.usrflags=ro flatcar.autologin flatcar.config.url=http://172.20.0.1:8080/ignition?uuid=ee378e7b-1575-425d-a6d6-e0dadb9f31a0&mac=52-54-00-90-c3-9f flatcar.first_boot flatcar.oem.id=pxe
2 changes: 1 addition & 1 deletion discoveryC/tests/proc/cmdline2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootflags=rw mount.usrflags=ro coreos.autologin coreos.config.url=http://172.20.0.1:8080/ignition?uuid=62b58ffd-7960-419a-8359-91def082191a&mac=52-54-00-71-83-ea coreos.first_boot coreos.oem.id=pxe
rootflags=rw mount.usrflags=ro flatcar.autologin flatcar.config.url=http://172.20.0.1:8080/ignition?uuid=62b58ffd-7960-419a-8359-91def082191a&mac=52-54-00-71-83-ea flatcar.first_boot flatcar.oem.id=pxe
2 changes: 1 addition & 1 deletion discoveryC/tests/proc/cmdline3
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootflags=rw mount.usrflags=ro coreos.autologin coreos.config.url=http://172.20.0.1:8080/ignition-pxe?uuid=62b58ffd-7960-419a-8359-91def082191a&mac=52-54-00-71-83-ea coreos.first_boot coreos.oem.id=pxe
rootflags=rw mount.usrflags=ro flatcar.autologin flatcar.config.url=http://172.20.0.1:8080/ignition-pxe?uuid=62b58ffd-7960-419a-8359-91def082191a&mac=52-54-00-71-83-ea flatcar.first_boot flatcar.oem.id=pxe
4 changes: 2 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ This is the available routes:
"/ignition/version/<string:filename>",
"/install-authorization/<string:request_raw_query>",
"/ipxe",
"/lifecycle/coreos-install",
"/lifecycle/coreos-install/<string:status>/<string:request_raw_query>",
"/lifecycle/flatcar-install",
"/lifecycle/flatcar-install/<string:status>/<string:request_raw_query>",
"/lifecycle/ignition",
"/lifecycle/ignition/<string:request_raw_query>",
"/lifecycle/rolling",
Expand Down
2 changes: 1 addition & 1 deletion docs/enjoliver-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ During the lifecycle of the Kubernetes cluster, rolling updates are **fast** and
Each node can be re-installed and re-join the cluster.


Each minute, every machine reports the content of `/usr/share/oem/coreos-install.json` to the enjoliver API `lifecycle/ignition/`
Each minute, every machine reports the content of `/usr/share/oem/flatcar-install.json` to the enjoliver API `lifecycle/ignition/`
Enjoliver will query matchbox and compare the content of the current ignition report and the desired ignition provided by matchbox.
The result will be stored in the database and returned to the machine.

Expand Down
2 changes: 1 addition & 1 deletion docs/usage-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Step-by-step:

# Very long:
sudo -E make aci
sudo -E make container_linux
sudo -E make flatcar

# misc
make config
Expand Down
2 changes: 1 addition & 1 deletion enjoliver-agent/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Enjoliver Agent


The enjoliver agent is a daemon running on each CoreOS container linux node of the Kubernetes cluster.
The enjoliver agent is a daemon running on each Flatcar linux node of the Kubernetes cluster.

The purpose of this daemon is provide local information.

Expand Down
6 changes: 3 additions & 3 deletions enjoliver-agent/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ Features: -TPM +SDJOURNAL
t.Errorf("fail to get version: %s", v)
}

unameOutput := "4.11.9-coreos\n"
unameOutput := "4.11.9-flatcar\n"
v, err = getStringInTable(unameOutput, kernelVersion)
if err != nil {
t.Errorf(err.Error())
}
if v != "4.11.9-coreos" {
if v != "4.11.9-flatcar" {
t.Errorf("fail to get version: %s", v)
}

Expand All @@ -102,7 +102,7 @@ Copyright 2000-2017 Willy Tarreau <[email protected]>

socatOutput := `[64604.961670] socat[18]: socat by Gerhard Rieger and contributors - see www.dest-unreach.org
[64604.962631] socat[18]: socat version 1.7.3.2 on Dec 1 2017 13:26:02
[64604.963345] socat[18]: running on Linux version #1 SMP Wed Nov 8 08:09:32 UTC 2017, release 4.14.0-rc8-coreos, machine x86_64
[64604.963345] socat[18]: running on Linux version #1 SMP Wed Nov 8 08:09:32 UTC 2017, release 4.14.0-rc8-flatcar, machine x86_64
[64604.965175] socat[18]: features:
[64604.965761] socat[18]: #define WITH_STDIO 1
[64604.966496] socat[18]: #define WITH_FDNUM 1
Expand Down
10 changes: 5 additions & 5 deletions enjoliver-api/enjoliver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ extra_selectors: {'os': 'installed'}

api_uri: 'http://127.0.0.1:5000'
#assets_server_uri: 'http://172.20.0.1'
#kernel: '/assets/coreos/serve/coreos_production_pxe.vmlinuz'
#initrd: '/assets/coreos/serve/coreos_production_pxe_image.cpio.gz'
#kernel: '/assets/flatcar/serve/flatcar_production_pxe.vmlinuz'
#initrd: '/assets/flatcar/serve/flatcar_production_pxe_image.cpio.gz'

matchbox_path: '/var/lib/matchbox'
matchbox_uri: 'http://127.0.0.1:8080'
Expand Down Expand Up @@ -71,8 +71,8 @@ cephtools_image_url: 'enjoliver.local/ceph-tools:latest'

etc_hosts: ['172.20.0.1 enjoliver.local']

coreos_install_base_url: "http://enjoliver.local:5000/assets/coreos"
coreos_install_lock_seconds: 45
flatcar_install_base_url: "http://enjoliver.local:5000/assets/flatcar"
flatcar_install_lock_seconds: 45

nameservers: ["8.8.8.8", "8.8.4.4"]
ntp: ["0.arch.pool.ntp.org", "1.arch.pool.ntp.org", "2.arch.pool.ntp.org", "3.arch.pool.ntp.org"]
Expand All @@ -82,4 +82,4 @@ vault_polling_sec: 30
disks_ladder_gb: {S: 10, M: 20, L: 30}

discovery_fqdn_verify: true
sync_replace_ip_by_fqdn: false
sync_replace_ip_by_fqdn: false
8 changes: 4 additions & 4 deletions enjoliver-api/enjoliver/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ def __init__(self, importer=''):
self.assets_server_uri = self.config_override("assets_server_uri", None)
self.kernel = self.config_override(
"kernel",
"/assets/coreos/serve/coreos_production_pxe.vmlinuz"
"/assets/flatcar/serve/flatcar_production_pxe.vmlinuz"
)
self.initrd = self.config_override(
"initrd",
"/assets/coreos/serve/coreos_production_pxe_image.cpio.gz"
"/assets/flatcar/serve/flatcar_production_pxe_image.cpio.gz"
)

# Scheduler
Expand Down Expand Up @@ -198,8 +198,8 @@ def __init__(self, importer=''):
"%s/gunicorn.pid" % os.path.dirname(__file__))
self.plan_pid_file = self.config_override("plan_pid_file", "%s/plan.pid" % os.path.dirname(__file__))

self.coreos_install_base_url = self.config_override("coreos_install_base_url", None)
self.coreos_install_lock_seconds = self.config_override("coreos_install_lock_seconds", 29)
self.flatcar_install_base_url = self.config_override("flatcar_install_base_url", None)
self.flatcar_install_lock_seconds = self.config_override("flatcar_install_lock_seconds", 29)

self.nameservers = self.config_override("nameservers", ["8.8.8.8", "8.8.4.4"])
self.ntp = self.config_override("ntp", ["0.arch.pool.ntp.org",
Expand Down
24 changes: 12 additions & 12 deletions enjoliver-api/enjoliver/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from enjoliver.db import session_commit
from enjoliver import tools
from enjoliver.model import MachineInterface, Machine, Schedule, ScheduleRoles, LifecycleIgnition, \
LifecycleCoreosInstall, LifecycleRolling
LifecycleFlatcarInstall, LifecycleRolling

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -53,11 +53,11 @@ def refresh_lifecycle_ignition(self, up_to_date: bool):

self.session.commit()

def refresh_lifecycle_coreos_install(self, success: bool):
lifecycle = self.session.query(LifecycleCoreosInstall).filter(
LifecycleCoreosInstall.machine_id == self.machine.id).first()
def refresh_lifecycle_flatcar_install(self, success: bool):
lifecycle = self.session.query(LifecycleFlatcarInstall).filter(
LifecycleFlatcarInstall.machine_id == self.machine.id).first()
if not lifecycle:
lifecycle = LifecycleCoreosInstall(
lifecycle = LifecycleFlatcarInstall(
machine_id=self.machine.id,
success=success
)
Expand Down Expand Up @@ -125,9 +125,9 @@ def get_all_updated_status(self):
})
return status

def get_coreos_install_status(self, mac: str):
def get_flatcar_install_status(self, mac: str):
with session_commit(sess_maker=self.sess_maker) as session:
lci = session.query(LifecycleCoreosInstall)\
lci = session.query(LifecycleFlatcarInstall)\
.join(Machine)\
.join(MachineInterface)\
.filter(MachineInterface.mac == mac)\
Expand All @@ -137,21 +137,21 @@ def get_coreos_install_status(self, mac: str):
else:
return None

def get_all_coreos_install_status(self):
def get_all_flatcar_install_status(self):
life_status_list = []
with session_commit(sess_maker=self.sess_maker) as session:
for machine in session.query(Machine)\
.join(LifecycleCoreosInstall)\
.join(LifecycleFlatcarInstall)\
.join(MachineInterface)\
.filter(MachineInterface.as_boot == True):

life_status_list.append({
"mac": machine.interfaces[0].mac,
"fqdn": machine.interfaces[0].fqdn,
"cidrv4": machine.interfaces[0].cidrv4,
"success": machine.lifecycle_coreos_install[0].success,
"created_date": machine.lifecycle_coreos_install[0].created_date,
"updated_date": machine.lifecycle_coreos_install[0].updated_date
"success": machine.lifecycle_flatcar_install[0].success,
"created_date": machine.lifecycle_flatcar_install[0].created_date,
"updated_date": machine.lifecycle_flatcar_install[0].updated_date
})
return life_status_list

Expand Down
6 changes: 3 additions & 3 deletions enjoliver-api/enjoliver/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ def _boot(self):
"kernel": "%s%s" % (uri, ec.kernel),
"initrd": ["%s%s" % (uri, ec.initrd)],
"cmdline": {
"coreos.config.url":
"flatcar.config.url":
"%s/%s?uuid=${uuid}&mac=${net0/mac:hexhyp}" % (self.api_uri, path_for_ignition),
"coreos.first_boot": "",
"coreos.oem.id": "pxe",
"flatcar.first_boot": "",
"flatcar.oem.id": "pxe",
"console": "ttyS0 console=ttyS1",
}
}
Expand Down
2 changes: 1 addition & 1 deletion enjoliver-api/enjoliver/k8s_2t.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _init_discovery(self):
extra_md = {
"etc_hosts": EC.etc_hosts,
"extra_selectors": extra_selectors,
"coreos_install_base_url": EC.coreos_install_base_url,
"flatcar_install_base_url": EC.flatcar_install_base_url,
}
if EC.lldp_image_url:
logger.debug("adding lldp_image_url: %s" % EC.lldp_image_url)
Expand Down
Loading