-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vpn: ship our own container image (#2909)
* vpn: ship our own container image The container image used in the VPN chart should be reproducible and stable. We're sticking close to the original nixery.dev version by building the image with nix ourselves, and then publishing the single layer from the result with Bazel OCI rules. The resulting image should be handled similar to s3proxy: it's built as a part of the Constellation release process and then consumed from a Helm chart in our registry. Co-authored-by: Malte Poll <[email protected]>
- Loading branch information
Showing
12 changed files
with
123 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
dev-docs/howto/vpn/helm/files/strongswan/charon-logging.conf
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
load("@rules_oci//oci:defs.bzl", "oci_image") | ||
|
||
oci_image( | ||
name = "vpn", | ||
base = "@distroless_static_linux_amd64", | ||
entrypoint = ["/bin/sh"], | ||
tars = [ | ||
"@vpn_oci_image//:layer.tar", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
2 changes: 2 additions & 0 deletions
2
...wto/vpn/helm/files/operator/entrypoint.sh → nix/container/vpn/operator.sh
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#!/bin/sh | ||
|
||
set -u | ||
|
||
signaled() { | ||
exit 143 | ||
} | ||
|
File renamed without changes.
7 changes: 6 additions & 1 deletion
7
...o/vpn/helm/files/strongswan/entrypoint.sh → nix/container/vpn/strongswan.sh
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ pkgs | ||
, pkgsLinux | ||
, stdenv | ||
}: | ||
let | ||
passwd = pkgs.writeTextDir "etc/passwd" '' | ||
root:x:0:0:root:/root:/bin/sh | ||
nobody:x:65534:65534:Kernel Overflow User:/:/sbin/nologin | ||
''; | ||
group = pkgs.writeTextDir "etc/group" '' | ||
root:x:0: | ||
nobody:x:65534: | ||
''; | ||
|
||
strongswanScript = pkgsLinux.writeShellApplication { | ||
name = "strongswan.sh"; | ||
runtimeInputs = with pkgsLinux; [ | ||
coreutils | ||
strongswan | ||
]; | ||
text = ./strongswan.sh; | ||
}; | ||
|
||
sidecarScript = pkgsLinux.writeShellApplication { | ||
name = "sidecar.sh"; | ||
runtimeInputs = with pkgsLinux; [ | ||
coreutils | ||
iproute2 | ||
jq | ||
util-linux | ||
procps | ||
]; | ||
text = ./sidecar.sh; | ||
}; | ||
|
||
operatorScript = pkgsLinux.writeShellApplication { | ||
name = "operator.sh"; | ||
runtimeInputs = with pkgsLinux; [ | ||
coreutils | ||
kubernetes | ||
jq | ||
]; | ||
text = ./operator.sh; | ||
}; | ||
|
||
image = pkgs.dockerTools.buildImage { | ||
name = "ghcr.io/edgelesssys/constellation/vpn"; | ||
copyToRoot = with pkgsLinux.dockerTools; [ | ||
passwd | ||
group | ||
strongswanScript | ||
sidecarScript | ||
operatorScript | ||
binSh | ||
]; | ||
config = { | ||
Cmd = [ "/bin/entrypoint.sh" ]; | ||
}; | ||
}; | ||
|
||
in | ||
|
||
stdenv.mkDerivation { | ||
name = "image"; | ||
|
||
src = image; | ||
|
||
buildInputs = with pkgs; [ gnutar jq ]; | ||
|
||
|
||
installPhase = '' | ||
mkdir -p "$out/tmp" | ||
pushd "$out/tmp" | ||
tar -xf ${image} | ||
layer="$(jq -r '.[0].Layers[0]' <manifest.json)" | ||
chmod -R u+w "." | ||
mv "$layer" "$out/layer.tar" | ||
popd | ||
rm -rf -- "$out/tmp" | ||
''; | ||
|
||
} |