Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 784296b

Browse files
committed
Update to container linux config and ignition format
1 parent ef3fa24 commit 784296b

File tree

4 files changed

+36
-19
lines changed

4 files changed

+36
-19
lines changed

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
builds/
22
packer_cache/
33
container-linux-config.yml
4+
ignition.json

‎Makefile‎

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
11
PACKER_CMD ?= packer
2-
CONTAINER_LINUX_RELEASE ?= stable
3-
CONTAINER_LINUX_IMAGE_DIGEST_URL ?= https://$(CONTAINER_LINUX_RELEASE).release.core-os.net/amd64-usr/current/coreos_production_iso_image.iso.DIGESTS
4-
CONTAINER_LINUX_CONFIG ?= container-linux-config.yml
2+
RELEASE ?= alpha
3+
DIGEST_URL ?= https://$(RELEASE).release.core-os.net/amd64-usr/current/coreos_production_iso_image.iso.DIGESTS
4+
CONFIG ?= container-linux-config.yml
55
DISK_SIZE ?= 40000
66
MEMORY ?= 1024M
77
BOOT_WAIT ?= 45s
88

9-
container-linux: builds/container-linux-$(CONTAINER_LINUX_RELEASE).qcow2
9+
container-linux: builds/container-linux-$(RELEASE).qcow2
1010

11-
builds/container-linux-$(CONTAINER_LINUX_RELEASE).qcow2:
12-
$(eval CONTAINER_LINUX_IMAGE_ISO_CHECKSUM := $(shell curl -s "$(CONTAINER_LINUX_IMAGE_DIGEST_URL)" | grep "coreos_production_iso_image.iso" | awk '{ print length, $1ドル | "sort -rg"}' | awk 'NR == 1 { print $2ドル }'))
11+
builds/container-linux-$(RELEASE).qcow2:
12+
$(eval ISO_CHECKSUM := $(shell curl -s "$(DIGEST_URL)" | grep "coreos_production_iso_image.iso" | awk '{ print length, $1ドル | "sort -rg"}' | awk 'NR == 1 { print $2ドル }'))
13+
14+
ct -pretty -in-file $(CONFIG) -out-file ignition.json
1315

1416
$(PACKER_CMD) build -force \
15-
-var 'release=$(CONTAINER_LINUX_RELEASE)' \
16-
-var 'iso_checksum=$(CONTAINER_LINUX_IMAGE_ISO_CHECKSUM)' \
17+
-var 'release=$(RELEASE)' \
18+
-var 'iso_checksum=$(ISO_CHECKSUM)' \
1719
-var 'iso_checksum_type=sha512' \
1820
-var 'disk_size=$(DISK_SIZE)' \
1921
-var 'memory=$(MEMORY)' \
2022
-var 'boot_wait=$(BOOT_WAIT)' \
21-
-var 'config=$(CONTAINER_LINUX_CONFIG)' \
2223
container-linux.json
2324

2425
clean:
25-
rm -rf builds packer_cache
26+
rm -rf builds
2627

27-
.PHONY: clean
28+
cache-clean:
29+
rm -rf packer_cache
30+
31+
ct: /usr/local/bin/ct
32+
33+
/usr/local/bin/ct:
34+
wget -O /usr/local/bin/ct https://github.com/coreos/container-linux-config-transpiler/releases/download/v0.4.2/ct-v0.4.2-x86_64-unknown-linux-gnu
35+
chmod +x /usr/local/bin/ct
36+
37+
ct-update: ct-clean ct
38+
39+
ct-clean:
40+
rm /usr/local/bin/ct
41+
42+
.PHONY: clean cache-clean ct-update ct-clean

‎container-linux-config.yml.example‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#cloud-config
2-
3-
ssh_authorized_keys:
4-
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g+ZTxC7weoIJLUafOgrm+h..."
1+
passwd:
2+
users:
3+
- name: core
4+
ssh_authorized_keys:
5+
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g+ZTxC7weoIJLUafOgrm+h..."

‎container-linux.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"disk_size": "40000",
77
"memory": "1024M",
88
"boot_wait": "45s",
9-
"config": "container-linux-config.yml"
9+
"ignition": "ignition.json"
1010
},
1111

1212
"builders": [
@@ -39,13 +39,13 @@
3939
"provisioners": [
4040
{
4141
"type": "file",
42-
"source": "{{ user `config` }}",
43-
"destination": "/tmp/container-linux-config.yml"
42+
"source": "{{ user `ignition` }}",
43+
"destination": "/tmp/ignition.json"
4444
},
4545
{
4646
"type": "shell",
4747
"inline": [
48-
"sudo coreos-install -d /dev/vda -C {{ user `release` }} -c /tmp/container-linux-config.yml"
48+
"sudo coreos-install -d /dev/vda -C {{ user `release` }} -i /tmp/ignition.json"
4949
]
5050
}
5151
]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /