-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c7d1d9d
Showing
45 changed files
with
4,149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
*.o | ||
*~ | ||
.deps | ||
.dirstamp | ||
/Makefile | ||
Makefile.in | ||
aclocal.m4 | ||
autom4te.cache | ||
cloud-init | ||
compile | ||
config.* | ||
configure | ||
depcomp | ||
install-sh | ||
missing | ||
stamp-h1 | ||
data/cloud-init.service | ||
clr-cloud-init-*.tar.xz | ||
clr-cloud-init-*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Auke Kok <[email protected]> | ||
Dimitri John Ledkov <[email protected]> | ||
Ikey Doherty <[email protected]> | ||
Julio Montes <[email protected]> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Copyright (C) 2015 Intel Corporation | ||
|
||
Author: Auke-jan H. Kok <[email protected]> | ||
Author: Julio Montes <[email protected]> | ||
|
||
This file is part of clr-cloud-init. | ||
|
||
clr-cloud-init is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
clr-cloud-init is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with clr-cloud-init. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
In addition, as a special exception, the copyright holders give | ||
permission to link the code of portions of this program with the | ||
OpenSSL library under certain conditions as described in each | ||
individual source file, and distribute linked combinations | ||
including the two. | ||
You must obey the GNU General Public License in all respects | ||
for all of the code used other than OpenSSL. If you modify | ||
file(s) with this exception, you may extend this exception to your | ||
version of the file(s), but you are not obligated to do so. If you | ||
do not wish to do so, delete this exception statement from your | ||
version. If you delete this exception statement from all source | ||
files in the program, then also delete it here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
AM_CPPFLAGS = -I $(top_srcdir)/src -I $(top_srcdir)/src/interpreters | ||
AM_CFLAGS = -std=gnu99 -fstack-protector -Wall -pedantic \ | ||
-Wstrict-prototypes -Wundef -fno-common \ | ||
-Werror-implicit-function-declaration \ | ||
-Wformat -Wformat-security -Werror=format-security \ | ||
-Wconversion -Wunreachable-code | ||
|
||
EXTRA_DIST = \ | ||
LICENSE \ | ||
COPYING \ | ||
data/cloud-init.service.in | ||
|
||
DISTCHECK_CONFIGURE_FLAGS = \ | ||
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) --enable-debug | ||
|
||
dist_man_MANS = \ | ||
docs/cloud-init.1 \ | ||
docs/cloud-config.5 | ||
|
||
bin_PROGRAMS = cloud-init | ||
cloud_init_SOURCES = \ | ||
src/ccmodules.h \ | ||
src/ccmodules/groups.c \ | ||
src/ccmodules/package_upgrade.c \ | ||
src/ccmodules/packages.c \ | ||
src/ccmodules/service.c \ | ||
src/ccmodules/ssh_authorized_keys.c \ | ||
src/ccmodules/users.c \ | ||
src/ccmodules/write_files.c \ | ||
src/curl.c \ | ||
src/curl.h \ | ||
src/datasources.h \ | ||
src/datasources/openstack.c \ | ||
src/debug.h \ | ||
src/default_user.h \ | ||
src/handlers.h \ | ||
src/interpreters.h \ | ||
src/interpreters/cloud_config.c \ | ||
src/interpreters/cloud_config.h \ | ||
src/interpreters/shell_script.c \ | ||
src/json.c \ | ||
src/json.h \ | ||
src/lib.c \ | ||
src/lib.h \ | ||
src/main.c \ | ||
src/userdata.c \ | ||
src/userdata.h | ||
|
||
|
||
if DEBUG | ||
AM_CFLAGS += -ggdb3 -O0 | ||
cloud_init_SOURCES += src/debug.c | ||
endif | ||
|
||
cloud_init_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(YAML_CFLAGS) $(JSON_GLIB_CFLAGS) | ||
cloud_init_LDADD = $(GLIB_LIBS) $(YAML_LIBS) $(CURL_LIBS) $(JSON_GLIB_LIBS) | ||
SYSTEMD_DIR=$(prefix)/lib/systemd/system/ | ||
systemdsystemunitdir = @SYSTEMD_SYSTEMUNITDIR@ | ||
systemdsystemunit_DATA = data/cloud-init.service | ||
|
||
systemdsystemunit-install-local: | ||
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/multi-user.target.wants/ | ||
ln -sf ../cloud-init.service $(DESTDIR)$(systemdsystemunitdir)/multi-user.target.wants/cloud-init.service | ||
|
||
install-data-local: systemdsystemunit-install-local | ||
|
||
systemdsystemunit-uninstall-local: | ||
rm -f $(DESTDIR)$(systemdsystemunitdir)/multi-user.target.wants/cloud-init.service | ||
|
||
uninstall-local: systemdsystemunit-uninstall-local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
|
||
Contents: | ||
|
||
1) Description of this project | ||
2) Compiling, prerequisites | ||
3) Bugs and feedback? | ||
|
||
==== | ||
|
||
1. Cloud-init for Clearlinux Project for Intel Architecture | ||
|
||
cloud-init is the standard way for cloud customers to initialize | ||
containers and virtual hosts. These virtual machines are usually | ||
provisioned in bulk and provided without any customization to cloud | ||
customers, which then require that they are customized for their | ||
particular purpose. | ||
|
||
Several implementations exist that implement this functionality, | ||
and this implementation is fairly similar to the other ones. For | ||
reference, we're listing the other implementations here: | ||
|
||
- https://launchpad.net/cloud-init | ||
A Python-based implementation and the "standard". Many of the | ||
features of this implementation are derived and benchmarked against | ||
this version. This implementation supports many different OS's, | ||
not just Ubuntu. | ||
- https://github.com/coreos/coreos-cloudinit | ||
A Go-based implementation for CoreOS. | ||
|
||
While generally it's preferred to use existing implementations, | ||
since it reduces duplicate code and makes stronger communities, in | ||
this project's case it was decided to forego extending and working | ||
on the existing implementations. Several factors were considered, and | ||
a short summary of the key points of that decision are listed below. | ||
|
||
Speed is a significant factor. Interpreted languages have come a long | ||
way and are highly performant, especially if properly used. However, | ||
theire is a significant cost of provisioning cloud nodes that have | ||
increased base storage costs due to the inclusion of libraries of | ||
interpreted languages. Since we expect people to prefer cloud nodes are | ||
minimal in size, having interpreted language libraries just for the | ||
sake of a cloud initialization script makes little sense, and we can | ||
reduce the storage need and copy times of cloud images significantly. | ||
|
||
Language choice is a minor factor. Generally languages that have | ||
good exception handling are preferred. Since execution speed and low | ||
complexity are preferred for installation and boot-time critical tasks, | ||
lots of libraries should be avoided, as robustness is critical. Missed | ||
python exceptions could cause cloud-init execution to halt, resulting | ||
in an unusable cloud host, which is to be avoided at all cost. The | ||
drawbacks of C being fairly sparse are known, and debugging tools | ||
compensate for that. | ||
|
||
We can shed additional overhead by eliminating unwanted functionality | ||
that a clearlinux cloud node does not need, but we can likely | ||
never recoup the initial cost of a base Python installation, as it | ||
is generally in the order of 100MB or more. Hence, we've opted to | ||
implement a version in C that has reduced library requrements. This | ||
has brought the size of this implementation down to under 1mb. Even | ||
considering used libraries, the resulting binary is small. | ||
|
||
|
||
==== | ||
|
||
2. Compiling | ||
|
||
Currently, cloud-init requires the following prerequisites: | ||
- glib-2.0 >= 2.24.1 | ||
- yaml-0.1 >= 0.1.4 | ||
- libcurl | ||
- json-glib-1.0 | ||
|
||
As cloud-init is tooled with autotools, one shouldn't have to do | ||
more than: | ||
|
||
$ sh autogen.sh | ||
$ make | ||
$ sudo make install | ||
|
||
|
||
==== | ||
|
||
3. Bugs, feedback, contact | ||
|
||
cloud-init is hosted on github. You can find releases, an issue | ||
tracker and git sources on github.com/clearlinux/clr-cloud-init. For | ||
mailing lists, subscribe to [email protected] (via | ||
lists.clearlinux.org). | ||
|
||
This project has many contributors. Not all may be mentioned in the | ||
AUTHORS file. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig | ||
|
||
autoreconf --force --install --symlink --warnings=all | ||
|
||
args="\ | ||
--sysconfdir=/etc \ | ||
--localstatedir=/var \ | ||
--prefix=/usr \ | ||
--enable-silent-rules" | ||
|
||
set -x | ||
./configure CFLAGS='-g -O0' $args "$@" | ||
make clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# -*- Autoconf -*- | ||
# Process this file with autoconf to produce a configure script. | ||
|
||
AC_PREREQ([2.68]) | ||
AC_INIT([clr-cloud-init],[0],[[email protected]]) | ||
AM_INIT_AUTOMAKE([foreign -Wall -Werror -Wno-portability silent-rules subdir-objects color-tests no-dist-gzip dist-xz]) | ||
AC_CONFIG_SRCDIR([src/main.c]) | ||
AC_CONFIG_FILES([Makefile | ||
data/cloud-init.service]) | ||
AC_CONFIG_HEADERS([config.h]) | ||
|
||
# Checks for programs. | ||
AC_PROG_CC | ||
AM_PROG_CC_C_O | ||
AC_PROG_INSTALL | ||
AC_PROG_MKDIR_P | ||
|
||
# Checks for libraries. | ||
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.24.1]) | ||
PKG_CHECK_MODULES([YAML], [yaml-0.1 >= 0.1.4]) | ||
PKG_CHECK_MODULES([CURL], [libcurl]) | ||
PKG_CHECK_MODULES([JSON_GLIB], [json-glib-1.0]) | ||
|
||
# Checks for header files. | ||
AC_CHECK_HEADERS([errno.h]) | ||
AC_CHECK_HEADERS([getopt.h]) | ||
AC_CHECK_HEADERS([glib.h]) | ||
AC_CHECK_HEADERS([stdarg.h]) | ||
AC_CHECK_HEADERS([stdbool.h]) | ||
AC_CHECK_HEADERS([stdio.h]) | ||
AC_CHECK_HEADERS([stdlib.h]) | ||
AC_CHECK_HEADERS([stdlib.h]) | ||
AC_CHECK_HEADERS([sys/types.h]) | ||
AC_CHECK_HEADERS([unistd.h]) | ||
|
||
# Checks for typedefs, structures, and compiler characteristics. | ||
AC_CHECK_HEADER_STDBOOL | ||
|
||
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [enable debug mode @<:@default=no@:>@]), | ||
[], [enable_debug=no]) | ||
AS_IF([test "x$enable_debug" = "xyes"], | ||
[AC_DEFINE([DEBUG], [1], [Debugging mode enabled])], | ||
[AC_DEFINE([NDEBUG], [1], [Debugging and assertions disabled])]) | ||
AM_CONDITIONAL([DEBUG], [test x$enable_debug = x"yes"]) | ||
|
||
# Options | ||
AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], | ||
[path to systemd system service directory]), [path_systemdsystemunit=${withval}], | ||
[path_systemdsystemunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"]) | ||
SYSTEMD_SYSTEMUNITDIR="${path_systemdsystemunit}" | ||
AC_SUBST(SYSTEMD_SYSTEMUNITDIR) | ||
AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdsystemunit}") | ||
|
||
|
||
# Checks for library functions. | ||
|
||
AC_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[Unit] | ||
Description=Initial cloud-init job (metadata service crawler) | ||
After=local-fs.target network.target | ||
Before=sshd.service sshd-keygen.service | ||
Requires=network.target | ||
Wants=local-fs.target sshd.service sshd-keygen.service | ||
ConditionFirstBoot=yes | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=@prefix@/bin/cloud-init --first-boot | ||
RemainAfterExit=yes | ||
TimeoutSec=0 | ||
|
||
# Output needs to appear in instance console output | ||
StandardOutput=journal+console | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Oops, something went wrong.