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

podvm: launch guest-components as systemd units #1858

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ aa_kbc_params = ""
# This field sets up the container registry auth
image_registry_auth_file="file:///etc/attestation-agent/auth.json"

# Do not spawn guest components in kata agent
guest_components_procs = "none"

# temp workaround for kata-containers/kata-containers#5590
[endpoints]
allowed = [
Expand Down
1 change: 1 addition & 0 deletions src/cloud-api-adaptor/pkg/agent/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type AgentConfig struct {
AaKbcParams string `toml:"aa_kbc_params"`
ImageRegistryAuthFile string `toml:"image_registry_auth_file"`
Endpoints Endpoints `toml:"endpoints"`
GuestComponentsProcs string `toml:"guest_components_procs"`
}

// Get daemon.Config from local file
Expand Down
8 changes: 7 additions & 1 deletion src/cloud-api-adaptor/pkg/agent/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ func TestUpdateAAKBCParams(t *testing.T) {
[endpoints]
allowed = [
"AddARPNeighborsRequest",
]`
]
guest_components_procs = "none"
`
if _, err := tmpFile.WriteString(testAgentConfigData); err != nil {
t.Fatalf("failed to write test data to file: %v", err)
}
Expand Down Expand Up @@ -139,6 +141,7 @@ func TestWriteAgentConfig(t *testing.T) {
AaKbcParams: "cc_kbc::http://192.168.1.2:8080",
ImageRegistryAuthFile: "/etc/attestation-agent/auth.json",
Endpoints: Endpoints{Allowed: []string{"AddARPNeighborsRequest", "AddSwapRequest"}},
GuestComponentsProcs: "none",
}

// Call the writeAgentConfig function
Expand Down Expand Up @@ -190,6 +193,9 @@ func TestParseAgentConfig(t *testing.T) {
t.Fatalf("agentConfig.Endpoints does not match test data: expected %v, got %v", "AddSwapRequest", agentConfig.Endpoints.Allowed[1])
}

if agentConfig.GuestComponentsProcs != "none" {
t.Fatalf("agentConfig.GuestComponentsProcs does not match test data: expected %v, got %v", "none", agentConfig.GuestComponentsProcs)
}
}

// Test the writeAgentConfig function with non existent toml entry in agent config file
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Service]
Environment=RUST_LOG=debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Service]
Environment=RUST_LOG=debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Service]
Environment=RUST_LOG=debug
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
enable attestation-protocol-forwarder.service
enable attestation-agent.service
enable api-server-rest.path
enable confidential-data-hub.path
enable kata-agent.service
enable netns@.service
enable process-user-data.service
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# On a read-only fs the kata-agent config is created in /run/peerpod, since it contains
# a parameter that can be set at pod creation time.
[Service]
Environment=KATA_AGENT_CONFIG_PATH=/run/peerpod/agent-config.toml
3 changes: 3 additions & 0 deletions src/cloud-api-adaptor/podvm/files/etc/agent-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ server_addr="unix:///run/kata-containers/agent.sock"
# This is replaced in the makefile steps so do not set it manually
aa_kbc_params = ""

# prevent the agent from launching coco guest-components
guest_components_procs = "none"

# temp workaround for kata-containers/kata-containers#5590
[endpoints]
allowed = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Attestation Agent TTRPC API Server
After=network.target process-user-data.service

[Service]
Type=simple
ExecStartPre=mkdir -p /run/confidential-containers/attestation-agent
ExecStart=/usr/local/bin/attestation-agent
RestartSec=1
Restart=always

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Monitor for the Attestation Agent socket

[Path]
PathExists=/run/confidential-containers/attestation-agent/attestation-agent.sock
Unit=confidential-data-hub.service

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Confidential Data Hub TTRPC API Server
After=network.target process-user-data.service

[Service]
Type=simple
ExecStart=/usr/local/bin/confidential-data-hub -c /run/confidential-containers/cdh.toml
mkulke marked this conversation as resolved.
Show resolved Hide resolved
mkulke marked this conversation as resolved.
Show resolved Hide resolved
RestartSec=1
Restart=always

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Wants=process-user-data.service
After=netns@podns.service process-user-data.service

[Service]
Environment=CDH_CONFIG_PATH=/run/confidential-containers/cdh.toml
ExecStartPre=mkdir -p /run/kata-containers
ExecStart=/usr/local/bin/kata-agent --config /etc/agent-config.toml
ExecStartPre=-umount /sys/fs/cgroup/misc
Expand Down
2 changes: 1 addition & 1 deletion src/cloud-api-adaptor/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ git:
reference: 277617af60c32661819c1132ffbf3db8dc6e1b9f
kata-containers:
url: https://github.com/kata-containers/kata-containers
reference: 3.5.0
reference: 59ff40f05484da2a462fa44f18fe95e7c8484546
umoci:
url: https://github.com/opencontainers/umoci
reference: v0.4.7
Expand Down
Loading