Compare commits

...

878 Commits

Author SHA1 Message Date
Sven Dowideit
2516850976 Merge pull request #1746 from rancher/INVESTIGATION
Release DHCP lease, and remove non-specified addresses from eth devices marked as DHCP:false
2017-04-03 19:39:07 +10:00
Sven Dowideit
ac5cb304d6 Call dhcp release on interfaces that are dhcp:false
and then remove any non-specified IP addresses from them too

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-04-03 09:25:55 +00:00
Sven Dowideit
d35e0e05d8 Merge pull request #1742 from rancher/fix-kexec-reboot-for-upgrade
ros os upgrade --kexec ... works again
2017-04-03 19:20:45 +10:00
Sven Dowideit
fdc16672d5 ros os upgrade --kexec ... works again
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-04-03 09:18:17 +00:00
Sven Dowideit
1356e609b3 Merge pull request #1743 from rancher/v0.8.x
fix downgrade from 0.8/0.9 to 0.7, and back again
2017-04-01 21:52:32 +10:00
Sven Dowideit
4410480fd6 Merge pull request #1745 from SvenDowideit/linux-4.9.20
Linux 4.9.20
2017-04-01 21:52:11 +10:00
Sven Dowideit
bc3f2a195d Linux 4.9.20
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-04-01 21:50:29 +10:00
Sven Dowideit
261be61cc0 Merge pull request #1736 from SvenDowideit/network-tests
Move the ApplyNetwork back to init where dhcp can run, and fix the te…
2017-04-01 21:29:47 +10:00
Sven Dowideit
62d8aaa58e Need to remove the immutable bit from ldlinux.sys so root can remove it
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-31 12:15:15 +00:00
Sven Dowideit
e871741ec3 need to use the old -t rancher-upgrade type so we can downgrade to older releases
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-31 10:41:25 +10:00
Sven Dowideit
088249d751 Linux 4.9.19
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-30 10:58:25 +00:00
Sven Dowideit
babf6ddb48 Merge pull request #1738 from SvenDowideit/explicitly-set-zfs-storagedriver
setting the storage driver explicitly may avoid a timing issue
2017-03-30 14:23:01 +10:00
Sven Dowideit
8b0be9cd2b setting the storage driver explicitly may avoid a timing issue
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-28 21:49:54 +10:00
Sven Dowideit
748be0ad66 Move the ApplyNetwork back to init where dhcp can run, and fix the tests for scope global
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-28 21:13:22 +10:00
Sven Dowideit
41e02e6f64 Merge pull request #1734 from SvenDowideit/add-cloud-config-iso-format-detection
Mount --cloud-config file.iso ending with .iso as an unmodified iso file
2017-03-28 16:06:59 +10:00
Sven Dowideit
d4ae014f76 add scripts/run --openstack, and use the iso if --cloud-config file.iso
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-28 16:04:49 +10:00
Sven Dowideit
ecdd081c27 Merge pull request #1733 from rancher/0.9.1-docs
0.9.1 docs updates
2017-03-28 15:55:03 +10:00
Sven Dowideit
8f69c1faff 0.9.1 docs updates
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-27 03:30:35 +00:00
Sven Dowideit
02a47b2edc Merge pull request #1732 from rancher/partition-option-doesnt-need-host-dev-mount
Don't need host dev mount for pre-created partition
2017-03-27 11:00:35 +10:00
Sven Dowideit
2f28a00e02 Don't need host dev mount for pre-created partition
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-27 00:59:11 +00:00
Sven Dowideit
da5cab621a Merge pull request #1731 from rancher/4.9.18
4.9.18
2017-03-26 22:47:19 +10:00
Sven Dowideit
74136bf8e6 4.9.18
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-26 12:46:41 +00:00
Sven Dowideit
53c88bc505 Merge pull request #1724 from rancher/docker-container-install-to-partition
Fixed install --partition and added scripts/run-install to use it in …
2017-03-26 22:22:19 +10:00
Sven Dowideit
5dfcd31b54 Merge pull request #1715 from rancher/use-network-cfg-earlier
Remove DHCP addresses from devices that change to static
2017-03-26 22:14:36 +10:00
Sven Dowideit
59a752c306 Use the partial cfg for the initial network
and release the network device from dhcp if we're not using it

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-26 11:49:14 +00:00
Sven Dowideit
77759afcaa Merge pull request #1728 from rancher/linux-4.9.17
Linux 4.9.17
2017-03-25 15:57:10 +10:00
Sven Dowideit
ca0d475c83 Linux 4.9.17
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-25 05:56:48 +00:00
Sven Dowideit
5ea76f704a Merge pull request #1727 from SvenDowideit/fix-for-do-host-test
Get only the filename
2017-03-25 15:55:17 +10:00
Sven Dowideit
b2cbd62a8d Get only the filename
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-25 15:52:00 +10:00
Sven Dowideit
8f4b2bc458 Merge pull request #1726 from SvenDowideit/simplify-automation-testing
Simplify automation testing (for DO)
2017-03-25 15:30:47 +10:00
Sven Dowideit
571597dde3 auto-test my development builds on DigitalOcean
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-25 15:23:12 +10:00
Sven Dowideit
63f8277ecb rearrange the cloud-config
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-25 11:53:50 +10:00
Sven Dowideit
15699a253c Fixed install --partition and added scripts/run-install
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-24 12:39:40 +00:00
Sven Dowideit
060390c160 Merge pull request #1718 from rancher/increase-test-verbosity
verbose reports the name of the test
2017-03-23 15:43:27 +10:00
Sven Dowideit
fb7a5745c2 verbose reports the name of the test
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-23 05:40:14 +00:00
Sven Dowideit
553e21f919 Merge pull request #1703 from rancher/merge-updated-docs
Merge updated docs
2017-03-23 15:32:36 +10:00
Sven Dowideit
af5935d3f2 Merge pull request #1717 from rancher/upgrade-downgraded-os
add a test for upgrading after a rolled back upgrade
2017-03-23 15:22:11 +10:00
Sven Dowideit
2a8d8fa891 Merge pull request #1716 from rancher/alpine-install
fix for alpine's simpler blkid cmd
2017-03-23 14:41:26 +10:00
Sven Dowideit
19fcea6264 add a test for upgrading after a rolled back upgrade
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-23 04:17:21 +00:00
Sven Dowideit
ab3c508a39 fix for alpine's simpler blkid cmd
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-23 01:31:35 +00:00
Sven Dowideit
6a18025fe5 Merge pull request #1714 from SvenDowideit/arm64-build-fixes
get an arm64 rootfs
2017-03-22 12:26:48 +10:00
Sven Dowideit
2fb3c6fe3e get an arm64 rootfs
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-22 02:13:27 +00:00
Sven Dowideit
693ca3179b linux 4.9.16
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-19 05:09:35 +00:00
Sven Dowideit
c3a501d33d more merges from rancher docs repo
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-17 13:25:10 +00:00
Sven Dowideit
daed587841 merge changes from rancher docs repo
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-17 13:01:46 +00:00
Sven Dowideit
ff4b315d0c Merge pull request #1702 from rancher/v0.9.0-docs
v0.9.0-docs
2017-03-17 20:43:53 +08:00
Sven Dowideit
e5f90c5ac5 v0.9.0-docs
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-17 12:37:45 +00:00
Sven Dowideit
ff2d445039 Merge pull request #1700 from SvenDowideit/prep-release
prepare for release
2017-03-16 13:00:00 +10:00
Sven Dowideit
26c2f3cc69 debug off
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-16 02:39:24 +00:00
Sven Dowideit
5b7bb8c81f Merge pull request #1697 from SvenDowideit/rpi-build
Simplify making an rpi release
2017-03-15 18:15:52 +10:00
Sven Dowideit
7e71e4c876 Simplify making an rpi release
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-15 08:14:52 +00:00
Sven Dowideit
76054f1152 Merge pull request #1696 from rancher/release-fixes
Release fixes
2017-03-15 15:15:56 +10:00
Sven Dowideit
19157702b3 don't build this test on arm, it crashes
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-15 05:14:30 +00:00
Sven Dowideit
18e0ea81d9 Linux 4.9.15 kernel
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-15 05:14:12 +00:00
Sven Dowideit
a66463285b Merge pull request #1695 from SvenDowideit/rpi-serial-console
enable the rpi3 serial console, and autologin to it
2017-03-15 14:40:07 +10:00
Sven Dowideit
eb0c4b2982 enable the rpi3 serial console, and autologin to it
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-15 14:38:32 +10:00
Sven Dowideit
1aa8521cf8 Merge pull request #1678 from SvenDowideit/elide-cmdline
Elide cmdline
2017-03-14 18:47:01 +10:00
Sven Dowideit
bcc1aed724 Merge pull request #1694 from SvenDowideit/digital-ocean-datasource-give-up
Don't keep retrying if we can't get to the metadata, we're not doing …
2017-03-14 18:46:26 +10:00
Sven Dowideit
2de5daffe9 Don't keep retrying if we can't get to the metadata, we're not doing anything to change the result
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-14 18:45:58 +10:00
Sven Dowideit
235857d021 Merge pull request #1693 from SvenDowideit/RANCHER_BOOT_WINS
Try RANCHER_BOOT first, and if that's not preset, use rancher.state.d…
2017-03-14 16:37:34 +10:00
Sven Dowideit
1e5baa57da Try RANCHER_BOOT first, and if that's not preset, use rancher.state.dev and then RANCHER_STATE
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-14 06:28:05 +00:00
Sven Dowideit
c62c05773c Merge pull request #1692 from SvenDowideit/fix-ssh-keys-from-user-data
Use a fake cloud-config struct that only contains the NetworkConfig -…
2017-03-14 16:19:43 +10:00
Sven Dowideit
af6888020d Use a fake cloud-config struct that only contains the NetworkConfig - as arrays dont merge (yet)
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-14 16:19:11 +10:00
Sven Dowideit
4c2d21275a add an example service using EXTRA_CMDLINE
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-14 14:19:43 +10:00
Sven Dowideit
73980f9c73 save the elided cmdline into an env var
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-14 14:19:43 +10:00
Sven Dowideit
368a13ed13 Docs for the elide parts of the kernel cmdline
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-14 14:19:43 +10:00
Sven Dowideit
f6ce1f0685 Use the kernel cmdline elide patch to load config into RancherOS that isn't visible in /pro/cmdline
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-14 14:19:43 +10:00
Sven Dowideit
4981e76755 Merge pull request #1691 from SvenDowideit/cleanups
Remove some dev debug output
2017-03-14 14:07:57 +10:00
Sven Dowideit
8babf66dc4 Remove some dev debug output
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-14 13:28:17 +10:00
Sven Dowideit
8ee82f263d Merge pull request #1690 from rancher/revert-1662-new-cli
Revert "WIP New ros cli"
2017-03-14 12:12:07 +10:00
Sven Dowideit
2d92956c82 Revert "WIP New ros cli" 2017-03-14 12:11:24 +10:00
Sven Dowideit
4cd73c111e Can't ignore the docs dir, it messes with the release tag versioning
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 13:01:27 +00:00
Sven Dowideit
355859e707 golint&gofmt
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 12:56:54 +00:00
Sven Dowideit
2cd6ec4db6 move the new cli to 'os' - its very experimental atm
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 12:56:54 +00:00
Sven Dowideit
dc540a0cf0 get started on the new cli
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 12:56:54 +00:00
Sven Dowideit
93cd0877dd Initial spike on the new cmdline
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 12:56:54 +00:00
Sven Dowideit
8d941162d8 ros list shows all the active services and any cache available updates
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 12:56:54 +00:00
Sven Dowideit
23e51e3b8d set the permissions for /var/lib/rancher/conf to 0700
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 12:56:36 +00:00
Sven Dowideit
27f11ec6c2 set the permissions for /var/lib/rancher/conf to 0700
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 11:44:47 +00:00
Sven Dowideit
63c3d57993 network test fix
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 11:44:46 +00:00
Sven Dowideit
8080d01ac9 Throw error if running install / upgrade on non-amd64
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 11:44:46 +00:00
Sven Dowideit
d1d0c30924 Merge pull request #1685 from SvenDowideit/add-build-openstack-to-openstack
Add building and running openstack image to Makefile
2017-03-13 20:49:14 +10:00
Sven Dowideit
a8ade0f873 Add building and running openstack image to Makefile
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 18:44:20 +10:00
Sven Dowideit
6611eb1134 Merge pull request #1682 from SvenDowideit/dont-prompt-for-reboot-on-install-failure
Don't prompt / reboot if there was an install error
2017-03-13 17:19:11 +10:00
Sven Dowideit
e80342d369 Don't prompt / reboot if there was an install error
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 16:36:50 +10:00
Sven Dowideit
23edbd05e8 Merge pull request #1681 from SvenDowideit/linux-kernel-4.9.14-cmdline
linux kernel 4.9.14-cmdline
2017-03-13 16:16:09 +10:00
Sven Dowideit
299d59b5fc Merge pull request #1666 from SvenDowideit/refactor-cloud-init
WIP Refactor cloud init
2017-03-13 16:14:28 +10:00
Sven Dowideit
90963f8f45 fix test
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 16:13:36 +10:00
Sven Dowideit
9afc3da083 linux kernel 4.9.14-cmdline
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 16:09:26 +10:00
Sven Dowideit
be9874d2f4 use the rancher.state.dev cfg to detect where we're installing
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 05:32:45 +00:00
Sven Dowideit
8a4fa93202 lets also not replace routes :(
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 14:27:24 +10:00
Sven Dowideit
78c08c4dd9 ok, lets not remove the un-speced ip's in 0.9.0
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 14:08:03 +10:00
Sven Dowideit
d65f9518df use DHCP for aws datasource
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-13 10:56:28 +10:00
Sven Dowideit
64949bb888 WIP refactor to simplify reading
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-12 21:26:03 +10:00
Sven Dowideit
17b3589782 Add a network test that sets up 2 of 4 ehternet devices, and allows another to use dhcp
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-10 22:28:41 +10:00
Sven Dowideit
00af8545d6 remove the non-network cloud-init option
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-10 13:40:15 +10:00
Sven Dowideit
4126cdbba7 copy the network.yml over the switchroot too
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-09 09:59:47 +10:00
Darren Shepherd
e4c2271c6b Don't make IPv4LL and Addresses mutally exclusive 2017-03-09 09:01:58 +10:00
Sven Dowideit
b5fdd63a85 fix the ip/cidr, and call updateNetwork
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-08 12:03:58 +00:00
Sven Dowideit
0779e13d46 Refactor the cloud-init metadata to return a netconf.NetworkConfig
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-08 12:03:58 +00:00
Sven Dowideit
5dbb0f2a28 simplistic start
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-08 12:03:58 +00:00
Sven Dowideit
8dc2050fd8 Merge pull request #1669 from joshwget/network-container-iptables
Bind mount host iptables into network container
2017-03-08 18:00:38 +10:00
Josh Curl
cdd682429e Bind mount host iptables into network container 2017-03-07 22:02:44 -08:00
Sven Dowideit
51de09e16e Merge pull request #1668 from rancher/linux-4.9.13
linux-4.9.13
2017-03-08 13:06:18 +10:00
Sven Dowideit
42248daf60 linux-4.9.13
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-08 03:05:39 +00:00
Sven Dowideit
6d606cc52b Merge pull request #1661 from SvenDowideit/pxe-run
run your dev build using pixiecore
2017-03-07 08:47:57 +10:00
Sven Dowideit
b2e0510697 run your dev build using pixiecore
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-06 20:40:09 +10:00
Sven Dowideit
d26d20d730 Merge pull request #1655 from SvenDowideit/fail-cloud-init-datasources-based-on-error-types
Fail cloud init datasources based on error types
2017-03-06 20:37:44 +10:00
Sven Dowideit
ff98f27407 use a smaller console to test
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-06 15:02:24 +10:00
Sven Dowideit
df32dfdc70 try to debug Drone failures - I think its just timing out.
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-04 08:05:28 +00:00
Sven Dowideit
10a4c59385 Make datasource.AvailabilityChanges() able to be dynamic so fail out for configdrive mount and url 404's faster
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-04 08:05:28 +00:00
Sven Dowideit
78051c2814 treat 404 error on datasource as unrecoverable
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-04 08:05:28 +00:00
Sven Dowideit
391082fa50 refactor a little and keep the datasource errors for later
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-04 08:05:28 +00:00
Darren Shepherd
23a4d8ec76 Merge pull request #1647 from SvenDowideit/cloud-init-merge
Work towards cloud-init changes for v0.9.0
2017-03-03 22:02:53 -07:00
Sven Dowideit
8fa2d80325 use our gce metadata - it adds ssh
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-02 16:25:00 +10:00
Sven Dowideit
be2c4044ce cloudinit tests pass :)
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-28 13:58:34 +10:00
Sven Dowideit
4f177ee605 remove systemd things that so we can build ros
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-28 13:58:34 +10:00
Sven Dowideit
e2ed97648a move coreos-cloudinit into config/cloudinit
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-28 13:58:34 +10:00
Sven Dowideit
9b793b5d7c bring in latest & likely last version of coreos-cloudinit
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-28 13:25:56 +10:00
Sven Dowideit
d9ad645f6d Merge pull request #1651 from rancher/v0.8.1-docs
V0.8.1 docs
2017-02-24 11:46:17 -08:00
Sven Dowideit
f096f552d1 v0.8.1 release links
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-24 19:45:23 +00:00
Sven Dowideit
f94704a803 Initial Security page
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-24 01:11:14 +00:00
Sven Dowideit
8a7c8d7758 linux 4.9.12 plus CVE-2017-6074
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-23 21:52:34 +00:00
Sven Dowideit
8e7181e690 Merge pull request #1626 from rancher/fix-iso-cloud-config
WIP Failing test for cloud-config on iso
2017-02-21 22:12:09 -08:00
Sven Dowideit
30534a617b Merge pull request #1641 from rancher/silence-empty-cloud-init-warning-on-upgrade
Don't complain if there is no cloud-config supplied when upgrading
2017-02-21 22:10:05 -08:00
Sven Dowideit
69be7de1c4 Fix ISO based cloud-config drive
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-22 05:23:22 +00:00
Sven Dowideit
2fb7651b60 Failing test for cloud-config on iso
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-22 05:23:22 +00:00
Sven Dowideit
da74a931e6 Merge pull request #1636 from juliengk/config_set_issue_1621
Count number of args for ros config set command
2017-02-21 21:23:03 -08:00
Sven Dowideit
acc72e634e Don't complain if there is no cloud-config supplied when upgrading
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-22 05:22:38 +00:00
Sven Dowideit
f93f360ab2 Merge pull request #1642 from tylert/update-copyrights
Update copyrights, fixes #1605
2017-02-21 21:21:21 -08:00
Sven Dowideit
bb7b22a739 Merge pull request #1645 from rancher/fix-kernel-header-test
kernel services moved to system-docker
2017-02-21 21:20:00 -08:00
Sven Dowideit
fd75fd3dc7 kernel services moved to system-docker
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-22 05:19:39 +00:00
Tyler Tidman
283c4b7193 Update copyrights, fixes #1605 2017-02-21 20:19:10 -05:00
Julien Kassar
1e6d38cbf0 Count number of args for ros config set command 2017-02-17 17:23:21 -05:00
Sven Dowideit
f041ceefc5 Merge pull request #1634 from juliengk/create_home_dir
Create home dir
2017-02-18 07:50:54 +10:00
Sven Dowideit
62cef9bbd2 Merge pull request #1630 from zimme/media-volumes
Add media-volumes
2017-02-18 07:50:06 +10:00
Sven Dowideit
34d75115db Merge pull request #1635 from rancher/mount-sys-fs-selinux-ro
Looks like /sys/fs/selinux should be mounted ro
2017-02-18 07:49:02 +10:00
Julien Kassar
ff35f9a5aa Add createHomeDir function in console_init.go 2017-02-17 14:05:39 -05:00
Sven Dowideit
3133664a11 Looks like /sys/fs/selinux should be mounted ro
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-17 18:31:02 +00:00
Sven Dowideit
03532960f3 Merge pull request #1632 from juliengk/docker_env_log
Replace Sirupsen/logrus package with rancher/os/log
2017-02-18 03:23:43 +10:00
Sven Dowideit
77cd10e840 Merge pull request #1628 from juliengk/yes_issue_1597
Use of bufio instead of fmt.Scan for yes function
2017-02-18 03:21:32 +10:00
Julien Kassar
493ba98292 Replace Sirupsen/logrus package with rancher/os/log 2017-02-17 11:24:07 -05:00
Simon Fridlund
2f8aa22925 Add media-volumes
Add /media and /mnt to a new volumes service media-volumes.
2017-02-17 13:18:08 +01:00
Julien Kassar
14257bdde8 Use of bufio instead of fmt.Scan for yes function 2017-02-17 03:20:04 -05:00
Sven Dowideit
db5da1ebfe Merge pull request #1616 from rancher/linux-4.9.10
linux 4.9.10
2017-02-17 09:41:53 +10:00
Sven Dowideit
6baa1ee7bd linux 4.9.10
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-16 17:41:11 +00:00
Josh Curl
752bec258d Merge pull request #1608 from stffabi/AllowServicesWithHttpsUrls
Allow services with https urls.
2017-02-15 15:22:10 -08:00
Fabrizio Steiner
885e809019 Allow services with https urls. 2017-02-15 10:13:57 +01:00
Sven Dowideit
ebb03a8c80 Merge pull request #1604 from rancher/ecs-ami-080
ECS AMI's for 0.8.0
2017-02-15 11:37:36 +10:00
Denise
270456adfd Merge pull request #1602 from rancher/update-links-to-v0.8.0
update links to v0.8.0
2017-02-14 17:07:09 -08:00
Denise
36251dd177 Update README.md 2017-02-14 17:06:14 -08:00
Sven Dowideit
3c5b38e225 update links to v0.8.0
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-15 01:04:05 +00:00
Sven Dowideit
bdd1d745fd ECS AMI's for 0.8.0
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-15 00:57:59 +00:00
Sven Dowideit
7135ae2cdc Merge pull request #1593 from SvenDowideit/fix-alpha-sort-on-rc-numbers
hashicorp version pkg uses alpha sort on -rc11 metadata - so switchin…
2017-02-10 11:27:14 +10:00
Sven Dowideit
9a75d2d5b4 hashicorp version pkg uses alpha sort on -rc11 metadata - so switching to Josh's catalog pkg
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-10 00:38:22 +00:00
Sven Dowideit
3929481b5b linux 4.9.9
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-09 13:25:59 +00:00
Sven Dowideit
4a4f76c669 Merge pull request #1589 from rancher/fix-upgrade-from-rollback
Fix upgrading from a rolled back upgrade
2017-02-09 23:24:22 +10:00
Sven Dowideit
892a17bdbf Fix upgrading from a rolled back upgrade
and reduce the verbosity of the non-debug output

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-09 13:22:31 +00:00
Sven Dowideit
34603057a5 Merge pull request #1582 from SvenDowideit/increase-test-timeout
this test has failed on drone :/
2017-02-07 22:28:22 +10:00
Sven Dowideit
2ab211d831 Merge pull request #1507 from SvenDowideit/zfs-notes
Start updating zfs docs
2017-02-07 22:15:14 +10:00
Sven Dowideit
ee27d7e582 Merge pull request #1583 from SvenDowideit/4.9.8
linux 4.9.8
2017-02-07 21:40:42 +10:00
Sven Dowideit
6bf91a2c55 linux 4.9.8
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-07 21:40:15 +10:00
Sven Dowideit
39801ee005 this test has failed on drone :/
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-07 21:38:41 +10:00
Sven Dowideit
cd5f5d6090 Merge pull request #1577 from gizmotronic/fix-package-scripts
Restore the missing initrd artifact.
2017-02-07 21:36:39 +10:00
gizmotronic
015deae38c Restore the missing initrd artifact.
This reverts only the path-related changes in b3a9893.
2017-02-02 23:39:20 -06:00
Sven Dowideit
47491c7e41 linux 4.9.7
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-03 04:55:44 +00:00
Sven Dowideit
99267f0cce Merge pull request #1570 from SvenDowideit/0.8.0-rpi-fixes
0.8.0 rpi fixes
2017-02-03 14:39:32 +10:00
Sven Dowideit
1813c0a0d2 use the resize patched buildroot for rpi
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-03 04:38:57 +00:00
Sven Dowideit
7d3630d981 allow the rpi image build to work on rpi too
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-03 04:38:57 +00:00
Sven Dowideit
4e29df1b8a build changes needed to allow rpi release to build
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-03 04:38:57 +00:00
Sven Dowideit
6444fdc414 Merge pull request #1576 from SvenDowideit/backwards-compatibility-for-old-consoles
WIP: fix for os upgrade to 0.8.0 when running a persistent cosole
2017-02-03 14:33:53 +10:00
Sven Dowideit
5471359991 add tests!
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-03 03:47:08 +00:00
Sven Dowideit
5cd881b791 will this make console.sh for non-upgraded persistent consoles?
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-03 01:05:37 +00:00
Sven Dowideit
1f6cad6171 update because we now use detach: false
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-02-01 12:03:31 +10:00
Sven Dowideit
ff448b0b96 Merge pull request #1567 from joshwget/update-security-notice
Update security notice in README
2017-02-01 10:51:28 +10:00
Josh Curl
8bbb578b74 Update security notice in README 2017-01-31 16:40:54 -08:00
Sven Dowideit
b530a3cd95 update with the latest version of the zfs service
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-31 22:11:14 +10:00
Sven Dowideit
98bccd9eca Start updating zfs docs
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-31 22:11:14 +10:00
Sven Dowideit
06bb106199 Merge pull request #1562 from SvenDowideit/make-upgrade-more-robust
Improve and test install and upgrade robustness
2017-01-30 21:55:19 +10:00
Sven Dowideit
fc96f75c35 add upgrade with non-default console installed
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-30 21:33:54 +10:00
Sven Dowideit
83e6696fd3 Improve and test install and upgrade robustness
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-30 14:48:43 +10:00
Sven Dowideit
dd56abf725 Merge pull request #1558 from SvenDowideit/paths-are-relative-to-the-syslinux-dir
Fixes found working on packet.net upgrade
2017-01-28 01:00:20 +10:00
Sven Dowideit
35afccefdf Fixes for packet.net raid based upgrades
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-27 14:27:48 +00:00
Sven Dowideit
0d889ef9a8 Force the boot prompt so we have a little more time 2017-01-27 05:35:51 +00:00
Sven Dowideit
e51ea84439 RANCHER_BOOT doesn't contain the /boot prefx, so lets mount it that way to fake it
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-27 05:35:41 +00:00
Sven Dowideit
26ec406a04 Yep, all cfg file paths are relative to the syslinux dir, not their own location
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-27 04:50:56 +00:00
Sven Dowideit
b3a9893fcf Add version string to the initrd file so we can have 2 modern initrd's on the disk
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-27 03:50:00 +00:00
Sven Dowideit
e2992d1626 Merge pull request #1556 from SvenDowideit/linux-4.9.6
linux 4.9.6 was released
2017-01-27 12:52:32 +10:00
Sven Dowideit
b75e418f71 linux 4.9.6 was released
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-27 12:49:41 +10:00
Sven Dowideit
7add8369f9 Merge pull request #1555 from SvenDowideit/oops-qemu-memory
Didn't see it - qemu doesn't complain, it only fails in iso boot mode…
2017-01-27 12:48:54 +10:00
Sven Dowideit
7ee3c0e12f Didn't see it - qemu doesn't complain, it only fails in iso boot mode during loading the initrd
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-27 12:48:05 +10:00
Sven Dowideit
569811d1f0 Darn, that was 81 chars
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-25 09:38:45 +00:00
Sven Dowideit
8d3dc7bede Merge pull request #1550 from joshwget/run-udev-before-early-cloud-init
Run udev before early cloud-init
2017-01-25 12:39:57 +10:00
Josh Curl
61191056a7 Run udev before early cloud-init 2017-01-24 11:53:20 -08:00
Sven Dowideit
65c794ea67 Merge pull request #1545 from SvenDowideit/tweak-ascii-art
Add Ros version and TM to banner, and move dmesg console logging into respawn
2017-01-24 21:34:37 +10:00
Sven Dowideit
1b8d869199 Add Ros version and TM to banner, and move dmesg console logging into respawn
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-24 11:33:01 +00:00
Sven Dowideit
27b07dab5a Merge pull request #1535 from SvenDowideit/docker-machine-fix
b2d autoformat test and fix
2017-01-22 22:45:27 +10:00
Sven Dowideit
4e433c272f Merge pull request #1544 from SvenDowideit/linux-4.9.5
upgrade to linux 4.9.5
2017-01-22 21:23:13 +10:00
Sven Dowideit
529c1ec83b upgrade to linux 4.9.5
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-22 21:22:43 +10:00
Sven Dowideit
a4e77692c4 My first pass at fixing the b2d autoformat
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-22 06:43:04 +00:00
Sven Dowideit
1c5d41a56e Add a test for the non-tar b2d autoformat trigger
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-22 06:43:04 +00:00
Sven Dowideit
48acef5336 Merge pull request #1542 from SvenDowideit/underscore_filenames
If golint can't deal with dashes, then argh!
2017-01-22 16:42:25 +10:00
Sven Dowideit
cf1ddf2ff8 If golang can't deal with dashes, then argh!
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-22 06:34:39 +00:00
Sven Dowideit
b79173c272 Merge pull request #1541 from SvenDowideit/run-memory-arg
allow tester to over-ride the vm's memory limit
2017-01-22 16:28:46 +10:00
Sven Dowideit
3a7096f19b allow tester to over-ride the vm's memory limit
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-22 13:14:31 +10:00
Sven Dowideit
353fa604ab Merge pull request #1540 from SvenDowideit/fix-os-release
Add an integration test for os-release
2017-01-21 23:14:13 +10:00
Sven Dowideit
9670aa8505 Add an integration test for os-release
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-21 23:12:41 +10:00
Sven Dowideit
0ec9c2c0e0 Merge pull request #1532 from joshwget/fix-os-release
Fix os-release file
2017-01-21 21:42:39 +10:00
Josh Curl
f906142534 Fix os-release file 2017-01-19 10:57:18 -08:00
Sven Dowideit
a9f19b7d1d Merge pull request #1529 from rancher/revert-1511-use-1.12.6-everywhere
Revert "I've build 1.12.6 for arm&arm64 - should try it out"
2017-01-18 22:15:17 +10:00
Sven Dowideit
1be5c6c527 Revert "I've build 1.12.6 for arm&arm64 - should try it out" 2017-01-18 12:13:33 +00:00
Sven Dowideit
ac761a3973 Merge pull request #1528 from SvenDowideit/more-installer-fixes
More installer fixes
2017-01-18 14:05:17 +10:00
Sven Dowideit
ff32d2d34c avoid kmsg ratelimiting for now
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-18 03:18:43 +00:00
Sven Dowideit
fc1e4e060d Don't prompt for user input when we're not interactive
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-18 02:08:16 +00:00
Sven Dowideit
7765a3308d work around 'No help topic found' issue calling set-disk-partitions script on older RancherOS
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-18 01:44:42 +00:00
Sven Dowideit
8e5eba0ac5 add --debug logging option to installer, and a dummy set-disk-partitions
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-18 10:50:37 +10:00
Sven Dowideit
ad5fad46ee Merge pull request #1524 from SvenDowideit/fix-installer-reboot
make yN and reboot happen in the console container, not in the instal…
2017-01-17 23:02:13 +10:00
Sven Dowideit
2980684ae0 disable the DEBUG log spewing to console once the console is up - from there, its in dmesg
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-17 22:31:55 +10:00
Sven Dowideit
1761d770c9 make yN and reboot happen in the console container, not in the installer sub-container
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-17 22:13:35 +10:00
Sven Dowideit
e854d0f374 Merge pull request #1521 from SvenDowideit/fixing-installer-for-real-hw
lets make 0.5.0 work too, as its in the tests
2017-01-17 21:26:34 +10:00
Sven Dowideit
7e32fcc7d3 lets make 0.5.0 work too, as its in the tests
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-17 20:40:21 +10:00
Sven Dowideit
9a5df48213 Merge pull request #1520 from SvenDowideit/fixing-installer-for-real-hw
Real hardware installer fixes
2017-01-17 17:05:53 +10:00
Sven Dowideit
70d5495c7e Real hardware installer fixes
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-17 17:05:23 +10:00
Sven Dowideit
e59ede0a08 Merge pull request #1519 from SvenDowideit/v0.8.0-rc3-arm-fix
fix layout build script to work on arm
2017-01-17 10:23:56 +10:00
Sven Dowideit
613e740d0a Merge pull request #1518 from SvenDowideit/global.cfg
need the default global.cfg for the isoboot
2017-01-17 10:21:51 +10:00
Sven Dowideit
92277088f2 need the default global.cfg for the isoboot
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-17 10:19:27 +10:00
Sven Dowideit
35a018df42 fix layout build script to work on arm
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-16 12:01:02 +00:00
Sven Dowideit
cbac292e4d Merge pull request #1511 from SvenDowideit/use-1.12.6-everywhere
I've build 1.12.6 for arm&arm64 - should try it out
2017-01-16 15:34:25 +10:00
Sven Dowideit
d2bee16058 I've build 1.12.6 for arm&arm64 - should try it out
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-16 04:53:35 +00:00
Sven Dowideit
f4975d7361 Merge pull request #1516 from SvenDowideit/linux-4.9.4
linux 4.9.4
2017-01-16 14:15:32 +10:00
Sven Dowideit
b929c1e70b linux 4.9.4
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-16 03:38:09 +00:00
Sven Dowideit
29fc46370c Merge pull request #1456 from SvenDowideit/convert-installer-to-go
Convert installer to go
2017-01-16 13:35:48 +10:00
Sven Dowideit
4f1418d3ba disable the old upgrade test - it can't work as things are
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-16 13:04:58 +10:00
Sven Dowideit
edb8022336 fix create-installer to use the installer tarball in the iso
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-16 12:37:01 +10:00
Sven Dowideit
e5a7889ce9 make --fresh apply to the second disk too
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
6bbed5fd4c start testing the version number of our install/upgrade test
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
2a575837b2 Installing 0.7.1, and then rebooting, and doing a ros upgrade to a faked up latest works \o/
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
bdb0d32235 Add isolinux cfg files to installer, and add ros to base installer for now
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
7519325162 try to simplify logging
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
f5230f1299 add integration tests for iso boot, install and then boot from disk.
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
11e78892c1 port the use of parted to go
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
6503928fbf the os-installer base Dockerfile
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
d90217ab06 quieten the debug messages for install, fix pre-0.8.0-rc2 installer calling
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
1a0e818328 make ros install --append work
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
85bdaa6145 previous&current isolinux/syslinux cfg works for fresh install, and ... the iso only has the smaller os-installer image in it \o/
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
47eaf2bda4 can't work yet - need the host fs to have the iso mounted...
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
f5193d065a Started separating out the kernel modules from initrd, but there are some details that will delay it
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:18 +00:00
Sven Dowideit
cc78ff7bd1 make the iso run also get the ssh and cloud-init so testing the installer is easier
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:40:16 +00:00
Sven Dowideit
087bc6fd2d Convert install script to go
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-15 23:39:38 +00:00
Josh Curl
80820e610a Allow question marks in unquoted kernel parameters 2017-01-15 23:39:37 +00:00
Josh Curl
4155dee5fa Run bootstrap services even if autoformat isn't set 2017-01-15 23:39:37 +00:00
Josh Curl
19e8c841f8 Wait for device partitions in type-0 Packet instance installs 2017-01-15 23:39:37 +00:00
Sven Dowideit
62e1fdfbb6 Merge pull request #1514 from rancher/revert-1510-4.9.3
Revert "4.9.3"
2017-01-16 09:34:39 +10:00
Sven Dowideit
1ca021fc6f Revert "4.9.3" 2017-01-16 09:33:27 +10:00
Sven Dowideit
6a1b3697fe Merge pull request #1510 from SvenDowideit/4.9.3
4.9.3
2017-01-13 14:24:53 +10:00
Sven Dowideit
1dd1f19ca5 buildroot 2016.11.1-1
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-13 04:20:23 +00:00
Sven Dowideit
e7d9d71442 4.9.3 kernel
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-01-13 00:18:13 +00:00
Sven Dowideit
190749f6c1 Merge pull request #1493 from joshwget/unquoted-question-marks
Allow question marks in unquoted kernel parameters
2017-01-09 08:36:00 +10:00
Sven Dowideit
95a8aa69db Merge pull request #1492 from joshwget/run-bootstrap-services
Run bootstrap services even if autoformat isn't set
2017-01-09 08:35:04 +10:00
Darren Shepherd
98803c2345 Merge pull request #1498 from joshwget/wait-for-partitions
Wait for device partitions in type-0 Packet instance installs
2017-01-06 12:55:04 -07:00
Josh Curl
6e6f83e417 Wait for device partitions in type-0 Packet instance installs 2017-01-06 10:34:29 -08:00
Josh Curl
f5c8cc1b53 Merge pull request #1496 from Silex/master
Small fixes
2017-01-05 08:03:59 -08:00
Philippe Vaucher
8443aa43da Fix typos 2017-01-05 16:22:25 +01:00
Philippe Vaucher
a6153c37e6 Remove duplicate line in scripts/package-iso 2017-01-05 16:22:20 +01:00
Josh Curl
c6232e67aa Allow question marks in unquoted kernel parameters 2017-01-04 16:34:40 -08:00
Josh Curl
68f3b9cfda Run bootstrap services even if autoformat isn't set 2017-01-04 16:18:33 -08:00
Josh Curl
81b35c69e1 Merge pull request #1473 from killerspaz/kernel-module-docs
Updating documentation around kernel modules
2016-12-19 14:57:08 -08:00
KillerSpaz
247d3f5822 Updating documentation around kernel modules
Combined DKMS documentation with this since they're directly related.
2016-12-16 19:29:19 -06:00
Denise
15e08a2f8e Merge pull request #1471 from SvenDowideit/london-ami
London AMI
2016-12-16 13:43:14 -08:00
Sven Dowideit
ccce5e52c1 Merge pull request #1461 from SvenDowideit/generate-changelog
generate a changelog to start from
2016-12-16 21:43:09 +10:00
Sven Dowideit
b1058f3be9 Merge pull request #1472 from SvenDowideit/v0.8.0-rc2-dev
lets use linux 4.9.0 kernel
2016-12-16 21:32:34 +10:00
Sven Dowideit
1a7227aff6 Merge pull request #1469 from godp1301/fix_issue_1450
Refactored make help target
2016-12-16 21:18:50 +10:00
Sven Dowideit
c9dd9772b4 London AMI
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-12-16 20:38:18 +10:00
Philippe Godin
0cdfbc76b5 Refactored make help target
Fixes issue #1450
2016-12-15 20:07:43 -05:00
Sven Dowideit
05b8587849 Merge pull request #1448 from konsumer/master
GPT partition option
2016-12-15 10:50:49 +10:00
David Konsumer
340c0d27b6 Merge pull request #1 from SvenDowideit/konsumer-gpt
replace fdisk with parted
2016-12-14 07:57:56 -08:00
Sven Dowideit
69d1077169 gpt disk in BIOS boot mode
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-12-14 22:04:31 +10:00
Sven Dowideit
7dc719148e plain syslinux with mbr works
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-12-14 21:01:58 +10:00
Sven Dowideit
528c39f238 replace fdisk with parted
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-12-14 14:58:38 +10:00
Sven Dowideit
ee51e854ba generate a changelog to start from
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-12-13 17:09:49 +10:00
Sven Dowideit
d444edd82f Merge pull request #1459 from SvenDowideit/fix-release-upload-cmds
Fix the commanline hints to upload release
2016-12-12 13:58:36 +10:00
Sven Dowideit
38faa7073b Fix the commanline hints to upload release
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-12-12 13:58:05 +10:00
Sven Dowideit
2d955f50de lets use linux 4.9.0 kernel
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-12-12 02:49:33 +00:00
Sven Dowideit
86d810038a Merge pull request #1420 from SvenDowideit/snazzy-login-logo
Gratuituous use of ASCII art on console
2016-12-12 12:46:21 +10:00
Sven Dowideit
62fc20ae25 Gratuituous use of ASCII art on console
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-12-10 21:59:24 +10:00
Sven Dowideit
b2059859df Merge pull request #1458 from joshwget/only-set-non-empty-password
Only set rancher password if non-empty
2016-12-10 16:20:12 +10:00
Sven Dowideit
ff1ab8cfe9 Merge pull request #1433 from joshwget/cli-validation
CLI validation for services, console, and engines
2016-12-10 16:17:41 +10:00
Sven Dowideit
0a83a4d6d0 Merge pull request #1444 from tetatetit/top-level-cloud-config
Top level cloud config
2016-12-10 15:37:38 +10:00
Josh Curl
328bd5bd2e Only set rancher password if non-empty 2016-12-08 15:22:43 -08:00
Josh Curl
cc3c78663c CLI validation for services, console, and engines 2016-12-05 10:18:31 -08:00
Sven Dowideit
f1f41dffa2 Merge pull request #1452 from joshwget/symlink-commands
Move all command bind mounts to symlinks
2016-12-05 16:09:48 +10:00
Josh Curl
6bd52cea7f Move all command bind mounts to symlinks 2016-12-04 09:32:03 -08:00
David Konsumer
64ec90fe3d GPT partition option
UNTESTED: This adds a `-g` flag to select gptmbr.bin for MBR image, allowing installation on a GPT harddrive.
2016-12-02 22:50:24 -08:00
Sven Dowideit
7fa9666be9 Merge pull request #1442 from joshwget/remove-mk-initrd-script
Remove mk-initrd.sh script
2016-12-02 12:44:42 +10:00
Sven Dowideit
b431254cc4 Merge pull request #1441 from joshwget/load-modules-after-running-preparefs
Load modules after running PrepareFs
2016-12-02 12:44:18 +10:00
Denise
b54b2425bb Merge pull request #1443 from joshwget/document-module-loading
Document module loading
2016-12-01 18:37:29 -08:00
Serhiy Berezin
de1bbbea38 Merge https://github.com/rancher/os into HEAD 2016-12-02 01:17:16 +00:00
Serhiy Berezin
3cc41b0a98 ALL top level cloud-config keys as kernel args work now if prefixed with "cc.", while prefixed just with "rancher." works as well for legacy backward compat 2016-12-02 01:16:42 +00:00
Josh Curl
3346c6bc38 Document module loading 2016-12-01 13:34:04 -08:00
Josh Curl
ba5934c559 Remove mk-initrd.sh script 2016-12-01 11:42:11 -08:00
Josh Curl
40100ffa7c Load modules after running PrepareFs 2016-12-01 11:27:33 -08:00
Josh Curl
d53452a7eb Show output for modprobe calls 2016-12-01 11:16:53 -08:00
Sven Dowideit
2bcc69b59a Merge pull request #1440 from joshwget/metadata-config-export
Show SSH keys and hostname from metadata in 'ros config export'
2016-12-01 14:05:12 +10:00
Josh Curl
be5d207d5d Show SSH keys and hostname from metadata in 'ros config export' 2016-11-30 16:41:58 -08:00
Josh Curl
a425c4cc1b Merge pull request #1415 from SvenDowideit/log-to-dmesg
Log all `ros` logLevels to dmesg.
2016-11-29 20:21:51 -05:00
Sven Dowideit
4df962d4b6 make ros log to dmesg
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-30 10:51:30 +10:00
Sven Dowideit
2e03f1b706 Merge pull request #1436 from joshwget/containers-remain-running-tests
Add tests to ensure containers remain running after console switch
2016-11-30 10:38:46 +10:00
Sven Dowideit
14e548bf40 Merge pull request #1434 from joshwget/add-golint-to-build-image
Add golint to build image
2016-11-30 10:38:33 +10:00
Josh Curl
dcb0456e18 Add golint to build image 2016-11-29 14:47:34 -08:00
Josh Curl
584c4f4686 Add tests to ensure containers remain running after console switch 2016-11-29 14:46:41 -08:00
Josh Curl
20856a4171 Fix golint error 2016-11-29 14:38:47 -08:00
Josh Curl
6790e050de Merge pull request #1435 from SvenDowideit/KERNEL_VERSION
Set rancher.environment.KERNEL_VERSION from /proc/version
2016-11-29 17:37:15 -05:00
Sven Dowideit
0ac5a2d40b Set rancher.environment.KERNEL_VERSION from /proc/version
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-29 23:09:07 +10:00
Sven Dowideit
4cd20d2163 ouch
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-29 10:36:44 +10:00
Sven Dowideit
30f44f7b98 Merge pull request #1422 from SvenDowideit/newer-hypriotos-kernel-4.4.27-7
Built v0.8.0-rc1 rpi image
2016-11-29 10:32:05 +10:00
Darren Shepherd
a2e6a78c83 Merge pull request #1429 from joshwget/enable-golint
Enable golint
2016-11-28 07:40:37 -08:00
Sven Dowideit
56d465e7bf Merge pull request #1430 from SvenDowideit/v4.8.11
linux 4.8.11
2016-11-28 19:58:57 +10:00
Sven Dowideit
93745adc2d linux 4.8.11
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-28 19:58:18 +10:00
Josh Curl
feaba53aa8 Enable golint 2016-11-28 00:09:17 -08:00
Josh Curl
a7c34b9855 Fix golint errors 2016-11-28 00:06:00 -08:00
Sven Dowideit
fa1dc760f2 Merge pull request #1425 from joshwget/validation-fixes
Validation fixes
2016-11-28 09:04:30 +10:00
Sven Dowideit
f3b9c72262 Built v0.8.0-rc1 rpi image
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-28 08:59:18 +10:00
Josh Curl
f6ba07bf8b Fix validation for list of maps 2016-11-26 23:27:42 -08:00
Josh Curl
47a447cb67 Add container to write_files schema 2016-11-26 23:26:20 -08:00
Sven Dowideit
833420def2 Merge pull request #1421 from SvenDowideit/v0.8.0-rc1-dev
Changes needed to get the arm and arm64 builds working
2016-11-25 10:12:04 +10:00
Sven Dowideit
a4cf5b47b2 Changes needed to get the arm and arm64 builds working
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-25 10:10:21 +10:00
Sven Dowideit
0d7810120f Merge pull request #1395 from SvenDowideit/v0.8.0-rc1-dev
start v0.8.0-rc1 with a mainline 4.8.* Linux kernel
2016-11-24 17:11:25 +10:00
Sven Dowideit
f4948a6ae4 the integration tests need the installer tar file
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-24 16:48:00 +10:00
Sven Dowideit
540545ff74 fix the kernel-headers test for 0.8.0-rc1
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-24 16:13:09 +10:00
Sven Dowideit
67ab66f95d Add info telling me how to release
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-24 01:51:24 +00:00
Sven Dowideit
84ed484196 start 0.8.0-rc1 with a mainline 4.8.10 and new buildroot builds
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-24 01:51:24 +00:00
Josh Curl
e7071ea390 Remove unnecessary label from cloud-init service 2016-11-24 01:51:24 +00:00
Sven Dowideit
13c6c15587 Merge pull request #1414 from joshwget/remove-empty-docker-engine-arguments
Remove empty Docker engine arguments
2016-11-23 08:54:30 +10:00
Sven Dowideit
ed645bd758 Merge pull request #1413 from joshwget/fix-cloud-init-execute-volumes
Fix cloud-init-execute service volumes
2016-11-22 15:16:22 +10:00
Josh Curl
1d617f1b92 Remove empty Docker engine arguments 2016-11-21 15:18:44 -08:00
Sven Dowideit
55d7d9e555 Merge pull request #1412 from joshwget/remove-unnecessary-label
Remove unnecessary label from cloud-init service
2016-11-22 08:27:53 +10:00
Sven Dowideit
4546f19bab Merge pull request #1410 from joshwget/remove-strip
Link with '-s -w' instead of calling strip
2016-11-22 08:27:38 +10:00
Sven Dowideit
a063252e06 Merge pull request #1409 from joshwget/symlink-power-commands
Use symlinks for power commands instead of bind mounts
2016-11-22 08:27:08 +10:00
Sven Dowideit
aa781b4a51 Merge pull request #1308 from SvenDowideit/move-os-release-file
Move the os-release file to /usr/lib and softlink
2016-11-22 08:26:27 +10:00
Josh Curl
c6eba498c5 Fix cloud-init-execute service volumes 2016-11-21 11:52:21 -08:00
Josh Curl
debc6a2f8c Remove unnecessary label from cloud-init service 2016-11-21 10:33:19 -08:00
Josh Curl
b6106af3ec Merge pull request #1411 from joshwget/update-service-command-docs
Remove -d flag from ros serivice up in docs
2016-11-20 20:44:35 -08:00
Josh Curl
4abc6dd4d1 Remove -d flag from ros serivice up in docs 2016-11-20 20:19:53 -08:00
Sven Dowideit
4d9b2595b8 Merge pull request #1408 from joshwget/fix-docker-machine-ssh
Fix SSH keys for Docker Machine
2016-11-21 09:10:50 +10:00
Sven Dowideit
56aac57035 Merge pull request #1404 from SvenDowideit/add-qemu-run-iso
run the iso
2016-11-18 10:57:33 +10:00
Josh Curl
f7de33c1a5 Link with '-s -w' instead of calling strip 2016-11-17 13:53:10 -08:00
Denise
9fb6654d0e Merge pull request #1397 from SvenDowideit/some-0.8.0-docs
Add some info about creating console images
2016-11-17 10:59:43 -08:00
Josh Curl
9a34545aa9 Use symlinks for power commands instead of bind mounts 2016-11-17 09:49:27 -08:00
Sven Dowideit
432fa5636e Push the os-release file into the hostfs, and then bind mount it into our system containers
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-17 21:39:36 +10:00
Sven Dowideit
05ca9416e7 Add some info about creating console images
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-17 20:57:06 +10:00
Sven Dowideit
0a7d679866 run the iso
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-17 20:54:08 +10:00
Josh Curl
90640882b4 Fix SSH keys for Docker Machine 2016-11-16 23:36:25 -08:00
Josh Curl
67c7ba0fed Merge pull request #1406 from joshwget/update-schema
Update schema
2016-11-16 23:35:49 -08:00
Josh Curl
98f7f9e207 Update schema 2016-11-16 21:02:33 -08:00
Darren Shepherd
4d89e3f5b7 Merge pull request #1402 from joshwget/go-update-ssh-keys
Rewrite update-ssh-keys in Go
2016-11-16 17:05:24 -07:00
Darren Shepherd
4479ff5cdb Merge pull request #1364 from joshwget/early-cloud-init
Early cloud-init
2016-11-16 17:05:03 -07:00
Denise
0a8c4fa471 Merge pull request #1400 from SvenDowideit/remove-kernel-images
kernel headers and extras don't get built from os anymore
2016-11-16 14:48:16 -08:00
Josh Curl
bba93792d5 Rewrite update-ssh-keys in Go 2016-11-16 13:02:35 -08:00
Josh Curl
2b0638c95f Merge pull request #1401 from joshwget/update-schema
Update schema
2016-11-16 13:01:58 -08:00
Josh Curl
ac3cd213dc Update schema 2016-11-16 10:06:13 -08:00
Sven Dowideit
b3d62c26f7 kernel headers and extras don't get built from os anymore
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-16 13:07:38 +10:00
Sven Dowideit
8cc4850fe0 Merge pull request #1379 from joshwget/add-insecure-registry-flag
Add --insecure-registry flag to daemon arguments
2016-11-15 10:10:27 +10:00
Darren Shepherd
0187b4ff92 Merge pull request #1389 from SvenDowideit/zfs-notes
Some things i noticed while i was testing zfs
2016-11-14 07:45:13 -07:00
Sven Dowideit
ff51ea0ac8 Merge pull request #1391 from SvenDowideit/v0.7.1-dev
The cfg used to build v0.7.1
2016-11-14 23:03:48 +10:00
Sven Dowideit
9f4ffef125 Start on 0.7.1 release of amd64
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-14 12:54:14 +00:00
Sven Dowideit
64d442c2a3 Some things i noticed while i was testing zfs
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-14 22:21:40 +10:00
Denise
b35727ee95 Merge pull request #1387 from deniseschannon/071updates
071updates
2016-11-12 10:42:25 -08:00
deniseschannon
e584bfb47d Headers fix 2016-11-12 09:47:43 -08:00
deniseschannon
8031ef551a Updated based on artifacts 2016-11-12 09:45:40 -08:00
deniseschannon
3964f5be3b Updated Readme 2016-11-12 09:39:54 -08:00
deniseschannon
d59735fc79 Final v0.7.1 updates 2016-11-12 09:35:22 -08:00
Josh Curl
0c6ce15f45 Merge pull request #1386 from deniseschannon/071updates
Updates to Amazon ECS and  packet script for v0.7.1
2016-11-12 09:11:47 -08:00
deniseschannon
9f909ae54d Updates to Amazon ECS and packet script for v0.7.1 2016-11-12 08:51:28 -08:00
Josh Curl
e286b4f20b Merge pull request #1385 from joshwget/add-bootcmd-to-schema
Add bootcmd to schema
2016-11-11 15:41:19 -08:00
Josh Curl
4ca24cffc6 Add bootcmd to schema 2016-11-11 14:56:25 -08:00
Sven Dowideit
28075b2a78 Merge pull request #1373 from joshwget/validate-command
Add command to validate configuration
2016-11-10 18:34:14 +10:00
Sven Dowideit
90c9257154 Merge pull request #1380 from SvenDowideit/select-integration-test-to-run
Select a specific integration test to run
2016-11-10 13:08:27 +10:00
Sven Dowideit
1d289143fe Select a specific integration test to run
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-10 13:07:45 +10:00
Josh Curl
5fe26f3ab5 Add --insecure-registry flag to daemon arguments 2016-11-09 11:36:51 -08:00
Josh Curl
2867d31a88 Add docs to 'ros config' section 2016-11-09 11:23:20 -08:00
Josh Curl
13b34a6668 Early cloud-init 2016-11-09 11:08:30 -08:00
Josh Curl
1f1c56d0ec Add unit test that covers entire configuration 2016-11-08 11:48:45 -08:00
Josh Curl
ceaec960c4 Update schema 2016-11-08 11:48:05 -08:00
Denise
17e9ac1292 Merge pull request #1376 from joshwget/runcmd-string-values
Support string values for runcmd
2016-11-07 21:16:20 -08:00
Josh Curl
c1abc67fa8 Support string values for runcmd 2016-11-07 11:36:37 -08:00
Josh Curl
25e5ca5e4c Add command to validate configuration 2016-11-06 18:23:01 -08:00
Denise
ee16cd4311 Merge pull request #1372 from joshwget/custom-builds-section
Add 'Custom Builds' section to docs
2016-11-06 18:00:52 -08:00
Josh Curl
343824c742 Add 'Custom Builds' section to docs 2016-11-04 16:22:18 -07:00
Josh Curl
2bfef7d7a8 Merge pull request #1370 from klausenbusk/do
Add initial DigitalOcean Debian->RancherOS cloud-config.yml
2016-11-04 10:23:57 -07:00
Josh Curl
72f7f9a572 Shim to support services depending on cloud-init service 2016-11-04 10:04:30 -07:00
Kristian Klausen
284fb06636 Add initial DigitalOcean Debian->RancherOS cloud-config.yml 2016-11-04 17:48:44 +01:00
Sven Dowideit
307a966e73 Merge pull request #1357 from SvenDowideit/move-kernel-images-to-os-repo
move the kernel headers and extras images to os repo
2016-11-04 16:17:41 +10:00
Sven Dowideit
6431034285 Merge pull request #1368 from joshwget/remove-seperate-image-for-syslog
Remove seperate image for syslog
2016-11-04 12:40:53 +10:00
Josh Curl
db6475c811 Remove seperate image for syslog 2016-11-03 16:43:41 -07:00
Sven Dowideit
7d34039738 Merge pull request #1342 from joshwget/bootcmd
Implement bootcmd
2016-11-04 08:33:11 +10:00
Josh Curl
bb4ad618e1 Implement bootcmd 2016-11-03 15:06:20 -07:00
Sven Dowideit
33b6145162 Merge pull request #1360 from SvenDowideit/import-docs-for-vnext
Import docs for vnext
2016-11-03 09:39:20 +10:00
Sven Dowideit
eb3f7fc9aa Merge pull request #1355 from joshwget/host-list
Change host engine opt type to list
2016-11-03 09:39:05 +10:00
Sven Dowideit
0fa7112e75 add a little docs
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-02 15:25:43 +10:00
Sven Dowideit
6b466251ef Merge pull request #1363 from joshwget/remove-entry-script
Remove unnecessary entry.sh script
2016-11-02 15:22:12 +10:00
Sven Dowideit
b344657d0f add 'make docs' to build locally
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-02 15:19:14 +10:00
Josh Curl
84eb54e8db Remove unnecessary entry.sh script 2016-11-01 21:53:36 -07:00
Sven Dowideit
4d4c633f7e Change the README to indicate that its a devel version of the docs
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-02 12:25:03 +10:00
Sven Dowideit
a6468ddcff remove the CNAME - this is dev docs
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-02 12:17:17 +10:00
Sven Dowideit
980ee23130 import the rancherOS docs so we can write docs for the next release
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-02 12:17:17 +10:00
Sven Dowideit
ffb0735aba Merge pull request #1358 from StrongMonkey/typo
correct typo
2016-11-01 22:55:04 +10:00
Daishan Peng
35ce5cd8b5 correct typo 2016-11-01 00:10:53 -07:00
Sven Dowideit
d65f376ed9 move the kernel headers and extras images to os repo
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-01 15:56:17 +10:00
Sven Dowideit
100d85149f Merge pull request #1338 from joshwget/move-to-ros-subcommands
Move more commands to subcommands of ros
2016-11-01 12:58:51 +10:00
Josh Curl
21fb3ebfa9 Move more commands to subcommands of ros 2016-10-31 19:16:21 -07:00
Sven Dowideit
3ccba631c3 Merge pull request #1356 from joshwget/security-disclosures-note
Add note about security disclosures
2016-11-01 10:42:58 +10:00
Josh Curl
6cb3fe08e8 Add note about security disclosures 2016-10-30 14:00:58 -07:00
Josh Curl
57018249a6 Change host engine opt type to list 2016-10-30 12:07:55 -07:00
Josh Curl
7dce4d54c1 Support list types for engine opts 2016-10-29 21:22:53 -07:00
Sven Dowideit
bbf822e430 Merge pull request #1341 from joshwget/always-test-runqemu
Always assert RunQemu is successful
2016-10-26 11:35:21 -04:00
Denise
a2c0ffffdf Merge pull request #1349 from joshwget/update-final-packet-code
Update last code sent for Packet installation
2016-10-25 13:59:25 -07:00
Josh Curl
7d40c641bc Update last code sent for Packet installation 2016-10-25 13:57:55 -07:00
Darren Shepherd
b8b4ddc2ae Merge pull request #1343 from joshwget/customize-service-commands
Switch from imported libcompose service commands to customized ones
2016-10-25 11:44:50 -07:00
Josh Curl
2ae22a66fe Always assert RunQemu is successful 2016-10-23 16:23:30 -07:00
Josh Curl
3685461692 Switch from imported libcompose service commands to customized ones 2016-10-23 16:20:32 -07:00
Sven Dowideit
b767e5e1a7 Merge pull request #1320 from SvenDowideit/override-kernel
Add a way to over-ride the downloaded kernel with a local file
2016-10-21 16:44:56 -07:00
Sven Dowideit
f6576815c9 Add a way to over-ride the downloaded kernel with a local file
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-10-21 16:44:39 -07:00
Sven Dowideit
ba2c65ec19 Merge pull request #1316 from SvenDowideit/refactor-yes
Moved NewReader into yes(prompt)
2016-10-21 13:48:19 -07:00
Sven Dowideit
4057275605 Merge pull request #1336 from joshwget/hide-internal-commands
Hide internal commands
2016-10-20 15:54:55 -07:00
Denise
c9d2957d7a Merge pull request #1339 from joshwget/wait-for-network-packet
Wait for network before installing in Packet
2016-10-20 14:36:04 -07:00
Josh Curl
8ad8fbb877 Wait for network before installing in Packet 2016-10-20 14:33:03 -07:00
Denise
36ad824dd8 Update README.md 2016-10-20 14:01:03 -07:00
Denise
ed4ad24f62 Update README.md 2016-10-20 11:40:26 -07:00
Josh Curl
8665960ff2 Hide various internal commands 2016-10-20 00:19:47 -07:00
Josh Curl
1a0a6f1c0e Update vendor 2016-10-20 00:18:38 -07:00
Josh Curl
ecc832d060 Bump libcompose 2016-10-20 00:17:29 -07:00
Sven Dowideit
d7368a1a50 Merge pull request #1327 from joshwget/seperate-ssh-and-docker-checks
Seperate SSH check from Docker check in tests
2016-10-19 20:52:55 -07:00
Josh Curl
19d4be62c6 Seperate SSH check from Docker check in tests 2016-10-19 18:12:47 -07:00
Josh Curl
5ecbf19aa8 Merge pull request #1332 from joshwget/move-in-netconf-and-dfs
Move in code from netconf and docker-from-scratch
2016-10-19 17:56:30 -07:00
Josh Curl
404e21f937 Merge pull request #1272 from SvenDowideit/add-latest-and-running
Add latest and running
2016-10-19 17:37:51 -07:00
Josh Curl
11d3bd69af Merge pull request #1326 from joshwget/rewrite-scripts-in-go
Rewrite a few scripts in Go and remove unneeded services
2016-10-19 17:30:44 -07:00
Josh Curl
691f7cb42c Move in code from netconf and docker-from-scratch 2016-10-19 16:21:35 -07:00
Josh Curl
1f4d23bf50 Update vendor 2016-10-19 16:05:56 -07:00
Josh Curl
0ae29130cd Remove netconf and docker-from-scratch 2016-10-19 16:05:45 -07:00
Sven Dowideit
5278dd5015 Moved NewReader into yes(prompt)
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-10-18 14:46:32 -07:00
Sven Dowideit
892b8d4bff Merge pull request #1329 from sols1/fix-http-proxy-test
Removed "env" from "system-docker inspect docker env"
2016-10-19 03:45:57 +10:00
--get
6ce8226cf4 Removed "env" from "system-docker inspect docker env" 2016-10-17 17:28:40 -07:00
Josh Curl
a7d405991c Rewrite a few scripts in Go and remove unneeded services 2016-10-17 14:47:44 -07:00
Darren Shepherd
9755a37fe6 Merge pull request #1325 from ibuildthecloud/kernel
Kernel Ubuntu-4.4.0-42.62-rancher1-1
2016-10-14 12:21:45 -07:00
Darren Shepherd
e3df9911bc Merge pull request #1313 from joshwget/bad-state-tests
Add tests for when state fails to mount
2016-10-14 11:37:25 -07:00
Darren Shepherd
0c32665255 Merge pull request #1324 from joshwget/console-done-before-rc-local
Write /run/console-done before executing /etc/rc.local
2016-10-14 11:37:17 -07:00
Darren Shepherd
6f9bab57e3 Kernel Ubuntu-4.4.0-42.62-rancher1-1 2016-10-14 11:35:26 -07:00
Josh Curl
e608377088 Write /run/console-done before executing /etc/rc.local 2016-10-14 10:48:32 -07:00
Darren Shepherd
200052dd56 Merge pull request #1322 from ibuildthecloud/new-kernel2
kernel v4.4.24-rancher1
2016-10-13 19:10:58 -07:00
Darren Shepherd
0107f361bb kernel v4.4.24-rancher1 2016-10-13 18:38:41 -07:00
Darren Shepherd
ea86e4e087 Merge pull request #1306 from rancher/revert-1263-efi-live-boot-support
Revert "Add EFI live boot support"
2016-10-13 18:36:22 -07:00
Josh Curl
a90d93691f Add tests for when state fails to mount 2016-10-11 15:30:00 -07:00
Darren Shepherd
ddbedb9b31 Revert "Add EFI live boot support" 2016-10-10 15:23:15 -07:00
Darren Shepherd
94fd38c358 Merge pull request #1263 from deitch/efi-live-boot-support
Add EFI live boot support
2016-10-10 10:23:50 -07:00
Denise
fb6442f9bb Merge pull request #1301 from deniseschannon/versionupdate
Updated packet script to use v0.7.0-rc3
2016-10-10 00:03:40 -07:00
deniseschannon
e8ffaedb08 Updated packet script to use v0.7.0-rc3 2016-10-09 23:58:28 -07:00
Avi Deitcher
d4fbc039a7 Add support for --efi to scripts/run 2016-10-10 09:06:05 +03:00
Darren Shepherd
9654e4eaad Merge pull request #1299 from joshwget/remove-read-only-mounts
Remove read-only mounts from cloud-init-execute
2016-10-09 20:43:05 -07:00
Josh Curl
2217e88611 Remove read-only mounts from cloud-init-execute 2016-10-09 18:46:30 -07:00
Denise
4dd735bad4 Merge pull request #1295 from joshwget/tinkerbell-body-key
Add 'body' key to Tinkerbell post bodies
2016-10-06 15:44:26 -07:00
Josh Curl
4eaf18946a Add 'body' key to Tinkerbell post bodies 2016-10-06 15:35:27 -07:00
Denise
b6c103373e Merge pull request #1294 from joshwget/packet-v0.7.0-rc2
Bump Packet script to v0.7.0-rc2
2016-10-06 14:55:03 -07:00
Denise
edd9d33eaa Merge pull request #1293 from joshwget/json-likes-double-quotes
Fix invalid JSON in Tinkerbell post body
2016-10-06 14:50:52 -07:00
Josh Curl
3e3e036bda Bump Packet script to v0.7.0-rc2 2016-10-06 14:48:37 -07:00
Josh Curl
f5681217b5 Fix invalid JSON in Tinkerbell post body 2016-10-06 13:37:59 -07:00
Darren Shepherd
01970f5651 Merge pull request #1289 from joshwget/fix-tinkerbell-url
Add /phone-home to Tinkerbell URL
2016-10-06 07:36:39 -07:00
Darren Shepherd
76b360706f Merge pull request #1271 from SvenDowideit/fix-dapper-filename
Fix dapper filename
2016-10-05 21:44:16 -07:00
Sven Dowideit
61f591f56e Add latest and currently running os info to 'ros os list'
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-10-06 12:31:14 +10:00
Josh Curl
dfc9455e72 Add /phone-home to Tinkerbell URL 2016-10-05 15:58:06 -07:00
Darren Shepherd
c681c71fa6 Merge pull request #1273 from joshwget/packet-autologin
Autologin to ttyS1 in Packet
2016-10-05 14:08:18 -07:00
Darren Shepherd
805e865bfb Merge pull request #1286 from joshwget/use-system-docker-for-packet
Use System Docker during Packet install
2016-10-05 14:06:37 -07:00
Josh Curl
e89f4f27e0 Use System Docker during Packet install 2016-10-05 13:45:13 -07:00
Josh Curl
8b9edc2836 Autologin to ttyS1 in Packet 2016-10-05 00:49:00 -07:00
Darren Shepherd
897cbb9e9f Merge pull request #1270 from joshwget/new-packet-installation-script
New Packet installation script
2016-10-04 23:46:38 -07:00
Sven Dowideit
e97ad03b99 Fix dapper filename
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-10-05 09:56:28 +10:00
Josh Curl
6ace0c1b05 New Packet installation script 2016-10-04 15:33:10 -07:00
Darren Shepherd
a05e41ca6b Merge pull request #1269 from joshwget/packet-phone-home
Post to Packet phone home URL on first boot
2016-10-04 15:09:14 -07:00
Darren Shepherd
bb824a9f1b Merge pull request #1268 from joshwget/run-partprobe-after-growpart
Run partprobe after growpart
2016-10-04 15:08:39 -07:00
Josh Curl
2f2be31d8d Post to Packet phone home URL on first boot 2016-10-04 13:23:47 -07:00
Josh Curl
0a3ee71352 Run partprobe after growpart 2016-10-04 09:41:11 -07:00
Darren Shepherd
314e1a69ae Merge pull request #1266 from ibuildthecloud/version
os-base v2016.08.1-1
2016-10-03 08:12:14 -07:00
Darren Shepherd
375e38c850 os-base v2016.08.1-1 2016-10-03 07:14:25 -07:00
Avi Deitcher
cc538ad523 Align kernel command-line params for EFI via grub to BIOS via isolinux 2016-10-02 14:34:44 +03:00
Avi Deitcher
cdd3dcc99e Set the correct image builder to include EFI 2016-10-02 11:45:59 +03:00
Avi Deitcher
4b121ec3b1 Add grub-efi to Dockerfile.dapper, efi.txt instructions and base grub.cfg 2016-10-02 11:40:57 +03:00
Darren Shepherd
f56501251e Merge pull request #1261 from rancher/revert-1256-move-packet-datasource
Revert "Move Packet datasource from cloud-init-pre to cloud-init"
2016-09-30 08:31:22 -07:00
Darren Shepherd
a811132245 Revert "Move Packet datasource from cloud-init-pre to cloud-init" 2016-09-30 07:41:03 -07:00
Darren Shepherd
2122f99fce Merge pull request #1260 from joshwget/noformat-and-raid
Add noformat and RAID installer types
2016-09-30 07:32:13 -07:00
Darren Shepherd
05a43ceac0 Merge pull request #1259 from joshwget/omitempty-engineopts
Add omitempty to EngineOpts tags
2016-09-30 07:31:20 -07:00
Darren Shepherd
bdcda45a11 Merge pull request #1256 from joshwget/move-packet-datasource
Move Packet datasource from cloud-init-pre to cloud-init
2016-09-30 07:29:39 -07:00
Darren Shepherd
99420925f5 Merge pull request #1236 from joshwget/refactor-loading
Refactor how consoles and engines are loaded
2016-09-30 07:28:48 -07:00
Josh Curl
2fc1d3fa5f Add noformat and RAID installer types 2016-09-29 21:55:19 -07:00
Josh Curl
7adb6ee3a8 Add omitempty to EngineOpts tags 2016-09-29 21:47:31 -07:00
Josh Curl
395ef0b8c4 Move Packet datasource from cloud-init-pre to cloud-init 2016-09-27 11:18:24 -07:00
Josh Curl
cf998978a8 Refactor how consoles and engines are loaded 2016-09-26 22:03:06 -07:00
Darren Shepherd
5987d713a4 Merge pull request #1245 from joshwget/parse-colons-without-quotes
Colons can be parsed without quotes
2016-09-26 21:41:57 -07:00
Darren Shepherd
e5293ff926 Merge pull request #1239 from joshwget/docker-arguments-map
Use a map to configure Docker arguments
2016-09-26 21:36:36 -07:00
Darren Shepherd
3bbf46b66d Merge pull request #1240 from joshwget/enable-validate-script
Enable scripts/validate without golint
2016-09-26 21:34:54 -07:00
Josh Curl
1da9a19951 Enable scripts/validate without golint 2016-09-26 21:32:40 -07:00
Josh Curl
b65e429bb6 Run gofmt and fix vet errors 2016-09-26 21:32:37 -07:00
Darren Shepherd
5cc30c6935 Merge pull request #1167 from joshwget/go-1.7
Bump Go to 1.7.1
2016-09-26 21:30:20 -07:00
Darren Shepherd
7ac9d02614 Merge pull request #1254 from joshwget/preserve-kernel-args
Preserve custom kernel arguments when upgrading
2016-09-26 21:22:41 -07:00
Darren Shepherd
e58a6a5433 Merge pull request #1252 from joshwget/ignore-mkdir-error
Ignore error creating /var/lib/system-docker if it already exists
2016-09-26 21:22:23 -07:00
Josh Curl
1731fc5642 Preserve custom kernel arguments when upgrading 2016-09-26 17:27:53 -07:00
Josh Curl
32b2ccda1e Ignore error creating /var/lib/system-docker if it already exists 2016-09-25 20:37:55 -07:00
Josh Curl
065fe4a16e Use a map to configure Docker arguments 2016-09-25 17:55:19 -07:00
Darren Shepherd
bdf266e655 Merge pull request #1238 from joshwget/show-more-command-output
Show output for more commands in cloud-init-execute
2016-09-25 13:18:50 -07:00
Darren Shepherd
a23776f03f Merge pull request #1251 from joshwget/remove-formatzero
Remove rancher.state.formatzero kernel parameter
2016-09-25 13:16:51 -07:00
Josh Curl
133c2610d1 Remove rancher.state.formatzero kernel parameter 2016-09-25 11:39:46 -07:00
Josh Curl
c1582f5a49 Colons can be parsed without quotes 2016-09-18 16:35:32 -07:00
Josh Curl
2781eab500 Split up parseCmdline unit test 2016-09-18 16:33:22 -07:00
Josh Curl
9e14a9da5a Bump Go to 1.7.1 2016-09-15 22:03:17 -07:00
Josh Curl
605a8bf618 Update vendor 2016-09-15 16:04:11 -07:00
Josh Curl
d28dfe1e19 Add fatih/structs 2016-09-15 16:03:50 -07:00
Josh Curl
d782d0b17f Show output for more commands in cloud-init-execute 2016-09-15 10:51:26 -07:00
Darren Shepherd
a22075aef2 Merge pull request #1194 from joshwget/upgrade-tests
Upgrade tests
2016-09-14 10:51:39 -07:00
Darren Shepherd
e0110932f4 Merge pull request #1233 from joshwget/drone
Update for Drone 0.5
2016-09-14 10:51:24 -07:00
Josh Curl
2751101ebe Increase timeout for integration tests 2016-09-13 17:32:07 -07:00
Denise
1de9d2d6c7 Update README.md 2016-09-13 16:53:53 -07:00
Josh Curl
8777e477b8 Add upgrade tests 2016-09-12 21:48:26 -07:00
Josh Curl
b536e6ea35 Add functionality for installing and running a test image 2016-09-12 21:48:16 -07:00
Josh Curl
17f0ef63b9 Create installer image build artifact 2016-09-12 21:48:10 -07:00
Denise
2b622f88dc Update README.md 2016-09-11 21:27:25 -07:00
Denise
71ce9e4aa3 Update README.md 2016-09-10 21:53:32 -07:00
Darren Shepherd
e315240651 Merge pull request #1220 from joshwget/runc-exec
Use runc exec to start User Docker
2016-09-09 10:00:25 -07:00
Josh Curl
21cf86665b Use runc exec to start User Docker 2016-09-09 09:06:23 -07:00
Denise
c080cadea0 Update README.md 2016-09-07 12:04:47 -07:00
Darren Shepherd
238c393640 Merge pull request #1219 from ibuildthecloud/scripts
Small script changes
2016-09-06 11:57:46 -07:00
Darren Shepherd
d01440fe55 Small script changes 2016-09-06 11:56:05 -07:00
Darren Shepherd
9122378855 Merge pull request #1218 from ibuildthecloud/bump
Ubuntu-4.4.0-37.56-rancher1
2016-09-06 11:52:28 -07:00
Darren Shepherd
b551fad495 Ubuntu-4.4.0-37.56-rancher1 2016-09-06 11:33:18 -07:00
Denise
68e6e0ab33 Update README.md 2016-09-02 13:26:49 -07:00
Denise
bca966a3a9 Merge pull request #1196 from joshwget/update-readme
Remove note about default username/password
2016-09-02 13:26:09 -07:00
Denise
ce523d98f4 Merge pull request #1212 from deniseschannon/master
Updated for v0.6.0
2016-09-02 13:25:55 -07:00
deniseschannon
5ab3f500d6 Updated for v0.6.0 2016-09-02 13:22:29 -07:00
Darren Shepherd
70f2c8dd3a Merge pull request #1209 from joshwget/start-script-fixes
Fix typo and set output for start scripts
2016-09-01 19:39:45 -07:00
Josh Curl
3b68017af5 Fix typo and set output for start scripts 2016-09-01 17:05:24 -07:00
Darren Shepherd
2081b1be95 Merge pull request #1208 from joshwget/reduce-memory-usage
Reduce memory usage copying Docker binaries
2016-09-01 10:53:13 -07:00
Josh Curl
73d0790e30 Reduce memory usage copying Docker binaries 2016-09-01 09:56:03 -07:00
Darren Shepherd
3262aa7497 Merge pull request #1207 from ibuildthecloud/bump
Ubuntu-4.4.0-34.53-rancher1
2016-08-31 17:08:25 -07:00
Darren Shepherd
17e01a3771 Merge pull request #1205 from joshwget/execute-start-scripts-using-bash
Execute start scripts using bash
2016-08-31 16:38:03 -07:00
Darren Shepherd
4d8da95bc7 Ubuntu-4.4.0-34.53-rancher1 2016-08-31 16:36:12 -07:00
Darren Shepherd
70df9efc4c Merge pull request #1206 from ibuildthecloud/build
Add suffix to rootfs build
2016-08-31 16:27:18 -07:00
Josh Curl
d4a026dc5d Execute start scripts using bash 2016-08-31 16:18:51 -07:00
Darren Shepherd
5d02e35df7 Add suffix to rootfs build 2016-08-31 14:04:47 -07:00
Darren Shepherd
22a3722aa0 Merge pull request #1200 from joshwget/docker-conf
Modify how /var/lib/rancher/conf/docker is sourced
2016-08-29 16:40:33 -07:00
Josh Curl
258a5a173c Modify how /var/lib/rancher/conf/docker is sourced 2016-08-29 15:54:40 -07:00
Darren Shepherd
2e6f31599a Merge pull request #1199 from joshwget/fix-upgrade-console
Fix --upgrade-console flag for upgrade
2016-08-29 15:31:14 -07:00
Darren Shepherd
345aa57c80 Merge pull request #1195 from joshwget/udev-dependencies
Run udev-cold as non-detached and adjust dependencies
2016-08-29 15:02:08 -07:00
Josh Curl
0631e90ee0 Fix --upgrade-console flag for upgrade 2016-08-29 11:29:32 -07:00
Josh Curl
864990e640 Remove note about default username/password 2016-08-28 12:40:39 -07:00
Darren Shepherd
39e4bf7e5d Update for Drone 0.5 2016-08-28 12:16:21 -07:00
Josh Curl
aa10d84b75 Run udev-cold as non-detached and adjust dependencies 2016-08-28 12:15:32 -07:00
Darren Shepherd
bd904fcbda Merge pull request #1192 from joshwget/package-images-with-os-base
Package images with rancher/os-base instead of busybox
2016-08-28 12:05:43 -07:00
Darren Shepherd
b11ed7c1ef Merge pull request #1191 from joshwget/default-arm-docker
Use Docker 1.11.2 as default for arm and arm64
2016-08-28 12:04:01 -07:00
Darren Shepherd
f5be4686d5 Merge pull request #1188 from joshwget/upgrade-from-persistent-consoles
Fix upgrades from persistent consoles
2016-08-28 12:03:40 -07:00
Darren Shepherd
ec85b27621 Merge pull request #1189 from joshwget/clean-up-dockerfile
Remove python-pip and tox from Dockerfile.dapper
2016-08-28 12:02:06 -07:00
Josh Curl
c2a58aeb70 Package images with rancher/os-base instead of busybox 2016-08-26 11:42:47 -07:00
Josh Curl
c54da1924b Use Docker 1.11.2 as default for arm and arm64 2016-08-26 11:23:34 -07:00
Josh Curl
05132c0dd6 Remove python-pip and tox from Dockerfile.dapper 2016-08-25 17:42:37 -07:00
Josh Curl
bffe4e5d3e Fix upgrades from persistent consoles 2016-08-25 16:04:31 -07:00
Darren Shepherd
f64314b82f Merge pull request #1186 from ibuildthecloud/fix-respawn
Fix respawn.conf.d
2016-08-25 07:52:27 -07:00
Darren Shepherd
92e20827d8 Fix respawn.conf.d 2016-08-24 21:43:51 -07:00
Darren Shepherd
22ab564dac Merge pull request #1185 from Cougar/force-reboot
Do not ask about reboot if --force and no --no-reboot
2016-08-24 16:32:12 -07:00
Cougar
d725d99fa5 Do not ask about reboot if --force and no --no-reboot 2016-08-25 01:51:33 +03:00
Darren Shepherd
f468cdb307 Merge pull request #1184 from joshwget/docker-1.12.1
Switch to Docker 1.12.1
2016-08-24 14:48:36 -07:00
Darren Shepherd
48c40a57c5 Merge pull request #1180 from joshwget/dev-mount
Use mount command to mount /dev
2016-08-24 14:44:20 -07:00
Josh Curl
3de6cabcff Switch to Docker 1.12.1 2016-08-24 14:43:51 -07:00
Darren Shepherd
a375cf6635 Merge pull request #1182 from joshwget/symlink-docker-proxy
Symlink docker-proxy
2016-08-24 14:37:10 -07:00
Josh Curl
c0bcb61158 Symlink docker-proxy 2016-08-24 09:43:03 -07:00
Josh Curl
360b576411 Use mount command to mount /dev 2016-08-23 11:07:13 -07:00
Darren Shepherd
dcc4962fdf Merge pull request #1172 from ibuildthecloud/add-console-stuff
Make respawn slightly extensible
2016-08-22 14:51:38 -07:00
Darren Shepherd
2cfe4d289d Make respawn slightly extensible 2016-08-22 14:31:36 -07:00
Darren Shepherd
723278a440 Merge pull request #1174 from joshwget/specify-each-autologin-tty
Specify each autologin tty
2016-08-22 13:50:50 -07:00
Darren Shepherd
4bbfdadfde Merge pull request #1170 from joshwget/runcmd
Implement runcmd
2016-08-22 13:50:21 -07:00
Josh Curl
4677af8419 Implement runcmd 2016-08-22 13:22:27 -07:00
Darren Shepherd
5ffc77e797 Merge pull request #1173 from ibuildthecloud/streams
Close streams properly
2016-08-22 11:37:30 -07:00
Josh Curl
e4a94a81ef Add autologin key to scripts/run 2016-08-22 11:20:04 -07:00
Josh Curl
bbab6aa760 Specify each tty for autologin 2016-08-22 11:19:24 -07:00
Darren Shepherd
42d966bd52 Close streams properly 2016-08-22 09:55:59 -07:00
Darren Shepherd
90cefae4d8 Merge pull request #1169 from joshwget/fix-image-preloading
Fix image preloading
2016-08-22 00:08:05 -07:00
Josh Curl
5eda685ff5 Fix image preloading 2016-08-21 22:51:01 -07:00
Darren Shepherd
8d79d67ca4 Merge pull request #1168 from ibuildthecloud/checksum
Create iso checksums
2016-08-18 22:42:28 -07:00
Darren Shepherd
ecb3880846 Create iso checksums 2016-08-18 22:41:30 -07:00
Darren Shepherd
6ed44af89a Extra compression 2016-08-18 21:26:34 -07:00
Darren Shepherd
7a1609a398 Merge pull request #1160 from joshwget/use-partx
Replace partprobe with partx
2016-08-18 18:11:33 -07:00
Darren Shepherd
894aa8054b Merge pull request #1165 from joshwget/docker-1.12.0
Switch default Docker version to 1.12.0
2016-08-18 18:10:14 -07:00
Josh Curl
4edba20d24 Switch default Docker version to 1.12.0 2016-08-18 16:44:50 -07:00
Josh Curl
da69a464fb Replace partprobe with partx 2016-08-18 15:35:39 -07:00
Darren Shepherd
add2080fb2 Merge pull request #1163 from joshwget/fix-duplicate
Fix duplicate volumes_from when switching consoles
2016-08-18 15:32:38 -07:00
Darren Shepherd
31193538e6 Merge pull request #1162 from joshwget/engine-list-details
Show current/enabled/disabled in 'ros engine list'
2016-08-18 15:32:02 -07:00
Darren Shepherd
26a9331e41 Merge pull request #1157 from joshwget/autologin-key
Add rancher.autologin key
2016-08-18 15:29:19 -07:00
Darren Shepherd
8c5c3fe09d Merge pull request #1161 from ibuildthecloud/os-base
os-base v2016.05-5
2016-08-18 15:18:37 -07:00
Josh Curl
42748a2c4b Fix duplicate volumes_from when switching consoles 2016-08-18 15:05:06 -07:00
Josh Curl
11cf2a195b Show current/enabled/disabled in 'ros engine list' 2016-08-17 16:33:49 -07:00
Josh Curl
4b3198dff4 Add rancher.autologin key 2016-08-17 16:07:46 -07:00
Darren Shepherd
abbff8d89a os-base v2016.05-5 2016-08-17 14:30:55 -07:00
Darren Shepherd
be58e0a8c0 Merge pull request #1159 from joshwget/fix-typo
Fix typo writing to sshd_config
2016-08-17 09:06:56 -07:00
Darren Shepherd
69db72ffc5 Merge pull request #1156 from ibuildthecloud/acpid
Support lid close in acpid
2016-08-17 09:06:47 -07:00
Josh Curl
b04536e55f Fix typo writing to sshd_config 2016-08-16 22:02:26 -07:00
Darren Shepherd
be49936400 Support lid close in acpid 2016-08-16 21:19:55 -07:00
Darren Shepherd
a81be13f82 Merge pull request #1120 from ibuildthecloud/kernel2
Bump kernel version
2016-08-16 21:07:49 -07:00
Darren Shepherd
c386353481 Merge pull request #1155 from joshwget/home-directory-permissions
Correct permissions on home directory
2016-08-16 21:05:29 -07:00
Darren Shepherd
2631eb118c Merge pull request #1158 from joshwget/restore-storage-driver-build-warning
Restore storage driver build warning
2016-08-16 18:33:12 -07:00
Josh Curl
9d603a6388 Restore storage driver build warning 2016-08-16 16:33:33 -07:00
Josh Curl
65468736df Correct permissions on home directory 2016-08-16 16:25:01 -07:00
Darren Shepherd
33c5060e45 Merge pull request #1152 from joshwget/remove-dfs-binaries
Strip more Docker binaries from DFS image
2016-08-16 15:48:25 -07:00
Darren Shepherd
d90d9b7f19 Bump kernel version 2016-08-16 15:47:28 -07:00
Josh Curl
455e36bb0e Strip more Docker binaries from DFS image 2016-08-16 14:09:47 -07:00
Darren Shepherd
6abdeb34d6 Merge pull request #1143 from joshwget/better-engine-switching
Make it easier to switch between Docker engines
2016-08-15 21:21:23 -07:00
Josh Curl
80c72d0761 Make it easier to switch between Docker engines 2016-08-15 15:06:26 -07:00
Darren Shepherd
3fb47bcc47 Merge pull request #1150 from joshwget/improved-mounts
Use the mount command to apply cloud-config mounts
2016-08-15 14:03:51 -07:00
Darren Shepherd
e827095b94 Merge pull request #1148 from joshwget/remove-rancheros-install-script
Remove rancheros-install script
2016-08-15 14:03:36 -07:00
Josh Curl
d4801494a1 Use the mount command to apply cloud-config mounts 2016-08-15 13:01:40 -07:00
Darren Shepherd
64711f9e66 Merge pull request #1147 from joshwget/write-files-enhancements
Extend write_files to run in all system services
2016-08-15 11:42:48 -07:00
Josh Curl
7890844e47 Remove rancheros-install script 2016-08-15 11:25:11 -07:00
Josh Curl
0a053c62ab Extend write_files to run in all system services 2016-08-15 11:14:50 -07:00
Darren Shepherd
14040ba772 Merge pull request #1145 from joshwget/split-cloud-init
Split cloud-init into cloud-init-execute and cloud-init-save
2016-08-15 11:06:58 -07:00
Josh Curl
6658917591 Bump codegangsta/cli 2016-08-14 19:57:08 -07:00
Josh Curl
c67475cbaa Rewrite console.sh and docker-init in Go 2016-08-12 11:40:56 -07:00
Josh Curl
889cb9eea8 Split cloud-init into cloud-init-execute and cloud-init-save 2016-08-04 15:47:12 -07:00
Denise
7601fae952 Merge pull request #1141 from aemneina/master
updating readme doc
2016-08-02 16:07:02 -07:00
Ahmad E
d69915040d updating readme doc 2016-08-02 15:50:17 -07:00
Darren Shepherd
e5f1f299f0 Merge pull request #1138 from joshwget/add-ros
Bind mount ros in udev-autoformat and udev-cold
2016-08-01 15:46:54 -07:00
Darren Shepherd
b1368b27fc Merge pull request #1139 from mrajashree/PRETTY_NAME_issue
Version in PRETTY_NAME
2016-08-01 15:46:22 -07:00
rajashree
f703b8d396 Adds version to PRETTY_NAME 2016-08-01 13:49:22 -07:00
Josh Curl
25628b7df4 Bind mount ros in udev-autoformat and udev-cold 2016-07-31 19:48:10 -07:00
Darren Shepherd
782f9059ba Merge pull request #1128 from joshwget/state-refactoring
Refactor state
2016-07-28 19:03:58 -07:00
Josh Curl
6b4222888c Refactor state 2016-07-27 23:25:08 -07:00
Josh Curl
1877cfa16b Fix some tests 2016-07-26 15:40:35 -07:00
Darren Shepherd
3700ba4726 Merge pull request #1116 from imikushin/unesc-proc-cmdline
Unescape kernel params
2016-07-21 23:07:22 -07:00
Darren Shepherd
ad6c25e0cc Merge pull request #1123 from joshwget/no-pull-flag
Add --no-pull flag to 'ros console switch'
2016-07-21 23:06:10 -07:00
Josh Curl
83332ceade Add --no-pull flag to 'ros console switch' 2016-07-21 10:25:32 -07:00
Darren Shepherd
c1cd100dae Merge pull request #1122 from joshwget/refactor-integration-tests
Refactor integration tests
2016-07-20 20:28:22 -07:00
Josh Curl
0c7fb4f1f9 Refactor integration tests 2016-07-20 10:42:16 -07:00
Darren Shepherd
df6d77fff7 Merge pull request #1121 from ibuildthecloud/vendor
Bump cniglue
2016-07-19 19:22:33 -07:00
Darren Shepherd
eec5363a20 Bump cniglue 2016-07-19 18:59:55 -07:00
Ivan Mikushin
22887dfb0b Unescape kernel params
so kernel params like rancher.cloud_init.datasources='["url:http://10.0.2.2:8800/cc.yml"]' could be used
2016-07-15 15:03:17 -07:00
Darren Shepherd
b882a7c049 Merge pull request #1103 from joshwget/bump-selinux-policy
Bump SELinux policy
2016-07-08 11:24:14 -07:00
Josh Curl
da80b76883 Bump SELinux policy 2016-07-07 10:04:10 -07:00
Denise
579991f458 Update README.md 2016-07-01 23:43:04 -07:00
Denise
bbf5735e9e Update README.md 2016-07-01 23:30:05 -07:00
Darren Shepherd
0f4640ec57 Merge pull request #1081 from joshwget/remove-suffix-from-core-repo
Remove SUFFIX from core repo
2016-07-01 13:33:20 -07:00
Darren Shepherd
2846f26e5b Merge pull request #1082 from ibuildthecloud/rpi3
Fix rootfs build for ARM
2016-07-01 13:33:12 -07:00
Darren Shepherd
16ea661b6b Fix rootfs build for ARM 2016-07-01 13:32:43 -07:00
Josh Curl
321318819c Remove SUFFIX from core repo 2016-07-01 10:13:52 -07:00
Darren Shepherd
fd8e1dedb5 Merge pull request #1076 from joshwget/remove-raspberry-pi-version
Remove version from Raspberry Pi artifacts
2016-06-30 22:01:21 -07:00
Darren Shepherd
f98e3efad2 Merge pull request #1077 from joshwget/update-console-switch-warning
Update console switch warning
2016-06-30 21:51:07 -07:00
Darren Shepherd
8c8b5ed418 Merge pull request #1078 from imikushin/dont-lose-ssh-keys
Do not lose ssh keys from metadata if there are no ssh keys in cloud-config
2016-06-30 21:50:22 -07:00
Darren Shepherd
55c3dd57d1 Merge pull request #1079 from joshwget/log-upgrade-once
Only log once during upgrade
2016-06-30 21:50:13 -07:00
Josh Curl
9b7b6ebe4a Remove version from Raspberry Pi artifacts 2016-06-30 17:23:12 -07:00
Josh Curl
25768888a5 Only log once during upgrade 2016-06-30 16:28:32 -07:00
Ivan Mikushin
b6edde6052 Do not lose ssh keys from metadata if there are no ssh keys in cloud-config 2016-06-30 14:21:41 -07:00
Josh Curl
78fc0d15cc Update console switch warning 2016-06-30 14:02:04 -07:00
Darren Shepherd
b79533c7f9 Merge pull request #1072 from ibuildthecloud/add-udev-to-installer
Add udev back to the installer
2016-06-29 23:52:38 -07:00
Darren Shepherd
7dfece8f3d Add udev back to the installer 2016-06-29 23:51:05 -07:00
Darren Shepherd
7ab3755d79 Merge pull request #1069 from ibuildthecloud/arm-fixes
Various fixes for ARM build
2016-06-29 23:48:56 -07:00
Darren Shepherd
70bf02df1f Various fixes for ARM build 2016-06-29 23:03:28 -07:00
Darren Shepherd
e03dbe77e8 Merge pull request #1071 from imikushin/restore-justice
Copyright comment cleanup
2016-06-29 23:02:05 -07:00
Darren Shepherd
475cc88cea Merge pull request #1070 from joshwget/dhcpcd-clientid
Switch dhcpcd to use clientid rather than duid
2016-06-29 22:58:43 -07:00
Ivan Mikushin
2264aa8230 Copyright comment cleanup
Add back the copyright notice
2016-06-29 22:50:22 -07:00
Josh Curl
68aaa20d3c Switch dhcpcd to use clientid rather than duid 2016-06-29 22:45:07 -07:00
Darren Shepherd
0b4e99e1e6 Merge pull request #1068 from imikushin/gce-fix
Fix fetching SSH authorized keys from GCE
2016-06-29 22:22:49 -07:00
Ivan Mikushin
e6a550d786 Fix fetching SSH authorized keys from GCE 2016-06-29 20:35:49 -07:00
Darren Shepherd
93b4949cce Merge pull request #1067 from joshwget/fix-invalid-auth-panic
Pass non-nil PrivilegeFunc to ImagePull
2016-06-29 20:09:31 -07:00
Josh Curl
b9eba9d290 Pass non-nil PrivilegeFunc to ImagePull 2016-06-29 20:05:23 -07:00
Darren Shepherd
e4e07ec278 Merge pull request #1063 from joshwget/fix-console-warning-message
Console switch warning based on running console and not enabled console
2016-06-29 20:03:16 -07:00
Darren Shepherd
e24cad0a5e Merge pull request #1066 from joshwget/suffix-version-environment
Add SUFFIX and VERSION to rancher.environment
2016-06-29 20:03:05 -07:00
Josh Curl
ac1269a222 Add SUFFIX and VERSION to rancher.environment 2016-06-29 18:39:12 -07:00
Josh Curl
92b24d9790 Console switch warning based on running console and not enabled console 2016-06-29 00:52:38 -07:00
Darren Shepherd
6b47d33df2 Merge pull request #1059 from ibuildthecloud/release
Release
2016-06-28 21:42:27 -07:00
Darren Shepherd
dd4f348592 Skip integration tests in release 2016-06-28 21:41:40 -07:00
Darren Shepherd
ddff0d3e6f rancher/docker:v1.11.2-1 2016-06-28 21:41:13 -07:00
Darren Shepherd
afb8806cb6 Merge pull request #1057 from ibuildthecloud/cni
Add CNI networking to system-docker
2016-06-28 16:05:11 -07:00
Darren Shepherd
e360f6cd6a Merge pull request #1058 from ibuildthecloud/installer-size
Shrink installer a tiny bit
2016-06-28 15:58:21 -07:00
Darren Shepherd
b0c6ad709c Merge pull request #1056 from joshwget/respect-customization
Fix two instances where customization isn't respected
2016-06-28 15:44:08 -07:00
Darren Shepherd
9abb58641d Merge pull request #1055 from joshwget/ros-console-list-details
Add details to 'ros console list'
2016-06-28 15:36:44 -07:00
Darren Shepherd
0323844ca6 Add CNI networking to system-docker 2016-06-28 15:34:26 -07:00
Darren Shepherd
327aa0964c Shrink installer a tiny bit 2016-06-28 15:28:51 -07:00
Josh Curl
b09c09edf4 Fix two instances where customization isn't respected 2016-06-28 14:35:51 -07:00
Josh Curl
8f8dec51ea Add details to 'ros console list' 2016-06-28 11:18:26 -07:00
Darren Shepherd
d8fc2a7401 Merge pull request #1051 from joshwget/dns-patch-build-tag
Go DNS patch based on build tag
2016-06-27 20:38:14 -07:00
Josh Curl
d0607ee68f Go DNS patch based on build tag 2016-06-27 20:05:44 -07:00
Darren Shepherd
38bc8ac90d Merge pull request #1047 from datawolf/fix-multi-arch-releases
Fix multi-arch support for releases
2016-06-27 14:52:00 -07:00
Wang Long
f2187f1bf8 Fix multi-arch support for releases
Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-06-27 20:47:28 +08:00
Darren Shepherd
116c147620 Merge pull request #1042 from joshwget/swap
Add swap support in cloud config mounts
2016-06-22 22:31:22 -07:00
Josh Curl
128c228ff5 Add swap support in cloud config mounts 2016-06-22 21:50:29 -07:00
Darren Shepherd
b22c075b95 Merge pull request #1033 from joshwget/sysctl-cloud-config
Add sysctl support in cloud config
2016-06-18 21:31:42 -07:00
Josh Curl
921c00c8ea Add sysctl support in cloud config 2016-06-17 23:05:45 -07:00
Darren Shepherd
eb0c262ef7 Merge pull request #1031 from joshwget/remove-rkt-support
Remove rkt support
2016-06-17 20:12:11 -07:00
Darren Shepherd
fc2acacab5 Merge pull request #1032 from joshwget/remove-old-trash-config
Remove trash.yml
2016-06-17 20:11:35 -07:00
Josh Curl
cdff94c07f Remove trash.yml 2016-06-17 16:49:46 -07:00
Josh Curl
73ea4c9bcd Remove rkt support 2016-06-17 16:49:12 -07:00
Darren Shepherd
50f334281f Merge pull request #1028 from ibuildthecloud/new-kernel
Ubuntu-4.4.0-23.41-rancher2-2
2016-06-17 14:29:33 -07:00
Darren Shepherd
9922786748 Merge pull request #1022 from joshwget/update-selinux-files
Update SELinux config files in installer
2016-06-17 13:24:37 -07:00
Darren Shepherd
a164f385ba Ubuntu-4.4.0-23.41-rancher2-2 2016-06-17 13:24:14 -07:00
Darren Shepherd
3cdbf2ef0c Merge pull request #1029 from joshwget/debug-flag-changes
Make rancher.debug control bootstrap Docker and turn on log
2016-06-17 10:51:57 -07:00
Darren Shepherd
0392f124cf Merge pull request #1030 from joshwget/remove-second-exec-start
Remove second exec start in User Docker
2016-06-17 10:51:21 -07:00
Josh Curl
65bff509e0 Remove second exec start in User Docker 2016-06-17 09:50:36 -07:00
Josh Curl
07cc5a430a Make rancher.debug control bootstrap Docker and turn on log 2016-06-17 09:41:33 -07:00
Darren Shepherd
e058c82515 Merge pull request #1027 from ibuildthecloud/foo4
Make /run shared, also don't rshare in initrd
2016-06-17 09:37:01 -07:00
Josh Curl
45712bef22 Update SELinux files in installer 2016-06-17 09:13:40 -07:00
Darren Shepherd
b514eb9e12 Merge pull request #1025 from ibuildthecloud/foo2
Build script updates
2016-06-17 08:34:27 -07:00
Darren Shepherd
17bb7cf6ee Merge pull request #1024 from ibuildthecloud/foo
Remove errors around IP forwarding not enabled
2016-06-17 08:18:08 -07:00
Darren Shepherd
ecc8482666 Make /run shared, also don't rshare in initrd 2016-06-17 08:04:35 -07:00
Darren Shepherd
2a60981b09 Build script updates
Always compress with gzip unless we are doing a release.  Also download
rootfs.tar to ${DOWNLOAD} so `dapper -m bind` works better.
2016-06-17 08:00:33 -07:00
Darren Shepherd
34198b8674 Merge pull request #1023 from joshwget/fix-image-preloading
Move preload directories and call wait-for-docker
2016-06-17 07:58:09 -07:00
Darren Shepherd
395b855871 Remove errors around IP forwarding not enabled 2016-06-17 07:55:32 -07:00
Josh Curl
9e82d7d768 Move preload directories and call wait-for-docker 2016-06-16 23:13:17 -07:00
Darren Shepherd
b6ddb4f577 Merge pull request #1021 from joshwget/remove-some-images
Remove a few images
2016-06-16 14:59:06 -07:00
Josh Curl
0d05948fc8 Remove a few images 2016-06-16 14:26:06 -07:00
Darren Shepherd
21fce533b8 Merge pull request #1019 from joshwget/console-switch-warning
Warn when attempting to switch to the same console
2016-06-16 11:11:11 -07:00
Darren Shepherd
9dee6f4d59 Merge pull request #1020 from joshwget/validate-ros-config-set
Validate value for 'ros config set'
2016-06-16 11:10:48 -07:00
Josh Curl
f850e151de Validate value for 'ros config set' 2016-06-16 10:14:52 -07:00
Josh Curl
a9e34206bc Warn when attempting to switch to the same console 2016-06-16 09:54:12 -07:00
Darren Shepherd
d797d587ab Merge pull request #1017 from ibuildthecloud/foo
Revert "Revert "/media and /mnt mounted as shared for console""
2016-06-15 17:39:20 -07:00
Darren Shepherd
924e4b8aae /media and /mnt mounted as shared for console 2016-06-15 16:45:05 -07:00
Darren Shepherd
c138ecb54d Merge pull request #1016 from ibuildthecloud/two-containerd
Fix containerds stomping on each other
2016-06-15 16:40:59 -07:00
Darren Shepherd
01c3adc31b Merge pull request #1015 from joshwget/resolve-device
Revolve device before performing cloud config mount
2016-06-15 16:34:19 -07:00
Darren Shepherd
e1a63c80f3 Fix containerds stomping on each other 2016-06-15 16:33:27 -07:00
Josh Curl
445d35e33e Revolve device before performing cloud config mount 2016-06-15 14:20:06 -07:00
Darren Shepherd
e98fc80d12 Merge pull request #1013 from joshwget/additional-mounts
Additional mounts can be set in cloud config
2016-06-14 15:46:41 -07:00
Darren Shepherd
82ca0def35 Merge pull request #1012 from joshwget/merge-input-flag
Add --input flag to ros config merge
2016-06-14 15:46:14 -07:00
Josh Curl
f24facc06c Additional mounts can be set in cloud config 2016-06-14 15:25:56 -07:00
Josh Curl
d205af4abf Add --input flag to ros config merge 2016-06-14 15:05:12 -07:00
Darren Shepherd
a002939a3f Merge pull request #1011 from imikushin/fix-installer
Fix installer build
2016-06-14 11:26:08 -07:00
Ivan Mikushin
a640bdb758 Fix installer build 2016-06-14 10:29:38 -07:00
Darren Shepherd
07d475cecb Merge pull request #1010 from joshwget/merge-v0.5
Merge v0.5 branch
2016-06-13 23:39:20 -07:00
Josh Curl
e4019385aa Merge remote-tracking branch 'origin/v0.5' into HEAD 2016-06-13 22:00:34 -07:00
Denise
6d3ac8d734 Merge pull request #1008 from joshwget/legacy-labels
Support legacy Docker Compose labels
2016-06-13 18:36:46 -07:00
Josh Curl
313cdb7e24 Support legacy Docker Compose labels 2016-06-13 17:53:36 -07:00
Denise
30d988d5b0 Merge pull request #996 from joshwget/console-switch-changes
Console switch changes
2016-06-13 17:50:50 -07:00
Darren Shepherd
0d3b1edd4d Merge pull request #992 from imikushin/arm64-kernel
use latest arm64 kernel build
2016-06-13 17:13:20 -07:00
Darren Shepherd
025e555fde Merge pull request #998 from imikushin/fix-iso-build
Fix building the iso
2016-06-13 17:12:57 -07:00
Ivan Mikushin
4f9cc68175 use latest arm64 kernel build
for v0.5 branch
2016-06-13 16:01:34 -07:00
Darren Shepherd
10a179cbbd Merge pull request #1000 from rancher/revert-987-foo
Revert "/media and /mnt mounted as shared for console"
2016-06-13 15:02:45 -07:00
Josh Curl
a5273d922e Revert "/media and /mnt mounted as shared for console" 2016-06-13 14:53:47 -07:00
Ivan Mikushin
9afb667cf4 Fix building the iso 2016-06-13 14:42:10 -07:00
Darren Shepherd
af52052758 Merge pull request #987 from ibuildthecloud/foo
/media and /mnt mounted as shared for console
2016-06-13 13:58:57 -07:00
Darren Shepherd
42ef7c062a Merge pull request #994 from joshwget/fix-network-caching
Fix network caching
2016-06-13 13:30:14 -07:00
Darren Shepherd
3837e789aa Merge pull request #993 from imikushin/dockerignore-tmp
add tmp to .dockerignore
2016-06-13 10:48:53 -07:00
Darren Shepherd
9b4bcfea50 Merge pull request #995 from joshwget/bump-os-base
Bump os-base
2016-06-13 10:48:36 -07:00
Josh Curl
c4c8ec402c Add 'ros console enable' command 2016-06-12 22:28:24 -07:00
Josh Curl
3153c28e86 Support switching to the default console 2016-06-12 12:02:07 -07:00
Josh Curl
7f7d8765ca New console label to handle switching between persistent consoles 2016-06-10 10:54:10 -07:00
Josh Curl
abfb45401a Update console switch warning message 2016-06-10 10:54:06 -07:00
Josh Curl
9f7e6a19ab Add --force flag to console switch 2016-06-10 10:54:02 -07:00
Josh Curl
02cfe37d30 Bump os-base 2016-06-09 16:46:35 -07:00
Josh Curl
b436cdff4d Fix network caching 2016-06-09 16:27:47 -07:00
Ivan Mikushin
a938f4375f add tmp to .dockerignore
let's please add tmp to .dockerignore: it's in .gitignore and I've got a boatload of stuff there, for my local testing
2016-06-09 15:59:58 -07:00
Darren Shepherd
77612b87c5 Merge pull request #989 from joshwget/more-service-logging
Enable logging in more ros command services
2016-06-07 22:01:30 -07:00
Darren Shepherd
9dc25fc411 Merge pull request #988 from joshwget/user-docker-improvements
Various User Docker improvements
2016-06-07 22:01:19 -07:00
Josh Curl
b279fa85f6 Enable logging in more ros command services 2016-06-07 19:19:18 -07:00
Josh Curl
3b8b47f103 Various User Docker improvements 2016-06-07 18:59:45 -07:00
Darren Shepherd
f410c678ba Make shared mount work in an initrd 2016-06-07 18:01:49 -07:00
Darren Shepherd
438a437459 Cleanup scripts for error handling 2016-06-07 17:24:17 -07:00
Josh Curl
9f0074c398 /media and /mnt mounted as shared for console 2016-06-07 12:09:10 -07:00
Darren Shepherd
3728a328ea Merge pull request #985 from ibuildthecloud/scripts-2
Various changes
2016-06-07 12:08:19 -07:00
Darren Shepherd
90224d5fcd Append to /var/log/docker.log and /var/log/system-docker.log 2016-06-07 11:21:54 -07:00
Darren Shepherd
c8fd1bc665 Pick vmlinuz then vmlinux 2016-06-07 11:21:28 -07:00
Darren Shepherd
751b71564e Add /usr/local/bin or /opt/bin to PATH for docker-init 2016-06-07 11:21:27 -07:00
Darren Shepherd
57a2f99484 Optimize scripts for slow disks 2016-06-07 11:21:27 -07:00
Darren Shepherd
e1d29fbab7 Bring back installer 2016-06-07 11:21:27 -07:00
Darren Shepherd
ac0f317bf8 Build script updates 2016-06-07 11:21:27 -07:00
Darren Shepherd
29c6aac571 Merge pull request #986 from joshwget/bump-netconf
Bump netconf
2016-06-07 11:21:02 -07:00
Josh Curl
09b4b202b2 Bump netconf 2016-06-07 11:14:06 -07:00
Darren Shepherd
7ec73416c8 Merge pull request #976 from joshwget/cloud-config-resize
Replace resize system service with cloud config option
2016-06-07 11:00:32 -07:00
Josh Curl
9658d3bffd Replace resize system service with cloud config option 2016-06-07 09:53:41 -07:00
Darren Shepherd
4d5e77f0d6 Merge pull request #981 from joshwget/fix-rancher-log
Fix 'rancher.log'
2016-06-06 17:48:40 -07:00
Darren Shepherd
80f10b6580 Merge pull request #983 from ibuildthecloud/kernel
Kernel Ubuntu-4.4.0-23.41-rancher2
2016-06-06 17:48:34 -07:00
Josh Curl
4cb1d26cf9 Fix 'rancher.log' 2016-06-06 15:31:34 -07:00
Darren Shepherd
355095d41f Kernel Ubuntu-4.4.0-23.41-rancher2 2016-06-06 15:27:55 -07:00
Darren Shepherd
cd76d85aea Merge pull request #980 from joshwget/first-class-consoles
First class consoles
2016-06-06 15:27:23 -07:00
Josh Curl
719d255636 First class consoles 2016-06-06 15:13:15 -07:00
Darren Shepherd
f22c692529 Merge pull request #975 from imikushin/tls
Disable docker server TLS cert auto-generation
2016-06-06 12:43:19 -07:00
Darren Shepherd
b83f0ec092 Merge pull request #971 from ibuildthecloud/1.11.1
1.11.2
2016-06-06 11:04:29 -07:00
Ivan Mikushin
41f333d0ff Disable docker server TLS cert auto-generation
Because users should be explicit about their docker TLS certs.
Also, re-generate the key and cert files when `ros tls gen` is run (used to be cached).
2016-06-06 10:27:03 -07:00
Darren Shepherd
82666d779e Fix tests 2016-06-06 10:17:21 -07:00
Darren Shepherd
c9c095f202 Build script 2016-06-06 08:08:04 -07:00
Darren Shepherd
03db5d1058 Update vendor/ 2016-06-06 08:08:00 -07:00
Darren Shepherd
8ab32c820f Docker 1.11.1 2016-06-03 11:38:25 -07:00
Darren Shepherd
43f90b8e61 Merge pull request #978 from imikushin/gce-cloud-config
Use GCE metadata service
2016-06-02 20:55:12 -06:00
Ivan Mikushin
c5fb496a5d use gce metadata service to get user-data and other metadata 2016-06-02 19:49:21 -07:00
Ivan Mikushin
bb89c44b99 vendor coreos-cloudinit v1.11 (patched) 2016-06-02 19:49:21 -07:00
Darren Shepherd
7c0b5ea1c4 Merge pull request #977 from imikushin/console-tweaks
Bump ubuntu-console to 16.04, add man
2016-06-02 20:47:27 -06:00
Darren Shepherd
8bb4517b9c Merge pull request #953 from joshwget/registry-credentials
Support registry credentials in cloud config
2016-06-02 20:45:53 -06:00
Ivan Mikushin
5c7482e5fd Bump ubuntu-console to 16.04
Also, minor image cleanups (use cached layers to build faster).
2016-06-02 19:38:09 -07:00
Darren Shepherd
7c6fa3f0b6 Merge pull request #955 from imikushin/upgrade-flow
ros os upgrade: ask for confirmation first, then download and upgrade
2016-06-02 20:15:37 -06:00
Josh Curl
adb5635186 Support registry credentials in cloud config 2016-06-02 19:00:42 -07:00
Darren Shepherd
4ab3162ed8 Merge pull request #973 from joshwget/remove-unneeded-code
Remove unneeded service processing code
2016-06-02 19:28:17 -06:00
Darren Shepherd
71c8f40ffe Merge pull request #972 from joshwget/boot-with-invalid-config
Fix boot issues due to invalid configs
2016-06-02 19:27:23 -06:00
Darren Shepherd
5659173628 Merge pull request #962 from joshwget/atomic-writes
Atomic writes
2016-06-02 19:26:44 -06:00
Darren Shepherd
6e2f8e5940 Merge pull request #921 from joshwget/default-key
Move default hostname and network under common key
2016-06-02 19:22:00 -06:00
Josh Curl
4f48569cb2 Atomic writes 2016-06-02 14:32:26 -07:00
Josh Curl
55d629b980 Remove unneeded service processing code 2016-06-02 09:01:00 -07:00
Josh Curl
08f40ad3e7 Fix boot issues due to invalid configs 2016-06-01 18:41:55 -07:00
Josh Curl
e51c5409aa Move default hostname and network under common key 2016-05-31 22:27:04 -07:00
Darren Shepherd
97344cc535 Merge pull request #970 from joshwget/bump-libcompose
Bump libcompose and sync dependencies
2016-05-31 22:23:01 -07:00
Darren Shepherd
6fd0beda35 Merge pull request #969 from ibuildthecloud/scripts
More build script changes
2016-05-31 22:11:02 -07:00
Josh Curl
7ea6dfbe07 Bump libcompose and sync dependencies 2016-05-31 22:01:53 -07:00
Darren Shepherd
5bf4d2c117 More build script changes 2016-05-31 21:11:03 -07:00
Darren Shepherd
742c9a9401 Merge pull request #967 from ibuildthecloud/madness
Update vendor
2016-05-31 19:06:14 -07:00
Darren Shepherd
e5ae33b4ed Merge pull request #968 from joshwget/fix-private-export
Fix --private flag for 'ros config export'
2016-05-31 18:34:40 -07:00
Darren Shepherd
a14846152b Update vendor 2016-05-31 18:14:32 -07:00
Josh Curl
a59ec33787 Fix --private flag for 'ros config export' 2016-05-31 18:10:56 -07:00
Darren Shepherd
410dfbe0fd Merge pull request #922 from joshwget/simplify-configuration
Simplify configuration
2016-05-31 15:56:14 -07:00
Josh Curl
95d8ebe146 Simplify configuration 2016-05-31 14:34:04 -07:00
Darren Shepherd
00824cebca Merge pull request #958 from joshwget/network-retries
Replace wait-for-network services with retries
2016-05-30 21:22:32 -07:00
Darren Shepherd
c24e1b136b Merge pull request #959 from joshwget/remove-libtrust
Remove libtrust from trash.yml
2016-05-30 21:22:09 -07:00
Darren Shepherd
36c09de412 Merge pull request #964 from joshwget/os-images-commits
Add missing commits from os-images
2016-05-30 21:21:59 -07:00
Darren Shepherd
68bc0f4103 Merge pull request #966 from joshwget/update-readme
Update README
2016-05-30 21:20:50 -07:00
Josh Curl
e253d47379 Update README 2016-05-30 20:42:51 -07:00
Josh Curl
bbf33a771e Add missing commits from os-images 2016-05-30 13:50:49 -07:00
Josh Curl
f8ac2e6ffb Remove libtrust from trash.yml 2016-05-28 20:30:51 -07:00
Josh Curl
6ec9ce1bc6 Replace wait-for-network services with retries 2016-05-26 18:54:42 -07:00
Darren Shepherd
afcb0d38fe Merge pull request #957 from joshwget/caching
Cache remote repos and service definitions
2016-05-25 13:21:13 -07:00
Josh Curl
69fe4bb619 Cache remote repos and service definitions 2016-05-25 09:40:28 -07:00
Ivan Mikushin
af6079f780 ros os upgrade: ask for confirmation first, then download the image and run upgrade
The confirmation question is a bit different if you are upgrading to the same version
2016-05-25 08:44:21 -07:00
Darren Shepherd
50153d77c5 Merge pull request #947 from joshwget/libcompose-sync
Libcompose sync
2016-05-23 20:19:58 -07:00
Josh Curl
50de80d09a Bump libcompose and its dependencies 2016-05-23 17:22:40 -07:00
Josh Curl
c18cd26e78 Update codegangsta/cli action return signature 2016-05-23 17:22:07 -07:00
Josh Curl
b2ab4d0c38 Use Docker exec to start User Docker 2016-05-23 17:21:35 -07:00
Josh Curl
42e48476e7 Sync with libcompose 2016-05-23 17:21:28 -07:00
Darren Shepherd
448f12acb1 Merge pull request #952 from ibuildthecloud/int-test
Make tests run
2016-05-23 14:35:06 -07:00
Darren Shepherd
9e73976a9e Make tests run 2016-05-23 14:15:38 -07:00
Darren Shepherd
0d5223db23 Fix tests 2016-05-22 23:51:46 -07:00
Darren Shepherd
d34ead2fbf Speed up build and run tests 2016-05-22 23:16:27 -07:00
Darren Shepherd
c09b807991 Merge pull request #860 from imikushin/rootfs-build-fix
Fix building rootfs for arm on amd64
2016-05-16 18:51:22 -07:00
Denise
a50d2e4c90 Update README.md 2016-05-13 14:39:35 -07:00
Denise
f5ae8d9dab Update README.md 2016-05-13 14:39:16 -07:00
Darren Shepherd
053f1db6be Merge pull request #932 from imikushin/fix-ci
fix ./scripts/run: create a unique loopback device for each run
2016-05-11 19:36:12 -07:00
Ivan Mikushin
d664c96001 fix ./scripts/run: create a unique loopback device for each run 2016-05-11 15:36:56 -07:00
Darren Shepherd
de7930d820 Merge pull request #927 from rancher/revert-847-bind-mount-var-lib-system-docker
Revert "Bind mount /var/lib/system-docker"
2016-05-09 15:20:38 -07:00
Josh Curl
8b75535eb5 Revert "Bind mount /var/lib/system-docker" 2016-05-09 15:13:14 -07:00
Darren Shepherd
8eefaeb5ed Merge pull request #925 from imikushin/go-1.6.2
use go-1.6.2
2016-05-08 20:40:11 -07:00
Ivan Mikushin
696478ad9b use go-1.6.2 2016-05-08 20:28:52 -07:00
Darren Shepherd
dd7b2554e7 More build script enhancements 2016-05-08 10:35:48 -07:00
Darren Shepherd
1d92167143 Initial desktop images checkin 2016-05-08 10:34:48 -07:00
Darren Shepherd
c3fd028395 Merge pull request #919 from rancher/revert-910-share-mount
Revert "/media and /mnt mounted as shared for console"
2016-05-07 15:09:25 -07:00
Josh Curl
2968bed32e Revert "/media and /mnt mounted as shared for console" 2016-05-07 15:08:39 -07:00
Darren Shepherd
bd2971aada Merge pull request #918 from joshwget/bump-netconf
Bump netconf
2016-05-07 14:56:11 -07:00
Josh Curl
0e82ddadfc Bump netconf 2016-05-07 13:41:57 -07:00
Darren Shepherd
a9ca80d47d Merge pull request #917 from joshwget/proxy-settings
HTTP proxy settings can be set in cloud config
2016-05-07 12:56:52 -07:00
Josh Curl
ae543ab167 HTTP proxy settings can be set in cloud config 2016-05-06 16:25:07 -07:00
Darren Shepherd
ab6cc149d3 Fix rootfs.tar 2016-05-06 15:45:16 -07:00
Darren Shepherd
3732ab5661 Add missing rootfs.tar 2016-05-06 15:42:56 -07:00
Darren Shepherd
3c8559a576 Merge pull request #910 from joshwget/share-mount
/media and /mnt mounted as shared for console
2016-05-06 15:12:28 -07:00
Darren Shepherd
ec410addb9 Refactor build scripts 2016-05-06 10:58:54 -07:00
Denise
acc2ee297a Update ISSUE_TEMPLATE.md 2016-05-05 22:12:07 -07:00
Denise
409ed945d1 Merge pull request #915 from deniseschannon/issuetemplate
Adding issue template
2016-05-05 22:11:18 -07:00
deniseschannon
0af0a517ca Adding issue template 2016-05-05 20:32:30 -07:00
Josh Curl
7241390042 /media and /mnt mounted as shared for console 2016-05-04 16:18:24 -07:00
Darren Shepherd
a888a57cd9 Merge pull request #892 from datawolf/fix-test-to-work-with-multi-arch
Modify the test_11_environment to work with multiple architectures
2016-05-02 13:25:06 -07:00
Darren Shepherd
cd84bd8cf6 Merge pull request #896 from joshwget/ros-config-set-default-value
Fix setting default values with 'ros config set'
2016-05-02 13:24:54 -07:00
Darren Shepherd
c94f2451d4 Merge pull request #897 from datawolf/fix-set-rancher.debug-error
Remove `-D` when we set rancher.debug=false
2016-05-02 13:24:32 -07:00
Darren Shepherd
d1957b834b Merge pull request #903 from joshwget/update-policy
Update policy
2016-04-30 10:50:51 -07:00
Josh Curl
b68447daaf Update policy 2016-04-30 10:04:22 -07:00
Wang Long
fa98165862 Remove -D when we set rancher.debug=false
when we set rancher.debug to true, the current code also set `-D` flag
to system-docker and user-docker daemon.
and then we change rancher.debug to false, the `-D` flag is also exist
by using command `sudo ros config get rancher.docker`.

this patch fix it.

Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-04-29 09:55:42 +08:00
Darren Shepherd
1f49d44fdb Merge pull request #901 from joshwget/unconfined-console
Processes in console container run as unconfined_t
2016-04-28 17:52:50 -07:00
Josh Curl
3fa11f963d Processes in console container run as unconfined_t 2016-04-27 15:33:02 -07:00
Darren Shepherd
862344bfc3 Merge pull request #891 from joshwget/switch-console-dependency
Console service should depend on wait-for-network
2016-04-25 10:59:26 -07:00
Darren Shepherd
f15967a7a3 Merge pull request #890 from joshwget/add-upgrade-console-flag
Add upgrade flag to upgrade persistent console
2016-04-25 10:50:37 -07:00
Josh Curl
6ab32ae19c Fix setting default values with 'ros config set' 2016-04-22 16:11:54 -07:00
Wang Long
4439cdde41 Modify the test_11_environment to work with multiple architectures
Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-04-19 11:36:41 +08:00
Josh Curl
ee73337f49 Add upgrade flag to upgrade persistent console 2016-04-18 17:00:18 -07:00
Josh Curl
35ee0b5982 Console service should depend on wait-for-network 2016-04-18 16:35:24 -07:00
Denise
eeea325e54 Update README.md 2016-04-15 11:23:33 -07:00
Denise
f878b31407 Merge pull request #885 from joshwget/update-readme
Update README.md
2016-04-15 11:13:07 -07:00
Darren Shepherd
d657155723 Merge pull request #884 from joshwget/remove-dns-override
Remove DHCP override flag
2016-04-15 10:58:19 -07:00
Josh Curl
8862878337 Remove DHCP override flag 2016-04-15 10:38:31 -07:00
Josh Curl
ad1098a730 Update README.md 2016-04-14 23:02:56 -07:00
Darren Shepherd
8b4e6cc502 Merge pull request #881 from joshwget/fix-dhcp-hostname
Fix DHCP hostname being overwritten
2016-04-14 21:59:38 -07:00
Josh Curl
a0ae6222c9 Fix DHCP hostname being overwritten 2016-04-14 21:58:07 -07:00
Darren Shepherd
5d15d3aa2c Merge pull request #882 from joshwget/unmarshal-args-as-yaml
Use yaml.Unmarshal to handle config arguments
2016-04-14 21:47:07 -07:00
Darren Shepherd
f7cd87e2fb Merge pull request #873 from joshwget/dns-integration-tests
Integration tests for DNS configuration in cloud config
2016-04-14 21:46:39 -07:00
Josh Curl
53acef17cd Use yaml.Unmarshal to handle config arguments 2016-04-14 17:04:00 -07:00
Ivan Mikushin
1df1582459 Fix building rootfs for arm on amd64 2016-04-13 14:40:28 -07:00
Josh Curl
3c78335edf Integration tests for DNS configuration in cloud config 2016-04-13 11:24:00 -07:00
2936 changed files with 339502 additions and 136964 deletions

View File

@@ -1,2 +0,0 @@
DOCKER_HOST="tcp://192.168.2.2:2375"
DOCKER_TLS_VERIFY=

View File

@@ -1,16 +1,17 @@
.DS_Store
.git
.idea
.vendor
.dockerignore
.trash-cache
bin
gopath
tmp
state
build
images/*/build
scripts/images/*/dist/
dist
Godeps/_workspace/pkg
tests/integration/.venv*
tests/integration/.tox
*/*/*/*.pyc
*/*/*/__pycache__
.trash-cache
#.dapper
vendor/*/*/*/.git
tmp

View File

@@ -1,15 +0,0 @@
.DS_Store
.git
.idea
.vendor
.dockerignore
bin
gopath
tmp
state
build
Godeps/_workspace/pkg
tests/integration/.venv*
tests/integration/.tox
*/*/*/*.pyc
*/*/*/__pycache__

View File

@@ -1,6 +1,8 @@
build:
image: rancher/dapper:1.10.3
volumes:
- /var/run/docker.sock:/var/run/docker.sock
commands:
- ./scripts/ci
---
pipeline:
build:
image: rancher/dapper:1.10.3
volumes:
- /var/run/docker.sock:/var/run/docker.sock
commands:
- dapper ci

5
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,5 @@
**RancherOS Version: (ros os version)**
**Where are you running RancherOS? (docker-machine, AWS, GCE, baremetal, etc.)**

8
.gitignore vendored
View File

@@ -5,11 +5,15 @@
/build
/dist
/gopath
/images/*/build
.dockerfile
*.swp
/tests/integration/MANIFEST
/tests/integration/.venv*
/tests/integration/.tox
/tests/integration/.idea
*.pyc
__pychache__
.docker-env.*
__pycache__
/.dapper
/.trash-cache
.idea

View File

@@ -1 +0,0 @@
github.com/rancher/os

View File

@@ -1,11 +0,0 @@
FROM debian:jessie
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y grub2 parted kexec-tools
COPY ./scripts/installer /scripts
COPY ./build.conf /scripts/
COPY ./dist/artifacts/vmlinuz /dist/vmlinuz
COPY ./dist/artifacts/initrd /dist/initrd
ENTRYPOINT ["/scripts/lay-down-os"]

View File

@@ -1,18 +0,0 @@
FROM aarch64/debian:jessie
ENV DEBIAN_FRONTEND noninteractive
ENV ARCH arm
RUN apt-get update && apt-get install -y parted git gcc make autoconf
RUN mkdir -p /usr/local/src && \
cd /usr/local/src && \
git clone https://git.linaro.org/people/takahiro.akashi/kexec-tools.git && \
cd kexec-tools && git checkout kdump/for-14 && ./bootstrap && ./configure && make && make install
COPY ./scripts/installer /scripts
COPY ./build.conf /scripts/
COPY ./dist/artifacts/vmlinuz /dist/
COPY ./dist/artifacts/initrd /dist/
ENTRYPOINT ["/scripts/lay-down-os"]

View File

@@ -1,81 +1,162 @@
FROM rancher/os-dapper-base
FROM ubuntu:16.04
# FROM arm64=aarch64/ubuntu:16.04 arm=armhf/ubuntu:16.04
RUN apt-get update && \
apt-get -y install locales sudo vim less curl wget git rsync build-essential isolinux xorriso gccgo \
libblkid-dev libmount-dev libselinux1-dev cpio genisoimage qemu-kvm qemu python-pip ca-certificates pkg-config tox module-init-tools
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cpio \
curl \
dosfstools \
gccgo \
genisoimage \
gettext \
git \
isolinux \
less \
libblkid-dev \
libmount-dev \
libselinux1-dev \
locales \
module-init-tools \
openssh-client \
pkg-config \
qemu \
qemu-kvm \
rsync \
sudo \
syslinux-common \
vim \
wget \
xorriso
ARG HOST_ARCH
ENV HOST_ARCH ${HOST_ARCH}
RUN ln -sf go-6 /usr/bin/go && mkdir -p /usr/local && cd /usr/local && \
wget -O - https://storage.googleapis.com/golang/go1.6.src.tar.gz | tar -xz && \
cd go/src && GOROOT_BOOTSTRAP=/usr GOARCH=${HOST_ARCH} GOHOSTARCH=${HOST_ARCH} ./make.bash
ENV PATH /usr/local/go/bin:$PATH
RUN mkdir -p /go/src /go/bin && chmod -R 777 /go
ENV GOPATH /go
ENV PATH /go/bin:$PATH
ARG HOST_DOCKER_BINARY_URL
ENV HOST_DOCKER_BINARY_URL ${HOST_DOCKER_BINARY_URL}
RUN wget -O - ${HOST_DOCKER_BINARY_URL} > /usr/local/bin/docker
RUN chmod +x /usr/local/bin/docker
########## Dapper Configuration #####################
ENV DAPPER_ENV VERSION DEV_BUILD RUNTEST
ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_SOURCE /go/src/github.com/rancher/os
ENV DAPPER_OUTPUT ./bin ./dist ./build/os-config.yml
ENV DAPPER_OUTPUT ./bin ./dist ./build/initrd ./build/kernel
ENV DAPPER_RUN_ARGS --privileged
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
ENV SHELL /bin/bash
WORKDIR ${DAPPER_SOURCE}
COPY .dockerignore.dapper .dockerignore
########## General Configuration #####################
ARG DAPPER_HOST_ARCH=amd64
ARG HOST_ARCH=${DAPPER_HOST_ARCH}
ARG ARCH=${HOST_ARCH}
CMD make
ARG OS_REPO=rancher
ARG HOSTNAME_DEFAULT=rancher
ARG DISTRIB_ID=RancherOS
ARG TOOLCHAIN
ENV TOOLCHAIN ${TOOLCHAIN}
ARG DOCKER_VERSION=1.11.2
ARG DOCKER_PATCH_VERSION=v${DOCKER_VERSION}-ros1
ARG DOCKER_BUILD_VERSION=1.10.3
ARG DOCKER_BUILD_PATCH_VERSION=v${DOCKER_BUILD_VERSION}-ros1
ARG SELINUX_POLICY_URL=https://github.com/rancher/refpolicy/releases/download/v0.0.3/policy.29
RUN if [ "${TOOLCHAIN}" != "" ] && ! which ${TOOLCHAIN}-gcc; then \
apt-get install -y gcc-${TOOLCHAIN} g++-${TOOLCHAIN} \
ARG KERNEL_VERSION_amd64=4.9.20-rancher
ARG KERNEL_URL_amd64=https://github.com/rancher/os-kernel/releases/download/v${KERNEL_VERSION_amd64}/linux-${KERNEL_VERSION_amd64}-x86.tar.gz
ARG KERNEL_URL_arm64=https://github.com/imikushin/os-kernel/releases/download/Estuary-4.4.0-arm64.8/linux-4.4.0-rancher-arm64.tar.gz
ARG DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz
ARG DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/${DOCKER_PATCH_VERSION}/docker-${DOCKER_VERSION}_arm.tgz
ARG DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/${DOCKER_PATCH_VERSION}/docker-${DOCKER_VERSION}_arm64.tgz
ARG BUILD_DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_BUILD_VERSION}
ARG BUILD_DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/${DOCKER_BUILD_PATCH_VERSION}/docker-${DOCKER_BUILD_VERSION}_arm
ARG BUILD_DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/${DOCKER_BUILD_PATCH_VERSION}/docker-${DOCKER_BUILD_VERSION}_arm64
ARG OS_RELEASES_YML=https://releases.rancher.com/os
ARG OS_SERVICES_REPO=https://raw.githubusercontent.com/${OS_REPO}/os-services
ARG IMAGE_NAME=${OS_REPO}/os
ARG DFS_IMAGE=${OS_REPO}/docker:v${DOCKER_VERSION}-2
ARG OS_BASE_URL_amd64=https://github.com/rancher/os-base/releases/download/v2016.08.1-2/os-base_amd64.tar.xz
ARG OS_BASE_URL_arm64=https://github.com/rancher/os-base/releases/download/v2016.08.1-2/os-base_arm64.tar.xz
ARG OS_BASE_URL_arm=https://github.com/rancher/os-base/releases/download/v2016.08.1-3/os-base_arm.tar.xz
######################################################
# Set up environment and export all ARGS as ENV
ENV ARCH=${ARCH} \
HOST_ARCH=${HOST_ARCH}
ENV BUILD_DOCKER_URL=BUILD_DOCKER_URL_${ARCH} \
BUILD_DOCKER_URL_amd64=${BUILD_DOCKER_URL_amd64} \
BUILD_DOCKER_URL_arm=${BUILD_DOCKER_URL_arm} \
BUILD_DOCKER_URL_arm64=${BUILD_DOCKER_URL_arm64} \
DAPPER_HOST_ARCH=${DAPPER_HOST_ARCH} \
DFS_IMAGE=${DFS_IMAGE} \
DISTRIB_ID=${DISTRIB_ID} \
DOCKER_PATCH_VERSION=${DOCKER_PATCH_VERSION} \
DOCKER_URL=DOCKER_URL_${ARCH} \
DOCKER_URL_amd64=${DOCKER_URL_amd64} \
DOCKER_URL_arm=${DOCKER_URL_arm} \
DOCKER_URL_arm64=${DOCKER_URL_arm64} \
DOCKER_VERSION=${DOCKER_VERSION} \
DOWNLOADS=/usr/src/downloads \
GOPATH=/go \
GO_VERSION=1.7.1 \
GOARCH=$ARCH \
HOSTNAME_DEFAULT=${HOSTNAME_DEFAULT} \
IMAGE_NAME=${IMAGE_NAME} \
KERNEL_VERSION=${KERNEL_VERSION_amd64} \
KERNEL_URL=KERNEL_URL_${ARCH} \
KERNEL_URL_amd64=${KERNEL_URL_amd64} \
KERNEL_URL_arm64=${KERNEL_URL_arm64} \
OS_BASE_SHA1=OS_BASE_SHA1_${ARCH} \
OS_BASE_URL=OS_BASE_URL_${ARCH} \
OS_BASE_URL_amd64=${OS_BASE_URL_amd64} \
OS_BASE_URL_arm=${OS_BASE_URL_arm} \
OS_BASE_URL_arm64=${OS_BASE_URL_arm64} \
OS_RELEASES_YML=${OS_RELEASES_YML} \
OS_REPO=${OS_REPO} \
OS_SERVICES_REPO=${OS_SERVICES_REPO} \
REPO_VERSION=master \
SELINUX_POLICY_URL=${SELINUX_POLICY_URL}
ENV PATH=${GOPATH}/bin:/usr/local/go/bin:$PATH
RUN mkdir -p ${DOWNLOADS}
# Download kernel
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN echo "... Downloading ${!KERNEL_URL}"; \
if [ -n "${!KERNEL_URL}" ]; then \
curl -fL ${!KERNEL_URL} > ${DOWNLOADS}/kernel.tar.gz \
;fi
RUN if [ "${TOOLCHAIN}" != "" ]; then \
apt-get update && \
cd /usr/local/src && \
for i in libselinux libsepol pcre3 util-linux; do \
apt-get build-dep -y $i && \
apt-get source -y $i \
;done \
;fi
# Download SELinux Policy
RUN curl -pfL ${SELINUX_POLICY_URL} > ${DOWNLOADS}/$(basename ${SELINUX_POLICY_URL})
RUN if [ "${TOOLCHAIN}" != "" ]; then \
cd /usr/local/src/pcre3-* && \
autoreconf && \
CC=${TOOLCHAIN}-gcc CXX=${TOOLCHAIN}-g++ ./configure --host=${TOOLCHAIN} --prefix=/usr/${TOOLCHAIN} && \
make -j$(nproc) && \
make install \
;fi
# Install Go
COPY assets/go-dnsclient.patch ${DAPPER_SOURCE}
RUN ln -sf go-6 /usr/bin/go && \
curl -sfL https://storage.googleapis.com/golang/go${GO_VERSION}.src.tar.gz | tar -xzf - -C /usr/local && \
patch /usr/local/go/src/net/dnsclient_unix.go ${DAPPER_SOURCE}/go-dnsclient.patch && \
cd /usr/local/go/src && \
GOROOT_BOOTSTRAP=/usr GOARCH=${HOST_ARCH} GOHOSTARCH=${HOST_ARCH} ./make.bash && \
rm /usr/bin/go
RUN if [ "${TOOLCHAIN}" != "" ]; then \
cd /usr/local/src/libselinux-* && \
CC=${TOOLCHAIN}-gcc CXX=${TOOLCHAIN}-g++ make CFLAGS=-Wall && \
make PREFIX=/usr/${TOOLCHAIN} DESTDIR=/usr/${TOOLCHAIN} install && \
cd /usr/local/src/libsepol-* && \
CC=${TOOLCHAIN}-gcc CXX=${TOOLCHAIN}-g++ make CFLAGS=-Wall && \
make PREFIX=/usr/${TOOLCHAIN} DESTDIR=/usr/${TOOLCHAIN} install \
;fi
# Install Host Docker
RUN curl -fL ${!BUILD_DOCKER_URL} > /usr/bin/docker && \
chmod +x /usr/bin/docker
RUN if [ "${TOOLCHAIN}" != "" ]; then \
cd /usr/local/src/util-linux-* && \
autoreconf && \
CC=${TOOLCHAIN}-gcc CXX=${TOOLCHAIN}-g++ ./configure --host=${TOOLCHAIN} --prefix=/usr/${TOOLCHAIN} \
--disable-all-programs \
--enable-libmount \
--enable-libblkid \
--enable-libuuid \
--enable-mount && \
make -j$(nproc) && \
make install \
;fi
# Install Trash
RUN go get github.com/rancher/trash
RUN apt-get update && \
apt-get -y install dosfstools
# Install golint
RUN go get github.com/golang/lint/golint
RUN go get gopkg.in/check.v1
# Install dapper
RUN curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m | sed 's/arm.*/arm/'` > /usr/bin/dapper && \
chmod +x /usr/bin/dapper
RUN cd ${DOWNLOADS} && \
curl -pfL ${!OS_BASE_URL} | tar xvJf -
ENTRYPOINT ["./scripts/entry"]
CMD ["ci"]

133
Makefile Normal file → Executable file
View File

@@ -1,104 +1,67 @@
FORCE_PULL := 0
DEV_BUILD := 0
HOST_ARCH := amd64
ARCH := amd64
SUFFIX := $(if $(filter-out amd64,$(ARCH)),_$(ARCH))
TARGETS := $(shell ls scripts | grep -vE 'clean|run|help|docs|release')
include build.conf
include build.conf.$(ARCH)
.dapper:
@echo Downloading dapper
@curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m|sed 's/v7l//'` > .dapper.tmp
@@chmod +x .dapper.tmp
@./.dapper.tmp -v
@mv .dapper.tmp .dapper
$(TARGETS): .dapper
./.dapper $@
bin/ros:
mkdir -p $(dir $@)
ARCH=$(ARCH) VERSION=$(VERSION) ./scripts/mk-ros.sh $@
trash: .dapper
./.dapper -m bind trash
build/host_ros: bin/ros
mkdir -p $(dir $@)
ifeq "$(ARCH)" "$(HOST_ARCH)"
ln -sf ../bin/ros $@
else
ARCH=$(HOST_ARCH) TOOLCHAIN= VERSION=$(VERSION) ./scripts/mk-ros.sh $@
endif
trash-keep: .dapper
./.dapper -m bind trash -k
deps: trash
assets/docker:
mkdir -p $(dir $@)
wget -O - "$(DOCKER_BINARY_URL)" > $@
chmod +x $@
build/initrd/.id: .dapper
./.dapper prepare
assets/selinux/policy.29:
mkdir -p $(dir $@)
wget -O - "$(SELINUX_POLICY_URL)" > $@
run: build/initrd/.id .dapper
./.dapper -m bind build-target
./scripts/run
assets/modules.tar.gz:
mkdir -p $(dir $@)
ifeq "$(ARCH)" "amd64"
curl -L "$(VBOX_MODULES_URL)" > $@
else
touch $@
endif
docs:
./scripts/docs
ifdef COMPILED_KERNEL_URL
shell-bind: .dapper
./.dapper -m bind -s
installer: minimal
docker build -t $(IMAGE_NAME):$(VERSION)$(SUFFIX) -f Dockerfile.$(ARCH) .
clean:
@./scripts/clean
dist/artifacts/vmlinuz: build/kernel/
mkdir -p $(dir $@)
mv $(or $(wildcard build/kernel/boot/vmlinuz*), $(wildcard build/kernel/boot/vmlinux*)) $@
release: release-build openstack
release-build:
./.dapper release
build/kernel/:
mkdir -p $@
wget -O - "$(COMPILED_KERNEL_URL)" | tar -xzf - -C $@
itest:
./.dapper integration-test 2>&1 | tee dist/itest.log
openstack:
cp dist/artifacts/rancheros.iso scripts/images/openstack/
cd scripts/images/openstack && ../../../.dapper
cp ./scripts/images/openstack/dist/*.img dist/
dist/artifacts/initrd: bin/ros assets/docker assets/selinux/policy.29 build/kernel/ build/images.tar assets/modules.tar.gz
mkdir -p $(dir $@)
SUFFIX=$(SUFFIX) DFS_IMAGE=$(DFS_IMAGE) DEV_BUILD=$(DEV_BUILD) \
KERNEL_RELEASE=$(KERNEL_RELEASE) ARCH=$(ARCH) ./scripts/mk-initrd.sh $@
openstack-run:
qemu-system-x86_64 -curses \
-net nic -net user \
-m 2048M \
--hdc scripts/images/openstack/dist/rancheros-openstack.img
rpi: release
# scripts/images/raspberry-pi-hypriot/dist/rancheros-raspberry-pi.zip
cp dist/artifacts/rootfs_arm.tar.gz scripts/images/raspberry-pi-hypriot/
cd scripts/images/raspberry-pi-hypriot/ \
&& ../../../.dapper
dist/artifacts/rancheros.iso: minimal
./scripts/mk-rancheros-iso.sh
help:
@./scripts/help
all: minimal installer iso
.DEFAULT_GOAL := default
initrd: dist/artifacts/initrd
minimal: initrd dist/artifacts/vmlinuz
iso: dist/artifacts/rancheros.iso dist/artifacts/iso-checksums.txt
test: minimal
./scripts/unit-test
cd tests/integration && HOST_ARCH=$(HOST_ARCH) ARCH=$(ARCH) tox
.PHONY: all minimal initrd iso installer test
endif
build/os-config.yml: build/host_ros
ARCH=$(ARCH) VERSION=$(VERSION) ./scripts/gen-os-config.sh $@
build/images.tar: build/host_ros build/os-config.yml
ARCH=$(ARCH) FORCE_PULL=$(FORCE_PULL) ./scripts/mk-images-tar.sh
dist/artifacts/rootfs.tar.gz: bin/ros assets/docker build/images.tar assets/selinux/policy.29 assets/modules.tar.gz
mkdir -p $(dir $@)
SUFFIX=$(SUFFIX) DFS_IMAGE=$(DFS_IMAGE) DEV_BUILD=$(DEV_BUILD) IS_ROOTFS=1 ./scripts/mk-initrd.sh $@
dist/artifacts/iso-checksums.txt: dist/artifacts/rancheros.iso
./scripts/mk-iso-checksums-txt.sh
version:
@echo $(VERSION)
rootfs: dist/artifacts/rootfs.tar.gz
.PHONY: rootfs version bin/ros
.PHONY: $(TARGETS)

View File

@@ -10,75 +10,82 @@ a container that runs the user Docker. The user Docker is then the instance tha
used to create containers. We created this separation because it seemed logical and also
it would really be bad if somebody did `docker rm -f $(docker ps -qa)` and deleted the entire OS.
![How it works](docs/rancheros.png "How it works")
## Latest Release
**v0.4.3 - Docker 1.10.1- Linux 4.2.8**
**v0.9.1 - Docker 1.12.6 - Linux 4.9.18**
### ISO
https://releases.rancher.com/os/latest/rancheros.iso
https://releases.rancher.com/os/v0.4.3/rancheros.iso
**Note**: you must login using `rancher` for username and password.
https://releases.rancher.com/os/latest/rancheros.iso
https://releases.rancher.com/os/v0.9.1/rancheros.iso
### Additional Downloads
#### Latest Links
* https://releases.rancher.com/os/latest/initrd
* https://releases.rancher.com/os/latest/initrd-v0.9.1
* https://releases.rancher.com/os/latest/iso-checksums.txt
* https://releases.rancher.com/os/latest/rancheros-v0.4.3.tar.gz
* https://releases.rancher.com/os/latest/rancheros-openstack.img
* https://releases.rancher.com/os/latest/rancheros.iso
* https://releases.rancher.com/os/latest/rancheros-v0.9.1.tar.gz
* https://releases.rancher.com/os/latest/rootfs.tar.gz
* https://releases.rancher.com/os/latest/vmlinuz
* https://releases.rancher.com/os/latest/vmlinuz-4.9.18-rancher
* https://releases.rancher.com/os/v0.4.3/initrd
* https://releases.rancher.com/os/v0.4.3/iso-checksums.txt
* https://releases.rancher.com/os/v0.4.3/rancheros-v0.4.3.tar.gz
* https://releases.rancher.com/os/v0.4.3/rancheros.iso
* https://releases.rancher.com/os/v0.4.3/vmlinuz
#### v0.9.1 Links
**Note**: you can use `http` instead of `https` in the above URLs, e.g. for iPXE.
* https://releases.rancher.com/os/v0.9.1/initrd
* https://releases.rancher.com/os/v0.9.1/initrd-v0.9.1
* https://releases.rancher.com/os/v0.9.1/iso-checksums.txt
* https://releases.rancher.com/os/v0.9.1/rancheros-openstack.img
* https://releases.rancher.com/os/v0.9.1/rancheros.iso
* https://releases.rancher.com/os/v0.9.1/rancheros-v0.9.1.tar.gz
* https://releases.rancher.com/os/v0.9.1/rootfs.tar.gz
* https://releases.rancher.com/os/v0.9.1/vmlinuz
* https://releases.rancher.com/os/v0.9.1/vmlinuz-4.9.18-rancher
#### v0.9.0 Links
* https://releases.rancher.com/os/v0.9.0/rootfs_arm.tar.gz
* https://releases.rancher.com/os/v0.9.0/rootfs_arm64.tar.gz
* https://releases.rancher.com/os/v0.9.0/rancheros-raspberry-pi.zip
**Note**: you can use `http` instead of `https` in the above URLs, e.g. for iPXE.
### Amazon
We have 2 different [virtualization types of AMIs](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/virtualization_types.html). SSH keys are added to the **`rancher`** user, so you must log in using the **rancher** user.
SSH keys are added to the **`rancher`** user, so you must log in using the **rancher** user.
**HVM**
Region | Type | AMI |
-------|------|------
ap-northeast-1 | HVM | [ami-58dbdd36](https://console.aws.amazon.com/ec2/home?region=ap-northeast-1#launchInstanceWizard:ami=ami-58dbdd36)
ap-southeast-1 | HVM | [ami-217eb042](https://console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchInstanceWizard:ami=ami-217eb042)
ap-southeast-2 | HVM | [ami-8da483ee](https://console.aws.amazon.com/ec2/home?region=ap-southeast-2#launchInstanceWizard:ami=ami-8da483ee)
eu-central-1 | HVM | [ami-62b0ab0e](https://console.aws.amazon.com/ec2/home?region=eu-central-1#launchInstanceWizard:ami=ami-62b0ab0e)
eu-west-1 | HVM | [ami-7de95b0e](https://console.aws.amazon.com/ec2/home?region=eu-west-1#launchInstanceWizard:ami=ami-7de95b0e)
sa-east-1 | HVM | [ami-70bc3f1c](https://console.aws.amazon.com/ec2/home?region=sa-east-1#launchInstanceWizard:ami=ami-70bc3f1c)
us-east-1 | HVM | [ami-6f023505](https://console.aws.amazon.com/ec2/home?region=us-east-1#launchInstanceWizard:ami=ami-6f023505)
us-west-1 | HVM | [ami-17780977](https://console.aws.amazon.com/ec2/home?region=us-west-1#launchInstanceWizard:ami=ami-17780977)
us-west-2 | HVM | [ami-e45fbf84](https://console.aws.amazon.com/ec2/home?region=us-west-2#launchInstanceWizard:ami=ami-e45fbf84)
ap-south-1 | HVM | [ami-fd1e6d92](https://ap-south-1.console.aws.amazon.com/ec2/home?region=ap-south-1#launchInstanceWizard:ami=ami-fd1e6d92)
eu-west-2 | HVM | [ami-51776335](https://eu-west-2.console.aws.amazon.com/ec2/home?region=eu-west-2#launchInstanceWizard:ami=ami-51776335)
eu-west-1 | HVM | [ami-481e232e](https://eu-west-1.console.aws.amazon.com/ec2/home?region=eu-west-1#launchInstanceWizard:ami=ami-481e232e)
ap-northeast-2 | HVM | [ami-c32efdad](https://ap-northeast-2.console.aws.amazon.com/ec2/home?region=ap-northeast-2#launchInstanceWizard:ami=ami-c32efdad)
ap-northeast-1 | HVM | [ami-33aaf154](https://ap-northeast-1.console.aws.amazon.com/ec2/home?region=ap-northeast-1#launchInstanceWizard:ami=ami-33aaf154)
sa-east-1 | HVM | [ami-15ed8d79](https://sa-east-1.console.aws.amazon.com/ec2/home?region=sa-east-1#launchInstanceWizard:ami=ami-15ed8d79)
ca-central-1 | HVM | [ami-e61fa282](https://ca-central-1.console.aws.amazon.com/ec2/home?region=ca-central-1#launchInstanceWizard:ami=ami-e61fa282)
ap-southeast-1 | HVM | [ami-63b50900](https://ap-southeast-1.console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchInstanceWizard:ami=ami-63b50900)
ap-southeast-2 | HVM | [ami-86b7bbe5](https://ap-southeast-2.console.aws.amazon.com/ec2/home?region=ap-southeast-2#launchInstanceWizard:ami=ami-86b7bbe5)
eu-central-1 | HVM | [ami-a71ecfc8](https://eu-central-1.console.aws.amazon.com/ec2/home?region=eu-central-1#launchInstanceWizard:ami=ami-a71ecfc8)
us-east-1 | HVM | [ami-37b00f21](https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#launchInstanceWizard:ami=ami-37b00f21)
us-east-2 | HVM | [ami-c61632a3](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#launchInstanceWizard:ami=ami-c61632a3)
us-west-1 | HVM | [ami-8998c3e9](https://us-west-1.console.aws.amazon.com/ec2/home?region=us-west-1#launchInstanceWizard:ami=ami-8998c3e9)
us-west-2 | HVM | [ami-f6910496](https://us-west-2.console.aws.amazon.com/ec2/home?region=us-west-2#launchInstanceWizard:ami=ami-f6910496)
**Paravirtual**
Region | Type | AMI
---|--- | ---
ap-northeast-1 | PV | [ami-c9d8dea7](https://console.aws.amazon.com/ec2/home?region=ap-northeast-1#launchInstanceWizard:ami=ami-c9d8dea7)
ap-southeast-1 | PV | [ami-727cb211](https://console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchInstanceWizard:ami=ami-727cb211)
ap-southeast-2 | PV | [ami-faa18699](https://console.aws.amazon.com/ec2/home?region=ap-southeast-2#launchInstanceWizard:ami=ami-faa18699)
eu-central-1 | PV | [ami-11b5ae7d](https://console.aws.amazon.com/ec2/home?region=eu-central-1#launchInstanceWizard:ami=ami-11b5ae7d)
eu-west-1 | PV | [ami-8fe755fc](https://console.aws.amazon.com/ec2/home?region=eu-west-1#launchInstanceWizard:ami=ami-8fe755fc)
sa-east-1 | PV | [ami-9b4ac9f7](https://console.aws.amazon.com/ec2/home?region=sa-east-1#launchInstanceWizard:ami=ami-9b4ac9f7)
us-east-1 | PV | [ami-b70136dd](https://console.aws.amazon.com/ec2/home?region=us-east-1#launchInstanceWizard:ami=ami-b70136dd)
us-west-1 | PV | [ami-4a7a0b2a](https://console.aws.amazon.com/ec2/home?region=us-west-1#launchInstanceWizard:ami=ami-4a7a0b2a)
us-west-2 | PV | [ami-d0a340b0](https://console.aws.amazon.com/ec2/home?region=us-west-2#launchInstanceWizard:ami=ami-d0a340b0)
### Google Compute Engine
### Google Compute Engine (Experimental)
We are providing a disk image that users can download and import for use in Google Compute Engine. The image can be obtained from the release artifacts for RancherOS.
We are providing a disk image that users can download and import for use in Google Compute Engine. The image can be obtained from the release artifacts for RancherOS v0.3.0 or later.
[Download Image](https://github.com/rancher/os/releases/download/v0.9.1/rancheros-v0.9.1.tar.gz)
[Download Image](https://github.com/rancher/os/releases/download/v0.4.3/rancheros-v0.4.3.tar.gz)
Please follow the directions at our [docs to launch in GCE](http://docs.rancher.com/os/running-rancheros/cloud/gce/).
#### Known issues/ToDos
* Add GCE daemon support. (Manages users)
Please follow the directions at our [docs to launch in GCE](http://docs.rancher.com/os/running-rancheros/cloud/gce/).
## Documentation for RancherOS
@@ -87,12 +94,15 @@ Please refer to our [RancherOS Documentation](http://docs.rancher.com/os/) websi
## Support, Discussion, and Community
If you need any help with RancherOS or Rancher, please join us at either our [Rancher forums](http://forums.rancher.com) or [#rancher IRC channel](http://webchat.freenode.net/?channels=rancher) where most of our team hangs out at.
For security issues, please email security@rancher.com instead of posting a public issue in GitHub. You may (but are not required to) use the GPG key located on [Keybase](https://keybase.io/rancher).
Please submit any **RancherOS** bugs, issues, and feature requests to [rancher/os](//github.com/rancher/os/issues).
Please submit any **Rancher** bugs, issues, and feature requests to [rancher/rancher](//github.com/rancher/rancher/issues).
#License
Copyright (c) 2014-2016 [Rancher Labs, Inc.](http://rancher.com)
Copyright (c) 2014-2017 [Rancher Labs, Inc.](http://rancher.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -105,4 +115,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,12 @@
{
"name": "bridge",
"type": "bridge",
"bridge": "docker-sys",
"isDefaultGateway": true,
"ipMasq": true,
"hairpinMode": true,
"ipam": {
"type": "host-local",
"subnet": "172.18.42.1/16"
}
}

1
assets/docker/cni/default.d Symbolic link
View File

@@ -0,0 +1 @@
bridge.d/

View File

@@ -0,0 +1,7 @@
{
"path": "/usr/bin/ros",
"args": [
"cni-glue",
"poststop"
]
}

View File

@@ -0,0 +1,6 @@
{
"path": "/usr/bin/ros",
"args": [
"cni-glue"
]
}

18
assets/go-dnsclient.patch Normal file
View File

@@ -0,0 +1,18 @@
296a297,300
> conf.update(name)
> }
>
> func (conf *resolverConfig) update(name string) {
300a305,316
> }
>
> func UpdateDnsConf() {
> resolvConf.initOnce.Do(resolvConf.init)
>
> // Ensure only one update at a time checks resolv.conf.
> if !resolvConf.tryAcquireSema() {
> return
> }
> defer resolvConf.releaseSema()
>
> resolvConf.update("/etc/resolv.conf")

View File

@@ -1 +0,0 @@
system_r:kernel_t:s0

View File

@@ -0,0 +1 @@
unconfined_r:unconfined_t:s0

View File

@@ -0,0 +1 @@
__default__:unconfined_u:s0-s0:c0.c1023

View File

@@ -1 +0,0 @@
__default__:system_u:s0-s0

View File

@@ -1,8 +0,0 @@
IMAGE_NAME=rancher/os
VERSION=v0.4.4-dev
DFS_IMAGE=rancher/docker:v1.10.3
SELINUX_POLICY_URL=https://github.com/rancher/refpolicy/releases/download/v0.0.1/policy.29
HOSTNAME_DEFAULT=rancher
OS_IMAGES_ROOT=rancher
OS_SERVICES_REPO=https://raw.githubusercontent.com/rancher/os-services

View File

@@ -1,7 +0,0 @@
DAPPER_BASE=ubuntu:16.04
TOOLCHAIN= #empty
COMPILED_KERNEL_URL=https://github.com/rancher/os-kernel/releases/download/Ubuntu-4.2.0-34.39-rancher/linux-4.2.8-ckt4-rancher-x86.tar.gz
DOCKER_BINARY_URL=https://get.docker.com/builds/Linux/x86_64/docker-1.10.3
OS_RELEASES_YML=https://releases.rancher.com/os/releases.yml
VBOX_MODULES_URL=https://github.com/rancher/os-vbox/releases/download/v0.0.2/vbox-modules.tar.gz

View File

@@ -1,6 +0,0 @@
DAPPER_BASE=armhf/ubuntu:16.04
TOOLCHAIN=arm-linux-gnueabihf
COMPILED_KERNEL_URL= #empty
DOCKER_BINARY_URL=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm
OS_RELEASES_YML=https://releases.rancher.com/os/releases_arm.yml

View File

@@ -1,6 +0,0 @@
DAPPER_BASE=aarch64/ubuntu:16.04
TOOLCHAIN=aarch64-linux-gnu
COMPILED_KERNEL_URL=https://github.com/imikushin/os-kernel/releases/download/Estuary-4.1.18-arm64-3/linux-4.1.18-arm64.tar.gz
DOCKER_BINARY_URL=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm64
OS_RELEASES_YML=https://releases.rancher.com/os/releases_arm64.yml

View File

@@ -1,20 +0,0 @@
#!/bin/bash
set -e
export ARCH=${ARCH:-amd64}
cd $(dirname $0)
if [ "$1" != "--dev" ]; then
echo
echo Running \"production\" build. Will use lzma to compress initrd, which is somewhat slow...
echo Ctrl+C if you don\'t want this.
echo
echo For \"developer\" builds, run ./build.sh --dev
echo
./scripts/make.sh all
else
./scripts/make.sh DEV_BUILD=1 all
fi
ls -lh dist/artifacts

View File

@@ -1,20 +0,0 @@
package cloudinit
import (
"os"
"os/exec"
log "github.com/Sirupsen/logrus"
)
func authorizeSSHKeys(user string, authorizedKeys []string, name string) {
for _, authorizedKey := range authorizedKeys {
cmd := exec.Command("update-ssh-keys", user, authorizedKey)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
log.WithFields(log.Fields{"err": err, "user": user, "auth_key": authorizedKey}).Error("Error updating SSH authorized_keys")
}
}
}

View File

@@ -1,383 +0,0 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015 Rancher Labs, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cloudinit
import (
"errors"
"flag"
"io/ioutil"
"os"
"strings"
"sync"
"syscall"
"time"
yaml "github.com/cloudfoundry-incubator/candiedyaml"
log "github.com/Sirupsen/logrus"
"github.com/coreos/coreos-cloudinit/config"
"github.com/coreos/coreos-cloudinit/datasource"
"github.com/coreos/coreos-cloudinit/datasource/configdrive"
"github.com/coreos/coreos-cloudinit/datasource/file"
"github.com/coreos/coreos-cloudinit/datasource/metadata/digitalocean"
"github.com/coreos/coreos-cloudinit/datasource/metadata/ec2"
"github.com/coreos/coreos-cloudinit/datasource/metadata/packet"
"github.com/coreos/coreos-cloudinit/datasource/proc_cmdline"
"github.com/coreos/coreos-cloudinit/datasource/url"
"github.com/coreos/coreos-cloudinit/pkg"
"github.com/coreos/coreos-cloudinit/system"
"github.com/rancher/netconf"
rancherConfig "github.com/rancher/os/config"
)
const (
datasourceInterval = 100 * time.Millisecond
datasourceMaxInterval = 30 * time.Second
datasourceTimeout = 5 * time.Minute
sshKeyName = "rancheros-cloud-config"
)
var (
save bool
execute bool
network bool
flags *flag.FlagSet
)
func init() {
flags = flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
flags.BoolVar(&network, "network", true, "use network based datasources")
flags.BoolVar(&save, "save", false, "save cloud config and exit")
flags.BoolVar(&execute, "execute", false, "execute saved cloud config")
}
func saveFiles(cloudConfigBytes, scriptBytes []byte, metadata datasource.Metadata) error {
os.MkdirAll(rancherConfig.CloudConfigDir, os.ModeDir|0600)
os.Remove(rancherConfig.CloudConfigScriptFile)
os.Remove(rancherConfig.CloudConfigBootFile)
os.Remove(rancherConfig.MetaDataFile)
if len(scriptBytes) > 0 {
log.Infof("Writing to %s", rancherConfig.CloudConfigScriptFile)
if err := ioutil.WriteFile(rancherConfig.CloudConfigScriptFile, scriptBytes, 500); err != nil {
log.Errorf("Error while writing file %s: %v", rancherConfig.CloudConfigScriptFile, err)
return err
}
}
if err := ioutil.WriteFile(rancherConfig.CloudConfigBootFile, cloudConfigBytes, 400); err != nil {
return err
}
log.Infof("Written to %s:\n%s", rancherConfig.CloudConfigBootFile, string(cloudConfigBytes))
metaDataBytes, err := yaml.Marshal(metadata)
if err != nil {
return err
}
if err = ioutil.WriteFile(rancherConfig.MetaDataFile, metaDataBytes, 400); err != nil {
return err
}
log.Infof("Written to %s:\n%s", rancherConfig.MetaDataFile, string(metaDataBytes))
return nil
}
func currentDatasource() (datasource.Datasource, error) {
cfg, err := rancherConfig.LoadConfig()
if err != nil {
log.WithFields(log.Fields{"err": err}).Error("Failed to read rancher config")
return nil, err
}
dss := getDatasources(cfg)
if len(dss) == 0 {
return nil, nil
}
ds := selectDatasource(dss)
return ds, nil
}
func saveCloudConfig() error {
userDataBytes, metadata, err := fetchUserData()
if err != nil {
return err
}
userData := string(userDataBytes)
scriptBytes := []byte{}
if config.IsScript(userData) {
scriptBytes = userDataBytes
userDataBytes = []byte{}
} else if isCompose(userData) {
if userDataBytes, err = composeToCloudConfig(userDataBytes); err != nil {
log.Errorf("Failed to convert compose to cloud-config syntax: %v", err)
return err
}
} else if config.IsCloudConfig(userData) {
if _, err := rancherConfig.ReadConfig(userDataBytes, false); err != nil {
log.WithFields(log.Fields{"cloud-config": userData, "err": err}).Warn("Failed to parse cloud-config, not saving.")
userDataBytes = []byte{}
}
} else {
log.Errorf("Unrecognized user-data\n%s", userData)
userDataBytes = []byte{}
}
if _, err := rancherConfig.ReadConfig(userDataBytes, false); err != nil {
log.WithFields(log.Fields{"cloud-config": userData, "err": err}).Warn("Failed to parse cloud-config")
return errors.New("Failed to parse cloud-config")
}
return saveFiles(userDataBytes, scriptBytes, metadata)
}
func fetchUserData() ([]byte, datasource.Metadata, error) {
var metadata datasource.Metadata
ds, err := currentDatasource()
if err != nil || ds == nil {
log.Errorf("Failed to select datasource: %v", err)
return nil, metadata, err
}
log.Infof("Fetching user-data from datasource %v", ds.Type())
userDataBytes, err := ds.FetchUserdata()
if err != nil {
log.Errorf("Failed fetching user-data from datasource: %v", err)
return nil, metadata, err
}
log.Infof("Fetching meta-data from datasource of type %v", ds.Type())
metadata, err = ds.FetchMetadata()
if err != nil {
log.Errorf("Failed fetching meta-data from datasource: %v", err)
return nil, metadata, err
}
return userDataBytes, metadata, nil
}
func SetHostname(cc *rancherConfig.CloudConfig) (string, error) {
name, _ := os.Hostname()
if cc.Hostname != "" {
name = cc.Hostname
}
if name != "" {
//set hostname
if err := syscall.Sethostname([]byte(name)); err != nil {
log.WithFields(log.Fields{"err": err, "hostname": name}).Error("Error setting hostname")
return "", err
}
}
return name, nil
}
func executeCloudConfig() error {
cc, err := rancherConfig.LoadConfig()
if err != nil {
return err
}
if _, err := SetHostname(cc); err != nil {
return err
}
if len(cc.SSHAuthorizedKeys) > 0 {
authorizeSSHKeys("rancher", cc.SSHAuthorizedKeys, sshKeyName)
authorizeSSHKeys("docker", cc.SSHAuthorizedKeys, sshKeyName)
}
for _, file := range cc.WriteFiles {
f := system.File{File: file}
fullPath, err := system.WriteFile(&f, "/")
if err != nil {
log.WithFields(log.Fields{"err": err, "path": fullPath}).Error("Error writing file")
continue
}
log.Printf("Wrote file %s to filesystem", fullPath)
}
return nil
}
func Main() {
flags.Parse(os.Args[1:])
log.Infof("Running cloud-init: save=%v, execute=%v", save, execute)
if save {
err := saveCloudConfig()
if err != nil {
log.WithFields(log.Fields{"err": err}).Error("Failed to save cloud-config")
}
}
if execute {
err := executeCloudConfig()
if err != nil {
log.WithFields(log.Fields{"err": err}).Error("Failed to execute cloud-config")
}
}
}
// getDatasources creates a slice of possible Datasources for cloudinit based
// on the different source command-line flags.
func getDatasources(cfg *rancherConfig.CloudConfig) []datasource.Datasource {
dss := make([]datasource.Datasource, 0, 5)
for _, ds := range cfg.Rancher.CloudInit.Datasources {
parts := strings.SplitN(ds, ":", 2)
switch parts[0] {
case "ec2":
if network {
if len(parts) == 1 {
dss = append(dss, ec2.NewDatasource(ec2.DefaultAddress))
} else {
dss = append(dss, ec2.NewDatasource(parts[1]))
}
}
case "file":
if len(parts) == 2 {
dss = append(dss, file.NewDatasource(parts[1]))
}
case "url":
if network {
if len(parts) == 2 {
dss = append(dss, url.NewDatasource(parts[1]))
}
}
case "cmdline":
if network {
if len(parts) == 1 {
dss = append(dss, proc_cmdline.NewDatasource())
}
}
case "configdrive":
if len(parts) == 2 {
dss = append(dss, configdrive.NewDatasource(parts[1]))
}
case "digitalocean":
if network {
if len(parts) == 1 {
dss = append(dss, digitalocean.NewDatasource(digitalocean.DefaultAddress))
} else {
dss = append(dss, digitalocean.NewDatasource(parts[1]))
}
} else {
enableDoLinkLocal()
}
case "gce":
if network {
gceCloudConfigFile, err := GetAndCreateGceDataSourceFilename()
if err != nil {
log.Errorf("Could not retrieve GCE CloudConfig %s", err)
continue
}
dss = append(dss, file.NewDatasource(gceCloudConfigFile))
}
case "packet":
if !network {
enablePacketNetwork(&cfg.Rancher)
}
dss = append(dss, packet.NewDatasource("https://metadata.packet.net/"))
}
}
return dss
}
func enableDoLinkLocal() {
err := netconf.ApplyNetworkConfigs(&netconf.NetworkConfig{
Interfaces: map[string]netconf.InterfaceConfig{
"eth0": {
IPV4LL: true,
},
},
})
if err != nil {
log.Errorf("Failed to apply link local on eth0: %v", err)
}
}
// selectDatasource attempts to choose a valid Datasource to use based on its
// current availability. The first Datasource to report to be available is
// returned. Datasources will be retried if possible if they are not
// immediately available. If all Datasources are permanently unavailable or
// datasourceTimeout is reached before one becomes available, nil is returned.
func selectDatasource(sources []datasource.Datasource) datasource.Datasource {
ds := make(chan datasource.Datasource)
stop := make(chan struct{})
var wg sync.WaitGroup
for _, s := range sources {
wg.Add(1)
go func(s datasource.Datasource) {
defer wg.Done()
duration := datasourceInterval
for {
log.Infof("Checking availability of %q\n", s.Type())
if s.IsAvailable() {
ds <- s
return
} else if !s.AvailabilityChanges() {
return
}
select {
case <-stop:
return
case <-time.After(duration):
duration = pkg.ExpBackoff(duration, datasourceMaxInterval)
}
}
}(s)
}
done := make(chan struct{})
go func() {
wg.Wait()
close(done)
}()
var s datasource.Datasource
select {
case s = <-ds:
case <-done:
case <-time.After(datasourceTimeout):
}
close(stop)
return s
}
func isCompose(content string) bool {
return strings.HasPrefix(content, "#compose\n")
}
func composeToCloudConfig(bytes []byte) ([]byte, error) {
compose := make(map[interface{}]interface{})
err := yaml.Unmarshal(bytes, &compose)
if err != nil {
return nil, err
}
return yaml.Marshal(map[interface{}]interface{}{
"rancher": map[interface{}]interface{}{
"services": compose,
},
})
}

View File

@@ -1,140 +0,0 @@
package cloudinit
import (
"io/ioutil"
"strings"
log "github.com/Sirupsen/logrus"
yaml "github.com/cloudfoundry-incubator/candiedyaml"
"google.golang.org/cloud/compute/metadata"
)
type GceCloudConfig struct {
FileName string
UserData string
NonUserDataSSHKeys []string
}
const (
gceCloudConfigFile = "/var/lib/rancher/conf/gce_cloudinit_config.yml"
)
func NewGceCloudConfig() *GceCloudConfig {
userData, err := metadata.InstanceAttributeValue("user-data")
if err != nil {
log.Errorf("Could not retrieve user-data: %s", err)
}
projectSSHKeys, err := metadata.ProjectAttributeValue("sshKeys")
if err != nil {
log.Errorf("Could not retrieve project SSH Keys: %s", err)
}
instanceSSHKeys, err := metadata.InstanceAttributeValue("sshKeys")
if err != nil {
log.Errorf("Could not retrieve instance SSH Keys: %s", err)
}
nonUserDataSSHKeysRaw := projectSSHKeys + "\n" + instanceSSHKeys
nonUserDataSSHKeys := gceSshKeyFormatter(nonUserDataSSHKeysRaw)
gceCC := &GceCloudConfig{
FileName: gceCloudConfigFile,
UserData: userData,
NonUserDataSSHKeys: nonUserDataSSHKeys,
}
return gceCC
}
func GetAndCreateGceDataSourceFilename() (string, error) {
gceCC := NewGceCloudConfig()
err := gceCC.saveToFile(gceCC.FileName)
if err != nil {
log.Errorf("Error: %s", err)
return "", err
}
return gceCC.FileName, nil
}
func (cc *GceCloudConfig) saveToFile(filename string) error {
//Get Merged UserData sshkeys
data, err := cc.getMergedUserData()
if err != nil {
log.Errorf("Could not process userdata: %s", err)
return err
}
//write file
writeFile(filename, data)
return nil
}
func (cc *GceCloudConfig) getMergedUserData() ([]byte, error) {
var returnUserData []byte
userdata := make(map[string]interface{})
if cc.UserData != "" {
log.Infof("Found UserData Config")
err := yaml.Unmarshal([]byte(cc.UserData), &userdata)
if err != nil {
log.Errorf("Could not unmarshal data: %s", err)
return nil, err
}
}
var auth_keys []string
if _, exists := userdata["ssh_authorized_keys"]; exists {
udSshKeys := userdata["ssh_authorized_keys"].([]interface{})
log.Infof("userdata %s", udSshKeys)
for _, value := range udSshKeys {
auth_keys = append(auth_keys, value.(string))
}
}
if cc.NonUserDataSSHKeys != nil {
for _, value := range cc.NonUserDataSSHKeys {
auth_keys = append(auth_keys, value)
}
}
userdata["ssh_authorized_keys"] = auth_keys
yamlUserData, err := yaml.Marshal(&userdata)
if err != nil {
log.Errorf("Could not Marshal userdata: %s", err)
return nil, err
} else {
returnUserData = append([]byte("#cloud-config\n"), yamlUserData...)
}
return returnUserData, nil
}
func writeFile(filename string, data []byte) error {
if err := ioutil.WriteFile(filename, data, 400); err != nil {
log.Errorf("Could not write file %v", err)
return err
}
return nil
}
func gceSshKeyFormatter(rawKeys string) []string {
keySlice := strings.Split(rawKeys, "\n")
var cloudFormatedKeys []string
if len(keySlice) > 0 {
for i := range keySlice {
keyString := keySlice[i]
sIdx := strings.Index(keyString, ":")
if sIdx != -1 {
key := strings.TrimSpace(keyString[sIdx+1:])
keyA := strings.Split(key, " ")
key = strings.Join(keyA, " ")
if key != "" {
cloudFormatedKeys = append(cloudFormatedKeys, key)
}
}
}
}
return cloudFormatedKeys
}

View File

@@ -1,95 +0,0 @@
package cloudinit
import (
"fmt"
"net/http"
"os"
"path"
"strings"
yaml "github.com/cloudfoundry-incubator/candiedyaml"
"github.com/Sirupsen/logrus"
"github.com/packethost/packngo/metadata"
"github.com/rancher/netconf"
rancherConfig "github.com/rancher/os/config"
)
func enablePacketNetwork(cfg *rancherConfig.RancherConfig) {
bootStrapped := false
for _, v := range cfg.Network.Interfaces {
if v.Address != "" {
if err := netconf.ApplyNetworkConfigs(&cfg.Network); err != nil {
logrus.Errorf("Failed to bootstrap network: %v", err)
return
}
bootStrapped = true
break
}
}
if !bootStrapped {
return
}
c := metadata.NewClient(http.DefaultClient)
m, err := c.Metadata.Get()
if err != nil {
logrus.Errorf("Failed to get Packet metadata: %v", err)
return
}
bondCfg := netconf.InterfaceConfig{
Addresses: []string{},
BondOpts: map[string]string{
"lacp_rate": "1",
"xmit_hash_policy": "layer3+4",
"downdelay": "200",
"updelay": "200",
"miimon": "100",
"mode": "4",
},
}
netCfg := netconf.NetworkConfig{
Interfaces: map[string]netconf.InterfaceConfig{},
}
for _, iface := range m.Network.Interfaces {
netCfg.Interfaces["mac="+iface.Mac] = netconf.InterfaceConfig{
Bond: "bond0",
}
}
for _, addr := range m.Network.Addresses {
bondCfg.Addresses = append(bondCfg.Addresses, fmt.Sprintf("%s/%d", addr.Address, addr.Cidr))
if addr.Gateway != "" {
if addr.AddressFamily == 4 {
if addr.Public {
bondCfg.Gateway = addr.Gateway
}
} else {
bondCfg.GatewayIpv6 = addr.Gateway
}
}
if addr.AddressFamily == 4 && strings.HasPrefix(addr.Gateway, "10.") {
bondCfg.PostUp = append(bondCfg.PostUp, "ip route add 10.0.0.0/8 via "+addr.Gateway)
}
}
netCfg.Interfaces["bond0"] = bondCfg
bytes, _ := yaml.Marshal(netCfg)
logrus.Debugf("Generated network config: %s", string(bytes))
cc := rancherConfig.CloudConfig{
Rancher: rancherConfig.RancherConfig{
Network: netCfg,
},
}
if err := os.MkdirAll(path.Dir(rancherConfig.CloudConfigNetworkFile), 0700); err != nil {
logrus.Errorf("Failed to create directory for file %s: %v", rancherConfig.CloudConfigNetworkFile, err)
}
if err := rancherConfig.WriteToFile(cc, rancherConfig.CloudConfigNetworkFile); err != nil {
logrus.Errorf("Failed to save config file %s: %v", rancherConfig.CloudConfigNetworkFile, err)
}
}

View File

@@ -0,0 +1,108 @@
package cloudinitexecute
import (
"io/ioutil"
"os"
"path"
"strconv"
"strings"
"github.com/rancher/os/log"
"github.com/rancher/os/util"
)
const (
sshDirName = ".ssh"
authorizedKeysFileName = "authorized_keys"
)
func authorizeSSHKeys(username string, authorizedKeys []string, name string) error {
var uid int
var gid int
var homeDir string
bytes, err := ioutil.ReadFile("/etc/passwd")
if err != nil {
return err
}
for _, line := range strings.Split(string(bytes), "\n") {
if strings.HasPrefix(line, username) {
split := strings.Split(line, ":")
if len(split) < 6 {
break
}
uid, err = strconv.Atoi(split[2])
if err != nil {
return err
}
gid, err = strconv.Atoi(split[3])
if err != nil {
return err
}
homeDir = split[5]
}
}
sshDir := path.Join(homeDir, sshDirName)
authorizedKeysFile := path.Join(sshDir, authorizedKeysFileName)
if _, err := os.Stat(sshDir); os.IsNotExist(err) {
if err = os.Mkdir(sshDir, 0700); err != nil {
return err
}
} else if err != nil {
return err
}
if err = os.Chown(sshDir, uid, gid); err != nil {
return err
}
for _, authorizedKey := range authorizedKeys {
if err = authorizeSSHKey(authorizedKey, authorizedKeysFile, uid, gid); err != nil {
log.Errorf("Failed to authorize SSH key %s: %v", authorizedKey, err)
}
}
return nil
}
func authorizeSSHKey(authorizedKey, authorizedKeysFile string, uid, gid int) error {
authorizedKeysFileInfo, err := os.Stat(authorizedKeysFile)
if os.IsNotExist(err) {
keysFile, err := os.Create(authorizedKeysFile)
if err != nil {
return err
}
if err = keysFile.Chmod(0600); err != nil {
return err
}
if err = keysFile.Close(); err != nil {
return err
}
authorizedKeysFileInfo, err = os.Stat(authorizedKeysFile)
if err != nil {
return err
}
} else if err != nil {
return err
}
bytes, err := ioutil.ReadFile(authorizedKeysFile)
if err != nil {
return err
}
if !strings.Contains(string(bytes), authorizedKey) {
bytes = append(bytes, []byte(authorizedKey)...)
bytes = append(bytes, '\n')
}
perm := authorizedKeysFileInfo.Mode().Perm()
if err = util.WriteFileAtomic(authorizedKeysFile, bytes, perm); err != nil {
return err
}
return os.Chown(authorizedKeysFile, uid, gid)
}

View File

@@ -0,0 +1,180 @@
package cloudinitexecute
import (
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
"strings"
rancherConfig "github.com/rancher/os/config"
"github.com/rancher/os/config/cloudinit/system"
"github.com/rancher/os/docker"
"github.com/rancher/os/log"
"github.com/rancher/os/util"
"golang.org/x/net/context"
)
const (
resizeStamp = "/var/lib/rancher/resizefs.done"
sshKeyName = "rancheros-cloud-config"
)
var (
console bool
preConsole bool
flags *flag.FlagSet
)
func init() {
flags = flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
flags.BoolVar(&console, "console", false, "apply console configuration")
flags.BoolVar(&preConsole, "pre-console", false, "apply pre-console configuration")
}
func Main() {
flags.Parse(os.Args[1:])
log.InitLogger()
log.Infof("Running cloud-init-execute: pre-console=%v, console=%v", preConsole, console)
cfg := rancherConfig.LoadConfig()
if !console && !preConsole {
console = true
preConsole = true
}
if console {
ApplyConsole(cfg)
}
if preConsole {
applyPreConsole(cfg)
}
}
func ApplyConsole(cfg *rancherConfig.CloudConfig) {
if len(cfg.SSHAuthorizedKeys) > 0 {
if err := authorizeSSHKeys("rancher", cfg.SSHAuthorizedKeys, sshKeyName); err != nil {
log.Error(err)
}
if err := authorizeSSHKeys("docker", cfg.SSHAuthorizedKeys, sshKeyName); err != nil {
log.Error(err)
}
}
WriteFiles(cfg, "console")
for _, mount := range cfg.Mounts {
if len(mount) != 4 {
log.Errorf("Unable to mount %s: must specify exactly four arguments", mount[1])
}
device := util.ResolveDevice(mount[0])
if mount[2] == "swap" {
cmd := exec.Command("swapon", device)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
log.Errorf("Unable to swapon %s: %v", device, err)
}
continue
}
cmdArgs := []string{device, mount[1]}
if mount[2] != "" {
cmdArgs = append(cmdArgs, "-t", mount[2])
}
if mount[3] != "" {
cmdArgs = append(cmdArgs, "-o", mount[3])
}
cmd := exec.Command("mount", cmdArgs...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
log.Errorf("Failed to mount %s: %v", mount[1], err)
}
}
util.RunCommandSequence(cfg.Runcmd)
}
func WriteFiles(cfg *rancherConfig.CloudConfig, container string) {
for _, file := range cfg.WriteFiles {
fileContainer := file.Container
if fileContainer == "" {
fileContainer = "console"
}
if fileContainer != container {
continue
}
f := system.File{
File: file.File,
}
fullPath, err := system.WriteFile(&f, "/")
if err != nil {
log.WithFields(log.Fields{"err": err, "path": fullPath}).Error("Error writing file")
continue
}
log.Printf("Wrote file %s to filesystem", fullPath)
}
}
func applyPreConsole(cfg *rancherConfig.CloudConfig) {
if _, err := os.Stat(resizeStamp); os.IsNotExist(err) && cfg.Rancher.ResizeDevice != "" {
if err := resizeDevice(cfg); err == nil {
os.Create(resizeStamp)
} else {
log.Errorf("Failed to resize %s: %s", cfg.Rancher.ResizeDevice, err)
}
}
for k, v := range cfg.Rancher.Sysctl {
elems := []string{"/proc", "sys"}
elems = append(elems, strings.Split(k, ".")...)
path := path.Join(elems...)
if err := ioutil.WriteFile(path, []byte(v), 0644); err != nil {
log.Errorf("Failed to set sysctl key %s: %s", k, err)
}
}
client, err := docker.NewSystemClient()
if err != nil {
log.Error(err)
}
for _, restart := range cfg.Rancher.RestartServices {
if err = client.ContainerRestart(context.Background(), restart, 10); err != nil {
log.Error(err)
}
}
}
func resizeDevice(cfg *rancherConfig.CloudConfig) error {
cmd := exec.Command("growpart", cfg.Rancher.ResizeDevice, "1")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Run()
cmd = exec.Command("partprobe", cfg.Rancher.ResizeDevice)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
cmd = exec.Command("resize2fs", fmt.Sprintf("%s1", cfg.Rancher.ResizeDevice))
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()
if err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,349 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015-2017 Rancher Labs, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cloudinitsave
import (
"bytes"
"errors"
"os"
"path"
"strings"
"sync"
"time"
yaml "github.com/cloudfoundry-incubator/candiedyaml"
"github.com/rancher/os/cmd/network"
rancherConfig "github.com/rancher/os/config"
"github.com/rancher/os/config/cloudinit/config"
"github.com/rancher/os/config/cloudinit/datasource"
"github.com/rancher/os/config/cloudinit/datasource/configdrive"
"github.com/rancher/os/config/cloudinit/datasource/file"
"github.com/rancher/os/config/cloudinit/datasource/metadata/digitalocean"
"github.com/rancher/os/config/cloudinit/datasource/metadata/ec2"
"github.com/rancher/os/config/cloudinit/datasource/metadata/gce"
"github.com/rancher/os/config/cloudinit/datasource/metadata/packet"
"github.com/rancher/os/config/cloudinit/datasource/proccmdline"
"github.com/rancher/os/config/cloudinit/datasource/url"
"github.com/rancher/os/config/cloudinit/pkg"
"github.com/rancher/os/log"
"github.com/rancher/os/netconf"
"github.com/rancher/os/util"
)
const (
datasourceInterval = 100 * time.Millisecond
datasourceMaxInterval = 30 * time.Second
datasourceTimeout = 5 * time.Minute
)
func Main() {
log.InitLogger()
log.Info("Running cloud-init-save")
if err := SaveCloudConfig(); err != nil {
log.Errorf("Failed to save cloud-config: %v", err)
}
}
func SaveCloudConfig() error {
log.Debugf("SaveCloudConfig")
// TODO: can't run these here, but it needs to be triggered from here :()
cfg := rancherConfig.LoadConfig()
log.Debugf("init: SaveCloudConfig(pre ApplyNetworkConfig): %#v", cfg.Rancher.Network)
network.ApplyNetworkConfig(cfg)
log.Debugf("datasources that will be consided: %#v", cfg.Rancher.CloudInit.Datasources)
dss := getDatasources(cfg)
if len(dss) == 0 {
log.Errorf("currentDatasource - none found")
return nil
}
selectDatasource(dss)
// TODO: can't run these here, but it needs to be triggered from here :()
// Apply any newly detected network config.
cfg = rancherConfig.LoadConfig()
log.Debugf("init: SaveCloudConfig(post ApplyNetworkConfig): %#v", cfg.Rancher.Network)
network.ApplyNetworkConfig(cfg)
return nil
}
func RequiresNetwork(datasource string) bool {
// TODO: move into the datasources (and metadatasources)
// and then we can enable that platforms defaults..
parts := strings.SplitN(datasource, ":", 2)
requiresNetwork, ok := map[string]bool{
"ec2": true,
"file": false,
"url": true,
"cmdline": true,
"configdrive": false,
"digitalocean": true,
"gce": true,
"packet": true,
}[parts[0]]
return ok && requiresNetwork
}
func saveFiles(cloudConfigBytes, scriptBytes []byte, metadata datasource.Metadata) error {
os.MkdirAll(rancherConfig.CloudConfigDir, os.ModeDir|0600)
if len(scriptBytes) > 0 {
log.Infof("Writing to %s", rancherConfig.CloudConfigScriptFile)
if err := util.WriteFileAtomic(rancherConfig.CloudConfigScriptFile, scriptBytes, 500); err != nil {
log.Errorf("Error while writing file %s: %v", rancherConfig.CloudConfigScriptFile, err)
return err
}
}
if len(cloudConfigBytes) > 0 {
if err := util.WriteFileAtomic(rancherConfig.CloudConfigBootFile, cloudConfigBytes, 400); err != nil {
return err
}
// TODO: Don't put secrets into the log
log.Infof("Written to %s:\n%s", rancherConfig.CloudConfigBootFile, string(cloudConfigBytes))
}
metaDataBytes, err := yaml.Marshal(metadata)
if err != nil {
return err
}
if err = util.WriteFileAtomic(rancherConfig.MetaDataFile, metaDataBytes, 400); err != nil {
return err
}
// TODO: Don't put secrets into the log
log.Infof("Written to %s:\n%s", rancherConfig.MetaDataFile, string(metaDataBytes))
// if we write the empty meta yml, the merge fails.
// TODO: the problem is that a partially filled one will still have merge issues, so that needs fixing - presumably by making merge more clever, and making more fields optional
emptyMeta, err := yaml.Marshal(datasource.Metadata{})
if err != nil {
return err
}
if bytes.Compare(metaDataBytes, emptyMeta) == 0 {
log.Infof("not writing %s: its all defaults.", rancherConfig.CloudConfigNetworkFile)
return nil
}
type nonRancherCfg struct {
Network netconf.NetworkConfig `yaml:"network,omitempty"`
}
type nonCfg struct {
Rancher nonRancherCfg `yaml:"rancher,omitempty"`
}
// write the network.yml file from metadata
cc := nonCfg{
Rancher: nonRancherCfg{
Network: metadata.NetworkConfig,
},
}
if err := os.MkdirAll(path.Dir(rancherConfig.CloudConfigNetworkFile), 0700); err != nil {
log.Errorf("Failed to create directory for file %s: %v", rancherConfig.CloudConfigNetworkFile, err)
}
if err := rancherConfig.WriteToFile(cc, rancherConfig.CloudConfigNetworkFile); err != nil {
log.Errorf("Failed to save config file %s: %v", rancherConfig.CloudConfigNetworkFile, err)
}
log.Infof("Written to %s:", rancherConfig.CloudConfigNetworkFile)
return nil
}
func fetchAndSave(ds datasource.Datasource) error {
var metadata datasource.Metadata
log.Infof("Fetching user-data from datasource %s", ds)
userDataBytes, err := ds.FetchUserdata()
if err != nil {
log.Errorf("Failed fetching user-data from datasource: %v", err)
return err
}
log.Infof("Fetching meta-data from datasource of type %v", ds.Type())
metadata, err = ds.FetchMetadata()
if err != nil {
log.Errorf("Failed fetching meta-data from datasource: %v", err)
return err
}
userData := string(userDataBytes)
scriptBytes := []byte{}
if config.IsScript(userData) {
scriptBytes = userDataBytes
userDataBytes = []byte{}
} else if isCompose(userData) {
if userDataBytes, err = composeToCloudConfig(userDataBytes); err != nil {
log.Errorf("Failed to convert compose to cloud-config syntax: %v", err)
return err
}
} else if config.IsCloudConfig(userData) {
if _, err := rancherConfig.ReadConfig(userDataBytes, false); err != nil {
log.WithFields(log.Fields{"cloud-config": userData, "err": err}).Warn("Failed to parse cloud-config, not saving.")
userDataBytes = []byte{}
}
} else {
log.Errorf("Unrecognized user-data\n(%s)", userData)
userDataBytes = []byte{}
}
if _, err := rancherConfig.ReadConfig(userDataBytes, false); err != nil {
log.WithFields(log.Fields{"cloud-config": userData, "err": err}).Warn("Failed to parse cloud-config")
return errors.New("Failed to parse cloud-config")
}
return saveFiles(userDataBytes, scriptBytes, metadata)
}
// getDatasources creates a slice of possible Datasources for cloudinit based
// on the different source command-line flags.
func getDatasources(cfg *rancherConfig.CloudConfig) []datasource.Datasource {
dss := make([]datasource.Datasource, 0, 5)
for _, ds := range cfg.Rancher.CloudInit.Datasources {
parts := strings.SplitN(ds, ":", 2)
root := ""
if len(parts) > 1 {
root = parts[1]
}
switch parts[0] {
case "ec2":
dss = append(dss, ec2.NewDatasource(root))
case "file":
if root != "" {
dss = append(dss, file.NewDatasource(root))
}
case "url":
if root != "" {
dss = append(dss, url.NewDatasource(root))
}
case "cmdline":
if len(parts) == 1 {
dss = append(dss, proccmdline.NewDatasource())
}
case "configdrive":
if root != "" {
dss = append(dss, configdrive.NewDatasource(root))
}
case "digitalocean":
// TODO: should we enableDoLinkLocal() - to avoid the need for the other kernel/oem options?
dss = append(dss, digitalocean.NewDatasource(root))
case "gce":
dss = append(dss, gce.NewDatasource(root))
case "packet":
dss = append(dss, packet.NewDatasource(root))
}
}
return dss
}
func enableDoLinkLocal() {
err := netconf.ApplyNetworkConfigs(&netconf.NetworkConfig{
Interfaces: map[string]netconf.InterfaceConfig{
"eth0": {
IPV4LL: true,
},
},
})
if err != nil {
log.Errorf("Failed to apply link local on eth0: %v", err)
}
}
// selectDatasource attempts to choose a valid Datasource to use based on its
// current availability. The first Datasource to report to be available is
// returned. Datasources will be retried if possible if they are not
// immediately available. If all Datasources are permanently unavailable or
// datasourceTimeout is reached before one becomes available, nil is returned.
func selectDatasource(sources []datasource.Datasource) datasource.Datasource {
ds := make(chan datasource.Datasource)
stop := make(chan struct{})
var wg sync.WaitGroup
for _, s := range sources {
wg.Add(1)
go func(s datasource.Datasource) {
defer wg.Done()
duration := datasourceInterval
for {
log.Infof("cloud-init: Checking availability of %q\n", s.Type())
if s.IsAvailable() {
log.Infof("cloud-init: Datasource available: %s", s)
ds <- s
return
}
if !s.AvailabilityChanges() {
log.Infof("cloud-init: Datasource unavailable, skipping: %s", s)
return
}
log.Errorf("cloud-init: Datasource not ready, will retry: %s", s)
select {
case <-stop:
return
case <-time.After(duration):
duration = pkg.ExpBackoff(duration, datasourceMaxInterval)
}
}
}(s)
}
done := make(chan struct{})
go func() {
wg.Wait()
close(done)
}()
var s datasource.Datasource
select {
case s = <-ds:
err := fetchAndSave(s)
if err != nil {
log.Errorf("Error fetching cloud-init datasource(%s): %s", s, err)
}
case <-done:
case <-time.After(datasourceTimeout):
}
close(stop)
return s
}
func isCompose(content string) bool {
return strings.HasPrefix(content, "#compose\n")
}
func composeToCloudConfig(bytes []byte) ([]byte, error) {
compose := make(map[interface{}]interface{})
err := yaml.Unmarshal(bytes, &compose)
if err != nil {
return nil, err
}
return yaml.Marshal(map[interface{}]interface{}{
"rancher": map[interface{}]interface{}{
"services": compose,
},
})
}

116
cmd/control/bootstrap.go Normal file
View File

@@ -0,0 +1,116 @@
package control
import (
"io/ioutil"
"os"
"os/exec"
"strings"
"time"
"github.com/codegangsta/cli"
"github.com/rancher/os/config"
"github.com/rancher/os/log"
"github.com/rancher/os/util"
)
func bootstrapAction(c *cli.Context) error {
log.Debugf("bootstrapAction")
if err := UdevSettle(); err != nil {
log.Errorf("Failed to run udev settle: %v", err)
}
log.Debugf("bootstrapAction: loadingConfig")
cfg := config.LoadConfig()
log.Debugf("bootstrapAction: MdadmScan(%v)", cfg.Rancher.State.MdadmScan)
if cfg.Rancher.State.MdadmScan {
if err := mdadmScan(); err != nil {
log.Errorf("Failed to run mdadm scan: %v", err)
}
}
stateScript := cfg.Rancher.State.Script
log.Debugf("bootstrapAction: stateScript(%v)", stateScript)
if stateScript != "" {
if err := runStateScript(stateScript); err != nil {
log.Errorf("Failed to run state script: %v", err)
}
}
log.Debugf("bootstrapAction: RunCommandSequence(%v)", cfg.Bootcmd)
util.RunCommandSequence(cfg.Bootcmd)
if cfg.Rancher.State.Dev != "" && cfg.Rancher.State.Wait {
waitForRoot(cfg)
}
autoformatDevices := cfg.Rancher.State.Autoformat
log.Debugf("bootstrapAction: Autoformat(%v)", cfg.Rancher.State.Autoformat)
if len(autoformatDevices) > 0 {
if err := autoformat(autoformatDevices); err != nil {
log.Errorf("Failed to run autoformat: %v", err)
}
}
log.Debugf("bootstrapAction: udev settle2")
if err := UdevSettle(); err != nil {
log.Errorf("Failed to run udev settle: %v", err)
}
return nil
}
func mdadmScan() error {
cmd := exec.Command("mdadm", "--assemble", "--scan")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}
func runStateScript(script string) error {
f, err := ioutil.TempFile("", "")
if err != nil {
return err
}
if _, err := f.WriteString(script); err != nil {
return err
}
if err := f.Chmod(os.ModePerm); err != nil {
return err
}
if err := f.Close(); err != nil {
return err
}
return util.RunScript(f.Name())
}
func waitForRoot(cfg *config.CloudConfig) {
var dev string
for i := 0; i < 30; i++ {
dev = util.ResolveDevice(cfg.Rancher.State.Dev)
if dev != "" {
break
}
time.Sleep(time.Millisecond * 1000)
}
if dev == "" {
return
}
for i := 0; i < 30; i++ {
if _, err := os.Stat(dev); err == nil {
break
}
time.Sleep(time.Millisecond * 1000)
}
}
func autoformat(autoformatDevices []string) error {
cmd := exec.Command("/usr/sbin/auto-format.sh")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Env = []string{
"AUTOFORMAT=" + strings.Join(autoformatDevices, " "),
}
return cmd.Run()
}

View File

@@ -3,17 +3,19 @@ package control
import (
"os"
log "github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/rancher/os/cmd/control/service"
"github.com/rancher/os/config"
"github.com/rancher/os/log"
)
func Main() {
log.InitLogger()
app := cli.NewApp()
app.Name = os.Args[0]
app.Usage = "Control and configure RancherOS"
app.Version = config.VERSION
app.Version = config.Version
app.Author = "Rancher Labs, Inc."
app.EnableBashCompletion = true
app.Before = func(c *cli.Context) error {
@@ -24,6 +26,13 @@ func Main() {
}
app.Commands = []cli.Command{
{
Name: "bootstrap",
Hidden: true,
HideHelp: true,
SkipFlagParsing: true,
Action: bootstrapAction,
},
{
Name: "config",
ShortName: "c",
@@ -31,35 +40,94 @@ func Main() {
HideHelp: true,
Subcommands: configSubcommands(),
},
{
Name: "console",
Usage: "manage which console container is used",
HideHelp: true,
Subcommands: consoleSubcommands(),
},
{
Name: "console-init",
Hidden: true,
HideHelp: true,
SkipFlagParsing: true,
Action: consoleInitAction,
},
{
Name: "dev",
ShortName: "d",
Usage: "dev spec",
Hidden: true,
HideHelp: true,
SkipFlagParsing: true,
Action: devAction,
},
{
Name: "docker-init",
Hidden: true,
HideHelp: true,
SkipFlagParsing: true,
Action: dockerInitAction,
},
{
Name: "engine",
Usage: "manage which Docker engine is used",
HideHelp: true,
Subcommands: engineSubcommands(),
},
{
Name: "entrypoint",
Hidden: true,
HideHelp: true,
SkipFlagParsing: true,
Action: entrypointAction,
},
{
Name: "env",
ShortName: "e",
Usage: "env command",
Hidden: true,
HideHelp: true,
SkipFlagParsing: true,
Action: envAction,
},
serviceCommand(),
service.Commands(),
{
Name: "os",
Usage: "operating system upgrade/downgrade",
HideHelp: true,
Subcommands: osSubcommands(),
},
{
Name: "preload-images",
Hidden: true,
HideHelp: true,
SkipFlagParsing: true,
Action: preloadImagesAction,
},
{
Name: "switch-console",
Hidden: true,
HideHelp: true,
SkipFlagParsing: true,
Action: switchConsoleAction,
},
{
Name: "tls",
Usage: "setup tls configuration",
HideHelp: true,
Subcommands: tlsConfCommands(),
},
{
Name: "udev-settle",
Hidden: true,
HideHelp: true,
SkipFlagParsing: true,
Action: udevSettleAction,
},
{
Name: "user-docker",
Hidden: true,
HideHelp: true,
SkipFlagParsing: true,
Action: userDockerAction,
},
installCommand,
selinuxCommand(),
}

View File

@@ -9,11 +9,12 @@ import (
"strings"
"text/template"
log "github.com/Sirupsen/logrus"
yaml "github.com/cloudfoundry-incubator/candiedyaml"
"github.com/rancher/os/log"
"github.com/codegangsta/cli"
"github.com/rancher/os/config"
"github.com/rancher/os/util"
)
func configSubcommands() []cli.Command {
@@ -28,17 +29,6 @@ func configSubcommands() []cli.Command {
Usage: "set a value",
Action: configSet,
},
{
Name: "import",
Usage: "import configuration from standard in or a file",
Action: runImport,
Flags: []cli.Flag{
cli.StringFlag{
Name: "input, i",
Usage: "File from which to read",
},
},
},
{
Name: "images",
Usage: "List Docker images for a configuration from a file",
@@ -79,6 +69,23 @@ func configSubcommands() []cli.Command {
Name: "merge",
Usage: "merge configuration from stdin",
Action: merge,
Flags: []cli.Flag{
cli.StringFlag{
Name: "input, i",
Usage: "File from which to read",
},
},
},
{
Name: "validate",
Usage: "validate configuration from stdin",
Action: validate,
Flags: []cli.Flag{
cli.StringFlag{
Name: "input, i",
Usage: "File from which to read",
},
},
},
}
}
@@ -89,9 +96,6 @@ func imagesFromConfig(cfg *config.CloudConfig) []string {
for _, service := range cfg.Rancher.BootstrapContainers {
imagesMap[service.Image] = 1
}
for _, service := range cfg.Rancher.Autoformat {
imagesMap[service.Image] = 1
}
for _, service := range cfg.Rancher.Services {
imagesMap[service.Image] = 1
}
@@ -100,13 +104,13 @@ func imagesFromConfig(cfg *config.CloudConfig) []string {
i := 0
for image := range imagesMap {
images[i] = image
i += 1
i++
}
sort.Strings(images)
return images
}
func runImages(c *cli.Context) {
func runImages(c *cli.Context) error {
configFile := c.String("input")
cfg, err := config.ReadConfig(nil, false, configFile)
if err != nil {
@@ -114,12 +118,14 @@ func runImages(c *cli.Context) {
}
images := imagesFromConfig(cfg)
fmt.Println(strings.Join(images, " "))
return nil
}
func runGenerate(c *cli.Context) {
func runGenerate(c *cli.Context) error {
if err := genTpl(os.Stdin, os.Stdout); err != nil {
log.Fatalf("Failed to generate config, err: '%s'", err)
}
return nil
}
func genTpl(in io.Reader, out io.Writer) error {
@@ -140,76 +146,34 @@ func env2map(env []string) map[string]string {
return m
}
func runImport(c *cli.Context) {
var input io.ReadCloser
var err error
input = os.Stdin
cfg, err := config.LoadConfig()
if err != nil {
log.Fatal(err)
func configSet(c *cli.Context) error {
if c.NArg() < 2 {
return nil
}
inputFile := c.String("input")
if inputFile != "" {
input, err = os.Open(inputFile)
if err != nil {
log.Fatal(err)
}
defer input.Close()
}
bytes, err := ioutil.ReadAll(input)
if err != nil {
log.Fatal(err)
}
cfg, err = cfg.Import(bytes)
if err != nil {
log.Fatal(err)
}
if err := cfg.Save(); err != nil {
log.Fatal(err)
}
}
func configSet(c *cli.Context) {
key := c.Args().Get(0)
value := c.Args().Get(1)
if key == "" {
return
return nil
}
cfg, err := config.LoadConfig()
err := config.Set(key, value)
if err != nil {
log.Fatal(err)
}
cfg, err = cfg.Set(key, value)
if err != nil {
log.Fatal(err)
}
if err := cfg.Save(); err != nil {
log.Fatal(err)
}
return nil
}
func configGet(c *cli.Context) {
func configGet(c *cli.Context) error {
arg := c.Args().Get(0)
if arg == "" {
return
return nil
}
cfg, err := config.LoadConfig()
val, err := config.Get(arg)
if err != nil {
log.WithFields(log.Fields{"err": err}).Fatal("config get: failed to load config")
}
val, err := cfg.GetIgnoreOmitEmpty(arg)
if err != nil {
log.WithFields(log.Fields{"cfg": cfg, "key": arg, "val": val, "err": err}).Fatal("config get: failed to retrieve value")
log.WithFields(log.Fields{"key": arg, "val": val, "err": err}).Fatal("config get: failed to retrieve value")
}
printYaml := false
@@ -229,31 +193,25 @@ func configGet(c *cli.Context) {
} else {
fmt.Println(val)
}
return nil
}
func merge(c *cli.Context) {
bytes, err := ioutil.ReadAll(os.Stdin)
func merge(c *cli.Context) error {
bytes, err := inputBytes(c)
if err != nil {
log.Fatal(err)
}
cfg, err := config.LoadConfig()
if err != nil {
if err = config.Merge(bytes); err != nil {
log.Fatal(err)
}
cfg, err = cfg.MergeBytes(bytes)
if err != nil {
log.Fatal(err)
}
if err := cfg.Save(); err != nil {
log.Fatal(err)
}
return nil
}
func export(c *cli.Context) {
content, err := config.Dump(c.Bool("private"), c.Bool("full"))
func export(c *cli.Context) error {
content, err := config.Export(c.Bool("private"), c.Bool("full"))
if err != nil {
log.Fatal(err)
}
@@ -262,9 +220,40 @@ func export(c *cli.Context) {
if output == "" {
fmt.Println(content)
} else {
err := ioutil.WriteFile(output, []byte(content), 0400)
err := util.WriteFileAtomic(output, []byte(content), 0400)
if err != nil {
log.Fatal(err)
}
}
return nil
}
func validate(c *cli.Context) error {
bytes, err := inputBytes(c)
if err != nil {
log.Fatal(err)
}
validationErrors, err := config.Validate(bytes)
if err != nil {
log.Fatal(err)
}
for _, validationError := range validationErrors.Errors() {
log.Error(validationError)
}
return nil
}
func inputBytes(c *cli.Context) ([]byte, error) {
input := os.Stdin
inputFile := c.String("input")
if inputFile != "" {
var err error
input, err = os.Open(inputFile)
if err != nil {
return nil, err
}
defer input.Close()
}
return ioutil.ReadAll(input)
}

170
cmd/control/console.go Normal file
View File

@@ -0,0 +1,170 @@
package control
import (
"fmt"
"io/ioutil"
"sort"
"strings"
"golang.org/x/net/context"
"github.com/codegangsta/cli"
composeConfig "github.com/docker/libcompose/config"
"github.com/docker/libcompose/project/options"
"github.com/rancher/os/cmd/control/service"
"github.com/rancher/os/compose"
"github.com/rancher/os/config"
"github.com/rancher/os/log"
"github.com/rancher/os/util"
"github.com/rancher/os/util/network"
)
func consoleSubcommands() []cli.Command {
return []cli.Command{
{
Name: "switch",
Usage: "switch console without a reboot",
Action: consoleSwitch,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "force, f",
Usage: "do not prompt for input",
},
cli.BoolFlag{
Name: "no-pull",
Usage: "don't pull console image",
},
},
},
{
Name: "enable",
Usage: "set console to be switched on next reboot",
Action: consoleEnable,
},
{
Name: "list",
Usage: "list available consoles",
Action: consoleList,
},
}
}
func consoleSwitch(c *cli.Context) error {
if len(c.Args()) != 1 {
log.Fatal("Must specify exactly one console to switch to")
}
newConsole := c.Args()[0]
cfg := config.LoadConfig()
validateConsole(newConsole, cfg)
if newConsole == currentConsole() {
log.Warnf("Console is already set to %s", newConsole)
}
if !c.Bool("force") {
fmt.Println(`Switching consoles will
1. destroy the current console container
2. log you out
3. restart Docker`)
if !yes("Continue") {
return nil
}
}
if !c.Bool("no-pull") && newConsole != "default" {
if err := compose.StageServices(cfg, newConsole); err != nil {
return err
}
}
service, err := compose.CreateService(nil, "switch-console", &composeConfig.ServiceConfigV1{
LogDriver: "json-file",
Privileged: true,
Net: "host",
Pid: "host",
Image: config.OsBase,
Labels: map[string]string{
config.ScopeLabel: config.System,
},
Command: []string{"/usr/bin/ros", "switch-console", newConsole},
VolumesFrom: []string{"all-volumes"},
})
if err != nil {
return err
}
if err = service.Delete(context.Background(), options.Delete{}); err != nil {
return err
}
if err = service.Up(context.Background(), options.Up{}); err != nil {
return err
}
return service.Log(context.Background(), true)
}
func consoleEnable(c *cli.Context) error {
if len(c.Args()) != 1 {
log.Fatal("Must specify exactly one console to enable")
}
newConsole := c.Args()[0]
cfg := config.LoadConfig()
validateConsole(newConsole, cfg)
if newConsole != "default" {
if err := compose.StageServices(cfg, newConsole); err != nil {
return err
}
}
if err := config.Set("rancher.console", newConsole); err != nil {
log.Errorf("Failed to update 'rancher.console': %v", err)
}
return nil
}
func consoleList(c *cli.Context) error {
cfg := config.LoadConfig()
consoles := availableConsoles(cfg)
currentConsole := currentConsole()
for _, console := range consoles {
if console == currentConsole {
fmt.Printf("current %s\n", console)
} else if console == cfg.Rancher.Console {
fmt.Printf("enabled %s\n", console)
} else {
fmt.Printf("disabled %s\n", console)
}
}
return nil
}
func validateConsole(console string, cfg *config.CloudConfig) {
consoles := availableConsoles(cfg)
if !service.IsLocalOrURL(console) && !util.Contains(consoles, console) {
log.Fatalf("%s is not a valid console", console)
}
}
func availableConsoles(cfg *config.CloudConfig) []string {
consoles, err := network.GetConsoles(cfg.Rancher.Repositories.ToArray())
if err != nil {
log.Fatal(err)
}
consoles = append(consoles, "default")
sort.Strings(consoles)
return consoles
}
func currentConsole() (console string) {
consoleBytes, err := ioutil.ReadFile("/run/console-done")
if err == nil {
console = strings.TrimSpace(string(consoleBytes))
} else {
log.Warnf("Failed to detect current console: %v", err)
}
return
}

280
cmd/control/console_init.go Normal file
View File

@@ -0,0 +1,280 @@
package control
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
"regexp"
"strings"
"syscall"
"github.com/codegangsta/cli"
"github.com/rancher/os/cmd/cloudinitexecute"
"github.com/rancher/os/config"
"github.com/rancher/os/log"
"github.com/rancher/os/util"
)
const (
consoleDone = "/run/console-done"
dockerHome = "/home/docker"
gettyCmd = "/sbin/agetty"
rancherHome = "/home/rancher"
startScript = "/opt/rancher/bin/start.sh"
)
type symlink struct {
oldname, newname string
}
func ConsoleInitMain() {
if err := consoleInitFunc(); err != nil {
log.Fatal(err)
}
}
func consoleInitAction(c *cli.Context) error {
return consoleInitFunc()
}
func createHomeDir(homedir string, uid, gid int) {
if _, err := os.Stat(homedir); os.IsNotExist(err) {
if err := os.MkdirAll(homedir, 0755); err != nil {
log.Error(err)
}
if err := os.Chown(homedir, uid, gid); err != nil {
log.Error(err)
}
}
}
func consoleInitFunc() error {
cfg := config.LoadConfig()
// Now that we're booted, stop writing debug messages to the console
cmd := exec.Command("sudo", "dmesg", "--console-off")
if err := cmd.Run(); err != nil {
log.Error(err)
}
createHomeDir(rancherHome, 1100, 1100)
createHomeDir(dockerHome, 1101, 1101)
password := config.GetCmdline("rancher.password")
if password != "" {
cmd := exec.Command("chpasswd")
cmd.Stdin = strings.NewReader(fmt.Sprint("rancher:", password))
if err := cmd.Run(); err != nil {
log.Error(err)
}
cmd = exec.Command("bash", "-c", `sed -E -i 's/(rancher:.*:).*(:.*:.*:.*:.*:.*:.*)$/\1\2/' /etc/shadow`)
if err := cmd.Run(); err != nil {
log.Error(err)
}
}
if err := setupSSH(cfg); err != nil {
log.Error(err)
}
if err := writeRespawn(); err != nil {
log.Error(err)
}
if err := modifySshdConfig(); err != nil {
log.Error(err)
}
for _, link := range []symlink{
{"/var/lib/rancher/engine/docker", "/usr/bin/docker"},
{"/var/lib/rancher/engine/docker-containerd", "/usr/bin/docker-containerd"},
{"/var/lib/rancher/engine/docker-containerd-ctr", "/usr/bin/docker-containerd-ctr"},
{"/var/lib/rancher/engine/docker-containerd-shim", "/usr/bin/docker-containerd-shim"},
{"/var/lib/rancher/engine/dockerd", "/usr/bin/dockerd"},
{"/var/lib/rancher/engine/docker-proxy", "/usr/bin/docker-proxy"},
{"/var/lib/rancher/engine/docker-runc", "/usr/bin/docker-runc"},
{"/usr/share/ros/os-release", "/usr/lib/os-release"},
{"/usr/share/ros/os-release", "/etc/os-release"},
} {
syscall.Unlink(link.newname)
if err := os.Symlink(link.oldname, link.newname); err != nil {
log.Error(err)
}
}
// font backslashes need to be escaped for when issue is output! (but not the others..)
if err := ioutil.WriteFile("/etc/issue", []byte(`
, , ______ _ _____ _____TM
,------------|'------'| | ___ \\ | | / _ / ___|
/ . '-' |- | |_/ /__ _ _ __ ___| |__ ___ _ __ | | | \\ '--.
\\/| | | | // _' | '_ \\ / __| '_ \\ / _ \\ '__' | | | |'--. \\
| .________.'----' | |\\ \\ (_| | | | | (__| | | | __/ | | \\_/ /\\__/ /
| | | | \\_| \\_\\__,_|_| |_|\\___|_| |_|\\___|_| \\___/\\____/
\\___/ \\___/ \s \r
RancherOS `+config.Version+` \n \l
`), 0644); err != nil {
log.Error(err)
}
cmd = exec.Command("bash", "-c", `echo $(/sbin/ifconfig | grep -B1 "inet addr" |awk '{ if ( $1 == "inet" ) { print $2 } else if ( $2 == "Link" ) { printf "%s:" ,$1 } }' |awk -F: '{ print $1 ": " $3}') >> /etc/issue`)
if err := cmd.Run(); err != nil {
log.Error(err)
}
cloudinitexecute.ApplyConsole(cfg)
if err := util.RunScript(config.CloudConfigScriptFile); err != nil {
log.Error(err)
}
if err := util.RunScript(startScript); err != nil {
log.Error(err)
}
if err := ioutil.WriteFile(consoleDone, []byte(cfg.Rancher.Console), 0644); err != nil {
log.Error(err)
}
if err := util.RunScript("/etc/rc.local"); err != nil {
log.Error(err)
}
os.Setenv("TERM", "linux")
respawnBinPath, err := exec.LookPath("respawn")
if err != nil {
return err
}
return syscall.Exec(respawnBinPath, []string{"respawn", "-f", "/etc/respawn.conf"}, os.Environ())
}
func generateRespawnConf(cmdline string) string {
var respawnConf bytes.Buffer
for i := 1; i < 7; i++ {
tty := fmt.Sprintf("tty%d", i)
respawnConf.WriteString(gettyCmd)
if strings.Contains(cmdline, fmt.Sprintf("rancher.autologin=%s", tty)) {
respawnConf.WriteString(" --autologin rancher")
}
respawnConf.WriteString(fmt.Sprintf(" 115200 %s\n", tty))
}
for _, tty := range []string{"ttyS0", "ttyS1", "ttyS2", "ttyS3", "ttyAMA0"} {
if !strings.Contains(cmdline, fmt.Sprintf("console=%s", tty)) {
continue
}
respawnConf.WriteString(gettyCmd)
if strings.Contains(cmdline, fmt.Sprintf("rancher.autologin=%s", tty)) {
respawnConf.WriteString(" --autologin rancher")
}
respawnConf.WriteString(fmt.Sprintf(" 115200 %s\n", tty))
}
respawnConf.WriteString("/usr/sbin/sshd -D")
return respawnConf.String()
}
func writeRespawn() error {
cmdline, err := ioutil.ReadFile("/proc/cmdline")
if err != nil {
return err
}
respawn := generateRespawnConf(string(cmdline))
files, err := ioutil.ReadDir("/etc/respawn.conf.d")
if err == nil {
for _, f := range files {
p := path.Join("/etc/respawn.conf.d", f.Name())
content, err := ioutil.ReadFile(p)
if err != nil {
log.Errorf("Failed to read %s: %v", p, err)
continue
}
respawn += fmt.Sprintf("\n%s", string(content))
}
} else if !os.IsNotExist(err) {
log.Error(err)
}
return ioutil.WriteFile("/etc/respawn.conf", []byte(respawn), 0644)
}
func modifySshdConfig() error {
sshdConfig, err := ioutil.ReadFile("/etc/ssh/sshd_config")
if err != nil {
return err
}
sshdConfigString := string(sshdConfig)
for _, item := range []string{
"UseDNS no",
"PermitRootLogin no",
"ServerKeyBits 2048",
"AllowGroups docker",
} {
match, err := regexp.Match("^"+item, sshdConfig)
if err != nil {
return err
}
if !match {
sshdConfigString += fmt.Sprintf("%s\n", item)
}
}
return ioutil.WriteFile("/etc/ssh/sshd_config", []byte(sshdConfigString), 0644)
}
func setupSSH(cfg *config.CloudConfig) error {
for _, keyType := range []string{"rsa", "dsa", "ecdsa", "ed25519"} {
outputFile := fmt.Sprintf("/etc/ssh/ssh_host_%s_key", keyType)
outputFilePub := fmt.Sprintf("/etc/ssh/ssh_host_%s_key.pub", keyType)
if _, err := os.Stat(outputFile); err == nil {
continue
}
saved, savedExists := cfg.Rancher.SSH.Keys[keyType]
pub, pubExists := cfg.Rancher.SSH.Keys[keyType+"-pub"]
if savedExists && pubExists {
// TODO check permissions
if err := util.WriteFileAtomic(outputFile, []byte(saved), 0600); err != nil {
return err
}
if err := util.WriteFileAtomic(outputFilePub, []byte(pub), 0600); err != nil {
return err
}
continue
}
cmd := exec.Command("bash", "-c", fmt.Sprintf("ssh-keygen -f %s -N '' -t %s", outputFile, keyType))
if err := cmd.Run(); err != nil {
return err
}
savedBytes, err := ioutil.ReadFile(outputFile)
if err != nil {
return err
}
pubBytes, err := ioutil.ReadFile(outputFilePub)
if err != nil {
return err
}
config.Set(fmt.Sprintf("rancher.ssh.keys.%s", keyType), string(savedBytes))
config.Set(fmt.Sprintf("rancher.ssh.keys.%s-pub", keyType), string(pubBytes))
}
return os.MkdirAll("/var/run/sshd", 0644)
}

View File

@@ -7,8 +7,9 @@ import (
"github.com/rancher/os/util"
)
func devAction(c *cli.Context) {
func devAction(c *cli.Context) error {
if len(c.Args()) > 0 {
fmt.Println(util.ResolveDevice(c.Args()[0]))
}
return nil
}

View File

@@ -0,0 +1,79 @@
package control
import (
"fmt"
"io/ioutil"
"os"
"path"
"strings"
"syscall"
"time"
"github.com/codegangsta/cli"
"github.com/rancher/os/config"
"github.com/rancher/os/log"
"github.com/rancher/os/util"
)
const (
dockerConf = "/var/lib/rancher/conf/docker"
dockerDone = "/run/docker-done"
dockerLog = "/var/log/docker.log"
)
func dockerInitAction(c *cli.Context) error {
for {
if _, err := os.Stat(consoleDone); err == nil {
break
}
time.Sleep(200 * time.Millisecond)
}
dockerBin := "/usr/bin/docker"
for _, binPath := range []string{
"/opt/bin",
"/usr/local/bin",
"/var/lib/rancher/docker",
} {
if util.ExistsAndExecutable(path.Join(binPath, "dockerd")) {
dockerBin = path.Join(binPath, "dockerd")
break
}
if util.ExistsAndExecutable(path.Join(binPath, "docker")) {
dockerBin = path.Join(binPath, "docker")
break
}
}
if err := syscall.Mount("", "/", "", syscall.MS_SHARED|syscall.MS_REC, ""); err != nil {
log.Error(err)
}
if err := syscall.Mount("", "/run", "", syscall.MS_SHARED|syscall.MS_REC, ""); err != nil {
log.Error(err)
}
mountInfo, err := ioutil.ReadFile("/proc/self/mountinfo")
if err != nil {
return err
}
for _, mount := range strings.Split(string(mountInfo), "\n") {
if strings.Contains(mount, "/var/lib/docker /var/lib/docker") && strings.Contains(mount, "rootfs") {
os.Setenv("DOCKER_RAMDISK", "1")
}
}
args := []string{
"bash",
"-c",
fmt.Sprintf(`[ -e %s ] && source %s; exec /usr/bin/dockerlaunch %s %s $DOCKER_OPTS >> %s 2>&1`, dockerConf, dockerConf, dockerBin, strings.Join(c.Args(), " "), dockerLog),
}
cfg := config.LoadConfig()
if err := ioutil.WriteFile(dockerDone, []byte(cfg.Rancher.Docker.Engine), 0644); err != nil {
log.Error(err)
}
return syscall.Exec("/bin/bash", args, os.Environ())
}

146
cmd/control/engine.go Normal file
View File

@@ -0,0 +1,146 @@
package control
import (
"fmt"
"io/ioutil"
"sort"
"strings"
"golang.org/x/net/context"
"github.com/codegangsta/cli"
"github.com/docker/libcompose/project/options"
"github.com/rancher/os/cmd/control/service"
"github.com/rancher/os/compose"
"github.com/rancher/os/config"
"github.com/rancher/os/log"
"github.com/rancher/os/util"
"github.com/rancher/os/util/network"
)
func engineSubcommands() []cli.Command {
return []cli.Command{
{
Name: "switch",
Usage: "switch Docker engine without a reboot",
Action: engineSwitch,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "force, f",
Usage: "do not prompt for input",
},
cli.BoolFlag{
Name: "no-pull",
Usage: "don't pull console image",
},
},
},
{
Name: "enable",
Usage: "set Docker engine to be switched on next reboot",
Action: engineEnable,
},
{
Name: "list",
Usage: "list available Docker engines",
Action: engineList,
},
}
}
func engineSwitch(c *cli.Context) error {
if len(c.Args()) != 1 {
log.Fatal("Must specify exactly one Docker engine to switch to")
}
newEngine := c.Args()[0]
cfg := config.LoadConfig()
validateEngine(newEngine, cfg)
project, err := compose.GetProject(cfg, true, false)
if err != nil {
log.Fatal(err)
}
if err = project.Stop(context.Background(), 10, "docker"); err != nil {
log.Fatal(err)
}
if err = compose.LoadSpecialService(project, cfg, "docker", newEngine); err != nil {
log.Fatal(err)
}
if err = project.Up(context.Background(), options.Up{}, "docker"); err != nil {
log.Fatal(err)
}
if err := config.Set("rancher.docker.engine", newEngine); err != nil {
log.Errorf("Failed to update rancher.docker.engine: %v", err)
}
return nil
}
func engineEnable(c *cli.Context) error {
if len(c.Args()) != 1 {
log.Fatal("Must specify exactly one Docker engine to enable")
}
newEngine := c.Args()[0]
cfg := config.LoadConfig()
validateEngine(newEngine, cfg)
if err := compose.StageServices(cfg, newEngine); err != nil {
return err
}
if err := config.Set("rancher.docker.engine", newEngine); err != nil {
log.Errorf("Failed to update 'rancher.docker.engine': %v", err)
}
return nil
}
func engineList(c *cli.Context) error {
cfg := config.LoadConfig()
engines := availableEngines(cfg)
currentEngine := currentEngine()
for _, engine := range engines {
if engine == currentEngine {
fmt.Printf("current %s\n", engine)
} else if engine == cfg.Rancher.Docker.Engine {
fmt.Printf("enabled %s\n", engine)
} else {
fmt.Printf("disabled %s\n", engine)
}
}
return nil
}
func validateEngine(engine string, cfg *config.CloudConfig) {
engines := availableEngines(cfg)
if !service.IsLocalOrURL(engine) && !util.Contains(engines, engine) {
log.Fatalf("%s is not a valid engine", engine)
}
}
func availableEngines(cfg *config.CloudConfig) []string {
engines, err := network.GetEngines(cfg.Rancher.Repositories.ToArray())
if err != nil {
log.Fatal(err)
}
sort.Strings(engines)
return engines
}
func currentEngine() (engine string) {
engineBytes, err := ioutil.ReadFile(dockerDone)
if err == nil {
engine = strings.TrimSpace(string(engineBytes))
} else {
log.Warnf("Failed to detect current Docker engine: %v", err)
}
return
}

111
cmd/control/entrypoint.go Normal file
View File

@@ -0,0 +1,111 @@
package control
import (
"os"
"os/exec"
"syscall"
"github.com/codegangsta/cli"
"github.com/rancher/os/log"
"golang.org/x/net/context"
"github.com/rancher/os/cmd/cloudinitexecute"
"github.com/rancher/os/config"
"github.com/rancher/os/docker"
"github.com/rancher/os/util"
)
const (
ca = "/etc/ssl/certs/ca-certificates.crt"
caBase = "/etc/ssl/certs/ca-certificates.crt.rancher"
)
func entrypointAction(c *cli.Context) error {
if _, err := os.Stat("/host/dev"); err == nil {
cmd := exec.Command("mount", "--rbind", "/host/dev", "/dev")
if err := cmd.Run(); err != nil {
log.Errorf("Failed to mount /dev: %v", err)
}
}
if err := util.FileCopy(caBase, ca); err != nil && !os.IsNotExist(err) {
log.Error(err)
}
cfg := config.LoadConfig()
shouldWriteFiles := false
for _, file := range cfg.WriteFiles {
if file.Container != "" {
shouldWriteFiles = true
}
}
if shouldWriteFiles {
writeFiles(cfg)
}
setupCommandSymlinks()
if len(os.Args) < 3 {
return nil
}
binary, err := exec.LookPath(os.Args[2])
if err != nil {
return err
}
return syscall.Exec(binary, os.Args[2:], os.Environ())
}
func writeFiles(cfg *config.CloudConfig) error {
id, err := util.GetCurrentContainerID()
if err != nil {
return err
}
client, err := docker.NewSystemClient()
if err != nil {
return err
}
info, err := client.ContainerInspect(context.Background(), id)
if err != nil {
return err
}
cloudinitexecute.WriteFiles(cfg, info.Name[1:])
return nil
}
func setupCommandSymlinks() {
for _, powerOperation := range []string{
"/sbin/poweroff",
"/sbin/shutdown",
"/sbin/reboot",
"/sbin/halt",
"/usr/sbin/poweroff",
"/usr/sbin/shutdown",
"/usr/sbin/reboot",
"/usr/sbin/halt",
} {
os.Remove(powerOperation)
}
for _, link := range []symlink{
{config.RosBin, "/usr/bin/cloud-init-execute"},
{config.RosBin, "/usr/bin/cloud-init-save"},
{config.RosBin, "/usr/bin/dockerlaunch"},
{config.RosBin, "/usr/bin/respawn"},
{config.RosBin, "/usr/bin/system-docker"},
{config.RosBin, "/usr/sbin/netconf"},
{config.RosBin, "/usr/sbin/wait-for-docker"},
{config.RosBin, "/sbin/poweroff"},
{config.RosBin, "/sbin/reboot"},
{config.RosBin, "/sbin/halt"},
{config.RosBin, "/sbin/shutdown"},
} {
if err := os.Symlink(link.oldname, link.newname); err != nil {
log.Error(err)
}
}
}

View File

@@ -11,15 +11,12 @@ import (
"github.com/rancher/os/util"
)
func envAction(c *cli.Context) {
cfg, err := config.LoadConfig()
if err != nil {
log.Fatal(err)
}
func envAction(c *cli.Context) error {
cfg := config.LoadConfig()
args := c.Args()
if len(args) == 0 {
return
return nil
}
osEnv := os.Environ()
@@ -39,4 +36,6 @@ func envAction(c *cli.Context) {
if err := syscall.Exec(args[0], args, util.Map2KVPairs(envMap)); err != nil {
log.Fatal(err)
}
return nil
}

1028
cmd/control/install.go Normal file → Executable file

File diff suppressed because it is too large Load Diff

102
cmd/control/install/grub.go Normal file
View File

@@ -0,0 +1,102 @@
package install
import (
"html/template"
"os"
"os/exec"
"path/filepath"
"github.com/rancher/os/log"
)
func RunGrub(baseName, device string) error {
log.Debugf("installGrub")
//grub-install --boot-directory=${baseName}/boot ${device}
cmd := exec.Command("grub-install", "--boot-directory="+baseName+"/boot", device)
if err := cmd.Run(); err != nil {
log.Errorf("%s", err)
return err
}
return nil
}
func grubConfig(menu BootVars) error {
log.Debugf("grubConfig")
filetmpl, err := template.New("grub2config").Parse(`{{define "grub2menu"}}menuentry "{{.Name}}" {
set root=(hd0,msdos1)
linux /{{.bootDir}}vmlinuz-{{.Version}}-rancheros {{.KernelArgs}} {{.Append}}
initrd /{{.bootDir}}initrd-{{.Version}}-rancheros
}
{{end}}
set default="0"
set timeout="{{.Timeout}}"
{{if .Fallback}}set fallback={{.Fallback}}{{end}}
{{- range .Entries}}
{{template "grub2menu" .}}
{{- end}}
`)
if err != nil {
log.Errorf("grub2config %s", err)
return err
}
cfgFile := filepath.Join(menu.BaseName, menu.BootDir+"grub/grub.cfg")
log.Debugf("grubConfig written to %s", cfgFile)
f, err := os.Create(cfgFile)
if err != nil {
return err
}
err = filetmpl.Execute(f, menu)
if err != nil {
return err
}
return nil
}
func PvGrubConfig(menu BootVars) error {
log.Debugf("pvGrubConfig")
filetmpl, err := template.New("grublst").Parse(`{{define "grubmenu"}}
title RancherOS {{.Version}}-({{.Name}})
root (hd0)
kernel /${bootDir}vmlinuz-{{.Version}}-rancheros {{.KernelArgs}} {{.Append}}
initrd /${bootDir}initrd-{{.Version}}-rancheros
{{end}}
default 0
timeout {{.Timeout}}
{{if .Fallback}}fallback {{.Fallback}}{{end}}
hiddenmenu
{{- range .Entries}}
{{template "grubmenu" .}}
{{- end}}
`)
if err != nil {
log.Errorf("pv grublst: %s", err)
return err
}
cfgFile := filepath.Join(menu.BaseName, menu.BootDir+"grub/menu.lst")
log.Debugf("grubMenu written to %s", cfgFile)
f, err := os.Create(cfgFile)
if err != nil {
log.Errorf("Create(%s) %s", cfgFile, err)
return err
}
err = filetmpl.Execute(f, menu)
if err != nil {
log.Errorf("execute %s", err)
return err
}
return nil
}

View File

@@ -0,0 +1,11 @@
package install
type MenuEntry struct {
Name, BootDir, Version, KernelArgs, Append string
}
type BootVars struct {
BaseName, BootDir string
Timeout uint
Fallback int
Entries []MenuEntry
}

View File

@@ -0,0 +1,45 @@
package install
import (
"html/template"
"os"
"path/filepath"
"github.com/rancher/os/log"
)
func syslinuxConfig(menu BootVars) error {
log.Debugf("syslinuxConfig")
filetmpl, err := template.New("syslinuxconfig").Parse(`{{define "syslinuxmenu"}}
LABEL {{.Name}}
LINUX ../vmlinuz-{{.Version}}-rancheros
APPEND {{.KernelArgs}} {{.Append}}
INITRD ../initrd-{{.Version}}-rancheros
{{end}}
TIMEOUT 20 #2 seconds
DEFAULT RancherOS-current
{{- range .Entries}}
{{template "syslinuxmenu" .}}
{{- end}}
`)
if err != nil {
log.Errorf("syslinuxconfig %s", err)
return err
}
cfgFile := filepath.Join(menu.BaseName, menu.BootDir+"syslinux/syslinux.cfg")
log.Debugf("syslinuxConfig written to %s", cfgFile)
f, err := os.Create(cfgFile)
if err != nil {
log.Errorf("Create(%s) %s", cfgFile, err)
return err
}
err = filetmpl.Execute(f, menu)
if err != nil {
return err
}
return nil
}

View File

@@ -1,21 +1,23 @@
package control
import (
"bufio"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"runtime"
"strings"
log "github.com/Sirupsen/logrus"
yaml "github.com/cloudfoundry-incubator/candiedyaml"
"golang.org/x/net/context"
dockerClient "github.com/fsouza/go-dockerclient"
yaml "github.com/cloudfoundry-incubator/candiedyaml"
"github.com/rancher/os/log"
"github.com/codegangsta/cli"
"github.com/docker/libcompose/project"
dockerClient "github.com/docker/engine-api/client"
composeConfig "github.com/docker/libcompose/config"
"github.com/docker/libcompose/project/options"
"github.com/rancher/os/cmd/power"
"github.com/rancher/os/compose"
"github.com/rancher/os/config"
@@ -56,7 +58,11 @@ func osSubcommands() []cli.Command {
},
cli.StringFlag{
Name: "append",
Usage: "kernel args to append by kexec",
Usage: "append additional kernel parameters",
},
cli.BoolFlag{
Name: "upgrade-console",
Usage: "upgrade console even if persistent",
},
},
},
@@ -73,31 +79,32 @@ func osSubcommands() []cli.Command {
}
}
// TODO: this and the getLatestImage should probably move to utils/network and be suitably cached.
func getImages() (*Images, error) {
upgradeUrl, err := getUpgradeUrl()
upgradeURL, err := getUpgradeURL()
if err != nil {
return nil, err
}
var body []byte
if strings.HasPrefix(upgradeUrl, "/") {
body, err = ioutil.ReadFile(upgradeUrl)
if strings.HasPrefix(upgradeURL, "/") {
body, err = ioutil.ReadFile(upgradeURL)
if err != nil {
return nil, err
}
} else {
u, err := url.Parse(upgradeUrl)
u, err := url.Parse(upgradeURL)
if err != nil {
return nil, err
}
q := u.Query()
q.Set("current", config.VERSION)
q.Set("current", config.Version)
u.RawQuery = q.Encode()
upgradeUrl = u.String()
upgradeURL = u.String()
resp, err := http.Get(upgradeUrl)
resp, err := http.Get(upgradeURL)
if err != nil {
return nil, err
}
@@ -111,7 +118,7 @@ func getImages() (*Images, error) {
return parseBody(body)
}
func osMetaDataGet(c *cli.Context) {
func osMetaDataGet(c *cli.Context) error {
images, err := getImages()
if err != nil {
log.Fatal(err)
@@ -122,14 +129,33 @@ func osMetaDataGet(c *cli.Context) {
log.Fatal(err)
}
for _, image := range images.Available {
_, err := client.InspectImage(image)
if err == dockerClient.ErrNoSuchImage {
fmt.Println(image, "remote")
} else {
fmt.Println(image, "local")
cfg := config.LoadConfig()
runningName := cfg.Rancher.Upgrade.Image + ":" + config.Version
foundRunning := false
for i := len(images.Available) - 1; i >= 0; i-- {
image := images.Available[i]
_, _, err := client.ImageInspectWithRaw(context.Background(), image, false)
local := "local"
if dockerClient.IsErrImageNotFound(err) {
local = "remote"
}
available := "available"
if image == images.Current {
available = "latest"
}
var running string
if image == runningName {
foundRunning = true
running = "running"
}
fmt.Println(image, local, available, running)
}
if !foundRunning {
fmt.Println(config.Version, "running")
}
return nil
}
func getLatestImage() (string, error) {
@@ -141,7 +167,11 @@ func getLatestImage() (string, error) {
return images.Current, nil
}
func osUpgrade(c *cli.Context) {
func osUpgrade(c *cli.Context) error {
if runtime.GOARCH != "amd64" {
log.Fatalf("ros install / upgrade only supported on 'amd64', not '%s'", runtime.GOARCH)
}
image := c.String("image")
if image == "" {
@@ -157,52 +187,59 @@ func osUpgrade(c *cli.Context) {
if c.Args().Present() {
log.Fatalf("invalid arguments %v", c.Args())
}
if err := startUpgradeContainer(image, c.Bool("stage"), c.Bool("force"), !c.Bool("no-reboot"), c.Bool("kexec"), c.String("append")); err != nil {
log.Fatal(err)
}
}
func osVersion(c *cli.Context) {
fmt.Println(config.VERSION)
}
func yes(in *bufio.Reader, question string) bool {
fmt.Printf("%s [y/N]: ", question)
line, err := in.ReadString('\n')
if err != nil {
if err := startUpgradeContainer(image, c.Bool("stage"), c.Bool("force"), !c.Bool("no-reboot"), c.Bool("kexec"), c.Bool("upgrade-console"), c.String("append")); err != nil {
log.Fatal(err)
}
return strings.ToLower(line[0:1]) == "y"
return nil
}
func startUpgradeContainer(image string, stage, force, reboot, kexec bool, kernelArgs string) error {
in := bufio.NewReader(os.Stdin)
func osVersion(c *cli.Context) error {
fmt.Println(config.Version)
return nil
}
func startUpgradeContainer(image string, stage, force, reboot, kexec bool, upgradeConsole bool, kernelArgs string) error {
command := []string{
"-t", "rancher-upgrade",
"-r", config.VERSION,
"-r", config.Version,
}
if kexec {
command = append(command, "-k")
}
kernelArgs = strings.TrimSpace(kernelArgs)
if kernelArgs != "" {
command = append(command, "-a", kernelArgs)
kernelArgs = strings.TrimSpace(kernelArgs)
if kernelArgs != "" {
command = append(command, "-a", kernelArgs)
}
if upgradeConsole {
if err := config.Set("rancher.force_console_rebuild", true); err != nil {
log.Fatal(err)
}
}
container, err := compose.CreateService(nil, "os-upgrade", &project.ServiceConfig{
fmt.Printf("Upgrading to %s\n", image)
confirmation := "Continue"
imageSplit := strings.Split(image, ":")
if len(imageSplit) > 1 && imageSplit[1] == config.Version+config.Suffix {
confirmation = fmt.Sprintf("Already at version %s. Continue anyway", imageSplit[1])
}
if !force && !yes(confirmation) {
os.Exit(1)
}
container, err := compose.CreateService(nil, "os-upgrade", &composeConfig.ServiceConfigV1{
LogDriver: "json-file",
Privileged: true,
Net: "host",
Pid: "host",
Image: image,
Labels: project.NewSliceorMap(map[string]string{
config.SCOPE: config.SYSTEM,
}),
Command: project.NewCommand(command...),
Labels: map[string]string{
config.ScopeLabel: config.System,
},
Command: command,
})
if err != nil {
return err
@@ -214,45 +251,32 @@ func startUpgradeContainer(image string, stage, force, reboot, kexec bool, kerne
}
// Only pull image if not found locally
if _, err := client.InspectImage(image); err != nil {
if err := container.Pull(); err != nil {
if _, _, err := client.ImageInspectWithRaw(context.Background(), image, false); err != nil {
if err := container.Pull(context.Background()); err != nil {
return err
}
}
if !stage {
imageSplit := strings.Split(image, ":")
if len(imageSplit) > 1 && imageSplit[1] == config.VERSION {
if !force && !yes(in, fmt.Sprintf("Already at version %s. Continue anyways", imageSplit[1])) {
os.Exit(1)
}
} else {
fmt.Printf("Upgrading to %s\n", image)
if !force && !yes(in, "Continue") {
os.Exit(1)
}
}
// If there is already an upgrade container, delete it
// Up() should to this, but currently does not due to a bug
if err := container.Delete(); err != nil {
if err := container.Delete(context.Background(), options.Delete{}); err != nil {
return err
}
if err := container.Up(); err != nil {
if err := container.Up(context.Background(), options.Up{}); err != nil {
return err
}
if err := container.Log(); err != nil {
if err := container.Log(context.Background(), true); err != nil {
return err
}
if err := container.Delete(); err != nil {
if err := container.Delete(context.Background(), options.Delete{}); err != nil {
return err
}
if reboot && (force || yes(in, "Continue with reboot")) {
if reboot && (force || yes("Continue with reboot")) {
log.Info("Rebooting")
power.Reboot()
}
@@ -271,11 +295,7 @@ func parseBody(body []byte) (*Images, error) {
return update, nil
}
func getUpgradeUrl() (string, error) {
cfg, err := config.LoadConfig()
if err != nil {
return "", err
}
return cfg.Rancher.Upgrade.Url, nil
func getUpgradeURL() (string, error) {
cfg := config.LoadConfig()
return cfg.Rancher.Upgrade.URL, nil
}

106
cmd/control/preload.go Normal file
View File

@@ -0,0 +1,106 @@
package control
import (
"compress/gzip"
"context"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"regexp"
"strings"
"github.com/codegangsta/cli"
dockerClient "github.com/docker/engine-api/client"
"github.com/rancher/os/docker"
"github.com/rancher/os/log"
)
const (
userImagesPreloadDirectory = "/var/lib/rancher/preload/docker"
)
func preloadImagesAction(c *cli.Context) error {
return PreloadImages(docker.NewDefaultClient, userImagesPreloadDirectory)
}
func shouldLoad(file string) bool {
if strings.HasSuffix(file, ".done") {
return false
}
if _, err := os.Stat(fmt.Sprintf("%s.done", file)); err == nil {
return false
}
return true
}
func PreloadImages(clientFactory func() (dockerClient.APIClient, error), imagesDir string) error {
var client dockerClient.APIClient
clientInitialized := false
if _, err := os.Stat(imagesDir); os.IsNotExist(err) {
if err = os.MkdirAll(imagesDir, 0755); err != nil {
return err
}
} else if err != nil {
return err
}
files, err := ioutil.ReadDir(imagesDir)
if err != nil {
return err
}
for _, file := range files {
filename := path.Join(imagesDir, file.Name())
if !shouldLoad(filename) {
continue
}
image, err := os.Open(filename)
if err != nil {
return err
}
var imageReader io.Reader
imageReader = image
match, err := regexp.MatchString(".t?gz$", file.Name())
if err != nil {
return err
}
if match {
imageReader, err = gzip.NewReader(image)
if err != nil {
return err
}
}
if !clientInitialized {
client, err = clientFactory()
if err != nil {
return err
}
clientInitialized = true
}
log.Infof("Loading image %s", filename)
if _, err = client.ImageLoad(context.Background(), imageReader, false); err != nil {
return err
}
if err = image.Close(); err != nil {
return err
}
doneStamp, err := os.Create(fmt.Sprintf("%s.done", filename))
if err != nil {
return err
}
if err = doneStamp.Close(); err != nil {
return err
}
}
return nil
}

View File

@@ -2,16 +2,17 @@ package control
import (
"fmt"
"syscall"
"github.com/codegangsta/cli"
"github.com/rancher/os/config"
"syscall"
)
func selinuxCommand() cli.Command {
app := cli.Command{}
app.Name = "selinux"
app.Usage = "Launch SELinux tools container."
app.Action = func(c *cli.Context) {
app.Action = func(c *cli.Context) error {
argv := []string{"system-docker", "run", "-it", "--privileged", "--rm",
"--net", "host", "--pid", "host", "--ipc", "host",
"-v", "/usr/bin/docker:/usr/bin/docker.dist:ro",
@@ -49,8 +50,9 @@ func selinuxCommand() cli.Command {
"-v", "/etc/selinux:/etc/selinux",
"-v", "/var/lib/selinux:/var/lib/selinux",
"-v", "/usr/share/selinux:/usr/share/selinux",
fmt.Sprintf("rancher/os-selinuxtools:%s", config.VERSION + config.SUFFIX), "bash"}
fmt.Sprintf("%s/os-selinuxtools:%s%s", config.OsRepo, config.Version, config.Suffix), "bash"}
syscall.Exec("/bin/system-docker", argv, []string{})
return nil
}
return app

View File

@@ -1,200 +0,0 @@
package control
import (
"fmt"
"strings"
"github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/docker/libcompose/cli/command"
dockerApp "github.com/docker/libcompose/cli/docker/app"
"github.com/docker/libcompose/project"
"github.com/rancher/os/compose"
"github.com/rancher/os/config"
"github.com/rancher/os/util"
)
type projectFactory struct {
}
func (p *projectFactory) Create(c *cli.Context) (*project.Project, error) {
cfg, err := config.LoadConfig()
if err != nil {
return nil, err
}
return compose.GetProject(cfg, true)
}
func beforeApp(c *cli.Context) error {
if c.GlobalBool("verbose") {
logrus.SetLevel(logrus.DebugLevel)
}
return nil
}
func serviceCommand() cli.Command {
factory := &projectFactory{}
app := cli.Command{}
app.Name = "service"
app.ShortName = "s"
app.Usage = "Command line interface for services and compose."
app.Before = beforeApp
app.Flags = append(command.CommonFlags(), dockerApp.DockerClientFlags()...)
app.Subcommands = append(serviceSubCommands(),
command.BuildCommand(factory),
command.CreateCommand(factory),
command.UpCommand(factory),
command.StartCommand(factory),
command.LogsCommand(factory),
command.RestartCommand(factory),
command.StopCommand(factory),
command.ScaleCommand(factory),
command.RmCommand(factory),
command.PullCommand(factory),
command.KillCommand(factory),
command.PortCommand(factory),
command.PsCommand(factory),
)
return app
}
func serviceSubCommands() []cli.Command {
return []cli.Command{
{
Name: "enable",
Usage: "turn on an service",
Action: enable,
},
{
Name: "disable",
Usage: "turn off an service",
Action: disable,
},
{
Name: "list",
Usage: "list services and state",
Action: list,
},
{
Name: "delete",
Usage: "delete a service",
Action: del,
},
}
}
func disable(c *cli.Context) {
changed := false
cfg, err := config.LoadConfig()
if err != nil {
logrus.Fatal(err)
}
for _, service := range c.Args() {
if _, ok := cfg.Rancher.ServicesInclude[service]; !ok {
continue
}
cfg.Rancher.ServicesInclude[service] = false
changed = true
}
if changed {
if err = cfg.Save(); err != nil {
logrus.Fatal(err)
}
}
}
func del(c *cli.Context) {
changed := false
cfg, err := config.LoadConfig()
if err != nil {
logrus.Fatal(err)
}
for _, service := range c.Args() {
if _, ok := cfg.Rancher.ServicesInclude[service]; !ok {
continue
}
delete(cfg.Rancher.ServicesInclude, service)
changed = true
}
if changed {
if err = cfg.Save(); err != nil {
logrus.Fatal(err)
}
}
}
func enable(c *cli.Context) {
cfg, err := config.LoadConfig()
if err != nil {
logrus.Fatal(err)
}
var enabledServices []string
for _, service := range c.Args() {
if val, ok := cfg.Rancher.ServicesInclude[service]; !ok || !val {
if strings.HasPrefix(service, "/") && !strings.HasPrefix(service, "/var/lib/rancher/conf") {
logrus.Fatalf("ERROR: Service should be in path /var/lib/rancher/conf")
}
cfg.Rancher.ServicesInclude[service] = true
enabledServices = append(enabledServices, service)
}
}
if len(enabledServices) > 0 {
if err := compose.StageServices(cfg, enabledServices...); err != nil {
logrus.Fatal(err)
}
if err := cfg.Save(); err != nil {
logrus.Fatal(err)
}
}
}
func list(c *cli.Context) {
cfg, err := config.LoadConfig()
if err != nil {
logrus.Fatal(err)
}
clone := make(map[string]bool)
for service, enabled := range cfg.Rancher.ServicesInclude {
clone[service] = enabled
}
services, err := util.GetServices(cfg.Rancher.Repositories.ToArray())
if err != nil {
logrus.Fatalf("Failed to get services: %v", err)
}
for _, service := range services {
if enabled, ok := clone[service]; ok {
delete(clone, service)
if enabled {
fmt.Printf("enabled %s\n", service)
} else {
fmt.Printf("disabled %s\n", service)
}
} else {
fmt.Printf("disabled %s\n", service)
}
}
for service, enabled := range clone {
if enabled {
fmt.Printf("enabled %s\n", service)
} else {
fmt.Printf("disabled %s\n", service)
}
}
}

View File

@@ -0,0 +1,180 @@
package app
import (
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"github.com/rancher/os/log"
"golang.org/x/net/context"
"github.com/codegangsta/cli"
"github.com/docker/libcompose/project"
"github.com/docker/libcompose/project/options"
)
func ProjectPs(p project.APIProject, c *cli.Context) error {
qFlag := c.Bool("q")
allInfo, err := p.Ps(context.Background(), qFlag, c.Args()...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
os.Stdout.WriteString(allInfo.String(!qFlag))
return nil
}
func ProjectStop(p project.APIProject, c *cli.Context) error {
err := p.Stop(context.Background(), c.Int("timeout"), c.Args()...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
return nil
}
func ProjectDown(p project.APIProject, c *cli.Context) error {
options := options.Down{
RemoveVolume: c.Bool("volumes"),
RemoveImages: options.ImageType(c.String("rmi")),
RemoveOrphans: c.Bool("remove-orphans"),
}
err := p.Down(context.Background(), options, c.Args()...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
return nil
}
func ProjectBuild(p project.APIProject, c *cli.Context) error {
config := options.Build{
NoCache: c.Bool("no-cache"),
ForceRemove: c.Bool("force-rm"),
Pull: c.Bool("pull"),
}
err := p.Build(context.Background(), config, c.Args()...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
return nil
}
func ProjectCreate(p project.APIProject, c *cli.Context) error {
options := options.Create{
NoRecreate: c.Bool("no-recreate"),
ForceRecreate: c.Bool("force-recreate"),
NoBuild: c.Bool("no-build"),
}
err := p.Create(context.Background(), options, c.Args()...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
return nil
}
func ProjectUp(p project.APIProject, c *cli.Context) error {
options := options.Up{
Create: options.Create{
NoRecreate: c.Bool("no-recreate"),
ForceRecreate: c.Bool("force-recreate"),
NoBuild: c.Bool("no-build"),
},
}
ctx, cancelFun := context.WithCancel(context.Background())
err := p.Up(ctx, options, c.Args()...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
if c.Bool("foreground") {
signalChan := make(chan os.Signal, 1)
cleanupDone := make(chan bool)
signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)
errChan := make(chan error)
go func() {
errChan <- p.Log(ctx, true, c.Args()...)
}()
go func() {
select {
case <-signalChan:
fmt.Printf("\nGracefully stopping...\n")
cancelFun()
ProjectStop(p, c)
cleanupDone <- true
case err := <-errChan:
if err != nil {
log.Fatal(err)
}
cleanupDone <- true
}
}()
<-cleanupDone
return nil
}
return nil
}
func ProjectStart(p project.APIProject, c *cli.Context) error {
err := p.Start(context.Background(), c.Args()...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
return nil
}
func ProjectRestart(p project.APIProject, c *cli.Context) error {
err := p.Restart(context.Background(), c.Int("timeout"), c.Args()...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
return nil
}
func ProjectLog(p project.APIProject, c *cli.Context) error {
err := p.Log(context.Background(), c.Bool("follow"), c.Args()...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
return nil
}
func ProjectPull(p project.APIProject, c *cli.Context) error {
err := p.Pull(context.Background(), c.Args()...)
if err != nil && !c.Bool("ignore-pull-failures") {
return cli.NewExitError(err.Error(), 1)
}
return nil
}
func ProjectDelete(p project.APIProject, c *cli.Context) error {
options := options.Delete{
RemoveVolume: c.Bool("v"),
}
if !c.Bool("force") {
options.BeforeDeleteCallback = func(stoppedContainers []string) bool {
fmt.Printf("Going to remove %v\nAre you sure? [yN]\n", strings.Join(stoppedContainers, ", "))
var answer string
_, err := fmt.Scanln(&answer)
if err != nil {
log.Error(err)
return false
}
if answer != "y" && answer != "Y" {
return false
}
return true
}
}
err := p.Delete(context.Background(), options, c.Args()...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
return nil
}
func ProjectKill(p project.APIProject, c *cli.Context) error {
err := p.Kill(context.Background(), c.String("signal"), c.Args()...)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
return nil
}

View File

@@ -0,0 +1,243 @@
package command
import (
"errors"
"github.com/codegangsta/cli"
composeApp "github.com/docker/libcompose/cli/app"
"github.com/rancher/os/cmd/control/service/app"
)
func verifyOneOrMoreServices(c *cli.Context) error {
if len(c.Args()) == 0 {
return errors.New("Must specify one or more services")
}
return nil
}
func CreateCommand(factory composeApp.ProjectFactory) cli.Command {
return cli.Command{
Name: "create",
Usage: "Create services",
Before: verifyOneOrMoreServices,
Action: composeApp.WithProject(factory, app.ProjectCreate),
Flags: []cli.Flag{
cli.BoolFlag{
Name: "no-recreate",
Usage: "If containers already exist, don't recreate them. Incompatible with --force-recreate.",
},
cli.BoolFlag{
Name: "force-recreate",
Usage: "Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate.",
},
cli.BoolFlag{
Name: "no-build",
Usage: "Don't build an image, even if it's missing.",
},
},
}
}
func BuildCommand(factory composeApp.ProjectFactory) cli.Command {
return cli.Command{
Name: "build",
Usage: "Build or rebuild services",
Before: verifyOneOrMoreServices,
Action: composeApp.WithProject(factory, app.ProjectBuild),
Flags: []cli.Flag{
cli.BoolFlag{
Name: "no-cache",
Usage: "Do not use cache when building the image",
},
cli.BoolFlag{
Name: "force-rm",
Usage: "Always remove intermediate containers",
},
cli.BoolFlag{
Name: "pull",
Usage: "Always attempt to pull a newer version of the image",
},
},
}
}
func PsCommand(factory composeApp.ProjectFactory) cli.Command {
return cli.Command{
Name: "ps",
Usage: "List containers",
Action: composeApp.WithProject(factory, app.ProjectPs),
Flags: []cli.Flag{
cli.BoolFlag{
Name: "q",
Usage: "Only display IDs",
},
},
}
}
func UpCommand(factory composeApp.ProjectFactory) cli.Command {
return cli.Command{
Name: "up",
Usage: "Create and start containers",
Before: verifyOneOrMoreServices,
Action: composeApp.WithProject(factory, app.ProjectUp),
Flags: []cli.Flag{
cli.BoolFlag{
Name: "foreground",
Usage: "Run in foreground and log",
},
cli.BoolFlag{
Name: "no-build",
Usage: "Don't build an image, even if it's missing.",
},
cli.BoolFlag{
Name: "no-recreate",
Usage: "If containers already exist, don't recreate them. Incompatible with --force-recreate.",
},
cli.BoolFlag{
Name: "force-recreate",
Usage: "Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate.",
},
},
}
}
func StartCommand(factory composeApp.ProjectFactory) cli.Command {
return cli.Command{
Name: "start",
Usage: "Start services",
Before: verifyOneOrMoreServices,
Action: composeApp.WithProject(factory, app.ProjectStart),
Flags: []cli.Flag{
cli.BoolTFlag{
Name: "foreground",
Usage: "Run in foreground and log",
},
},
}
}
func PullCommand(factory composeApp.ProjectFactory) cli.Command {
return cli.Command{
Name: "pull",
Usage: "Pulls service images",
Before: verifyOneOrMoreServices,
Action: composeApp.WithProject(factory, app.ProjectPull),
Flags: []cli.Flag{
cli.BoolFlag{
Name: "ignore-pull-failures",
Usage: "Pull what it can and ignores images with pull failures.",
},
},
}
}
func LogsCommand(factory composeApp.ProjectFactory) cli.Command {
return cli.Command{
Name: "logs",
Usage: "View output from containers",
Before: verifyOneOrMoreServices,
Action: composeApp.WithProject(factory, app.ProjectLog),
Flags: []cli.Flag{
cli.IntFlag{
Name: "lines",
Usage: "number of lines to tail",
Value: 100,
},
cli.BoolFlag{
Name: "follow",
Usage: "Follow log output.",
},
},
}
}
func RestartCommand(factory composeApp.ProjectFactory) cli.Command {
return cli.Command{
Name: "restart",
Usage: "Restart services",
Before: verifyOneOrMoreServices,
Action: composeApp.WithProject(factory, app.ProjectRestart),
Flags: []cli.Flag{
cli.IntFlag{
Name: "timeout,t",
Usage: "Specify a shutdown timeout in seconds.",
Value: 10,
},
},
}
}
func StopCommand(factory composeApp.ProjectFactory) cli.Command {
return cli.Command{
Name: "stop",
Usage: "Stop services",
Before: verifyOneOrMoreServices,
Action: composeApp.WithProject(factory, app.ProjectStop),
Flags: []cli.Flag{
cli.IntFlag{
Name: "timeout,t",
Usage: "Specify a shutdown timeout in seconds.",
Value: 10,
},
},
}
}
func DownCommand(factory composeApp.ProjectFactory) cli.Command {
return cli.Command{
Name: "down",
Usage: "Stop and remove containers, networks, images, and volumes",
Before: verifyOneOrMoreServices,
Action: composeApp.WithProject(factory, app.ProjectDown),
Flags: []cli.Flag{
cli.BoolFlag{
Name: "volumes,v",
Usage: "Remove data volumes",
},
cli.StringFlag{
Name: "rmi",
Usage: "Remove images, type may be one of: 'all' to remove all images, or 'local' to remove only images that don't have an custom name set by the `image` field",
},
cli.BoolFlag{
Name: "remove-orphans",
Usage: "Remove containers for services not defined in the Compose file",
},
},
}
}
func RmCommand(factory composeApp.ProjectFactory) cli.Command {
return cli.Command{
Name: "rm",
Usage: "Delete services",
Before: verifyOneOrMoreServices,
Action: composeApp.WithProject(factory, app.ProjectDelete),
Flags: []cli.Flag{
cli.BoolFlag{
Name: "force,f",
Usage: "Allow deletion of all services",
},
cli.BoolFlag{
Name: "v",
Usage: "Remove volumes associated with containers",
},
},
}
}
func KillCommand(factory composeApp.ProjectFactory) cli.Command {
return cli.Command{
Name: "kill",
Usage: "Kill containers",
Before: verifyOneOrMoreServices,
Action: composeApp.WithProject(factory, app.ProjectKill),
Flags: []cli.Flag{
cli.StringFlag{
Name: "signal,s",
Usage: "SIGNAL to send to the container",
Value: "SIGKILL",
},
},
}
}

View File

@@ -0,0 +1,224 @@
package service
import (
"fmt"
"strings"
"github.com/codegangsta/cli"
dockerApp "github.com/docker/libcompose/cli/docker/app"
"github.com/docker/libcompose/project"
"github.com/rancher/os/cmd/control/service/command"
"github.com/rancher/os/compose"
"github.com/rancher/os/config"
"github.com/rancher/os/log"
"github.com/rancher/os/util"
"github.com/rancher/os/util/network"
)
type projectFactory struct {
}
func (p *projectFactory) Create(c *cli.Context) (project.APIProject, error) {
cfg := config.LoadConfig()
return compose.GetProject(cfg, true, false)
}
func beforeApp(c *cli.Context) error {
if c.GlobalBool("verbose") {
log.SetLevel(log.DebugLevel)
}
return nil
}
func Commands() cli.Command {
factory := &projectFactory{}
app := cli.Command{}
app.Name = "service"
app.ShortName = "s"
app.Usage = "Command line interface for services and compose."
app.Before = beforeApp
app.Flags = append(dockerApp.DockerClientFlags(), cli.BoolFlag{
Name: "verbose,debug",
})
app.Subcommands = append(serviceSubCommands(),
command.BuildCommand(factory),
command.CreateCommand(factory),
command.UpCommand(factory),
command.StartCommand(factory),
command.LogsCommand(factory),
command.RestartCommand(factory),
command.StopCommand(factory),
command.RmCommand(factory),
command.PullCommand(factory),
command.KillCommand(factory),
command.PsCommand(factory),
)
return app
}
func serviceSubCommands() []cli.Command {
return []cli.Command{
{
Name: "enable",
Usage: "turn on an service",
Action: enable,
},
{
Name: "disable",
Usage: "turn off an service",
Action: disable,
},
{
Name: "list",
Usage: "list services and state",
Action: list,
},
{
Name: "delete",
Usage: "delete a service",
Action: del,
},
}
}
func updateIncludedServices(cfg *config.CloudConfig) error {
return config.Set("rancher.services_include", cfg.Rancher.ServicesInclude)
}
func disable(c *cli.Context) error {
changed := false
cfg := config.LoadConfig()
for _, service := range c.Args() {
validateService(service, cfg)
if _, ok := cfg.Rancher.ServicesInclude[service]; !ok {
continue
}
cfg.Rancher.ServicesInclude[service] = false
changed = true
}
if changed {
if err := updateIncludedServices(cfg); err != nil {
log.Fatal(err)
}
}
return nil
}
func del(c *cli.Context) error {
changed := false
cfg := config.LoadConfig()
for _, service := range c.Args() {
validateService(service, cfg)
if _, ok := cfg.Rancher.ServicesInclude[service]; !ok {
continue
}
delete(cfg.Rancher.ServicesInclude, service)
changed = true
}
if changed {
if err := updateIncludedServices(cfg); err != nil {
log.Fatal(err)
}
}
return nil
}
func enable(c *cli.Context) error {
cfg := config.LoadConfig()
var enabledServices []string
for _, service := range c.Args() {
validateService(service, cfg)
if val, ok := cfg.Rancher.ServicesInclude[service]; !ok || !val {
if isLocal(service) && !strings.HasPrefix(service, "/var/lib/rancher/conf") {
log.Fatalf("ERROR: Service should be in path /var/lib/rancher/conf")
}
cfg.Rancher.ServicesInclude[service] = true
enabledServices = append(enabledServices, service)
}
}
if len(enabledServices) > 0 {
if err := compose.StageServices(cfg, enabledServices...); err != nil {
log.Fatal(err)
}
if err := updateIncludedServices(cfg); err != nil {
log.Fatal(err)
}
}
return nil
}
func list(c *cli.Context) error {
cfg := config.LoadConfig()
clone := make(map[string]bool)
for service, enabled := range cfg.Rancher.ServicesInclude {
clone[service] = enabled
}
services := availableService(cfg)
for _, service := range services {
if enabled, ok := clone[service]; ok {
delete(clone, service)
if enabled {
fmt.Printf("enabled %s\n", service)
} else {
fmt.Printf("disabled %s\n", service)
}
} else {
fmt.Printf("disabled %s\n", service)
}
}
for service, enabled := range clone {
if enabled {
fmt.Printf("enabled %s\n", service)
} else {
fmt.Printf("disabled %s\n", service)
}
}
return nil
}
func isLocal(service string) bool {
return strings.HasPrefix(service, "/")
}
func IsLocalOrURL(service string) bool {
return isLocal(service) || strings.HasPrefix(service, "http:/") || strings.HasPrefix(service, "https:/")
}
func validateService(service string, cfg *config.CloudConfig) {
services := availableService(cfg)
if !IsLocalOrURL(service) && !util.Contains(services, service) {
log.Fatalf("%s is not a valid service", service)
}
}
func availableService(cfg *config.CloudConfig) []string {
services, err := network.GetServices(cfg.Rancher.Repositories.ToArray())
if err != nil {
log.Fatalf("Failed to get services: %v", err)
}
return services
}

View File

@@ -0,0 +1,48 @@
package control
import (
"errors"
"github.com/codegangsta/cli"
"github.com/docker/libcompose/project/options"
"github.com/rancher/os/compose"
"github.com/rancher/os/config"
"github.com/rancher/os/log"
"golang.org/x/net/context"
)
func switchConsoleAction(c *cli.Context) error {
if len(c.Args()) != 1 {
return errors.New("Must specify exactly one existing container")
}
newConsole := c.Args()[0]
cfg := config.LoadConfig()
project, err := compose.GetProject(cfg, true, false)
if err != nil {
return err
}
if newConsole != "default" {
if err = compose.LoadSpecialService(project, cfg, "console", newConsole); err != nil {
return err
}
}
if err = config.Set("rancher.console", newConsole); err != nil {
log.Errorf("Failed to update 'rancher.console': %v", err)
}
if err = project.Up(context.Background(), options.Up{
Log: true,
}, "console"); err != nil {
return err
}
if err = project.Restart(context.Background(), 10, "docker"); err != nil {
log.Errorf("Failed to restart Docker: %v", err)
}
return nil
}

View File

@@ -5,16 +5,25 @@ import (
"os"
"path/filepath"
log "github.com/Sirupsen/logrus"
"github.com/rancher/os/log"
"github.com/codegangsta/cli"
machineUtil "github.com/docker/machine/utils"
"github.com/rancher/os/config"
"github.com/rancher/os/util"
)
const (
NAME string = "rancher"
BITS int = 2048
NAME string = "rancher"
BITS int = 2048
ServerTLSPath string = "/etc/docker/tls"
ClientTLSPath string = "/home/rancher/.docker"
Cert string = "cert.pem"
Key string = "key.pem"
ServerCert string = "server-cert.pem"
ServerKey string = "server-key.pem"
CaCert string = "ca.pem"
CaKey string = "ca-key.pem"
)
func tlsConfCommands() []cli.Command {
@@ -44,101 +53,81 @@ func tlsConfCommands() []cli.Command {
}
}
func writeCerts(generateServer bool, hostname []string, cfg *config.CloudConfig, certPath, keyPath, caCertPath, caKeyPath string) error {
func writeCerts(generateServer bool, hostname []string, certPath, keyPath, caCertPath, caKeyPath string) error {
if !generateServer {
return machineUtil.GenerateCert([]string{""}, certPath, keyPath, caCertPath, caKeyPath, NAME, BITS)
}
if cfg.Rancher.Docker.ServerKey == "" || cfg.Rancher.Docker.ServerCert == "" {
err := machineUtil.GenerateCert(hostname, certPath, keyPath, caCertPath, caKeyPath, NAME, BITS)
if err != nil {
return err
}
cert, err := ioutil.ReadFile(certPath)
if err != nil {
return err
}
key, err := ioutil.ReadFile(keyPath)
if err != nil {
return err
}
cfg, err = cfg.Merge(map[interface{}]interface{}{
"rancher": map[interface{}]interface{}{
"docker": map[interface{}]interface{}{
"server_cert": string(cert),
"server_key": string(key),
},
},
})
if err != nil {
return err
}
return cfg.Save() // certPath, keyPath are already written to by machineUtil.GenerateCert()
}
if err := ioutil.WriteFile(certPath, []byte(cfg.Rancher.Docker.ServerCert), 0400); err != nil {
if err := machineUtil.GenerateCert(hostname, certPath, keyPath, caCertPath, caKeyPath, NAME, BITS); err != nil {
return err
}
return ioutil.WriteFile(keyPath, []byte(cfg.Rancher.Docker.ServerKey), 0400)
cert, err := ioutil.ReadFile(certPath)
if err != nil {
return err
}
key, err := ioutil.ReadFile(keyPath)
if err != nil {
return err
}
// certPath, keyPath are already written to by machineUtil.GenerateCert()
if err := config.Set("rancher.docker.server_cert", string(cert)); err != nil {
return err
}
if err := config.Set("rancher.docker.server_key", string(key)); err != nil {
return err
}
return nil
}
func writeCaCerts(cfg *config.CloudConfig, caCertPath, caKeyPath string) (*config.CloudConfig, error) {
func writeCaCerts(cfg *config.CloudConfig, caCertPath, caKeyPath string) error {
if cfg.Rancher.Docker.CACert == "" {
if err := machineUtil.GenerateCACertificate(caCertPath, caKeyPath, NAME, BITS); err != nil {
return nil, err
return err
}
caCert, err := ioutil.ReadFile(caCertPath)
if err != nil {
return nil, err
return err
}
caKey, err := ioutil.ReadFile(caKeyPath)
if err != nil {
return nil, err
return err
}
cfg, err = cfg.Merge(map[interface{}]interface{}{
"rancher": map[interface{}]interface{}{
"docker": map[interface{}]interface{}{
"ca_key": string(caKey),
"ca_cert": string(caCert),
},
},
})
if err != nil {
return nil, err
// caCertPath, caKeyPath are already written to by machineUtil.GenerateCACertificate()
if err := config.Set("rancher.docker.ca_cert", string(caCert)); err != nil {
return err
}
if err := config.Set("rancher.docker.ca_key", string(caKey)); err != nil {
return err
}
} else {
cfg = config.LoadConfig()
if err := util.WriteFileAtomic(caCertPath, []byte(cfg.Rancher.Docker.CACert), 0400); err != nil {
return err
}
if err = cfg.Save(); err != nil {
return nil, err
if err := util.WriteFileAtomic(caKeyPath, []byte(cfg.Rancher.Docker.CAKey), 0400); err != nil {
return err
}
return cfg, nil // caCertPath, caKeyPath are already written to by machineUtil.GenerateCACertificate()
}
if err := ioutil.WriteFile(caCertPath, []byte(cfg.Rancher.Docker.CACert), 0400); err != nil {
return nil, err
}
if err := ioutil.WriteFile(caKeyPath, []byte(cfg.Rancher.Docker.CAKey), 0400); err != nil {
return nil, err
}
return cfg, nil
return nil
}
func tlsConfCreate(c *cli.Context) {
func tlsConfCreate(c *cli.Context) error {
err := generate(c)
if err != nil {
log.Fatal(err)
}
return nil
}
func generate(c *cli.Context) error {
@@ -150,27 +139,22 @@ func generate(c *cli.Context) error {
}
func Generate(generateServer bool, outDir string, hostnames []string) error {
cfg, err := config.LoadConfig()
if err != nil {
return err
}
if outDir == "" {
if generateServer {
outDir = "/etc/docker/tls"
outDir = ServerTLSPath
} else {
outDir = "/home/rancher/.docker"
outDir = ClientTLSPath
}
log.Infof("Out directory (-d, --dir) not specified, using default: %s", outDir)
}
caCertPath := filepath.Join(outDir, "ca.pem")
caKeyPath := filepath.Join(outDir, "ca-key.pem")
certPath := filepath.Join(outDir, "cert.pem")
keyPath := filepath.Join(outDir, "key.pem")
caCertPath := filepath.Join(outDir, CaCert)
caKeyPath := filepath.Join(outDir, CaKey)
certPath := filepath.Join(outDir, Cert)
keyPath := filepath.Join(outDir, Key)
if generateServer {
certPath = filepath.Join(outDir, "server-cert.pem")
keyPath = filepath.Join(outDir, "server-key.pem")
certPath = filepath.Join(outDir, ServerCert)
keyPath = filepath.Join(outDir, ServerKey)
}
if _, err := os.Stat(outDir); os.IsNotExist(err) {
@@ -179,11 +163,11 @@ func Generate(generateServer bool, outDir string, hostnames []string) error {
}
}
cfg, err = writeCaCerts(cfg, caCertPath, caKeyPath)
if err != nil {
cfg := config.LoadConfig()
if err := writeCaCerts(cfg, caCertPath, caKeyPath); err != nil {
return err
}
if err := writeCerts(generateServer, hostnames, cfg, certPath, keyPath, caCertPath, caKeyPath); err != nil {
if err := writeCerts(generateServer, hostnames, certPath, keyPath, caCertPath, caKeyPath); err != nil {
return err
}

36
cmd/control/udevsettle.go Normal file
View File

@@ -0,0 +1,36 @@
package control
import (
"os"
"os/exec"
"github.com/codegangsta/cli"
"github.com/rancher/os/log"
)
func udevSettleAction(c *cli.Context) {
if err := UdevSettle(); err != nil {
log.Fatal(err)
}
}
func UdevSettle() error {
cmd := exec.Command("udevd", "--daemon")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
return err
}
cmd = exec.Command("udevadm", "trigger", "--action=add")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
return err
}
cmd = exec.Command("udevadm", "settle")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}

238
cmd/control/user_docker.go Normal file
View File

@@ -0,0 +1,238 @@
package control
import (
"io"
"io/ioutil"
"os"
"path"
"syscall"
"time"
"golang.org/x/net/context"
"path/filepath"
"github.com/codegangsta/cli"
composeClient "github.com/docker/libcompose/docker/client"
"github.com/docker/libcompose/project"
"github.com/rancher/os/compose"
"github.com/rancher/os/config"
rosDocker "github.com/rancher/os/docker"
"github.com/rancher/os/log"
"github.com/rancher/os/util"
)
const (
defaultStorageContext = "console"
dockerPidFile = "/var/run/docker.pid"
userDocker = "user-docker"
sourceDirectory = "/engine"
destDirectory = "/var/lib/rancher/engine"
)
var (
dockerCommand = []string{
"ros",
"docker-init",
}
)
func userDockerAction(c *cli.Context) error {
if err := copyBinaries(sourceDirectory, destDirectory); err != nil {
return err
}
if err := syscall.Mount("/host/sys", "/sys", "", syscall.MS_BIND|syscall.MS_REC, ""); err != nil {
return err
}
cfg := config.LoadConfig()
return startDocker(cfg)
}
func copyBinaries(source, dest string) error {
if err := os.MkdirAll(dest, 0755); err != nil {
return err
}
files, err := ioutil.ReadDir(dest)
if err != nil {
return err
}
for _, file := range files {
if err = os.RemoveAll(path.Join(dest, file.Name())); err != nil {
return err
}
}
files, err = ioutil.ReadDir(source)
if err != nil {
return err
}
for _, file := range files {
sourceFile := path.Join(source, file.Name())
destFile := path.Join(dest, file.Name())
in, err := os.Open(sourceFile)
if err != nil {
return err
}
out, err := os.Create(destFile)
if err != nil {
return err
}
if _, err = io.Copy(out, in); err != nil {
return err
}
if err = out.Sync(); err != nil {
return err
}
if err = in.Close(); err != nil {
return err
}
if err = out.Close(); err != nil {
return err
}
if err := os.Chmod(destFile, 0751); err != nil {
return err
}
}
return nil
}
func writeConfigCerts(cfg *config.CloudConfig) error {
outDir := ServerTLSPath
if err := os.MkdirAll(outDir, 0700); err != nil {
return err
}
caCertPath := filepath.Join(outDir, CaCert)
caKeyPath := filepath.Join(outDir, CaKey)
serverCertPath := filepath.Join(outDir, ServerCert)
serverKeyPath := filepath.Join(outDir, ServerKey)
if cfg.Rancher.Docker.CACert != "" {
if err := util.WriteFileAtomic(caCertPath, []byte(cfg.Rancher.Docker.CACert), 0400); err != nil {
return err
}
if err := util.WriteFileAtomic(caKeyPath, []byte(cfg.Rancher.Docker.CAKey), 0400); err != nil {
return err
}
}
if cfg.Rancher.Docker.ServerCert != "" {
if err := util.WriteFileAtomic(serverCertPath, []byte(cfg.Rancher.Docker.ServerCert), 0400); err != nil {
return err
}
if err := util.WriteFileAtomic(serverKeyPath, []byte(cfg.Rancher.Docker.ServerKey), 0400); err != nil {
return err
}
}
return nil
}
func startDocker(cfg *config.CloudConfig) error {
storageContext := cfg.Rancher.Docker.StorageContext
if storageContext == "" {
storageContext = defaultStorageContext
}
log.Infof("Starting Docker in context: %s", storageContext)
p, err := compose.GetProject(cfg, true, false)
if err != nil {
return err
}
pid, err := waitForPid(storageContext, p)
if err != nil {
return err
}
log.Infof("%s PID %d", storageContext, pid)
client, err := rosDocker.NewSystemClient()
if err != nil {
return err
}
dockerCfg := cfg.Rancher.Docker
args := dockerCfg.FullArgs()
log.Debugf("User Docker args: %v", args)
if dockerCfg.TLS {
if err := writeConfigCerts(cfg); err != nil {
return err
}
}
info, err := client.ContainerInspect(context.Background(), storageContext)
if err != nil {
return err
}
cmd := []string{"docker-runc", "exec", "--", info.ID, "env"}
log.Info(dockerCfg.AppendEnv())
cmd = append(cmd, dockerCfg.AppendEnv()...)
cmd = append(cmd, dockerCommand...)
cmd = append(cmd, args...)
log.Infof("Running %v", cmd)
return syscall.Exec("/usr/bin/ros", cmd, os.Environ())
}
func waitForPid(service string, project *project.Project) (int, error) {
log.Infof("Getting PID for service: %s", service)
for {
if pid, err := getPid(service, project); err != nil || pid == 0 {
log.Infof("Waiting for %s : %d : %v", service, pid, err)
time.Sleep(1 * time.Second)
} else {
return pid, err
}
}
}
func getPid(service string, project *project.Project) (int, error) {
s, err := project.CreateService(service)
if err != nil {
return 0, err
}
containers, err := s.Containers(context.Background())
if err != nil {
return 0, err
}
if len(containers) == 0 {
return 0, nil
}
client, err := composeClient.Create(composeClient.Options{
Host: config.SystemDockerHost,
})
if err != nil {
return 0, err
}
id, err := containers[0].ID()
if err != nil {
return 0, err
}
info, err := client.ContainerInspect(context.Background(), id)
if err != nil || info.ID == "" {
return 0, err
}
if info.State.Running {
return info.State.Pid, nil
}
return 0, nil
}

21
cmd/control/util.go Normal file
View File

@@ -0,0 +1,21 @@
package control
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/rancher/os/log"
)
func yes(question string) bool {
fmt.Printf("%s [y/N]: ", question)
in := bufio.NewReader(os.Stdin)
line, err := in.ReadString('\n')
if err != nil {
log.Fatal(err)
}
return strings.ToLower(line[0:1]) == "y"
}

100
cmd/network/network.go Normal file → Executable file
View File

@@ -1,58 +1,39 @@
package network
import (
"bufio"
"flag"
"io/ioutil"
"os"
"os/exec"
"strings"
log "github.com/Sirupsen/logrus"
"github.com/rancher/os/log"
"github.com/docker/libnetwork/resolvconf"
"github.com/rancher/netconf"
"github.com/rancher/os/cmd/cloudinit"
"github.com/rancher/os/config"
"github.com/rancher/os/hostname"
"github.com/rancher/os/netconf"
)
const (
NETWORK_DONE = "/var/run/network.done"
WAIT_FOR_NETWORK = "wait-for-network"
)
var (
daemon bool
flags *flag.FlagSet
)
func init() {
flags = flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
flags.BoolVar(&daemon, "daemon", false, "run dhcpd as daemon")
}
func sendTerm(proc string) {
cmd := exec.Command("killall", "-TERM", proc)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
cmd.Run()
}
func Main() {
flags.Parse(os.Args[1:])
log.InitLogger()
log.Infof("Running network: daemon=%v", daemon)
cfg := config.LoadConfig()
ApplyNetworkConfig(cfg)
os.Remove(NETWORK_DONE) // ignore error
cfg, err := config.LoadConfig()
if err != nil {
log.Fatal(err)
select {}
}
func ApplyNetworkConfig(cfg *config.CloudConfig) {
log.Infof("Apply Network Config")
nameservers := cfg.Rancher.Network.DNS.Nameservers
search := cfg.Rancher.Network.DNS.Search
userSetDNS := len(nameservers) > 0 || len(search) > 0
if !userSetDNS {
nameservers = cfg.Rancher.Defaults.Network.DNS.Nameservers
search = cfg.Rancher.Defaults.Network.DNS.Search
}
hostname, _ := cloudinit.SetHostname(cfg) // ignore error
log.Infof("Network: hostname: '%s'", hostname)
// TODO: don't write to the file if nameservers is still empty
if _, err := resolvconf.Build("/etc/resolv.conf", nameservers, search, nil); err != nil {
log.Error(err)
}
if _, err := resolvconf.Build("/etc/resolv.conf", cfg.Rancher.Network.Dns.Nameservers, cfg.Rancher.Network.Dns.Search, nil); err != nil {
if err := hostname.SetHostnameFromCloudConfig(cfg); err != nil {
log.Error(err)
}
@@ -60,38 +41,15 @@ func Main() {
log.Error(err)
}
hostname, _ = cloudinit.SetHostname(cfg) // ignore error
log.Infof("Network: hostname: '%s' (from DHCP, if not set by cloud-config)", hostname)
if hostname != "" {
hosts, err := os.Open("/etc/hosts")
defer hosts.Close()
if err != nil {
log.Fatal(err)
}
lines := bufio.NewScanner(hosts)
hostsContent := ""
for lines.Scan() {
line := strings.TrimSpace(lines.Text())
fields := strings.Fields(line)
if len(fields) > 0 && fields[0] == "127.0.1.1" {
hostsContent += "127.0.1.1 " + hostname + "\n"
continue
}
hostsContent += line + "\n"
}
if err := ioutil.WriteFile("/etc/hosts", []byte(hostsContent), 0600); err != nil {
log.Error(err)
}
}
if f, err := os.Create(NETWORK_DONE); err != nil {
// TODO: seems wrong to do this outside netconf
userSetHostname := cfg.Hostname != ""
log.Infof("Apply Network Config RunDhcp")
if err := netconf.RunDhcp(&cfg.Rancher.Network, !userSetHostname, !userSetDNS); err != nil {
log.Error(err)
} else {
f.Close()
}
sendTerm(WAIT_FOR_NETWORK)
if daemon {
select {}
log.Infof("Apply Network Config SyncHostname")
if err := hostname.SyncHostname(); err != nil {
log.Error(err)
}
}

View File

@@ -1,7 +1,6 @@
package power
import (
"bufio"
"errors"
"os"
"path/filepath"
@@ -9,14 +8,15 @@ import (
"strings"
"syscall"
log "github.com/Sirupsen/logrus"
dockerClient "github.com/fsouza/go-dockerclient"
"golang.org/x/net/context"
"github.com/docker/engine-api/types"
"github.com/docker/engine-api/types/container"
"github.com/docker/engine-api/types/filters"
"github.com/rancher/os/log"
"github.com/rancher/os/docker"
)
const (
DOCKER_CGROUPS_FILE = "/proc/self/cgroup"
"github.com/rancher/os/util"
)
func runDocker(name string) error {
@@ -36,11 +36,10 @@ func runDocker(name string) error {
cmd = os.Args
}
exiting, err := client.InspectContainer(name)
if exiting != nil {
err := client.RemoveContainer(dockerClient.RemoveContainerOptions{
ID: exiting.ID,
Force: true,
existing, err := client.ContainerInspect(context.Background(), name)
if err == nil && existing.ID != "" {
err := client.ContainerRemove(context.Background(), types.ContainerRemoveOptions{
ContainerID: existing.ID,
})
if err != nil {
@@ -48,53 +47,50 @@ func runDocker(name string) error {
}
}
currentContainerId, err := getCurrentContainerId()
currentContainerID, err := util.GetCurrentContainerID()
if err != nil {
return err
}
currentContainer, err := client.InspectContainer(currentContainerId)
currentContainer, err := client.ContainerInspect(context.Background(), currentContainerID)
if err != nil {
return err
}
powerContainer, err := client.CreateContainer(dockerClient.CreateContainerOptions{
Name: name,
Config: &dockerClient.Config{
powerContainer, err := client.ContainerCreate(context.Background(),
&container.Config{
Image: currentContainer.Config.Image,
Cmd: cmd,
Env: []string{
"IN_DOCKER=true",
},
},
HostConfig: &dockerClient.HostConfig{
&container.HostConfig{
PidMode: "host",
VolumesFrom: []string{
currentContainer.ID,
},
Privileged: true,
},
})
}, nil, name)
if err != nil {
return err
}
go func() {
client.AttachToContainer(dockerClient.AttachToContainerOptions{
Container: powerContainer.ID,
OutputStream: os.Stdout,
ErrorStream: os.Stderr,
Stderr: true,
Stdout: true,
client.ContainerAttach(context.Background(), types.ContainerAttachOptions{
ContainerID: powerContainer.ID,
Stream: true,
Stderr: true,
Stdout: true,
})
}()
err = client.StartContainer(powerContainer.ID, powerContainer.HostConfig)
err = client.ContainerStart(context.Background(), powerContainer.ID)
if err != nil {
return err
}
_, err = client.WaitContainer(powerContainer.ID)
_, err = client.ContainerWait(context.Background(), powerContainer.ID)
if err != nil {
log.Fatal(err)
@@ -114,7 +110,7 @@ func common(name string) {
}
}
func PowerOff() {
func Off() {
common("poweroff")
reboot(syscall.LINUX_REBOOT_CMD_POWER_OFF)
}
@@ -172,19 +168,20 @@ func shutDownContainers() error {
return err
}
opts := dockerClient.ListContainersOptions{
All: true,
Filters: map[string][]string{
"status": {"running"},
},
filter := filters.NewArgs()
filter.Add("status", "running")
opts := types.ContainerListOptions{
All: true,
Filter: filter,
}
containers, err := client.ListContainers(opts)
containers, err := client.ContainerList(context.Background(), opts)
if err != nil {
return err
}
currentContainerId, err := getCurrentContainerId()
currentContainerID, err := util.GetCurrentContainerID()
if err != nil {
return err
}
@@ -192,12 +189,12 @@ func shutDownContainers() error {
var stopErrorStrings []string
for _, container := range containers {
if container.ID == currentContainerId {
if container.ID == currentContainerID {
continue
}
log.Infof("Stopping %s : %v", container.ID[:12], container.Names)
stopErr := client.StopContainer(container.ID, uint(timeout))
stopErr := client.ContainerStop(context.Background(), container.ID, timeout)
if stopErr != nil {
stopErrorStrings = append(stopErrorStrings, " ["+container.ID+"] "+stopErr.Error())
}
@@ -206,10 +203,10 @@ func shutDownContainers() error {
var waitErrorStrings []string
for _, container := range containers {
if container.ID == currentContainerId {
if container.ID == currentContainerID {
continue
}
_, waitErr := client.WaitContainer(container.ID)
_, waitErr := client.ContainerWait(context.Background(), container.ID)
if waitErr != nil {
waitErrorStrings = append(waitErrorStrings, " ["+container.ID+"] "+waitErr.Error())
}
@@ -221,35 +218,3 @@ func shutDownContainers() error {
return nil
}
func getCurrentContainerId() (string, error) {
file, err := os.Open(DOCKER_CGROUPS_FILE)
if err != nil {
return "", err
}
fileReader := bufio.NewScanner(file)
if !fileReader.Scan() {
return "", errors.New("Empty file /proc/self/cgroup")
}
line := fileReader.Text()
parts := strings.Split(line, "/")
for len(parts) != 3 {
if !fileReader.Scan() {
return "", errors.New("Found no docker cgroups")
}
line = fileReader.Text()
parts = strings.Split(line, "/")
if len(parts) == 3 {
if strings.HasSuffix(parts[1], "docker") {
break
} else {
parts = nil
}
}
}
return parts[len(parts)-1:][0], nil
}

View File

@@ -5,14 +5,16 @@ import (
"github.com/codegangsta/cli"
"github.com/rancher/os/config"
"github.com/rancher/os/log"
)
func Main() {
log.InitLogger()
app := cli.NewApp()
app.Name = os.Args[0]
app.Usage = "Control and configure RancherOS"
app.Version = config.VERSION
app.Version = config.Version
app.Author = "Rancher Labs, Inc."
app.Email = "sid@rancher.com"
app.EnableBashCompletion = true
@@ -31,7 +33,7 @@ func Main() {
app.Run(os.Args)
}
func shutdown(c *cli.Context) {
func shutdown(c *cli.Context) error {
common("")
reboot := c.String("r")
poweroff := c.String("h")
@@ -39,6 +41,8 @@ func shutdown(c *cli.Context) {
if reboot == "now" {
Reboot()
} else if poweroff == "now" {
PowerOff()
Off()
}
return nil
}

View File

@@ -12,17 +12,18 @@ import (
"syscall"
"time"
log "github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/rancher/os/log"
)
var (
running bool = true
processes map[int]*os.Process = map[int]*os.Process{}
processLock = sync.Mutex{}
running = true
processes = map[int]*os.Process{}
processLock = sync.Mutex{}
)
func Main() {
log.InitLogger()
runtime.GOMAXPROCS(1)
runtime.LockOSThread()
app := cli.NewApp()
@@ -48,7 +49,7 @@ func setupSigterm() {
}()
}
func run(c *cli.Context) {
func run(c *cli.Context) error {
setupSigterm()
var stream io.Reader = os.Stdin
@@ -79,6 +80,7 @@ func run(c *cli.Context) {
}
wg.Wait()
return nil
}
func addProcess(process *os.Process) {

View File

@@ -1,11 +1,12 @@
package sysinit
import (
log "github.com/Sirupsen/logrus"
initPkg "github.com/rancher/os/init"
"github.com/rancher/os/log"
)
func Main() {
log.InitLogger()
if err := initPkg.SysInit(); err != nil {
log.Fatal(err)
}

View File

@@ -2,29 +2,21 @@ package systemdocker
import (
"os"
"strings"
"syscall"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/docker"
"github.com/rancher/os/config"
"github.com/rancher/os/log"
)
func Main() {
var newEnv []string
for _, env := range os.Environ() {
if !strings.HasPrefix(env, "DOCKER_HOST=") {
newEnv = append(newEnv, env)
}
}
newEnv = append(newEnv, "DOCKER_HOST="+config.DOCKER_SYSTEM_HOST)
log.InitLogger()
if os.Geteuid() != 0 {
log.Fatalf("%s: Need to be root", os.Args[0])
}
os.Args[0] = config.DOCKER_DIST_BIN
if err := syscall.Exec(os.Args[0], os.Args, newEnv); err != nil {
log.Fatal(err)
if os.Getenv("DOCKER_HOST") == "" {
os.Setenv("DOCKER_HOST", config.SystemDockerHost)
}
docker.Main()
}

View File

@@ -1,268 +0,0 @@
package userdocker
import (
"bufio"
"encoding/json"
"fmt"
"os"
"os/exec"
"os/signal"
"strings"
"syscall"
"time"
log "github.com/Sirupsen/logrus"
"github.com/docker/libcompose/docker"
"github.com/docker/libcompose/project"
"github.com/rancher/os/cmd/control"
"github.com/rancher/os/compose"
"github.com/rancher/os/config"
"github.com/opencontainers/runc/libcontainer/cgroups"
_ "github.com/opencontainers/runc/libcontainer/nsenter"
"github.com/opencontainers/runc/libcontainer/system"
)
const (
DEFAULT_STORAGE_CONTEXT = "console"
userDocker = "user-docker"
)
func Main() {
cfg, err := config.LoadConfig()
if err != nil {
log.Fatal(err)
}
if len(os.Args) == 1 {
if err := enter(cfg); err != nil {
log.Fatal(err)
}
} else {
if err := main(cfg); err != nil {
log.Fatal(err)
}
}
}
func enter(cfg *config.CloudConfig) error {
context := cfg.Rancher.Docker.StorageContext
if context == "" {
context = DEFAULT_STORAGE_CONTEXT
}
log.Infof("Starting Docker in context: %s", context)
p, err := compose.GetProject(cfg, true)
if err != nil {
return err
}
pid, err := waitForPid(context, p)
if err != nil {
return err
}
log.Infof("%s PID %d", context, pid)
return runNsenter(pid)
}
type result struct {
Pid int `json:"Pid"`
}
func findProgram(searchPaths ...string) string {
prog := ""
for _, i := range searchPaths {
var err error
prog, err = exec.LookPath(i)
if err == nil {
break
}
prog = i
}
return prog
}
func runNsenter(pid int) error {
args := []string{findProgram(userDocker), "main"}
r, w, err := os.Pipe()
if err != nil {
return err
}
cmd := &exec.Cmd{
Path: args[0],
Args: args,
Stdin: os.Stdin,
Stdout: os.Stdout,
Stderr: os.Stderr,
ExtraFiles: []*os.File{w},
Env: append(os.Environ(),
"_LIBCONTAINER_INITPIPE=3",
fmt.Sprintf("_LIBCONTAINER_INITPID=%d", pid),
),
}
if err := cmd.Start(); err != nil {
return err
}
w.Close()
var result result
if err := json.NewDecoder(r).Decode(&result); err != nil {
return err
}
if err := cmd.Wait(); err != nil {
return err
}
log.Infof("Docker PID %d", result.Pid)
p, err := os.FindProcess(result.Pid)
if err != nil {
return err
}
handleTerm(p)
if err := switchCgroup(result.Pid, pid); err != nil {
return err
}
_, err = p.Wait()
return err
}
func handleTerm(p *os.Process) {
term := make(chan os.Signal)
signal.Notify(term, syscall.SIGTERM)
go func() {
<-term
p.Signal(syscall.SIGTERM)
}()
}
func waitForPid(service string, project *project.Project) (int, error) {
log.Infof("Getting PID for service: %s", service)
for {
if pid, err := getPid(service, project); err != nil || pid == 0 {
log.Infof("Waiting for %s : %d : %v", service, pid, err)
time.Sleep(1 * time.Second)
} else {
return pid, err
}
}
}
func getPid(service string, project *project.Project) (int, error) {
s, err := project.CreateService(service)
if err != nil {
return 0, err
}
containers, err := s.Containers()
if err != nil {
return 0, err
}
if len(containers) == 0 {
return 0, nil
}
client, err := docker.CreateClient(docker.ClientOpts{
Host: config.DOCKER_SYSTEM_HOST,
})
if err != nil {
return 0, err
}
id, err := containers[0].ID()
if err != nil {
return 0, err
}
info, err := client.InspectContainer(id)
if err != nil || info == nil {
return 0, err
}
if info.State.Running {
return info.State.Pid, nil
}
return 0, nil
}
func main(cfg *config.CloudConfig) error {
os.Unsetenv("_LIBCONTAINER_INITPIPE")
os.Unsetenv("_LIBCONTAINER_INITPID")
if err := system.ParentDeathSignal(syscall.SIGKILL).Set(); err != nil {
return err
}
if err := os.Remove("/var/run/docker.pid"); err != nil && !os.IsNotExist(err) {
return err
}
dockerCfg := cfg.Rancher.Docker
args := dockerCfg.FullArgs()
log.Debugf("User Docker args: %v", args)
if dockerCfg.TLS {
log.Debug("Generating TLS certs if needed")
if err := control.Generate(true, "/etc/docker/tls", []string{"127.0.0.1", "*", "*.*", "*.*.*", "*.*.*.*"}); err != nil {
return err
}
}
prog := findProgram("docker-init", "dockerlaunch", "docker")
if strings.Contains(prog, "dockerlaunch") {
args = append([]string{prog, "docker"}, args...)
} else {
args = append([]string{prog}, args...)
}
log.Infof("Running %v", args)
return syscall.Exec(args[0], args, dockerCfg.AppendEnv())
}
func switchCgroup(src, target int) error {
cgroupFile := fmt.Sprintf("/proc/%d/cgroup", target)
f, err := os.Open(cgroupFile)
if err != nil {
return err
}
defer f.Close()
targetCgroups := map[string]string{}
s := bufio.NewScanner(f)
for s.Scan() {
text := s.Text()
parts := strings.Split(text, ":")
subparts := strings.Split(parts[1], "=")
subsystem := subparts[0]
if len(subparts) > 1 {
subsystem = subparts[1]
}
targetPath := fmt.Sprintf("/host/sys/fs/cgroup/%s%s", subsystem, parts[2])
log.Infof("Moving Docker to cgroup %s", targetPath)
targetCgroups[subsystem] = targetPath
}
if err := s.Err(); err != nil {
return err
}
return cgroups.EnterPid(targetCgroups, src)
}

View File

@@ -3,17 +3,18 @@ package wait
import (
"os"
"github.com/Sirupsen/logrus"
"github.com/rancher/os/config"
"github.com/rancher/os/docker"
"github.com/rancher/os/log"
)
func Main() {
_, err := docker.NewClient(config.DOCKER_HOST)
log.InitLogger()
_, err := docker.NewClient(config.DockerHost)
if err != nil {
logrus.Errorf("Failed to conect to Docker")
log.Errorf("Failed to connect to Docker")
os.Exit(1)
}
logrus.Infof("Docker is ready")
log.Infof("Docker is ready")
}

View File

@@ -1,23 +0,0 @@
package waitfornetwork
import (
"github.com/rancher/os/cmd/network"
"os"
"os/signal"
"syscall"
)
func handleTerm() {
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM)
<-c
os.Exit(0)
}
func Main() {
go handleTerm()
if _, err := os.Stat(network.NETWORK_DONE); err == nil {
os.Exit(0)
}
select {}
}

View File

@@ -2,26 +2,30 @@ package compose
import (
"fmt"
log "github.com/Sirupsen/logrus"
"golang.org/x/net/context"
yaml "github.com/cloudfoundry-incubator/candiedyaml"
"github.com/docker/libcompose/cli/logger"
composeConfig "github.com/docker/libcompose/config"
"github.com/docker/libcompose/docker"
composeClient "github.com/docker/libcompose/docker/client"
"github.com/docker/libcompose/project"
"github.com/docker/libcompose/project/events"
"github.com/docker/libcompose/project/options"
"github.com/rancher/os/config"
rosDocker "github.com/rancher/os/docker"
"github.com/rancher/os/log"
"github.com/rancher/os/util"
"github.com/rancher/os/util/network"
)
func CreateService(cfg *config.CloudConfig, name string, serviceConfig *project.ServiceConfig) (project.Service, error) {
func CreateService(cfg *config.CloudConfig, name string, serviceConfig *composeConfig.ServiceConfigV1) (project.Service, error) {
if cfg == nil {
var err error
cfg, err = config.LoadConfig()
if err != nil {
return nil, err
}
cfg = config.LoadConfig()
}
p, err := CreateServiceSet("once", cfg, map[string]*project.ServiceConfig{
p, err := CreateServiceSet("once", cfg, map[string]*composeConfig.ServiceConfigV1{
name: serviceConfig,
})
if err != nil {
@@ -31,8 +35,8 @@ func CreateService(cfg *config.CloudConfig, name string, serviceConfig *project.
return p.CreateService(name)
}
func CreateServiceSet(name string, cfg *config.CloudConfig, configs map[string]*project.ServiceConfig) (*project.Project, error) {
p, err := newProject(name, cfg, nil)
func CreateServiceSet(name string, cfg *config.CloudConfig, configs map[string]*composeConfig.ServiceConfigV1) (*project.Project, error) {
p, err := newProject(name, cfg, nil, nil)
if err != nil {
return nil, err
}
@@ -42,21 +46,22 @@ func CreateServiceSet(name string, cfg *config.CloudConfig, configs map[string]*
return p, nil
}
func RunServiceSet(name string, cfg *config.CloudConfig, configs map[string]*project.ServiceConfig) (*project.Project, error) {
func RunServiceSet(name string, cfg *config.CloudConfig, configs map[string]*composeConfig.ServiceConfigV1) (*project.Project, error) {
p, err := CreateServiceSet(name, cfg, configs)
if err != nil {
return nil, err
}
return p, p.Up()
return p, p.Up(context.Background(), options.Up{
Log: cfg.Rancher.Log,
})
}
func GetProject(cfg *config.CloudConfig, networkingAvailable bool) (*project.Project, error) {
return newCoreServiceProject(cfg, networkingAvailable)
func GetProject(cfg *config.CloudConfig, networkingAvailable, loadConsole bool) (*project.Project, error) {
return newCoreServiceProject(cfg, networkingAvailable, loadConsole)
}
func newProject(name string, cfg *config.CloudConfig, environmentLookup project.EnvironmentLookup) (*project.Project, error) {
clientFactory, err := rosDocker.NewClientFactory(docker.ClientOpts{})
func newProject(name string, cfg *config.CloudConfig, environmentLookup composeConfig.EnvironmentLookup, authLookup *rosDocker.ConfigAuthLookup) (*project.Project, error) {
clientFactory, err := rosDocker.NewClientFactory(composeClient.Options{})
if err != nil {
return nil, err
}
@@ -64,31 +69,89 @@ func newProject(name string, cfg *config.CloudConfig, environmentLookup project.
if environmentLookup == nil {
environmentLookup = rosDocker.NewConfigEnvironment(cfg)
}
if authLookup == nil {
authLookup = rosDocker.NewConfigAuthLookup(cfg)
}
serviceFactory := &rosDocker.ServiceFactory{
Deps: map[string][]string{},
}
context := &docker.Context{
ClientFactory: clientFactory,
AuthLookup: authLookup,
Context: project.Context{
ProjectName: name,
NoRecreate: true, // for libcompose to not recreate on project reload, looping up the boot :)
EnvironmentLookup: environmentLookup,
ServiceFactory: serviceFactory,
Log: cfg.Rancher.Log,
LoggerFactory: logger.NewColorLoggerFactory(),
},
}
serviceFactory.Context = context
return docker.NewProject(context)
authLookup.SetContext(context)
return docker.NewProject(context, &composeConfig.ParseOptions{
Interpolate: true,
Validate: false,
Preprocess: preprocessServiceMap,
})
}
func addServices(p *project.Project, enabled map[interface{}]interface{}, configs map[string]*project.ServiceConfig) map[interface{}]interface{} {
func preprocessServiceMap(serviceMap composeConfig.RawServiceMap) (composeConfig.RawServiceMap, error) {
newServiceMap := make(composeConfig.RawServiceMap)
for k, v := range serviceMap {
newServiceMap[k] = make(composeConfig.RawService)
for k2, v2 := range v {
if k2 == "environment" || k2 == "labels" {
newServiceMap[k][k2] = preprocess(v2, true)
} else {
newServiceMap[k][k2] = preprocess(v2, false)
}
}
}
return newServiceMap, nil
}
func preprocess(item interface{}, replaceTypes bool) interface{} {
switch typedDatas := item.(type) {
case map[interface{}]interface{}:
newMap := make(map[interface{}]interface{})
for key, value := range typedDatas {
newMap[key] = preprocess(value, replaceTypes)
}
return newMap
case []interface{}:
// newArray := make([]interface{}, 0) will cause golint to complain
var newArray []interface{}
newArray = make([]interface{}, 0)
for _, value := range typedDatas {
newArray = append(newArray, preprocess(value, replaceTypes))
}
return newArray
default:
if replaceTypes {
return fmt.Sprint(item)
}
return item
}
}
func addServices(p *project.Project, enabled map[interface{}]interface{}, configs map[string]*composeConfig.ServiceConfigV1) map[interface{}]interface{} {
serviceConfigsV2, _ := composeConfig.ConvertServices(configs)
// Note: we ignore errors while loading services
unchanged := true
for name, serviceConfig := range configs {
hash := project.GetServiceHash(name, serviceConfig)
for name, serviceConfig := range serviceConfigsV2 {
hash := composeConfig.GetServiceHash(name, serviceConfig)
if enabled[name] == hash {
continue
@@ -121,72 +184,25 @@ func adjustContainerNames(m map[interface{}]interface{}) map[interface{}]interfa
return m
}
func newCoreServiceProject(cfg *config.CloudConfig, network bool) (*project.Project, error) {
projectEvents := make(chan project.Event)
enabled := map[interface{}]interface{}{}
func newCoreServiceProject(cfg *config.CloudConfig, useNetwork, loadConsole bool) (*project.Project, error) {
environmentLookup := rosDocker.NewConfigEnvironment(cfg)
authLookup := rosDocker.NewConfigAuthLookup(cfg)
p, err := newProject("os", cfg, environmentLookup)
p, err := newProject("os", cfg, environmentLookup, authLookup)
if err != nil {
return nil, err
}
projectEvents := make(chan events.Event)
p.AddListener(project.NewDefaultListener(p))
p.AddListener(projectEvents)
p.ReloadCallback = func() error {
var err error
cfg, err = config.LoadConfig()
if err != nil {
return err
}
environmentLookup.SetConfig(cfg)
enabled = addServices(p, enabled, cfg.Rancher.Services)
for service, serviceEnabled := range cfg.Rancher.ServicesInclude {
if _, ok := enabled[service]; ok || !serviceEnabled {
continue
}
bytes, err := LoadServiceResource(service, network, cfg)
if err != nil {
if err == util.ErrNoNetwork {
log.Debugf("Can not load %s, networking not enabled", service)
} else {
log.Errorf("Failed to load %s : %v", service, err)
}
continue
}
m := map[interface{}]interface{}{}
if err := yaml.Unmarshal(bytes, &m); err != nil {
log.Errorf("Failed to parse YAML configuration: %s : %v", service, err)
continue
}
bytes, err = yaml.Marshal(adjustContainerNames(config.StringifyValues(m)))
if err != nil {
log.Errorf("Failed to marshal YAML configuration: %s : %v", service, err)
continue
}
err = p.Load(bytes)
if err != nil {
log.Errorf("Failed to load %s : %v", service, err)
continue
}
enabled[service] = service
}
return nil
}
p.ReloadCallback = projectReload(p, &useNetwork, loadConsole, environmentLookup, authLookup)
go func() {
for event := range projectEvents {
if event.EventType == project.EventContainerStarted && event.ServiceName == "ntp" {
network = true
if event.EventType == events.ContainerStarted && event.ServiceName == "network" {
useNetwork = true
}
}
}()
@@ -201,13 +217,13 @@ func newCoreServiceProject(cfg *config.CloudConfig, network bool) (*project.Proj
}
func StageServices(cfg *config.CloudConfig, services ...string) error {
p, err := newProject("stage-services", cfg, nil)
p, err := newProject("stage-services", cfg, nil, nil)
if err != nil {
return err
}
for _, service := range services {
bytes, err := LoadServiceResource(service, true, cfg)
bytes, err := network.LoadServiceResource(service, true, cfg)
if err != nil {
return fmt.Errorf("Failed to load %s : %v", service, err)
}
@@ -217,29 +233,25 @@ func StageServices(cfg *config.CloudConfig, services ...string) error {
return fmt.Errorf("Failed to parse YAML configuration: %s : %v", service, err)
}
bytes, err = yaml.Marshal(config.StringifyValues(m))
bytes, err = yaml.Marshal(m)
if err != nil {
fmt.Errorf("Failed to marshal YAML configuration: %s : %v", service, err)
return fmt.Errorf("Failed to marshal YAML configuration: %s : %v", service, err)
}
err = p.Load(bytes)
if err != nil {
fmt.Errorf("Failed to load %s : %v", service, err)
return fmt.Errorf("Failed to load %s : %v", service, err)
}
}
// Reduce service configurations to just image and labels
for serviceName, serviceConfig := range p.Configs {
p.Configs[serviceName] = &project.ServiceConfig{
for _, serviceName := range p.ServiceConfigs.Keys() {
serviceConfig, _ := p.ServiceConfigs.Get(serviceName)
p.ServiceConfigs.Add(serviceName, &composeConfig.ServiceConfig{
Image: serviceConfig.Image,
Labels: serviceConfig.Labels,
}
})
}
return p.Pull()
}
func LoadServiceResource(name string, network bool, cfg *config.CloudConfig) ([]byte, error) {
return util.LoadResource(name, network, cfg.Rancher.Repositories.ToArray())
return p.Pull(context.Background())
}

112
compose/reload.go Normal file
View File

@@ -0,0 +1,112 @@
package compose
import (
"fmt"
yaml "github.com/cloudfoundry-incubator/candiedyaml"
composeConfig "github.com/docker/libcompose/config"
"github.com/docker/libcompose/project"
"github.com/rancher/os/config"
"github.com/rancher/os/docker"
"github.com/rancher/os/log"
"github.com/rancher/os/util/network"
)
func LoadService(p *project.Project, cfg *config.CloudConfig, useNetwork bool, service string) error {
bytes, err := network.LoadServiceResource(service, useNetwork, cfg)
if err != nil {
return err
}
m := map[interface{}]interface{}{}
if err = yaml.Unmarshal(bytes, &m); err != nil {
return fmt.Errorf("Failed to parse YAML configuration for %s: %v", service, err)
}
m = adjustContainerNames(m)
bytes, err = yaml.Marshal(m)
if err != nil {
return fmt.Errorf("Failed to marshal YAML configuration for %s: %v", service, err)
}
if err = p.Load(bytes); err != nil {
return fmt.Errorf("Failed to load %s: %v", service, err)
}
return nil
}
func LoadSpecialService(p *project.Project, cfg *config.CloudConfig, serviceName, serviceValue string) error {
// Save config in case load fails
previousConfig, ok := p.ServiceConfigs.Get(serviceName)
p.ServiceConfigs.Add(serviceName, &composeConfig.ServiceConfig{})
if err := LoadService(p, cfg, true, serviceValue); err != nil {
// Rollback to previous config
if ok {
p.ServiceConfigs.Add(serviceName, previousConfig)
}
return err
}
return nil
}
func loadConsoleService(cfg *config.CloudConfig, p *project.Project) error {
if cfg.Rancher.Console == "" || cfg.Rancher.Console == "default" {
return nil
}
return LoadSpecialService(p, cfg, "console", cfg.Rancher.Console)
}
func loadEngineService(cfg *config.CloudConfig, p *project.Project) error {
if cfg.Rancher.Docker.Engine == "" || cfg.Rancher.Docker.Engine == cfg.Rancher.Defaults.Docker.Engine {
return nil
}
return LoadSpecialService(p, cfg, "docker", cfg.Rancher.Docker.Engine)
}
func projectReload(p *project.Project, useNetwork *bool, loadConsole bool, environmentLookup *docker.ConfigEnvironment, authLookup *docker.ConfigAuthLookup) func() error {
enabled := map[interface{}]interface{}{}
return func() error {
cfg := config.LoadConfig()
environmentLookup.SetConfig(cfg)
authLookup.SetConfig(cfg)
enabled = addServices(p, enabled, cfg.Rancher.Services)
for service, serviceEnabled := range cfg.Rancher.ServicesInclude {
if _, ok := enabled[service]; ok || !serviceEnabled {
continue
}
if err := LoadService(p, cfg, *useNetwork, service); err != nil {
if err != network.ErrNoNetwork {
log.Error(err)
}
continue
}
enabled[service] = service
}
if !*useNetwork {
return nil
}
if loadConsole {
if err := loadConsoleService(cfg, p); err != nil {
log.Errorf("Failed to load console: %v", err)
}
}
if err := loadEngineService(cfg, p); err != nil {
log.Errorf("Failed to load engine: %v", err)
}
return nil
}
}

View File

@@ -0,0 +1,9 @@
language: go
matrix:
include:
- go: 1.5
env: GO15VENDOREXPERIMENT=1
- go: 1.6
script:
- ./test

View File

@@ -0,0 +1,38 @@
# Deprecated Cloud-Config Features
## Retrieving SSH Authorized Keys
### From a GitHub User
Using the `coreos-ssh-import-github` field, we can import public SSH keys from a GitHub user to use as authorized keys to a server.
```yaml
#cloud-config
users:
- name: elroy
coreos-ssh-import-github: elroy
```
### From an HTTP Endpoint
We can also pull public SSH keys from any HTTP endpoint which matches [GitHub's API response format](https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user).
For example, if you have an installation of GitHub Enterprise, you can provide a complete URL with an authentication token:
```yaml
#cloud-config
users:
- name: elroy
coreos-ssh-import-url: https://github-enterprise.example.com/api/v3/users/elroy/keys?access_token=<TOKEN>
```
You can also specify any URL whose response matches the JSON format for public keys:
```yaml
#cloud-config
users:
- name: elroy
coreos-ssh-import-url: https://example.com/public-keys
```

View File

@@ -0,0 +1,26 @@
# Cloud-Config Locations
On every boot, coreos-cloudinit looks for a config file to configure your host. Here is a list of locations which are used by the Cloud-Config utility, depending on your CoreOS platform:
| Location | Description |
| --- | --- |
| `/media/configvirtfs/openstack/latest/user_data` | `/media/configvirtfs` mount point with [config-2](/os/docs/latest/config-drive.html#contents-and-format) label. It should contain a `openstack/latest/user_data` relative path. Usually used by cloud providers or in VM installations. |
| `/media/configdrive/openstack/latest/user_data` | FAT or ISO9660 filesystem with [config-2](/os/docs/latest/config-drive.html#qemu-virtfs) label and `/media/configdrive/` mount point. It should also contain a `openstack/latest/user_data` relative path. Usually used in installations which are configured by USB Flash sticks or CDROM media. |
| Kernel command line: `cloud-config-url=http://example.com/user_data`. | You can find this string using this command `cat /proc/cmdline`. Usually used in [PXE](/os/docs/latest/booting-with-pxe.html) or [iPXE](/os/docs/latest/booting-with-ipxe.html) boots. |
| `/var/lib/coreos-install/user_data` | When you install CoreOS manually using the [coreos-install](/os/docs/latest/installing-to-disk.html) tool. Usually used in bare metal installations. |
| `/usr/share/oem/cloud-config.yml` | Path for OEM images. |
| `/var/lib/coreos-vagrant/vagrantfile-user-data`| Vagrant OEM scripts automatically store Cloud-Config into this path. |
| `/var/lib/waagent/CustomData`| Azure platform uses OEM path for first Cloud-Config initialization and then `/var/lib/waagent/CustomData` to apply your settings. |
| `http://169.254.169.254/metadata/v1/user-data` `http://169.254.169.254/2009-04-04/user-data` `https://metadata.packet.net/userdata`|DigitalOcean, EC2 and Packet cloud providers correspondingly use these URLs to download Cloud-Config.|
| `/usr/share/oem/bin/vmtoolsd --cmd "info-get guestinfo.coreos.config.data"` | Cloud-Config provided by [VMware Guestinfo][VMware Guestinfo] |
| `/usr/share/oem/bin/vmtoolsd --cmd "info-get guestinfo.coreos.config.url"` | Cloud-Config URL provided by [VMware Guestinfo][VMware Guestinfo] |
[VMware Guestinfo]: vmware-guestinfo.md
You can also run the `coreos-cloudinit` tool manually and provide a path to your custom Cloud-Config file:
```sh
sudo coreos-cloudinit --from-file=/home/core/cloud-config.yaml
```
This command will apply your custom cloud-config.

View File

@@ -0,0 +1,37 @@
## OEM configuration
The `coreos.oem.*` parameters follow the [os-release spec][os-release], but have been repurposed as a way for coreos-cloudinit to know about the OEM partition on this machine. Customizing this section is only needed when generating a new OEM of CoreOS from the SDK. The fields include:
- **id**: Lowercase string identifying the OEM
- **name**: Human-friendly string representing the OEM
- **version-id**: Lowercase string identifying the version of the OEM
- **home-url**: Link to the homepage of the provider or OEM
- **bug-report-url**: Link to a place to file bug reports about this OEM
coreos-cloudinit renders these fields to `/etc/oem-release`.
If no **id** field is provided, coreos-cloudinit will ignore this section.
For example, the following cloud-config document...
```yaml
#cloud-config
coreos:
oem:
id: "rackspace"
name: "Rackspace Cloud Servers"
version-id: "168.0.0"
home-url: "https://www.rackspace.com/cloud/servers/"
bug-report-url: "https://github.com/coreos/coreos-overlay"
```
...would be rendered to the following `/etc/oem-release`:
```yaml
ID=rackspace
NAME="Rackspace Cloud Servers"
VERSION_ID=168.0.0
HOME_URL="https://www.rackspace.com/cloud/servers/"
BUG_REPORT_URL="https://github.com/coreos/coreos-overlay"
```
[os-release]: http://www.freedesktop.org/software/systemd/man/os-release.html

View File

@@ -0,0 +1,485 @@
# Using Cloud-Config
CoreOS allows you to declaratively customize various OS-level items, such as network configuration, user accounts, and systemd units. This document describes the full list of items we can configure. The `coreos-cloudinit` program uses these files as it configures the OS after startup or during runtime.
Your cloud-config is processed during each boot. Invalid cloud-config won't be processed but will be logged in the journal. You can validate your cloud-config with the [CoreOS online validator](https://coreos.com/validate/) or by running `coreos-cloudinit -validate`. In addition to these two validation methods you can debug `coreos-cloudinit` system output through the `journalctl` tool:
```sh
journalctl --identifier=coreos-cloudinit
```
It will show `coreos-cloudinit` run output which was triggered by system boot.
## Configuration File
The file used by this system initialization program is called a "cloud-config" file. It is inspired by the [cloud-init][cloud-init] project's [cloud-config][cloud-config] file, which is "the defacto multi-distribution package that handles early initialization of a cloud instance" ([cloud-init docs][cloud-init-docs]). Because the cloud-init project includes tools which aren't used by CoreOS, only the relevant subset of its configuration items will be implemented in our cloud-config file. In addition to those, we added a few CoreOS-specific items, such as etcd configuration, OEM definition, and systemd units.
We've designed our implementation to allow the same cloud-config file to work across all of our supported platforms.
[cloud-init]: https://launchpad.net/cloud-init
[cloud-init-docs]: http://cloudinit.readthedocs.org/en/latest/index.html
[cloud-config]: http://cloudinit.readthedocs.org/en/latest/topics/format.html#cloud-config-data
### File Format
The cloud-config file uses the [YAML][yaml] file format, which uses whitespace and new-lines to delimit lists, associative arrays, and values.
A cloud-config file must contain a header: either `#cloud-config` for processing as cloud-config (suggested) or `#!` for processing as a shell script (advanced). If cloud-config has the `#cloud-config` header, it should followed by an associative array which has zero or more of the following keys:
- `coreos`
- `ssh_authorized_keys`
- `hostname`
- `users`
- `write_files`
- `manage_etc_hosts`
The expected values for these keys are defined in the rest of this document.
If cloud-config header starts on `#!` then coreos-cloudinit will recognize it as shell script which is interpreted by bash and run it as transient systemd service.
[yaml]: https://en.wikipedia.org/wiki/YAML
### Providing Cloud-Config with Config-Drive
CoreOS tries to conform to each platform's native method to provide user data. Each cloud provider tends to be unique, but this complexity has been abstracted by CoreOS. You can view each platform's instructions on their documentation pages. The most universal way to provide cloud-config is [via config-drive](https://github.com/rancher/os/config/cloudinit/blob/master/Documentation/config-drive.md), which attaches a read-only device to the machine, that contains your cloud-config file.
## Configuration Parameters
### coreos
#### etcd (deprecated. see etcd2)
The `coreos.etcd.*` parameters will be translated to a partial systemd unit acting as an etcd configuration file.
If the platform environment supports the templating feature of coreos-cloudinit it is possible to automate etcd configuration with the `$private_ipv4` and `$public_ipv4` fields. For example, the following cloud-config document...
```yaml
#cloud-config
coreos:
etcd:
name: "node001"
# generate a new token for each unique cluster from https://discovery.etcd.io/new
discovery: "https://discovery.etcd.io/<token>"
# multi-region and multi-cloud deployments need to use $public_ipv4
addr: "$public_ipv4:4001"
peer-addr: "$private_ipv4:7001"
```
...will generate a systemd unit drop-in for etcd.service with the following contents:
```yaml
[Service]
Environment="ETCD_NAME=node001"
Environment="ETCD_DISCOVERY=https://discovery.etcd.io/<token>"
Environment="ETCD_ADDR=203.0.113.29:4001"
Environment="ETCD_PEER_ADDR=192.0.2.13:7001"
```
For more information about the available configuration parameters, see the [etcd documentation][etcd-config].
_Note: The `$private_ipv4` and `$public_ipv4` substitution variables referenced in other documents are only supported on Amazon EC2, Google Compute Engine, OpenStack, Rackspace, DigitalOcean, and Vagrant._
[etcd-config]: https://github.com/coreos/etcd/blob/release-0.4/Documentation/configuration.md
#### etcd2
The `coreos.etcd2.*` parameters will be translated to a partial systemd unit acting as an etcd configuration file.
If the platform environment supports the templating feature of coreos-cloudinit it is possible to automate etcd configuration with the `$private_ipv4` and `$public_ipv4` fields. When generating a [discovery token](https://discovery.etcd.io/new?size=3), set the `size` parameter, since etcd uses this to determine if all members have joined the cluster. After the cluster is bootstrapped, it can grow or shrink from this configured size.
For example, the following cloud-config document...
```yaml
#cloud-config
coreos:
etcd2:
# generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
discovery: "https://discovery.etcd.io/<token>"
# multi-region and multi-cloud deployments need to use $public_ipv4
advertise-client-urls: "http://$public_ipv4:2379"
initial-advertise-peer-urls: "http://$private_ipv4:2380"
# listen on both the official ports and the legacy ports
# legacy ports can be omitted if your application doesn't depend on them
listen-client-urls: "http://0.0.0.0:2379,http://0.0.0.0:4001"
listen-peer-urls: "http://$private_ipv4:2380,http://$private_ipv4:7001"
```
...will generate a systemd unit drop-in for etcd2.service with the following contents:
```yaml
[Service]
Environment="ETCD_DISCOVERY=https://discovery.etcd.io/<token>"
Environment="ETCD_ADVERTISE_CLIENT_URLS=http://203.0.113.29:2379"
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=http://192.0.2.13:2380"
Environment="ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379,http://0.0.0.0:4001"
Environment="ETCD_LISTEN_PEER_URLS=http://192.0.2.13:2380,http://192.0.2.13:7001"
```
For more information about the available configuration parameters, see the [etcd2 documentation][etcd2-config].
_Note: The `$private_ipv4` and `$public_ipv4` substitution variables referenced in other documents are only supported on Amazon EC2, Google Compute Engine, OpenStack, Rackspace, DigitalOcean, and Vagrant._
[etcd2-config]: https://github.com/coreos/etcd/blob/v2.3.2/Documentation/configuration.md
#### fleet
The `coreos.fleet.*` parameters work very similarly to `coreos.etcd2.*`, and allow for the configuration of fleet through environment variables. For example, the following cloud-config document...
```yaml
#cloud-config
coreos:
fleet:
public-ip: "$public_ipv4"
metadata: "region=us-west"
```
...will generate a systemd unit drop-in like this:
```yaml
[Service]
Environment="FLEET_PUBLIC_IP=203.0.113.29"
Environment="FLEET_METADATA=region=us-west"
```
List of fleet configuration parameters:
- **agent_ttl**: An Agent will be considered dead if it exceeds this amount of time to communicate with the Registry
- **engine_reconcile_interval**: Interval in seconds at which the engine should reconcile the cluster schedule in etcd
- **etcd_cafile**: Path to CA file used for TLS communication with etcd
- **etcd_certfile**: Provide TLS configuration when SSL certificate authentication is enabled in etcd endpoints
- **etcd_keyfile**: Path to private key file used for TLS communication with etcd
- **etcd_key_prefix**: etcd prefix path to be used for fleet keys
- **etcd_request_timeout**: Amount of time in seconds to allow a single etcd request before considering it failed
- **etcd_servers**: Comma separated list of etcd endpoints
- **etcd_username**: Username for Basic Authentication to etcd endpoints
- **etcd_password**: Password for Basic Authentication to etcd endpoints
- **metadata**: Comma separated key/value pairs that are published with the local to the fleet registry
- **public_ip**: IP accessible by other nodes for inter-host communication
- **verbosity**: Enable debug logging by setting this to an integer value greater than zero
For more information on fleet configuration, see the [fleet documentation][fleet-config].
[fleet-config]: https://github.com/coreos/fleet/blob/master/Documentation/deployment-and-configuration.md#configuration
#### flannel
The `coreos.flannel.*` parameters also work very similarly to `coreos.etcd2.*`
and `coreos.fleet.*`. They can be used to set environment variables for
flanneld. For example, the following cloud-config...
```yaml
#cloud-config
coreos:
flannel:
etcd_prefix: "/coreos.com/network2"
```
...will generate a systemd unit drop-in like so:
```
[Service]
Environment="FLANNELD_ETCD_PREFIX=/coreos.com/network2"
```
List of flannel configuration parameters:
- **etcd_endpoints**: Comma separated list of etcd endpoints
- **etcd_cafile**: Path to CA file used for TLS communication with etcd
- **etcd_certfile**: Path to certificate file used for TLS communication with etcd
- **etcd_keyfile**: Path to private key file used for TLS communication with etcd
- **etcd_prefix**: etcd prefix path to be used for flannel keys
- **etcd_username**: Username for Basic Authentication to etcd endpoints
- **etcd_password**: Password for Basic Authentication to etcd endpoints
- **ip_masq**: Install IP masquerade rules for traffic outside of flannel subnet
- **subnet_file**: Path to flannel subnet file to write out
- **interface**: Interface (name or IP) that should be used for inter-host communication
- **public_ip**: IP accessible by other nodes for inter-host communication
For more information on flannel configuration, see the [flannel documentation][flannel-readme].
[flannel-readme]: https://github.com/coreos/flannel/blob/master/README.md
#### locksmith
The `coreos.locksmith.*` parameters can be used to set environment variables
for locksmith. For example, the following cloud-config...
```yaml
#cloud-config
coreos:
locksmith:
endpoint: "http://example.com:2379"
```
...will generate a systemd unit drop-in like so:
```
[Service]
Environment="LOCKSMITHD_ENDPOINT=http://example.com:2379"
```
List of locksmith configuration parameters:
- **endpoint**: Comma separated list of etcd endpoints
- **etcd_cafile**: Path to CA file used for TLS communication with etcd
- **etcd_certfile**: Path to certificate file used for TLS communication with etcd
- **etcd_keyfile**: Path to private key file used for TLS communication with etcd
- **group**: Name of the reboot group in which this instance belongs
- **window_start**: Start time of the reboot window
- **window_length**: Duration of the reboot window
- **etcd_username**: Username for Basic Authentication to etcd endpoints
- **etcd_password**: Password for Basic Authentication to etcd endpoints
For the complete list of locksmith configuration parameters, see the [locksmith documentation][locksmith-readme].
[locksmith-readme]: https://github.com/coreos/locksmith/blob/master/README.md
#### update
The `coreos.update.*` parameters manipulate settings related to how CoreOS instances are updated.
These fields will be written out to and replace `/etc/coreos/update.conf`. If only one of the parameters is given it will only overwrite the given field.
The `reboot-strategy` parameter also affects the behaviour of [locksmith](https://github.com/coreos/locksmith).
- **reboot-strategy**: One of "reboot", "etcd-lock", "best-effort" or "off" for controlling when reboots are issued after an update is performed.
- _reboot_: Reboot immediately after an update is applied.
- _etcd-lock_: Reboot after first taking a distributed lock in etcd, this guarantees that only one host will reboot concurrently and that the cluster will remain available during the update.
- _best-effort_ - If etcd is running, "etcd-lock", otherwise simply "reboot".
- _off_ - Disable rebooting after updates are applied (not recommended).
- **server**: The location of the [CoreUpdate][coreupdate] server which will be queried for updates. Also known as the [omaha][omaha-docs] server endpoint.
- **group**: signifies the channel which should be used for automatic updates. This value defaults to the version of the image initially downloaded. (one of "master", "alpha", "beta", "stable")
[coreupdate]: https://coreos.com/products/coreupdate
[omaha-docs]: https://coreos.com/docs/coreupdate/custom-apps/coreupdate-protocol/
*Note: cloudinit will only manipulate the locksmith unit file in the systemd runtime directory (`/run/systemd/system/locksmithd.service`). If any manual modifications are made to an overriding unit configuration file (e.g. `/etc/systemd/system/locksmithd.service`), cloudinit will no longer be able to control the locksmith service unit.*
##### Example
```yaml
#cloud-config
coreos:
update:
reboot-strategy: "etcd-lock"
```
#### units
The `coreos.units.*` parameters define a list of arbitrary systemd units to start after booting. This feature is intended to help you start essential services required to mount storage and configure networking in order to join the CoreOS cluster. It is not intended to be a Chef/Puppet replacement.
Each item is an object with the following fields:
- **name**: String representing unit's name. Required.
- **runtime**: Boolean indicating whether or not to persist the unit across reboots. This is analogous to the `--runtime` argument to `systemctl enable`. The default value is false.
- **enable**: Boolean indicating whether or not to handle the [Install] section of the unit file. This is similar to running `systemctl enable <name>`. The default value is false.
- **content**: Plaintext string representing entire unit file. If no value is provided, the unit is assumed to exist already.
- **command**: Command to execute on unit: start, stop, reload, restart, try-restart, reload-or-restart, reload-or-try-restart. The default behavior is to not execute any commands.
- **mask**: Whether to mask the unit file by symlinking it to `/dev/null` (analogous to `systemctl mask <name>`). Note that unlike `systemctl mask`, **this will destructively remove any existing unit file** located at `/etc/systemd/system/<unit>`, to ensure that the mask succeeds. The default value is false.
- **drop-ins**: A list of unit drop-ins with the following fields:
- **name**: String representing unit's name. Required.
- **content**: Plaintext string representing entire file. Required.
**NOTE:** The command field is ignored for all network, netdev, and link units. The systemd-networkd.service unit will be restarted in their place.
##### Examples
Write a unit to disk, automatically starting it.
```yaml
#cloud-config
coreos:
units:
- name: "docker-redis.service"
command: "start"
content: |
[Unit]
Description=Redis container
Author=Me
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker start -a redis_server
ExecStop=/usr/bin/docker stop -t 2 redis_server
```
Add the DOCKER_OPTS environment variable to docker.service.
```yaml
#cloud-config
coreos:
units:
- name: "docker.service"
drop-ins:
- name: "50-insecure-registry.conf"
content: |
[Service]
Environment=DOCKER_OPTS='--insecure-registry="10.0.1.0/24"'
```
Start the built-in `etcd2` and `fleet` services:
```yaml
#cloud-config
coreos:
units:
- name: "etcd2.service"
command: "start"
- name: "fleet.service"
command: "start"
```
### ssh_authorized_keys
The `ssh_authorized_keys` parameter adds public SSH keys which will be authorized for the `core` user.
The keys will be named "coreos-cloudinit" by default.
Override this by using the `--ssh-key-name` flag when calling `coreos-cloudinit`.
```yaml
#cloud-config
ssh_authorized_keys:
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g+ZTxC7weoIJLUafOgrm+h..."
```
### hostname
The `hostname` parameter defines the system's hostname.
This is the local part of a fully-qualified domain name (i.e. `foo` in `foo.example.com`).
```yaml
#cloud-config
hostname: "coreos1"
```
### users
The `users` parameter adds or modifies the specified list of users. Each user is an object which consists of the following fields. Each field is optional and of type string unless otherwise noted.
All but the `passwd` and `ssh-authorized-keys` fields will be ignored if the user already exists.
- **name**: Required. Login name of user
- **gecos**: GECOS comment of user
- **passwd**: Hash of the password to use for this user
- **homedir**: User's home directory. Defaults to /home/\<name\>
- **no-create-home**: Boolean. Skip home directory creation.
- **primary-group**: Default group for the user. Defaults to a new group created named after the user.
- **groups**: Add user to these additional groups
- **no-user-group**: Boolean. Skip default group creation.
- **ssh-authorized-keys**: List of public SSH keys to authorize for this user
- **coreos-ssh-import-github** [DEPRECATED]: Authorize SSH keys from GitHub user
- **coreos-ssh-import-github-users** [DEPRECATED]: Authorize SSH keys from a list of GitHub users
- **coreos-ssh-import-url** [DEPRECATED]: Authorize SSH keys imported from a url endpoint.
- **system**: Create the user as a system user. No home directory will be created.
- **no-log-init**: Boolean. Skip initialization of lastlog and faillog databases.
- **shell**: User's login shell.
The following fields are not yet implemented:
- **inactive**: Deactivate the user upon creation
- **lock-passwd**: Boolean. Disable password login for user
- **sudo**: Entry to add to /etc/sudoers for user. By default, no sudo access is authorized.
- **selinux-user**: Corresponding SELinux user
- **ssh-import-id**: Import SSH keys by ID from Launchpad.
```yaml
#cloud-config
users:
- name: "elroy"
passwd: "$6$5s2u6/jR$un0AvWnqilcgaNB3Mkxd5yYv6mTlWfOoCYHZmfi3LDKVltj.E8XNKEcwWm..."
groups:
- "sudo"
- "docker"
ssh-authorized-keys:
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g+ZTxC7weoIJLUafOgrm+h..."
```
#### Generating a password hash
If you choose to use a password instead of an SSH key, generating a safe hash is extremely important to the security of your system. Simplified hashes like md5crypt are trivial to crack on modern GPU hardware. Here are a few ways to generate secure hashes:
```
# On Debian/Ubuntu (via the package "whois")
mkpasswd --method=SHA-512 --rounds=4096
# OpenSSL (note: this will only make md5crypt. While better than plantext it should not be considered fully secure)
openssl passwd -1
# Python (change password and salt values)
python -c "import crypt, getpass, pwd; print crypt.crypt('password', '\$6\$SALT\$')"
# Perl (change password and salt values)
perl -e 'print crypt("password","\$6\$SALT\$") . "\n"'
```
Using a higher number of rounds will help create more secure passwords, but given enough time, password hashes can be reversed. On most RPM based distributions there is a tool called mkpasswd available in the `expect` package, but this does not handle "rounds" nor advanced hashing algorithms.
### write_files
The `write_files` directive defines a set of files to create on the local filesystem.
Each item in the list may have the following keys:
- **path**: Absolute location on disk where contents should be written
- **content**: Data to write at the provided `path`
- **permissions**: Integer representing file permissions, typically in octal notation (i.e. 0644)
- **owner**: User and group that should own the file written to disk. This is equivalent to the `<user>:<group>` argument to `chown <user>:<group> <path>`.
- **encoding**: Optional. The encoding of the data in content. If not specified this defaults to the yaml document encoding (usually utf-8). Supported encoding types are:
- **b64, base64**: Base64 encoded content
- **gz, gzip**: gzip encoded content, for use with the !!binary tag
- **gz+b64, gz+base64, gzip+b64, gzip+base64**: Base64 encoded gzip content
```yaml
#cloud-config
write_files:
- path: "/etc/resolv.conf"
permissions: "0644"
owner: "root"
content: |
nameserver 8.8.8.8
- path: "/etc/motd"
permissions: "0644"
owner: "root"
content: |
Good news, everyone!
- path: "/tmp/like_this"
permissions: "0644"
owner: "root"
encoding: "gzip"
content: !!binary |
H4sIAKgdh1QAAwtITM5WyK1USMqvUCjPLMlQSMssS1VIya9KzVPIySwszS9SyCpNLwYARQFQ5CcAAAA=
- path: "/tmp/or_like_this"
permissions: "0644"
owner: "root"
encoding: "gzip+base64"
content: |
H4sIAKgdh1QAAwtITM5WyK1USMqvUCjPLMlQSMssS1VIya9KzVPIySwszS9SyCpNLwYARQFQ5CcAAAA=
- path: "/tmp/todolist"
permissions: "0644"
owner: "root"
encoding: "base64"
content: |
UGFjayBteSBib3ggd2l0aCBmaXZlIGRvemVuIGxpcXVvciBqdWdz
```
### manage_etc_hosts
The `manage_etc_hosts` parameter configures the contents of the `/etc/hosts` file, which is used for local name resolution.
Currently, the only supported value is "localhost" which will cause your system's hostname
to resolve to "127.0.0.1". This is helpful when the host does not have DNS
infrastructure in place to resolve its own hostname, for example, when using Vagrant.
```yaml
#cloud-config
manage_etc_hosts: "localhost"
```

View File

@@ -0,0 +1,40 @@
# Distribution via Config Drive
CoreOS supports providing configuration data via [config drive][config-drive]
disk images. Currently only providing a single script or cloud config file is
supported.
[config-drive]: http://docs.openstack.org/user-guide/cli_config_drive.html
## Contents and Format
The image should be a single FAT or ISO9660 file system with the label
`config-2` and the configuration data should be located at
`openstack/latest/user_data`.
For example, to wrap up a config named `user_data` in a config drive image:
```sh
mkdir -p /tmp/new-drive/openstack/latest
cp user_data /tmp/new-drive/openstack/latest/user_data
mkisofs -R -V config-2 -o configdrive.iso /tmp/new-drive
rm -r /tmp/new-drive
```
If on OS X, replace the `mkisofs` invocation with:
```sh
hdiutil makehybrid -iso -joliet -default-volume-name config-2 -o configdrive.iso /tmp/new-drive
```
## QEMU virtfs
One exception to the above, when using QEMU it is possible to skip creating an
image and use a plain directory containing the same contents:
```sh
qemu-system-x86_64 \
-fsdev local,id=conf,security_model=none,readonly,path=/tmp/new-drive \
-device virtio-9p-pci,fsdev=conf,mount_tag=config-2 \
[usual qemu options here...]
```

View File

@@ -0,0 +1,27 @@
#Debian Interfaces#
**WARNING**: This option is EXPERIMENTAL and may change or be removed at any
point.
There is basic support for converting from a Debian network configuration to
networkd unit files. The -convert-netconf=debian option is used to activate
this feature.
#convert-netconf#
Default: ""
Read the network config provided in cloud-drive and translate it from the
specified format into networkd unit files (requires the -from-configdrive
flag). Currently only supports "debian" which provides support for a small
subset of the [Debian network configuration]
(https://wiki.debian.org/NetworkConfiguration). These options include:
- interface config methods
- static
- address/netmask
- gateway
- hwaddress
- dns-nameservers
- dhcp
- hwaddress
- manual
- loopback
- vlan_raw_device
- bond-slaves

View File

@@ -0,0 +1,36 @@
# VMWare Guestinfo Interface
## Cloud-Config VMWare Guestinfo Variables
coreos-cloudinit accepts configuration from the VMware RPC API's *guestinfo*
facility. This datasource can be enabled with the `--from-vmware-guestinfo`
flag to coreos-cloudinit.
The following guestinfo variables are recognized and processed by cloudinit
when passed from the hypervisor to the virtual machine at boot time. Note that
property names are prefixed with `guestinfo.` in the VMX, e.g., `guestinfo.hostname`.
| guestinfo variable | type |
|:--------------------------------------|:--------------------------------|
| `hostname` | `hostname` |
| `interface.<n>.name` | `string` |
| `interface.<n>.mac` | `MAC address` |
| `interface.<n>.dhcp` | `{"yes", "no"}` |
| `interface.<n>.role` | `{"public", "private"}` |
| `interface.<n>.ip.<m>.address` | `CIDR IP address` |
| `interface.<n>.route.<l>.gateway` | `IP address` |
| `interface.<n>.route.<l>.destination` | `CIDR IP address` |
| `dns.server.<x>` | `IP address` |
| `dns.domain.<y>` | `DNS search domain` |
| `coreos.config.data` | `string` |
| `coreos.config.data.encoding` | `{"", "base64", "gzip+base64"}` |
| `coreos.config.url` | `URL` |
Note: "n", "m", "l", "x" and "y" are 0-indexed, incrementing integers. The
identifier for an `interface` does not correspond to anything outside of this
configuration; it serves only to distinguish between multiple `interface`s.
The guide to [booting on VMWare][bootvmware] is the starting point for more
information about configuring and running CoreOS on VMWare.
[bootvmware]: https://github.com/coreos/docs/blob/master/os/booting-on-vmware.md

View File

@@ -0,0 +1,2 @@
Alex Crawford <alex.crawford@coreos.com> (@crawford)
Jonathan Boulle <jonathan.boulle@coreos.com> (@jonboulle)

View File

@@ -0,0 +1,90 @@
**NOTE**: This project has been superseded by [Ignition][ignition] and is no longer under active development. Please direct all development efforts to Ignition.
[ignition]: https://github.com/coreos/ignition
# coreos-cloudinit [![Build Status](https://travis-ci.org/coreos/coreos-cloudinit.png?branch=master)](https://travis-ci.org/coreos/coreos-cloudinit)
coreos-cloudinit enables a user to customize CoreOS machines by providing either a cloud-config document or an executable script through user-data.
## Configuration with cloud-config
A subset of the [official cloud-config spec][official-cloud-config] is implemented by coreos-cloudinit.
Additionally, several [CoreOS-specific options][custom-cloud-config] have been implemented to support interacting with unit files, bootstrapping etcd clusters, and more.
All supported cloud-config parameters are [documented here][all-cloud-config].
[official-cloud-config]: http://cloudinit.readthedocs.org/en/latest/topics/format.html#cloud-config-data
[custom-cloud-config]: https://github.com/rancher/os/config/cloudinit/blob/master/Documentation/cloud-config.md#coreos-parameters
[all-cloud-config]: https://github.com/rancher/os/config/cloudinit/tree/master/Documentation/cloud-config.md
The following is an example cloud-config document:
```
#cloud-config
coreos:
units:
- name: etcd.service
command: start
users:
- name: core
passwd: $1$allJZawX$00S5T756I5PGdQga5qhqv1
write_files:
- path: /etc/resolv.conf
content: |
nameserver 192.0.2.2
nameserver 192.0.2.3
```
## Executing a Script
coreos-cloudinit supports executing user-data as a script instead of parsing it as a cloud-config document.
Make sure the first line of your user-data is a shebang and coreos-cloudinit will attempt to execute it:
```
#!/bin/bash
echo 'Hello, world!'
```
## user-data Field Substitution
coreos-cloudinit will replace the following set of tokens in your user-data with system-generated values.
| Token | Description |
| ------------- | ----------- |
| $public_ipv4 | Public IPv4 address of machine |
| $private_ipv4 | Private IPv4 address of machine |
These values are determined by CoreOS based on the given provider on which your machine is running.
Read more about provider-specific functionality in the [CoreOS OEM documentation][oem-doc].
[oem-doc]: https://coreos.com/docs/sdk-distributors/distributors/notes-for-distributors/
For example, submitting the following user-data...
```
#cloud-config
coreos:
etcd:
addr: $public_ipv4:4001
peer-addr: $private_ipv4:7001
```
...will result in this cloud-config document being executed:
```
#cloud-config
coreos:
etcd:
addr: 203.0.113.29:4001
peer-addr: 192.0.2.13:7001
```
## Bugs
Please use the [CoreOS issue tracker][bugs] to report all bugs, issues, and feature requests.
[bugs]: https://github.com/coreos/bugs/issues/new?labels=component/cloud-init

17
config/cloudinit/build Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash -e
NAME="coreos-cloudinit"
ORG_PATH="github.com/coreos"
REPO_PATH="${ORG_PATH}/${NAME}"
VERSION=$(git describe --dirty --tags)
GLDFLAGS="-X main.version=\"${VERSION}\""
if [ ! -h gopath/src/${REPO_PATH} ]; then
mkdir -p gopath/src/${ORG_PATH}
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
fi
export GOBIN=${PWD}/bin
export GOPATH=${PWD}/gopath
go build -ldflags "${GLDFLAGS}" -o ${GOBIN}/${NAME} ${REPO_PATH}

View File

@@ -0,0 +1,170 @@
// Copyright 2015 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (
"fmt"
"reflect"
"regexp"
"strings"
"unicode"
"github.com/coreos/yaml"
)
// CloudConfig encapsulates the entire cloud-config configuration file and maps
// directly to YAML. Fields that cannot be set in the cloud-config (fields
// used for internal use) have the YAML tag '-' so that they aren't marshalled.
type CloudConfig struct {
SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys"`
CoreOS CoreOS `yaml:"coreos"`
WriteFiles []File `yaml:"write_files"`
Hostname string `yaml:"hostname"`
Users []User `yaml:"users"`
ManageEtcHosts EtcHosts `yaml:"manage_etc_hosts"`
}
type CoreOS struct {
Etcd Etcd `yaml:"etcd"`
Etcd2 Etcd2 `yaml:"etcd2"`
Flannel Flannel `yaml:"flannel"`
Fleet Fleet `yaml:"fleet"`
Locksmith Locksmith `yaml:"locksmith"`
OEM OEM `yaml:"oem"`
Update Update `yaml:"update"`
Units []Unit `yaml:"units"`
}
func IsCloudConfig(userdata string) bool {
header := strings.SplitN(userdata, "\n", 2)[0]
// Trim trailing whitespaces
header = strings.TrimRightFunc(header, unicode.IsSpace)
return (header == "#cloud-config")
}
// NewCloudConfig instantiates a new CloudConfig from the given contents (a
// string of YAML), returning any error encountered. It will ignore unknown
// fields but log encountering them.
func NewCloudConfig(contents string) (*CloudConfig, error) {
yaml.UnmarshalMappingKeyTransform = func(nameIn string) (nameOut string) {
return strings.Replace(nameIn, "-", "_", -1)
}
var cfg CloudConfig
err := yaml.Unmarshal([]byte(contents), &cfg)
return &cfg, err
}
// Decode decodes the content of cloud config. Currently only WriteFiles section
// supports several types of encoding and all of them are supported. After
// decode operation, Encoding type is unset.
func (cc *CloudConfig) Decode() error {
for i, file := range cc.WriteFiles {
content, err := DecodeContent(file.Content, file.Encoding)
if err != nil {
return err
}
cc.WriteFiles[i].Content = string(content)
cc.WriteFiles[i].Encoding = ""
}
return nil
}
func (cc CloudConfig) String() string {
bytes, err := yaml.Marshal(cc)
if err != nil {
return ""
}
stringified := string(bytes)
stringified = fmt.Sprintf("#cloud-config\n%s", stringified)
return stringified
}
// IsZero returns whether or not the parameter is the zero value for its type.
// If the parameter is a struct, only the exported fields are considered.
func IsZero(c interface{}) bool {
return isZero(reflect.ValueOf(c))
}
type ErrorValid struct {
Value string
Valid string
Field string
}
func (e ErrorValid) Error() string {
return fmt.Sprintf("invalid value %q for option %q (valid options: %q)", e.Value, e.Field, e.Valid)
}
// AssertStructValid checks the fields in the structure and makes sure that
// they contain valid values as specified by the 'valid' flag. Empty fields are
// implicitly valid.
func AssertStructValid(c interface{}) error {
ct := reflect.TypeOf(c)
cv := reflect.ValueOf(c)
for i := 0; i < ct.NumField(); i++ {
ft := ct.Field(i)
if !isFieldExported(ft) {
continue
}
if err := AssertValid(cv.Field(i), ft.Tag.Get("valid")); err != nil {
err.Field = ft.Name
return err
}
}
return nil
}
// AssertValid checks to make sure that the given value is in the list of
// valid values. Zero values are implicitly valid.
func AssertValid(value reflect.Value, valid string) *ErrorValid {
if valid == "" || isZero(value) {
return nil
}
vs := fmt.Sprintf("%v", value.Interface())
if m, _ := regexp.MatchString(valid, vs); m {
return nil
}
return &ErrorValid{
Value: vs,
Valid: valid,
}
}
func isZero(v reflect.Value) bool {
switch v.Kind() {
case reflect.Struct:
vt := v.Type()
for i := 0; i < v.NumField(); i++ {
if isFieldExported(vt.Field(i)) && !isZero(v.Field(i)) {
return false
}
}
return true
default:
return v.Interface() == reflect.Zero(v.Type()).Interface()
}
}
func isFieldExported(f reflect.StructField) bool {
return f.PkgPath == ""
}

View File

@@ -0,0 +1,547 @@
// Copyright 2015 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (
"fmt"
"reflect"
"regexp"
"strings"
"testing"
)
func TestNewCloudConfig(t *testing.T) {
tests := []struct {
contents string
config CloudConfig
}{
{},
{
contents: "#cloud-config\nwrite_files:\n - path: underscore",
config: CloudConfig{WriteFiles: []File{{Path: "underscore"}}},
},
{
contents: "#cloud-config\nwrite-files:\n - path: hyphen",
config: CloudConfig{WriteFiles: []File{{Path: "hyphen"}}},
},
{
contents: "#cloud-config\ncoreos:\n update:\n reboot-strategy: off",
config: CloudConfig{CoreOS: CoreOS{Update: Update{RebootStrategy: "off"}}},
},
{
contents: "#cloud-config\ncoreos:\n update:\n reboot-strategy: false",
config: CloudConfig{CoreOS: CoreOS{Update: Update{RebootStrategy: "false"}}},
},
{
contents: "#cloud-config\nwrite_files:\n - permissions: 0744",
config: CloudConfig{WriteFiles: []File{{RawFilePermissions: "0744"}}},
},
{
contents: "#cloud-config\nwrite_files:\n - permissions: 744",
config: CloudConfig{WriteFiles: []File{{RawFilePermissions: "744"}}},
},
{
contents: "#cloud-config\nwrite_files:\n - permissions: '0744'",
config: CloudConfig{WriteFiles: []File{{RawFilePermissions: "0744"}}},
},
{
contents: "#cloud-config\nwrite_files:\n - permissions: '744'",
config: CloudConfig{WriteFiles: []File{{RawFilePermissions: "744"}}},
},
}
for i, tt := range tests {
config, err := NewCloudConfig(tt.contents)
if err != nil {
t.Errorf("bad error (test case #%d): want %v, got %s", i, nil, err)
}
if !reflect.DeepEqual(&tt.config, config) {
t.Errorf("bad config (test case #%d): want %#v, got %#v", i, tt.config, config)
}
}
}
func TestNewCloudConfigDecode(t *testing.T) {
// //all of these decode to "bar"
contentTests := map[string]string{
"base64": "YmFy",
"b64": "YmFy",
// theoretically gz+gzip are supported but they break yaml
// "gz": "\x1f\x8b\x08\x08w\x14\x87T\x02\xffok\x00KJ,\x02\x00\xaa\x8c\xffv\x03\x00\x00\x00",
// "gzip": "\x1f\x8b\x08\x08w\x14\x87T\x02\xffok\x00KJ,\x02\x00\xaa\x8c\xffv\x03\x00\x00\x00",
"gz+base64": "H4sIABMVh1QAA0tKLAIAqoz/dgMAAAA=",
"gzip+base64": "H4sIABMVh1QAA0tKLAIAqoz/dgMAAAA=",
"gz+b64": "H4sIABMVh1QAA0tKLAIAqoz/dgMAAAA=",
"gzip+b64": "H4sIABMVh1QAA0tKLAIAqoz/dgMAAAA=",
}
type testCase struct {
contents string
config CloudConfig
}
var decodingTests []testCase
for name, content := range contentTests {
decodingTests = append(decodingTests, testCase{
contents: fmt.Sprintf("#cloud-config\nwrite_files:\n - encoding: %q\n content: |\n %s", name, content),
config: CloudConfig{WriteFiles: []File{{Content: "bar"}}},
})
}
for i, tt := range decodingTests {
config, err := NewCloudConfig(tt.contents)
if err != nil {
t.Errorf("bad error (test case #%d): want %v, got %s", i, nil, err)
}
if err := config.Decode(); err != nil {
t.Errorf("bad error (test case #%d): want %v, got %s", i, nil, err)
}
if !reflect.DeepEqual(&tt.config, config) {
t.Errorf("bad config (test case #%d): want %#v, got %#v", i, tt.config, config)
}
}
}
func TestIsZero(t *testing.T) {
tests := []struct {
c interface{}
empty bool
}{
{struct{}{}, true},
{struct{ a, b string }{}, true},
{struct{ A, b string }{}, true},
{struct{ A, B string }{}, true},
{struct{ A string }{A: "hello"}, false},
{struct{ A int }{}, true},
{struct{ A int }{A: 1}, false},
}
for _, tt := range tests {
if empty := IsZero(tt.c); tt.empty != empty {
t.Errorf("bad result (%q): want %t, got %t", tt.c, tt.empty, empty)
}
}
}
func TestAssertStructValid(t *testing.T) {
tests := []struct {
c interface{}
err error
}{
{struct{}{}, nil},
{struct {
A, b string `valid:"^1|2$"`
}{}, nil},
{struct {
A, b string `valid:"^1|2$"`
}{A: "1", b: "2"}, nil},
{struct {
A, b string `valid:"^1|2$"`
}{A: "1", b: "hello"}, nil},
{struct {
A, b string `valid:"^1|2$"`
}{A: "hello", b: "2"}, &ErrorValid{Value: "hello", Field: "A", Valid: "^1|2$"}},
{struct {
A, b int `valid:"^1|2$"`
}{}, nil},
{struct {
A, b int `valid:"^1|2$"`
}{A: 1, b: 2}, nil},
{struct {
A, b int `valid:"^1|2$"`
}{A: 1, b: 9}, nil},
{struct {
A, b int `valid:"^1|2$"`
}{A: 9, b: 2}, &ErrorValid{Value: "9", Field: "A", Valid: "^1|2$"}},
}
for _, tt := range tests {
if err := AssertStructValid(tt.c); !reflect.DeepEqual(tt.err, err) {
t.Errorf("bad result (%q): want %q, got %q", tt.c, tt.err, err)
}
}
}
func TestConfigCompile(t *testing.T) {
tests := []interface{}{
Etcd{},
File{},
Flannel{},
Fleet{},
Locksmith{},
OEM{},
Unit{},
Update{},
}
for _, tt := range tests {
ttt := reflect.TypeOf(tt)
for i := 0; i < ttt.NumField(); i++ {
ft := ttt.Field(i)
if !isFieldExported(ft) {
continue
}
if _, err := regexp.Compile(ft.Tag.Get("valid")); err != nil {
t.Errorf("bad regexp(%s.%s): want %v, got %s", ttt.Name(), ft.Name, nil, err)
}
}
}
}
func TestCloudConfigUnknownKeys(t *testing.T) {
contents := `
coreos:
etcd:
discovery: "https://discovery.etcd.io/827c73219eeb2fa5530027c37bf18877"
coreos_unknown:
foo: "bar"
section_unknown:
dunno:
something
bare_unknown:
bar
write_files:
- content: fun
path: /var/party
file_unknown: nofun
users:
- name: fry
passwd: somehash
user_unknown: philip
hostname:
foo
`
cfg, err := NewCloudConfig(contents)
if err != nil {
t.Fatalf("error instantiating CloudConfig with unknown keys: %v", err)
}
if cfg.Hostname != "foo" {
t.Fatalf("hostname not correctly set when invalid keys are present")
}
if cfg.CoreOS.Etcd.Discovery != "https://discovery.etcd.io/827c73219eeb2fa5530027c37bf18877" {
t.Fatalf("etcd section not correctly set when invalid keys are present")
}
if len(cfg.WriteFiles) < 1 || cfg.WriteFiles[0].Content != "fun" || cfg.WriteFiles[0].Path != "/var/party" {
t.Fatalf("write_files section not correctly set when invalid keys are present")
}
if len(cfg.Users) < 1 || cfg.Users[0].Name != "fry" || cfg.Users[0].PasswordHash != "somehash" {
t.Fatalf("users section not correctly set when invalid keys are present")
}
}
// Assert that the parsing of a cloud config file "generally works"
func TestCloudConfigEmpty(t *testing.T) {
cfg, err := NewCloudConfig("")
if err != nil {
t.Fatalf("Encountered unexpected error :%v", err)
}
keys := cfg.SSHAuthorizedKeys
if len(keys) != 0 {
t.Error("Parsed incorrect number of SSH keys")
}
if len(cfg.WriteFiles) != 0 {
t.Error("Expected zero WriteFiles")
}
if cfg.Hostname != "" {
t.Errorf("Expected hostname to be empty, got '%s'", cfg.Hostname)
}
}
// Assert that the parsing of a cloud config file "generally works"
func TestCloudConfig(t *testing.T) {
contents := `
coreos:
etcd:
discovery: "https://discovery.etcd.io/827c73219eeb2fa5530027c37bf18877"
update:
reboot_strategy: reboot
units:
- name: 50-eth0.network
runtime: yes
content: '[Match]
Name=eth47
[Network]
Address=10.209.171.177/19
'
oem:
id: rackspace
name: Rackspace Cloud Servers
version_id: 168.0.0
home_url: https://www.rackspace.com/cloud/servers/
bug_report_url: https://github.com/coreos/coreos-overlay
ssh_authorized_keys:
- foobar
- foobaz
write_files:
- content: |
penny
elroy
path: /etc/dogepack.conf
permissions: '0644'
owner: root:dogepack
hostname: trontastic
`
cfg, err := NewCloudConfig(contents)
if err != nil {
t.Fatalf("Encountered unexpected error :%v", err)
}
keys := cfg.SSHAuthorizedKeys
if len(keys) != 2 {
t.Error("Parsed incorrect number of SSH keys")
} else if keys[0] != "foobar" {
t.Error("Expected first SSH key to be 'foobar'")
} else if keys[1] != "foobaz" {
t.Error("Expected first SSH key to be 'foobaz'")
}
if len(cfg.WriteFiles) != 1 {
t.Error("Failed to parse correct number of write_files")
} else {
wf := cfg.WriteFiles[0]
if wf.Content != "penny\nelroy\n" {
t.Errorf("WriteFile has incorrect contents '%s'", wf.Content)
}
if wf.Encoding != "" {
t.Errorf("WriteFile has incorrect encoding %s", wf.Encoding)
}
if wf.RawFilePermissions != "0644" {
t.Errorf("WriteFile has incorrect permissions %s", wf.RawFilePermissions)
}
if wf.Path != "/etc/dogepack.conf" {
t.Errorf("WriteFile has incorrect path %s", wf.Path)
}
if wf.Owner != "root:dogepack" {
t.Errorf("WriteFile has incorrect owner %s", wf.Owner)
}
}
if len(cfg.CoreOS.Units) != 1 {
t.Error("Failed to parse correct number of units")
} else {
u := cfg.CoreOS.Units[0]
expect := `[Match]
Name=eth47
[Network]
Address=10.209.171.177/19
`
if u.Content != expect {
t.Errorf("Unit has incorrect contents '%s'.\nExpected '%s'.", u.Content, expect)
}
if u.Runtime != true {
t.Errorf("Unit has incorrect runtime value")
}
if u.Name != "50-eth0.network" {
t.Errorf("Unit has incorrect name %s", u.Name)
}
}
if cfg.CoreOS.OEM.ID != "rackspace" {
t.Errorf("Failed parsing coreos.oem. Expected ID 'rackspace', got %q.", cfg.CoreOS.OEM.ID)
}
if cfg.Hostname != "trontastic" {
t.Errorf("Failed to parse hostname")
}
if cfg.CoreOS.Update.RebootStrategy != "reboot" {
t.Errorf("Failed to parse locksmith strategy")
}
}
// Assert that our interface conversion doesn't panic
func TestCloudConfigKeysNotList(t *testing.T) {
contents := `
ssh_authorized_keys:
- foo: bar
`
cfg, err := NewCloudConfig(contents)
if err != nil {
t.Fatalf("Encountered unexpected error: %v", err)
}
keys := cfg.SSHAuthorizedKeys
if len(keys) != 0 {
t.Error("Parsed incorrect number of SSH keys")
}
}
func TestCloudConfigSerializationHeader(t *testing.T) {
cfg, _ := NewCloudConfig("")
contents := cfg.String()
header := strings.SplitN(contents, "\n", 2)[0]
if header != "#cloud-config" {
t.Fatalf("Serialized config did not have expected header")
}
}
func TestCloudConfigUsers(t *testing.T) {
contents := `
users:
- name: elroy
passwd: somehash
ssh_authorized_keys:
- somekey
gecos: arbitrary comment
homedir: /home/place
no_create_home: yes
primary_group: things
groups:
- ping
- pong
no_user_group: true
system: y
no_log_init: True
shell: /bin/sh
`
cfg, err := NewCloudConfig(contents)
if err != nil {
t.Fatalf("Encountered unexpected error: %v", err)
}
if len(cfg.Users) != 1 {
t.Fatalf("Parsed %d users, expected 1", len(cfg.Users))
}
user := cfg.Users[0]
if user.Name != "elroy" {
t.Errorf("User name is %q, expected 'elroy'", user.Name)
}
if user.PasswordHash != "somehash" {
t.Errorf("User passwd is %q, expected 'somehash'", user.PasswordHash)
}
if keys := user.SSHAuthorizedKeys; len(keys) != 1 {
t.Errorf("Parsed %d ssh keys, expected 1", len(keys))
} else {
key := user.SSHAuthorizedKeys[0]
if key != "somekey" {
t.Errorf("User SSH key is %q, expected 'somekey'", key)
}
}
if user.GECOS != "arbitrary comment" {
t.Errorf("Failed to parse gecos field, got %q", user.GECOS)
}
if user.Homedir != "/home/place" {
t.Errorf("Failed to parse homedir field, got %q", user.Homedir)
}
if !user.NoCreateHome {
t.Errorf("Failed to parse no_create_home field")
}
if user.PrimaryGroup != "things" {
t.Errorf("Failed to parse primary_group field, got %q", user.PrimaryGroup)
}
if len(user.Groups) != 2 {
t.Errorf("Failed to parse 2 goups, got %d", len(user.Groups))
} else {
if user.Groups[0] != "ping" {
t.Errorf("First group was %q, not expected value 'ping'", user.Groups[0])
}
if user.Groups[1] != "pong" {
t.Errorf("First group was %q, not expected value 'pong'", user.Groups[1])
}
}
if !user.NoUserGroup {
t.Errorf("Failed to parse no_user_group field")
}
if !user.System {
t.Errorf("Failed to parse system field")
}
if !user.NoLogInit {
t.Errorf("Failed to parse no_log_init field")
}
if user.Shell != "/bin/sh" {
t.Errorf("Failed to parse shell field, got %q", user.Shell)
}
}
func TestCloudConfigUsersGithubUser(t *testing.T) {
contents := `
users:
- name: elroy
coreos_ssh_import_github: bcwaldon
`
cfg, err := NewCloudConfig(contents)
if err != nil {
t.Fatalf("Encountered unexpected error: %v", err)
}
if len(cfg.Users) != 1 {
t.Fatalf("Parsed %d users, expected 1", len(cfg.Users))
}
user := cfg.Users[0]
if user.Name != "elroy" {
t.Errorf("User name is %q, expected 'elroy'", user.Name)
}
if user.SSHImportGithubUser != "bcwaldon" {
t.Errorf("github user is %q, expected 'bcwaldon'", user.SSHImportGithubUser)
}
}
func TestCloudConfigUsersSSHImportURL(t *testing.T) {
contents := `
users:
- name: elroy
coreos_ssh_import_url: https://token:x-auth-token@github.enterprise.com/api/v3/polvi/keys
`
cfg, err := NewCloudConfig(contents)
if err != nil {
t.Fatalf("Encountered unexpected error: %v", err)
}
if len(cfg.Users) != 1 {
t.Fatalf("Parsed %d users, expected 1", len(cfg.Users))
}
user := cfg.Users[0]
if user.Name != "elroy" {
t.Errorf("User name is %q, expected 'elroy'", user.Name)
}
if user.SSHImportURL != "https://token:x-auth-token@github.enterprise.com/api/v3/polvi/keys" {
t.Errorf("ssh import url is %q, expected 'https://token:x-auth-token@github.enterprise.com/api/v3/polvi/keys'", user.SSHImportURL)
}
}

View File

@@ -0,0 +1,59 @@
// Copyright 2015 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
type Etcd2 struct {
AdvertiseClientURLs string `yaml:"advertise_client_urls" env:"ETCD_ADVERTISE_CLIENT_URLS"`
CAFile string `yaml:"ca_file" env:"ETCD_CA_FILE" deprecated:"ca_file obsoleted by trusted_ca_file and client_cert_auth"`
CertFile string `yaml:"cert_file" env:"ETCD_CERT_FILE"`
ClientCertAuth bool `yaml:"client_cert_auth" env:"ETCD_CLIENT_CERT_AUTH"`
CorsOrigins string `yaml:"cors" env:"ETCD_CORS"`
DataDir string `yaml:"data_dir" env:"ETCD_DATA_DIR"`
Debug bool `yaml:"debug" env:"ETCD_DEBUG"`
Discovery string `yaml:"discovery" env:"ETCD_DISCOVERY"`
DiscoveryFallback string `yaml:"discovery_fallback" env:"ETCD_DISCOVERY_FALLBACK"`
DiscoverySRV string `yaml:"discovery_srv" env:"ETCD_DISCOVERY_SRV"`
DiscoveryProxy string `yaml:"discovery_proxy" env:"ETCD_DISCOVERY_PROXY"`
ElectionTimeout int `yaml:"election_timeout" env:"ETCD_ELECTION_TIMEOUT"`
EnablePprof bool `yaml:"enable_pprof" env:"ETCD_ENABLE_PPROF"`
ForceNewCluster bool `yaml:"force_new_cluster" env:"ETCD_FORCE_NEW_CLUSTER"`
HeartbeatInterval int `yaml:"heartbeat_interval" env:"ETCD_HEARTBEAT_INTERVAL"`
InitialAdvertisePeerURLs string `yaml:"initial_advertise_peer_urls" env:"ETCD_INITIAL_ADVERTISE_PEER_URLS"`
InitialCluster string `yaml:"initial_cluster" env:"ETCD_INITIAL_CLUSTER"`
InitialClusterState string `yaml:"initial_cluster_state" env:"ETCD_INITIAL_CLUSTER_STATE"`
InitialClusterToken string `yaml:"initial_cluster_token" env:"ETCD_INITIAL_CLUSTER_TOKEN"`
KeyFile string `yaml:"key_file" env:"ETCD_KEY_FILE"`
ListenClientURLs string `yaml:"listen_client_urls" env:"ETCD_LISTEN_CLIENT_URLS"`
ListenPeerURLs string `yaml:"listen_peer_urls" env:"ETCD_LISTEN_PEER_URLS"`
LogPackageLevels string `yaml:"log_package_levels" env:"ETCD_LOG_PACKAGE_LEVELS"`
MaxSnapshots int `yaml:"max_snapshots" env:"ETCD_MAX_SNAPSHOTS"`
MaxWALs int `yaml:"max_wals" env:"ETCD_MAX_WALS"`
Name string `yaml:"name" env:"ETCD_NAME"`
PeerCAFile string `yaml:"peer_ca_file" env:"ETCD_PEER_CA_FILE" deprecated:"peer_ca_file obsoleted peer_trusted_ca_file and peer_client_cert_auth"`
PeerCertFile string `yaml:"peer_cert_file" env:"ETCD_PEER_CERT_FILE"`
PeerKeyFile string `yaml:"peer_key_file" env:"ETCD_PEER_KEY_FILE"`
PeerClientCertAuth bool `yaml:"peer_client_cert_auth" env:"ETCD_PEER_CLIENT_CERT_AUTH"`
PeerTrustedCAFile string `yaml:"peer_trusted_ca_file" env:"ETCD_PEER_TRUSTED_CA_FILE"`
Proxy string `yaml:"proxy" env:"ETCD_PROXY" valid:"^(on|off|readonly)$"`
ProxyDialTimeout int `yaml:"proxy_dial_timeout" env:"ETCD_PROXY_DIAL_TIMEOUT"`
ProxyFailureWait int `yaml:"proxy_failure_wait" env:"ETCD_PROXY_FAILURE_WAIT"`
ProxyReadTimeout int `yaml:"proxy_read_timeout" env:"ETCD_PROXY_READ_TIMEOUT"`
ProxyRefreshInterval int `yaml:"proxy_refresh_interval" env:"ETCD_PROXY_REFRESH_INTERVAL"`
ProxyWriteTimeout int `yaml:"proxy_write_timeout" env:"ETCD_PROXY_WRITE_TIMEOUT"`
SnapshotCount int `yaml:"snapshot_count" env:"ETCD_SNAPSHOT_COUNT"`
StrictReconfigCheck bool `yaml:"strict_reconfig_check" env:"ETCD_STRICT_RECONFIG_CHECK"`
TrustedCAFile string `yaml:"trusted_ca_file" env:"ETCD_TRUSTED_CA_FILE"`
WalDir string `yaml:"wal_dir" env:"ETCD_WAL_DIR"`
}

View File

@@ -0,0 +1,29 @@
// Copyright 2015 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
type Flannel struct {
EtcdEndpoints string `yaml:"etcd_endpoints" env:"FLANNELD_ETCD_ENDPOINTS"`
EtcdCAFile string `yaml:"etcd_cafile" env:"FLANNELD_ETCD_CAFILE"`
EtcdCertFile string `yaml:"etcd_certfile" env:"FLANNELD_ETCD_CERTFILE"`
EtcdKeyFile string `yaml:"etcd_keyfile" env:"FLANNELD_ETCD_KEYFILE"`
EtcdPrefix string `yaml:"etcd_prefix" env:"FLANNELD_ETCD_PREFIX"`
EtcdUsername string `yaml:"etcd_username" env:"FLANNELD_ETCD_USERNAME"`
EtcdPassword string `yaml:"etcd_password" env:"FLANNELD_ETCD_PASSWORD"`
IPMasq string `yaml:"ip_masq" env:"FLANNELD_IP_MASQ"`
SubnetFile string `yaml:"subnet_file" env:"FLANNELD_SUBNET_FILE"`
Iface string `yaml:"interface" env:"FLANNELD_IFACE"`
PublicIP string `yaml:"public_ip" env:"FLANNELD_PUBLIC_IP"`
}

View File

@@ -0,0 +1,35 @@
// Copyright 2015 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
type Fleet struct {
AgentTTL string `yaml:"agent_ttl" env:"FLEET_AGENT_TTL"`
AuthorizedKeysFile string `yaml:"authorized_keys_file" env:"FLEET_AUTHORIZED_KEYS_FILE"`
DisableEngine bool `yaml:"disable_engine" env:"FLEET_DISABLE_ENGINE"`
EngineReconcileInterval float64 `yaml:"engine_reconcile_interval" env:"FLEET_ENGINE_RECONCILE_INTERVAL"`
EtcdCAFile string `yaml:"etcd_cafile" env:"FLEET_ETCD_CAFILE"`
EtcdCertFile string `yaml:"etcd_certfile" env:"FLEET_ETCD_CERTFILE"`
EtcdKeyFile string `yaml:"etcd_keyfile" env:"FLEET_ETCD_KEYFILE"`
EtcdKeyPrefix string `yaml:"etcd_key_prefix" env:"FLEET_ETCD_KEY_PREFIX"`
EtcdRequestTimeout float64 `yaml:"etcd_request_timeout" env:"FLEET_ETCD_REQUEST_TIMEOUT"`
EtcdServers string `yaml:"etcd_servers" env:"FLEET_ETCD_SERVERS"`
EtcdUsername string `yaml:"etcd_username" env:"FLEET_ETCD_USERNAME"`
EtcdPassword string `yaml:"etcd_password" env:"FLEET_ETCD_PASSWORD"`
Metadata string `yaml:"metadata" env:"FLEET_METADATA"`
PublicIP string `yaml:"public_ip" env:"FLEET_PUBLIC_IP"`
TokenLimit int `yaml:"token_limit" env:"FLEET_TOKEN_LIMIT"`
Verbosity int `yaml:"verbosity" env:"FLEET_VERBOSITY"`
VerifyUnits bool `yaml:"verify_units" env:"FLEET_VERIFY_UNITS"`
}

View File

@@ -20,7 +20,10 @@ import (
func IsIgnitionConfig(userdata string) bool {
var cfg struct {
Version *int `json:"ignitionVersion" yaml:"ignition_version"`
Version *int `json:"ignitionVersion"`
Ignition struct {
Version *string `json:"version"`
} `json:"ignition"`
}
return (json.Unmarshal([]byte(userdata), &cfg) == nil && cfg.Version != nil)
return (json.Unmarshal([]byte(userdata), &cfg) == nil && (cfg.Version != nil || cfg.Ignition.Version != nil))
}

View File

@@ -0,0 +1,27 @@
// Copyright 2015 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
type Locksmith struct {
Endpoint string `yaml:"endpoint" env:"LOCKSMITHD_ENDPOINT"`
EtcdCAFile string `yaml:"etcd_cafile" env:"LOCKSMITHD_ETCD_CAFILE"`
EtcdCertFile string `yaml:"etcd_certfile" env:"LOCKSMITHD_ETCD_CERTFILE"`
EtcdKeyFile string `yaml:"etcd_keyfile" env:"LOCKSMITHD_ETCD_KEYFILE"`
EtcdUsername string `yaml:"etcd_username" env:"LOCKSMITHD_ETCD_USERNAME"`
EtcdPassword string `yaml:"etcd_password" env:"LOCKSMITHD_ETCD_PASSWORD"`
Group string `yaml:"group" env:"LOCKSMITHD_GROUP"`
RebootWindowStart string `yaml:"window_start" env:"REBOOT_WINDOW_START" valid:"^((?i:sun|mon|tue|wed|thu|fri|sat|sun) )?0*([0-9]|1[0-9]|2[0-3]):0*([0-9]|[1-5][0-9])$"`
RebootWindowLength string `yaml:"window_length" env:"REBOOT_WINDOW_LENGTH" valid:"^[-+]?([0-9]*(\\.[0-9]*)?[a-z]+)+$"`
}

Some files were not shown because too many files have changed in this diff Show More