Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packages/by-name: add peerpod node installer #1008

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ jobs:
- name: Create coordinator resource definitions
run: |
mkdir -p workspace
for platform in aks-clh-snp k3s-qemu-tdx k3s-qemu-snp rke2-qemu-tdx; do
for platform in aks-clh-snp k3s-qemu-tdx k3s-qemu-snp rke2-qemu-tdx aks-peer-snp; do
nix run .#scripts.write-coordinator-yaml -- "${coordinatorImgTagged}" "${platform}" > workspace/coordinator-$platform.yml
echo -n "${platform} " >> workspace/coordinator-policy.hash
yq < workspace/coordinator-$platform.yml \
Expand Down
2 changes: 1 addition & 1 deletion internal/kuberesource/parts.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func NodeInstaller(namespace string, platform platforms.Platform) (*NodeInstalle
containers = []*applycorev1.ContainerApplyConfiguration{nydusSnapshotter}
volumes = nydusSnapshotterVolumes
case platforms.AKSPeerSNP:
nodeInstallerImageURL = "ghcr.io/edgelesssys/contrast/node-installer-kata:latest"
nodeInstallerImageURL = "ghcr.io/edgelesssys/contrast/node-installer-peerpod:latest"
containers = []*applycorev1.ContainerApplyConfiguration{nydusSnapshotter, cloudAPIAdaptor}
volumes = append(nydusSnapshotterVolumes, cloudAPIAdaptorVolumes...)
default:
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ node-installer platform=default_platform:
;;
"AKS-PEER-SNP")
just push "nydus-snapshotter"
just push "node-installer-kata"
just push "node-installer-peerpod"
just push "cloud-api-adaptor"
;;
*)
Expand Down
3 changes: 2 additions & 1 deletion packages/by-name/contrast/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
buildGoTest,
microsoft,
kata,
peerpod,
contrast,
installShellFiles,
}:
Expand Down Expand Up @@ -52,7 +53,7 @@ let
k3s-qemu-tdx-handler = runtimeHandler "k3s-qemu-tdx" kata.contrast-node-installer-image.runtimeHash;
rke2-qemu-tdx-handler = runtimeHandler "rke2-qemu-tdx" kata.contrast-node-installer-image.runtimeHash;
k3s-qemu-snp-handler = runtimeHandler "k3s-qemu-snp" kata.contrast-node-installer-image.runtimeHash;
aks-peer-snp-handler = runtimeHandler "aks-peer-snp" kata.contrast-node-installer-image.runtimeHash;
aks-peer-snp-handler = runtimeHandler "aks-peer-snp" peerpod.contrast-node-installer-image.runtimeHash;

aksRefVals = {
snp = [
Expand Down
141 changes: 141 additions & 0 deletions packages/by-name/peerpod/contrast-node-installer-image/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Copyright 2024 Edgeless Systems GmbH
# SPDX-License-Identifier: AGPL-3.0-only

{
ociLayerTar,
ociImageManifest,
ociImageLayout,
writers,
hashDirs,

contrast,
kata,
nydus-snapshotter,
pkgsStatic,

debugRuntime ? false,
}:

let
node-installer = ociLayerTar {
files = [
{
source = "${contrast.nodeinstaller}/bin/node-installer";
destination = "/bin/node-installer";
}
{
source = "${pkgsStatic.util-linux}/bin/nsenter";
destination = "/bin/nsenter";
}
];
};

installer-config = ociLayerTar {
files = [
{
source = writers.writeJSON "contrast-node-install.json" {
files = [
{
url = "file:///opt/edgeless/share/kata-containers.img";
path = "/opt/edgeless/@@runtimeName@@/share/kata-containers.img";
}
{
url = "file:///opt/edgeless/share/kata-kernel";
path = "/opt/edgeless/@@runtimeName@@/share/kata-kernel";
}
{
url = "file:///opt/edgeless/bin/containerd-shim-contrast-cc-v2";
path = "/opt/edgeless/@@runtimeName@@/bin/containerd-shim-contrast-cc-v2";
executable = true;
}
{
url = "file:///opt/edgeless/bin/kata-runtime";
path = "/opt/edgeless/@@runtimeName@@/bin/kata-runtime";
executable = true;
}
{
url = "file:///bin/nydus-overlayfs";
path = "/opt/edgeless/@@runtimeName@@/bin/nydus-overlayfs";
executable = true;
}
];
inherit debugRuntime;
};
destination = "/config/contrast-node-install.json";
}
];
};

kata-container-img = ociLayerTar {
files = [
{
source = kata.kata-image;
destination = "/opt/edgeless/share/kata-containers.img";
}
{
source = "${kata.kata-kernel-uvm}/bzImage";
destination = "/opt/edgeless/share/kata-kernel";
}
];
};

kata-runtime = ociLayerTar {
files = [
{
source = "${kata.kata-runtime}/bin/kata-runtime";
destination = "/opt/edgeless/bin/kata-runtime";
}
{
source = "${kata.kata-runtime}/bin/containerd-shim-kata-v2";
destination = "/opt/edgeless/bin/containerd-shim-contrast-cc-v2";
}
];
};

nydus = ociLayerTar {
files = [
{
source = "${nydus-snapshotter}/bin/nydus-overlayfs";
destination = "/bin/nydus-overlayfs";
}
];
};

layers = [
installer-config
kata-container-img
kata-runtime
nydus
];

manifest = ociImageManifest {
layers = layers ++ [ node-installer ];
extraConfig = {
"config" = {
"Env" = [
"PATH=/bin:/usr/bin"
"CONFIG_DIR=/config"
"HOST_MOUNT=/host"
];
"Entrypoint" = [ "/bin/node-installer" ];
};
};
extraManifest = {
"annotations" = {
"org.opencontainers.image.title" = "contrast-node-installer-peerpod";
"org.opencontainers.image.description" = "Contrast Node Installer (Peerpod)";
};
};
};
in

ociImageLayout {
manifests = [ manifest ];
passthru = {
inherit debugRuntime;
runtimeHash = hashDirs {
dirs = layers; # Layers without node-installer, or we have a circular dependency!
name = "runtime-hash-peerpod";
};
};
}
3 changes: 3 additions & 0 deletions packages/containers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,8 @@ containers
push-node-installer-kata =
pushOCIDir "push-node-installer-kata" pkgs.kata.contrast-node-installer-image
"v${pkgs.contrast.version}";
push-node-installer-peerpod =
pushOCIDir "push-node-installer-peerpod" pkgs.peerpod.contrast-node-installer-image
"v${pkgs.contrast.version}";
}
// (lib.concatMapAttrs (name: container: { "push-${name}" = pushContainer container; }) containers)