Skip to content

Commit

Permalink
Merge pull request #2575 from stefansundin/formatting-polish
Browse files Browse the repository at this point in the history
Fix minor formatting issues
  • Loading branch information
stmcginnis authored Nov 21, 2022
2 parents 65b54fd + 50744a4 commit e44527c
Show file tree
Hide file tree
Showing 74 changed files with 320 additions and 283 deletions.
34 changes: 20 additions & 14 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ Ensure the following OS packages are installed:

##### Ubuntu

```
```shell
apt install build-essential openssl libssl-dev pkg-config liblz4-tool
```

##### Fedora

```
```shell
yum install make automake gcc openssl openssl-devel pkg-config lz4 perl-FindBin perl-lib
```

Expand All @@ -45,7 +45,7 @@ Rust 1.51.0 or higher is required.
To organize build tasks, we use [cargo-make](https://sagiegurari.github.io/cargo-make/).
To get it, run:

```
```shell
cargo install cargo-make
```

Expand All @@ -68,28 +68,34 @@ Docker's [post-installation steps for Linux](https://docs.docker.com/install/lin

To build an image, run:

```
```shell
cargo make
```

This will build an image for the default variant, `aws-k8s-1.24`.
This will build an image for the default variant (a recent `aws-k8s-*`, see the `BUILDSYS_VARIANT` variable in [Makefile.toml](Makefile.toml) to find the current default variant).
All packages will be built in turn, and then compiled into an `img` file in the `build/images/` directory.

The version number in [Release.toml](Release.toml) will be used in naming the file, and will be used inside the image as the release version.
If you're planning on [publishing your build](PUBLISHING.md), you may want to change the version.

To build an image for a different variant, run:

```
```shell
cargo make -e BUILDSYS_VARIANT=my-variant-here
```

To build an image for a different architecture, run:

```
```shell
cargo make -e BUILDSYS_ARCH=my-arch-here
```

If you want to limit the build concurrency, set `BUILDSYS_JOBS` (the default is `8`):

```shell
cargo make -e BUILDSYS_JOBS=4
```

(You can use variant and arch arguments together, too.)

#### Package licenses
Expand Down Expand Up @@ -160,7 +166,7 @@ If you're using an EC2 instance, the [EC2 instance's IAM role](https://docs.aws.

For a simple start, pick an [EC2 region](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions), then run:

```
```shell
cargo make -e PUBLISH_REGIONS=your-region-here ami
```

Expand All @@ -170,7 +176,7 @@ Your new AMI ID will be printed after it's registered.

If you built your image for a different architecture or variant, just use the same arguments here:

```
```shell
cargo make -e PUBLISH_REGIONS=your-region-here -e BUILDSYS_VARIANT=my-variant-here ami
```

Expand Down Expand Up @@ -200,19 +206,19 @@ kmod kits are included in the official Bottlerocket repos starting with Bottlero
Let's say you want to download the kit for building x86_64 modules for v1.7.0 and variant aws-k8s-1.21.

First, you need tuftool:
```bash
```shell
cargo install tuftool
```

Next, you need the Bottlerocket root role, which is used by tuftool to verify the kmod kit.
This will download and verify the root role itself:
```bash
```shell
curl -O "https://cache.bottlerocket.aws/root.json"
sha512sum -c <<<"b81af4d8eb86743539fbc4709d33ada7b118d9f929f0c2f6c04e1d41f46241ed80423666d169079d736ab79965b4dd25a5a6db5f01578b397496d49ce11a3aa2 root.json"
```

Next, set your desired parameters, and download the kmod kit:
```bash
```shell
ARCH=x86_64
VERSION=v1.7.0
VARIANT=aws-k8s-1.21
Expand All @@ -227,11 +233,11 @@ tuftool download "${OUTDIR}" --target-name ${VARIANT}-${ARCH}-kmod-kit-${VERSION
### Using the kmod kit

To use the kmod kit, extract it, and update your PATH to use its toolchain:
```bash
```shell
tar xf "${VARIANT}-${ARCH}-kmod-kit-${VERSION}.tar.xz"

export CROSS_COMPILE="${ARCH}-bottlerocket-linux-musl-"
export KERNELDIR="${PWD}/${VARIANT}-${ARCH}-kmod-kit-${VERSION}/kernel-devel
export KERNELDIR="${PWD}/${VARIANT}-${ARCH}-kmod-kit-${VERSION}/kernel-devel"
export PATH="${PWD}/${VARIANT}-${ARCH}-kmod-kit-${VERSION}/toolchain/usr/bin:${PATH}"
```

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
* New mount in host containers for system logs ([#2295])
* Apply strict mount options and enforce execution rules ([#2239])
* Switch to a more commonly used syntax for disabling kernel config settings ([#2290])
* Respect proxy settings when running setting generators ([#2227])
* Respect proxy settings when running setting generators ([#2227])
* Add `NET_CAP_ADMIN` to bootstrap containers ([#2266])
* Reduce log output for DHCP services ([#2260])
* Fix invalid kernel config options ([#2269])
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ To send us a pull request, please:

GitHub provides additional documentation on [forking a repository](https://help.github.com/articles/fork-a-repo/) and [creating a pull request](https://help.github.com/articles/creating-a-pull-request/).

## Repo branch and tag structure
## Repo branch and tag structure

Active development occurs under the `develop` branch.

Expand Down
13 changes: 9 additions & 4 deletions PROVISIONING-METAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ The Bottlerocket image for bare metal is signed and uploaded alongside the rest
You first need the Bottlerocket root role, which is used by `tuftool` to verify the image.
The following will download and verify the root role itself:

```
```shell
curl -O "https://cache.bottlerocket.aws/root.json"
sha512sum -c <<<"b81af4d8eb86743539fbc4709d33ada7b118d9f929f0c2f6c04e1d41f46241ed80423666d169079d736ab79965b4dd25a5a6db5f01578b397496d49ce11a3aa2 root.json"
```

Next, set your desired version and variant, and use `tuftool` to download the image:
To install `tuftool` you'll need to install Rust (via [rustup](https://rustup.rs/) or the official site), and then you can run `cargo install tuftool`.
```

```shell
ARCH="x86_64"
VERSION="v1.9.0"
VARIANT="metal-k8s-1.23"
Expand Down Expand Up @@ -106,6 +107,7 @@ Please keep in mind that when using static addresses, DNS information must be su
* `route-metric` (integer): Relative route priority.

Example `net.toml` with comments:

```toml
version = 2

Expand Down Expand Up @@ -174,6 +176,7 @@ Settings prefixed with `init` are added to the kernel command line after the `--
In the example below, two console devices are set up, and `systemd`'s log level is set to `debug`.

Example Boot Configuration:

```
kernel {
console = tty0, "ttyS1,115200n8"
Expand All @@ -187,7 +190,8 @@ The Bottlerocket SDK provides the `bootconfig` CLI tool, which is used to create
To create the Boot Configuration initrd, create a config file named `bootconfig-input` containing your desired key/value pair kernel and init arguments.

Then run the following (you will need Docker installed):
```

```shell
ARCH=$(uname -m)
SDK_VERSION="v0.26.0"
SDK_IMAGE="public.ecr.aws/bottlerocket/bottlerocket-sdk-${ARCH}:${SDK_VERSION}"
Expand All @@ -208,7 +212,8 @@ The above command will create the properly named initrd `bootconfig.data` in you
This is the file you will write to disk during provisioning.

You can list a `bootconfig.data`'s contents, which also validates its format, by running:
```

```shell
ARCH=$(uname -m)
SDK_VERSION="v0.26.0"
SDK_IMAGE="public.ecr.aws/bottlerocket/bottlerocket-sdk-${ARCH}:${SDK_VERSION}"
Expand Down
3 changes: 2 additions & 1 deletion PUBLISHING-AWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ This is useful for testing, and for sharing private AMIs with specific accounts.

If you want to make your AMIs public to the world, there's a shortcut:

```
```shell
cargo make ami-public
```

Expand Down Expand Up @@ -137,6 +137,7 @@ This will copy the fully versioned parameter from earlier, something like:
```

...to a simpler parameter name:

```
/your/prefix/here/aws-k8s-1.24/x86_64/latest/image_id
```
Expand Down
4 changes: 2 additions & 2 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ There's nothing secret in a root role file, so if you have a way of storing it r
The `signing_keys` portion above references a local file path.
If you want to use an SSM or KMS key, you'd write it like this, instead:

```
```toml
signing_keys = { kms = { key_id = "abc-def-123" } }
```

...or...

```
```toml
signing_keys = { ssm = { parameter = "/my/parameter" } }
```

Expand Down
23 changes: 12 additions & 11 deletions QUICKSTART-ECS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For more information about clusters, see

You can create a cluster with the AWS CLI as follows:

```
```shell
aws ecs --region us-west-2 create-cluster --cluster-name bottlerocket
```

Expand Down Expand Up @@ -82,12 +82,13 @@ For example, to use the parameter above, you would pass this as the AMI ID in yo
If you prefer to fetch the AMI ID yourself, you can use [aws-cli](https://aws.amazon.com/cli/) on the command line.
To fetch the example parameter above, for the us-west-2 region, you could run this:

```
```shell
aws ssm get-parameter --region us-west-2 --name "/aws/service/bottlerocket/aws-ecs-1/x86_64/latest/image_id" --query Parameter.Value --output text
```

If you have `jq` and would like a bit more information, try this:
```
If you have `jq` installed and would like a bit more information, try this:

```shell
aws ssm get-parameters --region us-west-2 \
--names "/aws/service/bottlerocket/aws-ecs-1/x86_64/latest/image_id" \
"/aws/service/bottlerocket/aws-ecs-1/x86_64/latest/image_version" \
Expand All @@ -107,7 +108,7 @@ in your account.
To find your default VPC, run this command.
(If you use an AWS region other than "us-west-2", make sure to change that.)

```
```shell
aws ec2 describe-vpcs \
--region us-west-2 \
--filters=Name=isDefault,Values=true \
Expand All @@ -118,7 +119,7 @@ If you want to use a different VPC you created, run this to get the ID for your
Make sure to change VPC_NAME to the name of the VPC you created.
(If you use an EC2 region other than "us-west-2", make sure to change that too.)

```
```shell
aws ec2 describe-vpcs \
--region us-west-2 \
--filters=Name=tag:Name,Values=VPC_NAME \
Expand All @@ -130,7 +131,7 @@ It will give you a list of the subnets and tell you whether each is public or pr
Make sure to change VPC_ID to the value you received from the previous command.
(If you use an EC2 region other than "us-west-2", make sure to change that too.)

```
```shell
aws ec2 describe-subnets \
--region us-west-2 \
--filter=Name=vpc-id,Values=VPC_ID \
Expand Down Expand Up @@ -170,15 +171,15 @@ If you add SSM permissions, you can use Bottlerocket's default SSM agent to get

To attach the role policy for SSM permissions, run the following (replacing INSTANCE_ROLE_NAME with the name of your instance role):

```
```shell
aws iam attach-role-policy \
--role-name INSTANCE_ROLE_NAME \
--policy-arn arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore
```

Next, to retrieve the instance profile name used to launch instances, run this:

```
```shell
aws iam list-instance-profiles-for-role --role-name INSTANCE_ROLE_NAME --query "InstanceProfiles[*].InstanceProfileName" --output text
```

Expand All @@ -190,7 +191,7 @@ For the instance to be able to communicate with ECS, we need to make sure to con

Create a file called `user-data.toml` with the following contents, where CLUSTER_NAME is the name of the cluster you created above (for example, "bottlerocket").

```
```toml
[settings.ecs]
cluster = "CLUSTER_NAME"
```
Expand All @@ -209,7 +210,7 @@ There are a few values to make sure you change in this command:
* user-data.toml: the path to the user data file you created earlier
* INSTANCE_PROFILE_NAME: the IAM instance profile you created, e.g. `ecsInstanceRole`

```
```shell
aws ec2 run-instances --key-name YOUR_KEY_NAME \
--subnet-id SUBNET_ID \
--image-id BOTTLEROCKET_AMI_ID \
Expand Down
Loading

0 comments on commit e44527c

Please sign in to comment.