From 60ebe8c47f5fcd3e92e2479c94395456efa4817b Mon Sep 17 00:00:00 2001 From: Tom Kirchner Date: Wed, 26 Feb 2020 14:07:03 -0800 Subject: [PATCH 1/2] Rename aws-k8s variant to aws-k8s-1.15 This requires removing the variants workspace, which we had intended to do anyway because you wouldn't want to build the whole workspace. It needs to be removed now because "." isn't valid in a package name, and we were passing the variant name to build the variant's "package". --- BUILDING.md | 10 +++++----- Makefile.toml | 11 ++++++----- README.md | 4 ++-- bin/amiize.sh | 8 ++++---- sources/models/README.md | 6 +++--- sources/models/build.rs | 2 +- .../models/src/{aws-k8s => aws-k8s-1.15}/mod.rs | 0 .../override-defaults.toml | 0 sources/models/src/lib.rs | 6 +++--- sources/updater/updog/README.md | 14 +++++++------- sources/updater/updog/src/bin/updata.rs | 6 +++--- sources/updater/updog/src/main.rs | 6 +++--- sources/updater/updog/tests/data/example_3.json | 4 ++-- variants/Cargo.toml | 9 --------- variants/README.md | 4 ++-- variants/{ => aws-dev}/Cargo.lock | 5 ----- variants/aws-k8s-1.15/Cargo.lock | 5 +++++ variants/{aws-k8s => aws-k8s-1.15}/Cargo.toml | 4 +++- variants/{aws-k8s => aws-k8s-1.15}/build.rs | 0 variants/{aws-k8s => aws-k8s-1.15}/lib.rs | 0 20 files changed, 49 insertions(+), 55 deletions(-) rename sources/models/src/{aws-k8s => aws-k8s-1.15}/mod.rs (100%) rename sources/models/src/{aws-k8s => aws-k8s-1.15}/override-defaults.toml (100%) delete mode 100644 variants/Cargo.toml rename variants/{ => aws-dev}/Cargo.lock (73%) create mode 100644 variants/aws-k8s-1.15/Cargo.lock rename variants/{aws-k8s => aws-k8s-1.15}/Cargo.toml (64%) rename variants/{aws-k8s => aws-k8s-1.15}/build.rs (100%) rename variants/{aws-k8s => aws-k8s-1.15}/lib.rs (100%) diff --git a/BUILDING.md b/BUILDING.md index 72278c0496c..172768295d8 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -53,11 +53,11 @@ The script has some assumptions about your setup, in particular that you: * have a few other common tools installed, like `jq`, `du`, and `rsync` First, decompress the images. -(Note: these filenames assume an `x86_64` architecture and `aws-k8s` [variant](README.md).) +(Note: these filenames assume an `x86_64` architecture and `aws-k8s-1.15` [variant](README.md).) ``` -lz4 -d build/latest/bottlerocket-aws-k8s-x86_64.img.lz4 && \ -lz4 -d build/latest/bottlerocket-aws-k8s-x86_64-data.img.lz4 +lz4 -d build/latest/bottlerocket-aws-k8s-1.15-x86_64.img.lz4 && \ +lz4 -d build/latest/bottlerocket-aws-k8s-1.15-x86_64-data.img.lz4 ``` Next, register an AMI: @@ -65,8 +65,8 @@ Next, register an AMI: ``` bin/amiize.sh --name YOUR-AMI-NAME-HERE \ --ssh-keypair YOUR-EC2-SSH-KEYPAIR-NAME-HERE \ - --root-image build/latest/bottlerocket-aws-k8s-x86_64.img \ - --data-image build/latest/bottlerocket-aws-k8s-x86_64-data.img \ + --root-image build/latest/bottlerocket-aws-k8s-1.15-x86_64.img \ + --data-image build/latest/bottlerocket-aws-k8s-1.15-x86_64-data.img \ --region us-west-2 \ --instance-type m3.xlarge \ --arch x86_64 \ diff --git a/Makefile.toml b/Makefile.toml index 34733893cdc..98f615ed75f 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -10,7 +10,7 @@ BUILDSYS_SOURCES_DIR = "${BUILDSYS_ROOT_DIR}/sources" BUILDSYS_TIMESTAMP = { script = ["date +%s"] } BUILDSYS_VERSION_BUILD = { script = ["git describe --always --dirty --exclude '*' || echo 00000000"] } BUILDSYS_VERSION_IMAGE = { script = ["awk -F '[ =\"]+' '$1 == \"version\" {print $2}' Release.toml"] } -BUILDSYS_VARIANT = "aws-k8s" +BUILDSYS_VARIANT = "aws-k8s-1.15" # Disallow pulling directly Upstream URLs when lookaside cache results in MISSes as a fallback. # To use the upstream source as fallback, override this on the command line and set it to 'true' BUILDSYS_UPSTREAM_SOURCE_FALLBACK = "false" @@ -79,7 +79,8 @@ fi dependencies = ["setup"] script = [ ''' -for ws in sources packages variants tools/buildsys ; do +for ws in sources packages variants/* tools/buildsys ; do + [ -d "${ws}" ] || continue cargo fetch --locked --manifest-path ${ws}/Cargo.toml done chmod o+r -R ${CARGO_HOME} @@ -151,8 +152,7 @@ export PATH="${BUILDSYS_TOOLS_DIR}/bin:${PATH}" cargo build \ ${CARGO_BUILD_ARGS} \ ${CARGO_MAKE_CARGO_ARGS} \ - --manifest-path variants/Cargo.toml \ - --package ${BUILDSYS_VARIANT} + --manifest-path variants/${BUILDSYS_VARIANT}/Cargo.toml ''' ] @@ -225,7 +225,8 @@ script = ['tools/gen-docs.sh'] [tasks.clean] script = [ ''' -for ws in sources packages variants tools/buildsys ; do +for ws in sources packages variants/* tools/buildsys ; do + [ -d "${ws}" ] || continue cargo clean --manifest-path ${ws}/Cargo.toml done rm -f ${BUILDSYS_TOOLS_DIR}/bin/buildsys diff --git a/README.md b/README.md index a3f496f7ac2..a3e4c63f7b1 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,9 @@ We’re excited to get early feedback and to continue working on more use cases! Bottlerocket is architected such that different cloud environments and container orchestrators can be supported in the future. A build of Bottlerocket that supports different features or integration characteristics is known as a 'variant'. The artifacts of a build will include the architecture and variant name. -For example, an `x86_64` build of the `aws-k8s` variant will produce an image named `bottlerocket-aws-k8s-x86_64--.img`. +For example, an `x86_64` build of the `aws-k8s-1.15` variant will produce an image named `bottlerocket-aws-k8s-1.15-x86_64--.img`. -Our first supported variant, `aws-k8s`, supports EKS as described above. +Our first supported variant, `aws-k8s-1.15`, supports EKS as described above. ## Setup diff --git a/bin/amiize.sh b/bin/amiize.sh index 7fd9e1531b9..fc7b94496ea 100755 --- a/bin/amiize.sh +++ b/bin/amiize.sh @@ -31,8 +31,8 @@ # Tested with the Amazon Linux AMI as worker AMI. # Example call: # bin/amiize.sh --region us-west-2 \ -# --root-image build/latest/bottlerocket-aws-k8s-x86_64.img \ -# --data-image build/latest/bottlerocket-aws-k8s-x86_64-data.img \ +# --root-image build/latest/bottlerocket-aws-k8s-1.15-x86_64.img \ +# --data-image build/latest/bottlerocket-aws-k8s-1.15-x86_64-data.img \ # --worker-ami ami-0f2176987ee50226e --ssh-keypair tjk \ # --instance-type m3.xlarge --name bottlerocket-20190918-01 --arch x86_64 \ # --user-data 'I2Nsb3VkLWNvbmZpZwpyZXBvX3VwZ3JhZGU6IG5vbmUK' @@ -356,8 +356,8 @@ if [ -n "${registered_ami}" ]; then fi # Determine the size of the images (in G, for EBS) -# 2G bottlerocket-aws-k8s-x86_64.img -# 8G bottlerocket-aws-k8s-x86_64-data.img +# 2G bottlerocket-aws-k8s-1.15-x86_64.img +# 8G bottlerocket-aws-k8s-1.15-x86_64-data.img # This is overridden by --root-volume-size and --data-volume-size if you pass those options. root_image_size=$(du --apparent-size --block-size=G "${ROOT_IMAGE}" | sed -r 's,^([0-9]+)G\t.*,\1,') if [ ! "${root_image_size}" -gt 0 ]; then diff --git a/sources/models/README.md b/sources/models/README.md index dc287777442..06b03436f83 100644 --- a/sources/models/README.md +++ b/sources/models/README.md @@ -20,10 +20,10 @@ Default values are specified in [defaults.toml](defaults.toml) and can be overri The `#[model]` attribute on Settings and its sub-structs reduces duplication and adds some required metadata; see [its docs](model-derive/) for details. -### aws-k8s: Kubernetes +### aws-k8s-1.15: Kubernetes 1.15 -* [Model](src/aws-k8s/mod.rs) -* [Overridden defaults](src/aws-k8s/override-defaults.toml) +* [Model](src/aws-k8s-1.15/mod.rs) +* [Overridden defaults](src/aws-k8s-1.15/override-defaults.toml) ### aws-dev: Development build diff --git a/sources/models/build.rs b/sources/models/build.rs index 50d0695df00..193019bdb75 100644 --- a/sources/models/build.rs +++ b/sources/models/build.rs @@ -33,7 +33,7 @@ fn link_current_variant() { let var = "VARIANT"; println!("cargo:rerun-if-env-changed={}", var); let variant = env::var(var).unwrap_or_else(|_| { - eprintln!("For local builds, you must set the {} environment variable so we know which API model to build against. Valid values are the directories in sources/models, for example \"aws-k8s\".", var); + eprintln!("For local builds, you must set the {} environment variable so we know which API model to build against. Valid values are the directories in sources/models, for example \"aws-k8s-1.15\".", var); process::exit(1); }); diff --git a/sources/models/src/aws-k8s/mod.rs b/sources/models/src/aws-k8s-1.15/mod.rs similarity index 100% rename from sources/models/src/aws-k8s/mod.rs rename to sources/models/src/aws-k8s-1.15/mod.rs diff --git a/sources/models/src/aws-k8s/override-defaults.toml b/sources/models/src/aws-k8s-1.15/override-defaults.toml similarity index 100% rename from sources/models/src/aws-k8s/override-defaults.toml rename to sources/models/src/aws-k8s-1.15/override-defaults.toml diff --git a/sources/models/src/lib.rs b/sources/models/src/lib.rs index 5ee02a65ca6..a882329f8f3 100644 --- a/sources/models/src/lib.rs +++ b/sources/models/src/lib.rs @@ -17,10 +17,10 @@ Default values are specified in [defaults.toml](defaults.toml) and can be overri The `#[model]` attribute on Settings and its sub-structs reduces duplication and adds some required metadata; see [its docs](model-derive/) for details. -## aws-k8s: Kubernetes +## aws-k8s-1.15: Kubernetes 1.15 -* [Model](src/aws-k8s/mod.rs) -* [Overridden defaults](src/aws-k8s/override-defaults.toml) +* [Model](src/aws-k8s-1.15/mod.rs) +* [Overridden defaults](src/aws-k8s-1.15/override-defaults.toml) ## aws-dev: Development build diff --git a/sources/updater/updog/README.md b/sources/updater/updog/README.md index d807e5306b8..d0b4594c568 100644 --- a/sources/updater/updog/README.md +++ b/sources/updater/updog/README.md @@ -11,21 +11,21 @@ The Updog client provides an interface to a TUF repository and prepares for, dow ### Check for the most recent update ``` # updog check-update -aws-k8s-0.1.4 (v0.0) +aws-k8s-1.15 0.1.4 (v0.0) ``` ### List all available updates, including older versions ``` # updog check-update --all -aws-k8s-0.1.4 (v0.0) -aws-k8s-0.1.2 (v0.0) -aws-k8s-0.1.1 (v0.0) +aws-k8s-1.15 0.1.4 (v0.0) +aws-k8s-1.15 0.1.2 (v0.0) +aws-k8s-1.15 0.1.1 (v0.0) ``` ### Specify JSON output ``` # updog check-update --json -[{"variant":"aws-k8s","arch":"x86_64","version":"0.1.4","max_version":"0.1.4","waves":{"512":"2019-10-03T20:45:52Z","1024":"2019-10-03T21:00:52Z","1536":"2019-10-03T22:00:52Z","2048":"2019-10-03T23:00:52Z"},"images":{"boot":"bottlerocket-x86_64-aws-k8s-v0.1.4-boot.ext4.lz4","root":"bottlerocket-x86_64-aws-k8s-v0.1.4-root.ext4.lz4","hash":"bottlerocket-x86_64-aws-k8s-v0.1.4-root.verity.lz4"}}] +[{"variant":"aws-k8s-1.15","arch":"x86_64","version":"0.1.4","max_version":"0.1.4","waves":{"512":"2019-10-03T20:45:52Z","1024":"2019-10-03T21:00:52Z","1536":"2019-10-03T22:00:52Z","2048":"2019-10-03T23:00:52Z"},"images":{"boot":"bottlerocket-x86_64-aws-k8s-1.15-v0.1.4-boot.ext4.lz4","root":"bottlerocket-x86_64-aws-k8s-1.15-v0.1.4-root.ext4.lz4","hash":"bottlerocket-x86_64-aws-k8s-1.15-v0.1.4-root.verity.lz4"}}] ``` ### Try to update with wave information @@ -37,7 +37,7 @@ Once timestamp has passed: ``` # updog update --timestamp 2019-10-03T21:24:00+00:00 Starting update to 0.1.4 -Update applied: aws-k8s-0.1.4 +Update applied: aws-k8s-1.15 0.1.4 ``` ### Force an immediate update, ignoring wave limits @@ -45,5 +45,5 @@ Update applied: aws-k8s-0.1.4 # updog update --now Starting update to 0.1.4 ** Updating immediately ** -Update applied: aws-k8s-0.1.4 +Update applied: aws-k8s-1.15 0.1.4 ``` diff --git a/sources/updater/updog/src/bin/updata.rs b/sources/updater/updog/src/bin/updata.rs index 8e82fee4632..cd8f9152df8 100644 --- a/sources/updater/updog/src/bin/updata.rs +++ b/sources/updater/updog/src/bin/updata.rs @@ -28,7 +28,7 @@ struct AddUpdateArgs { // metadata file to create/modify file: PathBuf, - // image 'variant', eg. 'aws-k8s' + // image 'variant', eg. 'aws-k8s-1.15' #[structopt(short = "f", long = "variant")] variant: String, @@ -85,7 +85,7 @@ struct RemoveUpdateArgs { // metadata file to create/modify file: PathBuf, - // image 'variant', eg. 'aws-k8s' + // image 'variant', eg. 'aws-k8s-1.15' #[structopt(short = "l", long = "variant")] variant: String, @@ -129,7 +129,7 @@ struct WaveArgs { // metadata file to create/modify file: PathBuf, - // image 'variant', eg. 'aws-k8s' + // image 'variant', eg. 'aws-k8s-1.15' #[structopt(short = "l", long = "variant")] variant: String, diff --git a/sources/updater/updog/src/main.rs b/sources/updater/updog/src/main.rs index 6632a16a6d2..698394f9c22 100644 --- a/sources/updater/updog/src/main.rs +++ b/sources/updater/updog/src/main.rs @@ -725,7 +725,7 @@ mod tests { }; let version = Version::parse("0.1.3").unwrap(); - let variant = String::from("aws-k8s"); + let variant = String::from("aws-k8s-1.15"); let update = update_required(&config, &manifest, &version, &variant, None); assert!(update.is_some(), "Updog ignored max version"); @@ -911,7 +911,7 @@ mod tests { fn check_update_waves() { let mut manifest = Manifest::default(); let mut update = Update { - variant: String::from("aws-k8s"), + variant: String::from("aws-k8s-1.15"), arch: String::from(TARGET_ARCH), version: Version::parse("1.1.1").unwrap(), max_version: Version::parse("1.1.1").unwrap(), @@ -924,7 +924,7 @@ mod tests { }; let current_version = Version::parse("1.0.0").unwrap(); - let variant = String::from("aws-k8s"); + let variant = String::from("aws-k8s-1.15"); let config = Config { metadata_base_url: String::from("foo"), target_base_url: String::from("bar"), diff --git a/sources/updater/updog/tests/data/example_3.json b/sources/updater/updog/tests/data/example_3.json index a4b564d16ea..e3b5a9b8939 100644 --- a/sources/updater/updog/tests/data/example_3.json +++ b/sources/updater/updog/tests/data/example_3.json @@ -1,7 +1,7 @@ { "updates": [ { - "variant": "aws-k8s", + "variant": "aws-k8s-1.15", "arch": "x86_64", "version": "0.1.1", "max_version": "0.1.2", @@ -16,7 +16,7 @@ } }, { - "variant": "aws-k8s", + "variant": "aws-k8s-1.15", "arch": "x86_64", "version": "0.1.2", "max_version": "0.1.2", diff --git a/variants/Cargo.toml b/variants/Cargo.toml deleted file mode 100644 index 5c5acb1fd2e..00000000000 --- a/variants/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[workspace] -members = [ - "aws-k8s", - "aws-dev", -] - -[profile.dev] -debug = false -opt-level = 'z' diff --git a/variants/README.md b/variants/README.md index 830916d04dc..47cb94ce0af 100644 --- a/variants/README.md +++ b/variants/README.md @@ -24,9 +24,9 @@ Information about API settings for variants can be found in the [models](../sour ## Variants -### aws-k8s: Kubernetes node +### aws-k8s-1.15: Kubernetes 1.15 node -The [aws-k8s](aws-k8s/Cargo.toml) variant includes the packages needed to run a Kubernetes node in AWS. +The [aws-k8s-1.15](aws-k8s-1.15/Cargo.toml) variant includes the packages needed to run a Kubernetes node in AWS. It supports self-hosted clusters and clusters managed by [EKS](https://aws.amazon.com/eks/). ### aws-dev: Development build diff --git a/variants/Cargo.lock b/variants/aws-dev/Cargo.lock similarity index 73% rename from variants/Cargo.lock rename to variants/aws-dev/Cargo.lock index 31858089db2..c08592906ff 100644 --- a/variants/Cargo.lock +++ b/variants/aws-dev/Cargo.lock @@ -3,8 +3,3 @@ [[package]] name = "aws-dev" version = "0.1.0" - -[[package]] -name = "aws-k8s" -version = "0.1.0" - diff --git a/variants/aws-k8s-1.15/Cargo.lock b/variants/aws-k8s-1.15/Cargo.lock new file mode 100644 index 00000000000..c1563216fc1 --- /dev/null +++ b/variants/aws-k8s-1.15/Cargo.lock @@ -0,0 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "aws-k8s-1_15" +version = "0.1.0" diff --git a/variants/aws-k8s/Cargo.toml b/variants/aws-k8s-1.15/Cargo.toml similarity index 64% rename from variants/aws-k8s/Cargo.toml rename to variants/aws-k8s-1.15/Cargo.toml index 20f6edea038..8781708adef 100644 --- a/variants/aws-k8s/Cargo.toml +++ b/variants/aws-k8s-1.15/Cargo.toml @@ -1,5 +1,7 @@ [package] -name = "aws-k8s" +# This is the aws-k8s-1.15 variant. "." is not allowed in crate names, but we +# don't use this crate name anywhere. +name = "aws-k8s-1_15" version = "0.1.0" edition = "2018" publish = false diff --git a/variants/aws-k8s/build.rs b/variants/aws-k8s-1.15/build.rs similarity index 100% rename from variants/aws-k8s/build.rs rename to variants/aws-k8s-1.15/build.rs diff --git a/variants/aws-k8s/lib.rs b/variants/aws-k8s-1.15/lib.rs similarity index 100% rename from variants/aws-k8s/lib.rs rename to variants/aws-k8s-1.15/lib.rs From 5666387cbfd3c5f6c253ba5fa7e00dd1cd1e3a8d Mon Sep 17 00:00:00 2001 From: Tom Kirchner Date: Wed, 26 Feb 2020 14:07:12 -0800 Subject: [PATCH 2/2] updog: print space between variant and version rather than hyphen Variant names can include versions (e.g. aws-k8s-1.15) and seeing that combined with the update version using a hyphen can be confusing. For example, in aws-k8s-1.15-0.3.0, it's unclear what each version applies to. This change uses a space instead, to visually separate the two components. --- sources/updater/updog/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/updater/updog/src/main.rs b/sources/updater/updog/src/main.rs index 698394f9c22..301d01eff4c 100644 --- a/sources/updater/updog/src/main.rs +++ b/sources/updater/updog/src/main.rs @@ -422,7 +422,7 @@ fn parse_args(args: std::env::Args) -> Arguments { } fn fmt_full_version(update: &Update) -> String { - format!("{}-{}", update.variant, update.version) + format!("{} {}", update.variant, update.version) } fn output(json: bool, object: T, string: &str) -> Result<()> { @@ -532,7 +532,7 @@ fn main_inner() -> Result<()> { output( arguments.json, &u, - &format!("Update applied: {}-{}", u.variant, u.version), + &format!("Update applied: {}", fmt_full_version(&u)), )?; } else if let Some(wave) = u.jitter(config.seed) { // return the jittered time of our wave in the update