Skip to content

Commit

Permalink
Add a vmware-dev variant
Browse files Browse the repository at this point in the history
This change adds the necessary files for a VMWare development variant.
The files are currently a copy of the aws-dev variant but will diverge
over time.
  • Loading branch information
zmrow committed Feb 12, 2021
1 parent d54880b commit 3df4ee2
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
- variant: aws-dev
arch: x86_64
supported: false
- variant: vmware-dev
arch: x86_64
supported: false
fail-fast: false
steps:
- uses: actions/checkout@v2
Expand Down
14 changes: 14 additions & 0 deletions packages/containerd/containerd-config-toml_vmware-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version = 2
root = "/var/lib/containerd"
state = "/run/containerd"
disabled_plugins = [
"io.containerd.internal.v1.opt",
"io.containerd.snapshotter.v1.aufs",
"io.containerd.snapshotter.v1.devmapper",
"io.containerd.snapshotter.v1.native",
"io.containerd.snapshotter.v1.zfs",
"io.containerd.grpc.v1.cri",
]

[grpc]
address = "/run/containerd/containerd.sock"
3 changes: 2 additions & 1 deletion packages/containerd/containerd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Source2: containerd-config-toml_aws-k8s
Source3: containerd-config-toml_aws-dev
Source4: containerd-config-toml_aws-ecs-1
Source5: containerd-tmpfiles.conf
Source6: containerd-config-toml_vmware-dev
Source1000: clarify.toml

# Upstream patch; can drop when we move to v1.4.0.
Expand Down Expand Up @@ -100,7 +101,7 @@ install -p -m 0644 %{S:1} %{buildroot}%{_cross_unitdir}/containerd.service

install -d %{buildroot}%{_cross_templatedir}
install -d %{buildroot}%{_cross_factorydir}%{_cross_sysconfdir}/containerd
install -p -m 0644 %{S:2} %{S:3} %{S:4} %{buildroot}%{_cross_templatedir}
install -p -m 0644 %{S:2} %{S:3} %{S:4} %{S:6} %{buildroot}%{_cross_templatedir}

install -d %{buildroot}%{_cross_tmpfilesdir}
install -p -m 0644 %{S:5} %{buildroot}%{_cross_tmpfilesdir}/containerd.conf
Expand Down
1 change: 1 addition & 0 deletions sources/logdog/conf/logdog.vmware-dev.conf
7 changes: 6 additions & 1 deletion sources/models/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,16 @@ The `#[model]` attribute on Settings and its sub-structs reduces duplication and
* [Model](src/aws-ecs-1/mod.rs)
* [Default settings](src/aws-ecs-1/defaults.d/)

### aws-dev: Development build
### aws-dev: AWS development build

* [Model](src/aws-dev/mod.rs)
* [Default settings](src/aws-dev/defaults.d/)

### vmware-dev: VMWare development build

* [Model](src/vmware-dev/mod.rs)
* [Default settings](src/vmware-dev/defaults.d/)

## This directory

We use `build.rs` to symlink the proper API model source code for Cargo to build.
Expand Down
7 changes: 6 additions & 1 deletion sources/models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@ The `#[model]` attribute on Settings and its sub-structs reduces duplication and
* [Model](src/aws-ecs-1/mod.rs)
* [Default settings](src/aws-ecs-1/defaults.d/)
## aws-dev: Development build
## aws-dev: AWS development build
* [Model](src/aws-dev/mod.rs)
* [Default settings](src/aws-dev/defaults.d/)
## vmware-dev: VMWare development build
* [Model](src/vmware-dev/mod.rs)
* [Default settings](src/vmware-dev/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/vmware-dev/defaults.d/10-defaults.toml
18 changes: 18 additions & 0 deletions sources/models/src/vmware-dev/defaults.d/50-vmware-dev.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[configuration-files.containerd-config-toml]
# No override to path
template-path = "/usr/share/templates/containerd-config-toml_vmware-dev"

# Docker
[services.docker]
restart-commands = ["/bin/systemctl try-restart docker.service"]
configuration-files = ["proxy-env"]

# Network
[metadata.settings.network]
affected-services = ["containerd", "docker", "host-containerd"]

# NTP
# Use a public endpoint, don't assume any local ones.
[settings.ntp]
time-servers = ["2.amazon.pool.ntp.org"]

18 changes: 18 additions & 0 deletions sources/models/src/vmware-dev/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use model_derive::model;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

use crate::modeled_types::Identifier;
use crate::{ContainerImage, KernelSettings, NetworkSettings, NtpSettings, 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,
updates: UpdatesSettings,
host_containers: HashMap<Identifier, ContainerImage>,
ntp: NtpSettings,
network: NetworkSettings,
kernel: KernelSettings,
}
9 changes: 8 additions & 1 deletion variants/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,17 @@ This variant is compatible with Kubernetes 1.19, 1.20, and 1.21 clusters.
The [aws-ecs-1](aws-ecs-1/Cargo.toml) variant includes the packages needed to run an [Amazon ECS](https://ecs.aws)
container instance in AWS.

### aws-dev: Development build
### aws-dev: AWS development build

The [aws-dev](aws-dev/Cargo.toml) variant has useful packages for local development of the OS.
It includes tools for troubleshooting as well as Docker for running containers.
User data will be read from IMDS.

### vmware-dev: VMWare development build

The [vmware-dev](vmware-dev/Cargo.toml) variant has useful packages for local development of the OS, and is intended to run as a VMWare guest.
It includes tools for troubleshooting as well as Docker for running containers.
User data will be read from a mounted CD-ROM, either from a file named "user-data" or from an OVF file.

## Development

Expand Down
5 changes: 5 additions & 0 deletions variants/vmware-dev/Cargo.lock

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

30 changes: 30 additions & 0 deletions variants/vmware-dev/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "vmware-dev"
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]
included-packages = [
# core
"release",
# docker
"docker-cli",
"docker-engine",
"docker-init",
"docker-proxy",
# tools
"findutils",
"login",
"iputils",
"procps",
"strace",
"tcpdump",
"chrony-tools",
]

[lib]
path = "lib.rs"
9 changes: 9 additions & 0 deletions variants/vmware-dev/build.rs
Original file line number Diff line number Diff line change
@@ -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/vmware-dev/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// not used

0 comments on commit 3df4ee2

Please sign in to comment.