Skip to content

Commit f453f1f

Browse files
Noah Meyerhanssamuelkarp
authored andcommitted
Initial (code) commit
1 parent 8fd6383 commit f453f1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+7902
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.img
2+
firecracker
3+
firecracker-*
4+
vmlinux

COPYRIGHT_HEADER

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
not use this file except in compliance with the License. A copy of the
5+
License is located at
6+
7+
http://aws.amazon.com/apache2.0/
8+
9+
or in the "license" file accompanying this file. This file is distributed
10+
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
express or implied. See the License for the specific language governing
12+
permissions and limitations under the License.

HACKING.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Developing for this project
2+
====
3+
4+
Testing
5+
---
6+
7+
Tests are written using Go's testing framework and can be run with the standard
8+
`go test` tool. If you prefer to use the Makefile, `make test EXTRAGOARGS=-v`
9+
will run tests in verbose mode.
10+
11+
You need some external resources in order to run the tests, as described below:
12+
13+
1. A firecracker binary (tested with 0.10.1), but any recent version should
14+
work. Must either be installed as `./firecracker` or the path must be
15+
specified through the `FC_TEST_BIN` environment variable.
16+
2. Access to hardware virtualization via `/dev/kvm` (ensure you have mode
17+
`+rw`!)
18+
3. An uncompressed Linux kernel binary that can boot in Firecracker VM (Must be
19+
installed as `./vmlinux`)
20+
4. A tap device owned by your userid (Must be either named `fc-test-tap0` or
21+
have the name specified with the `FC_TEST_TAP` environment variable; try
22+
`sudo ip tuntap add fc-test-tap0 mode tap user $UID` to create `fc-test-tap0`
23+
if you need to create one)
24+
5. A root filesystem image installed (Must be named `root-drive.img`; can be
25+
empty, create it something like
26+
`dd if=/dev/zero of=drive-2.img bs=1k count=102400`)
27+
28+
With all of those set up, `make test EXTRAGOARGS=-v` should create a Firecracker
29+
process and run the Linux kernel in a MicroVM.
30+
31+
Regenerating the API client
32+
---
33+
34+
The API client can be generated using the
35+
[Go swagger implementation](https://goswagger.io/). To do so, perform the
36+
following:
37+
38+
1. Update `client/swagger.yaml`
39+
3. Run `go generate`
40+
4. Figure out what broke and fix it.

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
# not use this file except in compliance with the License. A copy of the
5+
# License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is distributed
10+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
# express or implied. See the License for the specific language governing
12+
# permissions and limitations under the License.
13+
14+
SUBDIRS:=cmd/firectl
15+
16+
# Set this to pass additional commandline flags to the go compiler, e.g. "make test EXTRAGOARGS=-v"
17+
EXTRAGOARGS:=
18+
19+
all: build
20+
21+
build clean test:
22+
go $@ $(EXTRAGOARGS)
23+
for d in $(SUBDIRS); do \
24+
cd $$d && go $@ $(EXTRAGOARGS); \
25+
done
26+
27+
.PHONY: all clean build test

TODO.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
TODO
2+
===
3+
4+
Features
5+
---
6+
7+
There's currently no support for specifying rate limits for network or block device access.
8+
9+
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.
10+
11+
Integration with the `jailer`
12+
13+
The tests rely on a bunch of hardcoded information and priviledged access. This should be fixed.

client/firecracker_client.go

Lines changed: 130 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/models/boot_source.go

Lines changed: 80 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/models/cpu_template.go

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)