Skip to content

Commit

Permalink
Initial (code) commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Meyerhans authored and samuelkarp committed Nov 15, 2018
1 parent 8fd6383 commit f453f1f
Show file tree
Hide file tree
Showing 56 changed files with 7,902 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.img
firecracker
firecracker-*
vmlinux
12 changes: 12 additions & 0 deletions COPYRIGHT_HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"). You may
not use this file except in compliance with the License. A copy of the
License is located at

http://aws.amazon.com/apache2.0/

or in the "license" file accompanying this file. This file 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.
40 changes: 40 additions & 0 deletions HACKING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Developing for this project
====

Testing
---

Tests are written using Go's testing framework and can be run with the standard
`go test` tool. If you prefer to use the Makefile, `make test EXTRAGOARGS=-v`
will run tests in verbose mode.

You need some external resources in order to run the tests, as described below:

1. A firecracker binary (tested with 0.10.1), but any recent version should
work. Must either be installed as `./firecracker` or the path must be
specified through the `FC_TEST_BIN` environment variable.
2. Access to hardware virtualization via `/dev/kvm` (ensure you have mode
`+rw`!)
3. An uncompressed Linux kernel binary that can boot in Firecracker VM (Must be
installed as `./vmlinux`)
4. A tap device owned by your userid (Must be either named `fc-test-tap0` or
have the name specified with the `FC_TEST_TAP` environment variable; try
`sudo ip tuntap add fc-test-tap0 mode tap user $UID` to create `fc-test-tap0`
if you need to create one)
5. A root filesystem image installed (Must be named `root-drive.img`; can be
empty, create it something like
`dd if=/dev/zero of=drive-2.img bs=1k count=102400`)

With all of those set up, `make test EXTRAGOARGS=-v` should create a Firecracker
process and run the Linux kernel in a MicroVM.

Regenerating the API client
---

The API client can be generated using the
[Go swagger implementation](https://goswagger.io/). To do so, perform the
following:

1. Update `client/swagger.yaml`
3. Run `go generate`
4. Figure out what broke and fix it.
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may
# not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file 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.

SUBDIRS:=cmd/firectl

# Set this to pass additional commandline flags to the go compiler, e.g. "make test EXTRAGOARGS=-v"
EXTRAGOARGS:=

all: build

build clean test:
go $@ $(EXTRAGOARGS)
for d in $(SUBDIRS); do \
cd $$d && go $@ $(EXTRAGOARGS); \
done

.PHONY: all clean build test
13 changes: 13 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
TODO
===

Features
---

There's currently no support for specifying rate limits for network or block device access.

Better integration with CNI could be nice. Currently, the network namespace should be created ahead of time by and, and the CNI plugins should be run within it to configure the network. Then the firecracker process (`cmd/firectl/firectl` or whatever process is calling the library) can join that namespace and attach to the appropriate TAP device. At least some of this workflow should be integrated into the library.

Integration with the `jailer`

The tests rely on a bunch of hardcoded information and priviledged access. This should be fixed.
130 changes: 130 additions & 0 deletions client/firecracker_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions client/models/boot_source.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 76 additions & 0 deletions client/models/cpu_template.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f453f1f

Please sign in to comment.