Skip to content

Commit

Permalink
ccloudvm: Add templates for kata containers.
Browse files Browse the repository at this point in the history
Add templates to tests packages in VM.

Fixes: kata-containers#15

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
  • Loading branch information
jcvenegas committed May 14, 2018
1 parent 3295f8a commit 084c3f8
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 0 deletions.
84 changes: 84 additions & 0 deletions ccloudvm/kata-pkgs-fedora27.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
base_image_url: https://mirror.us-midwest-1.nexcess.net/fedora/releases/27/CloudImages/x86_64/images/Fedora-Cloud-Base-27-1.6.x86_64.qcow2
base_image_name: Fedora 27
hostname: singlevm
vm:
disk_gib: 16
mem_mib: 8000
cpus: 8
...
---
#cloud-config
write_files:
- content: |
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -D --add-runtime kata-runtime=/usr/bin/kata-runtime
path: /etc/systemd/system/docker.service.d/kata-containers.conf
{{- if len $.HTTPProxy }}
- content: |
[Service]
Environment="HTTP_PROXY={{$.HTTPProxy}}"{{if len .HTTPSProxy}} "HTTPS_PROXY={{.HTTPSProxy}}{{end}}"{{if len .NoProxy}} "NO_PROXY={{.NoProxy}},{{.Hostname}}{{end}}"
path: /etc/systemd/system/docker.service.d/http-proxy.conf
{{- end}}
{{with proxyEnv . 5}}
- content: |
{{.}}
path: /etc/environment
{{end -}}

dnf:
{{- if len $.HTTPProxy }}
proxy: "{{$.HTTPProxy}}"
{{- end}}
{{- if len $.HTTPSProxy }}
https_proxy: "{{$.HTTPSProxy}}"
{{- end}}

package_upgrade: {{with .PackageUpgrade}}{{.}}{{else}}false{{end}}

runcmd:
- {{beginTask . "Booting VM"}}
- {{endTaskOk . }}

- hostnamectl set-hostname {{.Hostname}}

- {{beginTask . (printf "Adding %s to /etc/hosts" .Hostname) }}
- echo "127.0.0.1 {{.Hostname}}" >> /etc/hosts
- {{endTaskCheck .}}

{{range .Mounts}}
- mkdir -p {{.Path}}
- sudo chown {{$.User}}:{{$.User}} {{.Tag}}
- echo "{{.Tag}} {{.Path}} 9p x-systemd.automount,x-systemd.device-timeout=10,nofail,trans=virtio,version=9p2000.L 0 0" >> /etc/fstab
{{end}}
{{range .Mounts}}
- {{beginTask $ (printf "Mounting %s" .Path) }}
- mount {{.Path}}
- {{endTaskCheck $}}
{{end}}

- {{beginTask . "Install kata"}}
- sudo dnf -y install dnf-plugins-core
- source /etc/os-release
- sudo -E VERSION_ID=$VERSION_ID dnf config-manager --add-repo http://download.opensuse.org/repositories/home:/katacontainers:/release/Fedora\_$VERSION_ID/home:katacontainers:release.repo
- sudo -E dnf -y install kata-runtime
- {{endTaskCheck .}}

- {{beginTask . "Install docker"}}
- sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
- sudo dnf makecache
- sudo dnf -y install docker-ce
- {{endTaskCheck .}}

users:
- name: {{.User}}
uid: "{{.UID}}"
gid: "{{.GID}}"
gecos: CC Demo User
lock-passwd: true
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
ssh-authorized-keys:
- {{.PublicKey}}
...
80 changes: 80 additions & 0 deletions ccloudvm/kata-pkgs-xenial.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
base_image_url: https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
base_image_name: Ubuntu 16.04
vm:
disk_gib: 16
mem_mib: 8000
cpus: 8
...
---
{{- define "ENV" -}}
{{proxyVars .}}
{{- print " DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true " -}}
{{end}}
#cloud-config
write_files:
- content: |
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -D --add-runtime kata-runtime=/usr/bin/kata-runtime
path: /etc/systemd/system/docker.service.d/kata-containers.conf
{{with proxyEnv . 5}}
- content: |
{{.}}
path: /etc/environment
{{end}}

apt:
{{- if len $.HTTPProxy }}
proxy: "{{$.HTTPProxy}}"
{{- end}}
{{- if len $.HTTPSProxy }}
https_proxy: "{{$.HTTPSProxy}}"
{{- end}}
package_upgrade: {{with .PackageUpgrade}}{{.}}{{else}}false{{end}}

runcmd:
- {{beginTask . "Booting VM"}}
- {{endTaskOk . }}

- {{beginTask . (printf "Adding %s to /etc/hosts" .Hostname) }}
- echo "127.0.0.1 {{.Hostname}}" >> /etc/hosts
- {{endTaskCheck .}}

{{range .Mounts}}
- mkdir -p {{.Path}}
- sudo chown {{$.User}}:{{$.User}} {{.Tag}}
- echo "{{.Tag}} {{.Path}} 9p x-systemd.automount,x-systemd.device-timeout=10,nofail,trans=virtio,version=9p2000.L 0 0" >> /etc/fstab
{{end}}
{{range .Mounts}}
- {{beginTask $ (printf "Mounting %s" .Path) }}
- mount {{.Path}}
- {{endTaskCheck $}}
{{end}}

- {{beginTask . "Install kata"}}
- sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/katacontainers:/release/xUbuntu_$(lsb_release -rs)/ /' >> /etc/apt/sources.list.d/kata-containers.list"
- wget -qO - http://download.opensuse.org/repositories/home:/katacontainers:/release/xUbuntu_$(lsb_release -rs)/Release.key | sudo apt-key add -
- sudo -E apt-get update
- sudo -E apt-get -y install kata-runtime
- {{endTaskCheck .}}

- {{beginTask . "Install docker"}}
- sudo -E apt-get -y install apt-transport-https ca-certificates wget software-properties-common
- wget -qO - https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo -E add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo -E apt-get update
- sudo -E apt-get -y install docker-ce
- {{endTaskCheck .}}

users:
- name: {{.User}}
uid: "{{.UID}}"
gid: "{{.GID}}"
gecos: CIAO Demo User
lock-passwd: true
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
ssh-authorized-keys:
- {{.PublicKey}}
...

0 comments on commit 084c3f8

Please sign in to comment.