Skip to content

Commit e58ab4b

Browse files
committed
wip
1 parent 447a823 commit e58ab4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1319
-8
lines changed

kernel/kernel-yocto.config

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,8 @@ CONFIG_DL2K=m
19201920
# CONFIG_NET_VENDOR_ENGLEDER is not set
19211921
# CONFIG_NET_VENDOR_EZCHIP is not set
19221922
# CONFIG_NET_VENDOR_FUNGIBLE is not set
1923-
# CONFIG_NET_VENDOR_GOOGLE is not set
1923+
CONFIG_NET_VENDOR_GOOGLE=y
1924+
CONFIG_GVE=y
19241925
# CONFIG_NET_VENDOR_HUAWEI is not set
19251926
# CONFIG_NET_VENDOR_I825XX is not set
19261927
CONFIG_NET_VENDOR_INTEL=y
@@ -3895,7 +3896,7 @@ CONFIG_JBD2=y
38953896
CONFIG_FS_MBCACHE=y
38963897
# CONFIG_REISERFS_FS is not set
38973898
# CONFIG_JFS_FS is not set
3898-
# CONFIG_XFS_FS is not set
3899+
CONFIG_XFS_FS=y
38993900
# CONFIG_GFS2_FS is not set
39003901
# CONFIG_BTRFS_FS is not set
39013902
# CONFIG_NILFS2_FS is not set

l2-builder.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Include]
2+
Include=base/base.conf
3+
Include=l2-builder/l2-builder.conf
4+
5+
[Config]
6+
Profiles=gcp

l2-builder/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mkosi.extra/usr/bin/*
2+
!mkosi.extra/usr/bin/.gitkeep

l2-builder/kernel.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_NET_VENDOR_GOOGLE=y
2+
CONFIG_GVE=y

l2-builder/l2-builder.conf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[Build]
2+
Environment=KERNEL_CONFIG_SNIPPETS=kernel/snippets/ubuntu.config,l2-builder/kernel.config
3+
WithNetwork=true
4+
5+
[Content]
6+
BuildScripts=l2-builder/mkosi.build
7+
ExtraTrees=l2-builder/mkosi.extra
8+
PostInstallationScripts=l2-builder/mkosi.postinst
9+
10+
Packages=ethtool
11+
libtss2-dev
12+
prometheus-node-exporter
13+
prometheus-process-exporter
14+
sudo
15+
usrmerge
16+
xfsprogs
17+
xxd
18+
zip
19+
20+
BuildPackages=golang
21+
libssl-dev
22+
rustup
23+
unzip
24+
yq

l2-builder/mkosi.build

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/bin/bash
2+
3+
set -euxo pipefail
4+
5+
ENV_YAML="$SRCDIR/l2-builder/mkosi.extra/usr/flashbots/env.yaml"
6+
BPROXY_VERSION=$(mkosi-chroot yq -r .bproxy.version < "$ENV_YAML")
7+
BPROXY_CHECKSUM=$(mkosi-chroot yq -r .bproxy.checksum < "$ENV_YAML")
8+
NODE_HEALTHCHECKER_VERSION=$(mkosi-chroot yq -r .node_healthchecker.version < "$ENV_YAML")
9+
NODE_HEALTHCHECKER_CHECKSUM=$(mkosi-chroot yq -r .node_healthchecker.checksum < "$ENV_YAML")
10+
VAULT_VERSION=$(mkosi-chroot yq -r .vault.version < "$ENV_YAML")
11+
GOMPLATE_VERSION=$(mkosi-chroot yq -r .deps.gomplate_version < "$ENV_YAML")
12+
RUST_VERSION=$(mkosi-chroot yq -r .deps.rust_version < "$ENV_YAML")
13+
OPS_AGENT_VERSION=$(mkosi-chroot yq -r .deps.ops_agent_version < "$ENV_YAML")
14+
15+
export RUSTUP_HOME="/rustup"
16+
export CARGO_HOME="/cargo"
17+
mkosi-chroot rustup toolchain install $RUST_VERSION
18+
mkosi-chroot rustup default $RUST_VERSION
19+
export PATH="$CARGO_HOME/bin:$PATH"
20+
21+
source scripts/make_git_package.sh
22+
source scripts/build_rust_package.sh
23+
24+
# build/re-use op-rbuilder
25+
if [ -f "l2-builder/mkosi.extra/usr/bin/op-rbuilder" ]; then
26+
echo "Using pre-built op-rbuilder binary"
27+
else
28+
build_rust_package \
29+
"op-rbuilder" \
30+
"main" \
31+
"https://github.com/flashbots/op-rbuilder.git" \
32+
"" "" "-g"
33+
fi
34+
35+
# build/re-use tdx-quote-provider
36+
if [ -f "l2-builder/mkosi.extra/usr/bin/tdx-quote-provider" ]; then
37+
echo "Using pre-built tdx-quote-provider binary"
38+
else
39+
build_rust_package \
40+
"tdx-quote-provider" \
41+
"main" \
42+
"https://github.com/flashbots/op-rbuilder.git" \
43+
"" "" "-g"
44+
fi
45+
46+
# build gomplate
47+
make_git_package \
48+
"gomplate" \
49+
"v${GOMPLATE_VERSION}" \
50+
"https://github.com/hairyhenderson/gomplate" \
51+
'go build -trimpath -ldflags "-s -w -buildid=" -o ./build/gomplate ./cmd/gomplate' \
52+
"build/gomplate:/usr/bin/gomplate"
53+
chmod +x $DESTDIR/usr/bin/gomplate
54+
55+
# build vault
56+
make_git_package \
57+
"vault" \
58+
"v${VAULT_VERSION}" \
59+
"https://github.com/hashicorp/vault.git" \
60+
'go build -trimpath -ldflags "-s -w -buildid=" -o ./bin/vault .' \
61+
"bin/vault:/usr/bin/vault"
62+
chmod +x $DESTDIR/usr/bin/vault
63+
64+
cd "$BUILDROOT"
65+
66+
if [ -f "l2-builder/mkosi.extra/usr/bin/bproxy" ]; then
67+
echo "Using pre-built bproxy binary"
68+
else
69+
curl -L -o bproxy.zip "https://github.com/flashbots/bproxy/releases/download/v${BPROXY_VERSION}/bproxy_linux_amd64.zip"
70+
echo "${BPROXY_CHECKSUM} bproxy.zip" | sha256sum -c
71+
unzip bproxy.zip
72+
install -m 755 bproxy "$DESTDIR/usr/bin/bproxy"
73+
rm -f bproxy bproxy.zip
74+
fi
75+
76+
if [ -f "l2-builder/mkosi.extra/usr/bin/node-healthchecker" ]; then
77+
echo "Using pre-built node-healthchecker binary"
78+
else
79+
# Download and install node-healthchecker
80+
curl -L -o node-healthchecker.zip "https://github.com/flashbots/node-healthchecker/releases/download/v${NODE_HEALTHCHECKER_VERSION}/node-healthchecker_linux_amd64.zip"
81+
echo "${NODE_HEALTHCHECKER_CHECKSUM} node-healthchecker.zip" | sha256sum -c
82+
unzip node-healthchecker.zip
83+
install -m 755 node-healthchecker "$DESTDIR/usr/bin/node-healthchecker"
84+
rm -f node-healthchecker node-healthchecker.zip
85+
fi
86+
87+
# Build Google Cloud Ops Agent
88+
IMPORT_PATH="github.com/GoogleCloudPlatform/ops-agent"
89+
BUILD_CMD="
90+
# Fluentbit
91+
export SOURCE_DATE_EPOCH=0 PATH=/usr/local/go/bin:\$PATH
92+
export CFLAGS='-fno-ident -Wno-date-time' CXXFLAGS='-fno-ident -Wno-date-time'
93+
git submodule update --init --depth 1 submodules/fluent-bit
94+
./builds/fluent_bit.sh \$(pwd)/out
95+
96+
# Main gcs agent binaries
97+
mkdir -p out/libexec
98+
LDFLAGS='-s -w -buildid='
99+
go build -buildvcs=false -trimpath -ldflags \"\$LDFLAGS \\
100+
-X $IMPORT_PATH/internal/version.BuildDistro=debian13 \\
101+
-X $IMPORT_PATH/internal/version.Version=$OPS_AGENT_VERSION\" \\
102+
-o out/libexec/google_cloud_ops_agent_engine \\
103+
$IMPORT_PATH/cmd/google_cloud_ops_agent_engine
104+
105+
go build -buildvcs=false -trimpath -ldflags \"\$LDFLAGS\" \\
106+
-o out/libexec/google_cloud_ops_agent_wrapper \\
107+
$IMPORT_PATH/cmd/agent_wrapper
108+
"
109+
110+
make_git_package \
111+
"google-cloud-ops-agent" \
112+
"$OPS_AGENT_VERSION" \
113+
"https://github.com/GoogleCloudPlatform/ops-agent" \
114+
"$BUILD_CMD" \
115+
"out/libexec:/opt/google-cloud-ops-agent/libexec" \
116+
"out/opt/google-cloud-ops-agent/subagents/fluent-bit:/opt/google-cloud-ops-agent/subagents/fluent-bit" \
117+
"systemd/google-cloud-ops-agent-fluent-bit.service:/usr/lib/systemd/system/google-cloud-ops-agent-fluent-bit.service" \
118+
"systemd/google-cloud-ops-agent.service:/usr/lib/systemd/system/google-cloud-ops-agent.service"
119+
120+
sed -i 's|@PREFIX@|/opt/google-cloud-ops-agent|g; s|@SYSCONFDIR@|/etc|g' "$DESTDIR/usr/lib/systemd/system/google-cloud-ops-agent"*.service
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Set the command-line arguments to pass to the server.
2+
ARGS="\
3+
--collector.systemd \
4+
--collector.systemd.unit-include=\".*(bproxy|node-healthchecker|op-rbuilder|prometheus-node-exporter|prometheus-process-exporter|rproxy|vault-agent).*\" \
5+
--log.format=json \
6+
--web.listen-address=0.0.0.0:9100 \
7+
"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Set the command-line arguments to pass to the server.
2+
ARGS="\
3+
-config.path=/etc/prometheus-process-exporter/config.yaml \
4+
-threads=false \
5+
-web.listen-address=0.0.0.0:9256 \
6+
"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
logging:
2+
receivers:
3+
syslog:
4+
type: files
5+
include_paths:
6+
- /var/log/messages
7+
- /var/log/syslog
8+
processors:
9+
parse_json:
10+
type: parse_json
11+
field: message
12+
time_key: "@timestamp"
13+
time_format: "%Y-%m-%dT%H:%M:%S.%L%z"
14+
service:
15+
pipelines:
16+
default_pipeline:
17+
receivers: [syslog]
18+
processors: [parse_json]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
process_names:
2+
- name: bproxy
3+
cmdline:
4+
- '^\/([-.0-9a-zA-Z]+\/)*bproxy[-.0-9a-zA-Z]* '
5+
- name: node-healthchecker
6+
cmdline:
7+
- '^\/([-.0-9a-zA-Z]+\/)*node-healthchecker[-.0-9a-zA-Z]* '
8+
- name: op-rbuilder
9+
cmdline:
10+
- '^\/([-.0-9a-zA-Z]+\/)*op-rbuilder[-.0-9a-zA-Z]* '
11+
- name: rproxy
12+
cmdline:
13+
- '^\/([-.0-9a-zA-Z]+\/)*rproxy[-.0-9a-zA-Z]* '
14+
- name: vault-agent
15+
cmdline:
16+
- '^\/([-.0-9a-zA-Z]+\/)*vault[-.0-9a-zA-Z]* '

0 commit comments

Comments
 (0)