Skip to content

Commit

Permalink
Add metal-k8s-1.23 variant
Browse files Browse the repository at this point in the history
This change adds an additional variant `metal-k8s-1.23`, which includes
necessary Kubernetes packages and settings for running Bottlerocket on
metal in a Kubernetes v1.23 cluster.
  • Loading branch information
etungsten committed Jun 8, 2022
1 parent 495eab8 commit 37f53e1
Show file tree
Hide file tree
Showing 23 changed files with 129 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Expand Up @@ -49,6 +49,10 @@ jobs:
arch: x86_64
supported: false
fetch-upstream: "false"
- variant: metal-k8s-1.23
arch: x86_64
supported: false
fetch-upstream: "false"
- variant: vmware-k8s-1.20
arch: x86_64
supported: true
Expand Down
1 change: 1 addition & 0 deletions sources/logdog/conf/logdog.metal-k8s-1.23.conf
9 changes: 7 additions & 2 deletions sources/models/README.md
Expand Up @@ -104,14 +104,19 @@ The `#[model]` attribute on Settings and its sub-structs reduces duplication and

### metal-k8s-1.21: Metal Kubernetes 1.21

* [Model](src/metal-k8s-1.22/mod.rs)
* [Model](src/metal-k8s-1.23/mod.rs)
* [Default settings](src/metal-k8s-1.22/defaults.d/)

### metal-k8s-1.22: Metal Kubernetes 1.22

* [Model](src/metal-k8s-1.22/mod.rs)
* [Model](src/metal-k8s-1.23/mod.rs)
* [Default settings](src/metal-k8s-1.22/defaults.d/)

### metal-k8s-1.23: Metal Kubernetes 1.23

* [Model](src/metal-k8s-1.23/mod.rs)
* [Default settings](src/metal-k8s-1.23/defaults.d/)

## This directory

We use `build.rs` to symlink the proper API model source code for Cargo to build.
Expand Down
9 changes: 7 additions & 2 deletions sources/models/src/lib.rs
Expand Up @@ -101,14 +101,19 @@ The `#[model]` attribute on Settings and its sub-structs reduces duplication and
## metal-k8s-1.21: Metal Kubernetes 1.21
* [Model](src/metal-k8s-1.22/mod.rs)
* [Model](src/metal-k8s-1.23/mod.rs)
* [Default settings](src/metal-k8s-1.22/defaults.d/)
## metal-k8s-1.22: Metal Kubernetes 1.22
* [Model](src/metal-k8s-1.22/mod.rs)
* [Model](src/metal-k8s-1.23/mod.rs)
* [Default settings](src/metal-k8s-1.22/defaults.d/)
## metal-k8s-1.23: Metal Kubernetes 1.23
* [Model](src/metal-k8s-1.23/mod.rs)
* [Default settings](src/metal-k8s-1.23/defaults.d/)
# This directory
We use `build.rs` to symlink the proper API model source code for Cargo to build.
Expand Down
1 change: 1 addition & 0 deletions sources/models/src/metal-k8s-1.23/defaults.d/90-boot.toml
29 changes: 29 additions & 0 deletions sources/models/src/metal-k8s-1.23/mod.rs
@@ -0,0 +1,29 @@
use model_derive::model;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

use crate::modeled_types::Identifier;
use crate::{
BootSettings, BootstrapContainer, HostContainer, KernelSettings, KubernetesSettings,
MetricsSettings, NetworkSettings, NtpSettings, OciHooks, PemCertificate, RegistrySettings,
UpdatesSettings,
};

// Note: we have to use 'rename' here because the top-level Settings structure is the only one
// that uses its name in serialization; internal structures use the field name that points to it
#[model(rename = "settings", impl_default = true)]
struct Settings {
motd: String,
kubernetes: KubernetesSettings,
updates: UpdatesSettings,
host_containers: HashMap<Identifier, HostContainer>,
bootstrap_containers: HashMap<Identifier, BootstrapContainer>,
ntp: NtpSettings,
network: NetworkSettings,
kernel: KernelSettings,
boot: BootSettings,
metrics: MetricsSettings,
pki: HashMap<Identifier, PemCertificate>,
container_registry: RegistrySettings,
oci_hooks: OciHooks,
}
11 changes: 11 additions & 0 deletions variants/Cargo.lock

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

1 change: 1 addition & 0 deletions variants/Cargo.toml
Expand Up @@ -14,6 +14,7 @@ members = [
"metal-dev",
"metal-k8s-1.21",
"metal-k8s-1.22",
"metal-k8s-1.23",
"vmware-dev",
"vmware-k8s-1.20",
"vmware-k8s-1.21",
Expand Down
7 changes: 7 additions & 0 deletions variants/README.md
Expand Up @@ -158,6 +158,13 @@ It supports self-hosted clusters.

This variant is compatible with Kubernetes 1.22, 1.23, and 1.24 clusters.

### metal-k8s-1.23: Metal Kubernetes 1.23 node

The [metal-k8s-1.23](metal-k8s-1.23/Cargo.toml) variant includes the packages needed to run a Kubernetes node on bare metal.
It supports self-hosted clusters.

This variant is compatible with Kubernetes 1.23, 1.24, and 1.25 clusters.

### Deprecated variants

#### aws-k8s-1.15: Kubernetes 1.15 node
Expand Down
41 changes: 41 additions & 0 deletions variants/metal-k8s-1.23/Cargo.toml
@@ -0,0 +1,41 @@
[package]
# This is the metal-k8s-1.23 variant. "." is not allowed in crate names, but
# we don't use this crate name anywhere.
name = "metal-k8s-1_23"
version = "0.1.0"
edition = "2018"
publish = false
build = "build.rs"
# Don't rebuild crate just because of changes to README.
exclude = ["README.md"]

[package.metadata.build-variant.image-layout]
os-image-size-gib = 4
partition-plan = "unified"

[package.metadata.build-variant]
image-format = "raw"
kernel-parameters = [
# Only reserve if there are at least 2GB
"crashkernel=2G-:256M"
]
included-packages = [
"cni",
"cni-plugins",
"kernel-5.10",
"kubelet-1.23",
"release",
]
grub-features = [
"set-private-var"
]

[lib]
path = "lib.rs"

[build-dependencies]
cni = { path = "../../packages/cni" }
cni-plugins = { path = "../../packages/cni-plugins" }
kernel-5_10 = { path = "../../packages/kernel-5.10" }
kubernetes-1_23 = { path = "../../packages/kubernetes-1.23" }
release = { path = "../../packages/release" }
9 changes: 9 additions & 0 deletions variants/metal-k8s-1.23/build.rs
@@ -0,0 +1,9 @@
use std::process::{exit, Command};

fn main() -> Result<(), std::io::Error> {
let ret = Command::new("buildsys").arg("build-variant").status()?;
if !ret.success() {
exit(1);
}
Ok(())
}
1 change: 1 addition & 0 deletions variants/metal-k8s-1.23/lib.rs
@@ -0,0 +1 @@
// not used

0 comments on commit 37f53e1

Please sign in to comment.