Commit Graph

4961 Commits

Author SHA1 Message Date
Graham Whaley
d6d38dae13 cli: update_test: defer remove tmpfile
Ensure we remove the tmpfile used for testing.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2018-07-23 17:32:52 +01:00
Peng Tao
d69fbcf17f sandbox: add stateful sandbox config
When enabled, do not release in memory sandbox resources in VC APIs,
and callers are expected to call sandbox.Release() to release the in
memory resources.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-23 09:54:02 +08:00
Peng Tao
4656a72b92 cli: create vm factory if failed to load existing one
When vm factory is enabled, create vm factory automatically
during creation.

Fixes: #504

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-23 08:46:53 +08:00
Peng Tao
7a6f205970 virtcontainers: keep qmp connection when possible
For each time a sandbox structure is created, we ensure s.Release()
is called. Then we can keep the qmp connection as long as Sandbox
pointer is alive.

All VC interfaces are still stateless as s.Release() is called before
each API returns.

OTOH, for VCSandbox APIs, FetchSandbox() must be paired with s.Release,
the same as before.

Fixes: #500

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-23 08:37:55 +08:00
Peng Tao
c9bd12aa19 qemu: cleanup qmp channel setup and teardown
Unify qmp channel setup and teardown. This also fixes the issue that
sometimes qmp pointer is not reset after qmp is shutdown.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-23 08:36:58 +08:00
Lai Jiangshan
14d25b82a4
Merge pull request #303 from bergwolf/vmfactory
add vm factory support
2018-07-22 06:47:34 +08:00
Peng Tao
0a11230bfb factory: add UTs
Add UTs to all factory components.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-19 12:44:58 +08:00
Peng Tao
7cdc0fe912 cli: do not set ip based kernel parameter
For one thing, it is not used by any kata components. For another thing,
it breaks vm factory hypervisor config check.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-19 12:44:58 +08:00
Peng Tao
0309e59cf8 cli: add vm factory management subcommand
Add enable_template option to the config file.
When it is set, enable the vm template factory.

cache factory cannot be used by kata cli directly because
it requires a running daemon to maintain the cache VMs.

`kata-runtime factory init` would initialize the vm factory and
`kata-runtime factory destroy` would destroy the vm factory.

When configured, a vm factory is loaded before creating new sandboxes.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-19 12:44:58 +08:00
Peng Tao
a7d888febc virtconainers: add SetFactory API
Add SetFactory to allow virtcontainers consumers to set a vm factory.
And use it to create new VMs whenever the factory is set.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-19 12:44:58 +08:00
Peng Tao
bdd5c66fc5 virtcontainers: add vm factory support
Add vm factory support per design in the VM Factory plugin section.
The vm factory controls how a new vm is created:

1. direct: vm is created directly
2. template: vm is created via vm template. A template vm is pre-created
   and saved. Later vm is just a clone of the template vm so that they
   readonly share a portion of initial memory (including kernel, initramfs
   and the kata agent). CPU and memory are hot plugged when necessary.
3. cache: vm is created via vm caches. A set of cached vm are pre-created
   and maintained alive. New vms are created by just picking a cached vm.
   CPU and memory are hot plugged when necessary.

Fixes: #303

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-19 12:44:58 +08:00
Peng Tao
8dda2dd7a5 virtcontainers: add a vm abstraction layer
As representation of a guest without actual sandbox attached to it.
This prepares for vm factory support.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-19 12:44:58 +08:00
Peng Tao
28b6104710 qemu: prepare for vm templating support
1. support qemu migration save operation
2. setup vm templating parameters per hypervisor config
3. create vm storage path when it does not exist. This can happen when
an empty guest is created without a sandbox.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-19 12:44:58 +08:00
Peng Tao
057214f0fe agent: prepare for vm factory
There are a few changes we need on kata agent to introduce vm factory
support:
1. decouple agent creation from sandbox config
2. setup agent without creating a sandbox
3. expose vm storage path and share mount point

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-19 12:44:55 +08:00
Peng Tao
7f20dd89a3 hypervisor: cleanup valid method
The boolean return value is not necessary.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-19 10:49:25 +08:00
Peng Tao
18e6a6effc hypervisor: decouple hypervisor from sandbox
A hypervisor implementation does not need to depend on a sandbox
structure. Decouple them in preparation for vm factory.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-19 10:49:25 +08:00
Peng Tao
4ac675453f qemu: remove append9PVolumes
It is not used and we actully cannot append multiple 9pfs volumes to
a guest.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-19 10:49:25 +08:00
Graham Whaley
e0010619fc
Merge pull request #495 from bergwolf/agent_debug
kata_agent: print request details
2018-07-18 17:22:36 +01:00
Peng Tao
81c073f67d
Merge pull request #458 from harche/without_devices
virtcontainers: Add support for ephemeral volumes
2018-07-18 15:06:09 +08:00
Peng Tao
5d6da3517a kata_agent: print request details
It helps tracking each request that is sent and we can match with the
one printed by kata-agent on the guest side to find out any stack
requests in the middle.

Fixes: #494

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2018-07-18 11:26:50 +08:00
Harshal Patil
b821a5df4c virtcontainers: Add support for ephemeral volumes
Ephemeral volumes should not be passed at 9pfs mounts.
They should be created inside the VM.

This patch disables ephemeral volumes from getting
mounted as 9pfs from the host and instead a corresponding
tmpfs is created inside the VM.

Fixes : #61

Signed-off-by: Harshal Patil <harshal.patil@in.ibm.com>
2018-07-18 07:41:36 +05:30
Julio Montes
a9fde8201e
Merge pull request #96 from nitkon/patch-1
Kata-deploy: scrub for grammar and typos in README
2018-07-17 08:20:19 -05:00
Peng Tao
545fe0c873
Merge pull request #490 from kata-containers/makefile-fix
makefile: update PREFIX to remove redundant slash
2018-07-17 17:44:21 +08:00
Archana Shinde
555a58a807
Merge pull request #101 from kata-containers/kata-deploy-container-update
kata-deploy: update to use katadocker container image
2018-07-16 16:40:41 -07:00
Eric Ernst
c72a720b97 makefile: update PREFIX to remove redundant slash
Fixes: #488

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
2018-07-16 11:01:33 -07:00
Julio Montes
77cbea5a42
Merge pull request #475 from grahamwhaley/20180706_env_json
kata-env: Add ability to output as JSON
2018-07-16 07:38:50 -05:00
Eric Ernst
14e34ee27e kata-deploy: update to use katadocker container image
Now that initial files for kata-deploy have merged, we
have an initial image on dockerhub.  s/egernst/katadocker

Fixes: #100

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
2018-07-13 15:32:52 +00:00
Julio Montes
1434a3c5b0
Merge pull request #89 from devimc/topic/snap
snap: improve README and Makefile
2018-07-13 09:34:10 -05:00
nitkon
11d9609ce9
Kata-deploy: scrub for grammar and typos in README
Fixes:  #95

Signed-off-by: Nitesh Konkar niteshkonkar@in.ibm.com
2018-07-13 13:54:48 +05:30
Archana Shinde
deb38b915e
Merge pull request #65 from kata-containers/introduce-kata-deploy
kata-deploy: add support for deploying Kata on K8S
2018-07-12 14:42:04 -07:00
Archana Shinde
02056b613e
Merge pull request #482 from chavafg/topic/update-cri-o
versions: Update CRI-O supported version
2018-07-12 10:30:16 -07:00
Salvador Fuentes
bb0bab2683 versions: Update CRI-O supported version
Some test fixes were introduced into the 1.9 and 1.10 branches
of cri-o. These fixes will help us minimize random failures.

Fixes #481.

Signed-off-by: Salvador Fuentes <salvador.fuentes@intel.com>
2018-07-12 09:47:03 -05:00
Julio Montes
81a41050b8 snap: improve README and Makefile
Address code review of pr #82

fixes #88

Signed-off-by: Julio Montes <julio.montes@intel.com>
2018-07-12 09:16:15 -05:00
Eric Ernst
c2024c9f87
Merge pull request #192 from scooley/kube-anchor
docs: update kube anchor in distro install guides
2018-07-11 13:59:22 -07:00
Eric Ernst
976b883501 kata-deploy: cleanup, updated for 1.1.0
Signed-off-by: Eric Ernst <eric.ernst@intel.com>
2018-07-11 20:49:47 +00:00
Sarah
748acc6683 docs: update kube anchor in distro install guides.
Fixes: #184

Signed-off-by: Sarah <scooley@microsoft.com>
2018-07-11 12:57:00 -07:00
Graham Whaley
bd6db3031a kata-env: tests: add JSON out/in verify test
Add a test to ensure the JSON output passes the same
parameter check and write/re-read test as the TOML one.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2018-07-11 17:54:11 +01:00
Graham Whaley
e45f591219 kata-env: Do not leave temp files on test
One of the test cases was not defer removing the tmpfile
it uses. Add that defer.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2018-07-11 17:14:18 +01:00
Graham Whaley
1f8f7629a0 kata-env: Fix test cases for kata-env JSON
With the addition of the JSON kata-env output, we need
to fix up the tests:
 - add a test for the JSON flag
 - fix the format/layout of the other tests to take into
  account the change in function API and the additon of a
  flagset to the cmdline ctx.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2018-07-11 17:12:36 +01:00
Archana Shinde
8af3dd4511
Merge pull request #479 from grahamwhaley/20180710_no_exit_check
Fix no exit static check
2018-07-11 08:30:30 -07:00
Eric Ernst
0be8a5cb03
Merge pull request #86 from jcvenegas/update-repository-version
Update repository version
2018-07-10 14:43:47 -07:00
Eric Ernst
e642e32ed5 kata-deploy: add support for deploying Kata on K8S
A Dockerfile is created and reference daemonsets are also
provided for deploying Kata Containers onto a running Kubernetes
cluster. A few daemonsets are introduced:

1) runtime-labeler: This daemonset will create a label on each node in
the cluster identifying the CRI shim in use. For example,
container-runtime=crio or container-runtime=containerd.

2) crio and containerd kata installer: Assuming either CRIO or
containerd is the CRI runtime on the node (determined based on label
from (1),, either the crio or containerd variant will execute.  These daemonsets
will install the VM artifacts and host binaries required for using
Kata Containers.  Once installed, it will add a node label kata-runtime=true
and reconfigure either crio or containerd to make use of Kata for untrusted workloads.
As a final step it will restart the CRI shim and kubelet.  Upon deletion,
the daemonset will remove the kata binaries and VM artifacts and update
the label to kata-runtime=cleanup.

3) crio and containerd cleanup: Either of these two daemonsets will run,
pending the container-runtime label value and if the node has label
kata-runtime=cleanup.  This daemonset simply restarts crio/containerd as
well as kubelet. This was not feasible in a preStepHook, hence the
seperate cleanup step.

An RBAC is created to allow the daemonsets to modify labels on the node.

To deploy kata:
kubectl apply -f kata-rbac.yaml
kubectl apply -f kata-deploy.yaml

To remove kata:
kubectl delete -f kata-deploy.yaml
kubectl apply -f kata-cleanup.yaml
kubectl delete -f kata-cleanup.yaml
kubectl delete -f kata-rbac.yaml

This initial commit is based on contributions by a few folks on
github.com/egernst/kata-deploy

Also-by: Saikrishna Edupuganti <saikrishna.edupuganti@intel.com>
Signed-off-by: Eric Ernst <eric.ernst@intel.com>
Signed-off-by: Jon Olson <jonolson@google.com>
Signed-off-by: Ricardo Aravena <raravena@branch.io>
Signed-off-by: Eric Ernst <eric.ernst@intel.com>
2018-07-10 18:52:05 +00:00
Graham Whaley
031632d5b0 ci: no-exit: Do not run no-exit check on test files
The test files do not have access to our app level
exit() function, and are thus OK to call os.Exit() if
they need. Skip them from the check.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2018-07-10 17:04:27 +01:00
Graham Whaley
63c06bee70 kata-env: Add ability to output as JSON
Having a direct JSON output for kata-env will help record
results in our CIs in some instances. Add that ability with
a kata-env command line extension.

Fixes: #474

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2018-07-10 16:06:53 +01:00
Graham Whaley
62495d45be ci: no-exit: Allow path override for os.Exit check
Allow the path being checked by the os-no-exit script to be
passed in, and update the Makefile to use that to check the
current code paths of the cli and virtcontainers.

Fixes: #477

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2018-07-10 15:29:34 +01:00
Graham Whaley
6268ba4aa3 ci: no-exit: Skip check if no files to check
If we find no files to check, gracefully quit the test.
Formerly, if the list was empty we ended up trying to read
from stdin, and thus hung.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2018-07-10 15:29:34 +01:00
Graham Whaley
1c453a372e ci: no-exit: Document and echo what the check is
Make it clearer why we run the check.
Make it announce itself.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2018-07-10 15:29:34 +01:00
Sebastien Boeuf
ff7b4f6ed7
Merge pull request #473 from lifupan/hyper-integration
api: To stop its monitor after a sandbox paused
2018-07-09 19:28:01 -07:00
Sebastien Boeuf
cd842afca4
Merge pull request #417 from nitkon/maxmem
virtcontainers: Set ppc64le maxmem depending on qemu version
2018-07-09 12:07:12 -07:00
Jose Carlos Venegas Munoz
4eb3a3dcd1 test: Add test update-repository-version.sh
Add some basic test to verify the script works.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2018-07-09 13:14:47 -05:00