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

Add /etc/pki directory to appnet agent's bind mounts #4437

Merged
merged 1 commit into from
Dec 4, 2024
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
7 changes: 7 additions & 0 deletions agent/engine/serviceconnect/manager_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ const (

ecsAgentLogFileENV = "ECS_LOGFILE"
defaultECSAgentLogPathContainer = "/log"

// This is the path to the host's PKI directory. The appnet agent container needs
// this directory mounted so that it can access the host's PKI directory for the
// purpose of utilizing any special CA certs that the underlying EC2 instance has
// configured.
hostPKIDirPath = "/etc/pki"
)

type manager struct {
Expand Down Expand Up @@ -207,6 +213,7 @@ func (m *manager) initAgentDirectoryMounts(taskId string, container *apicontaine

hostConfig.Binds = append(hostConfig.Binds, getBindMountMapping(statusPathHost, m.statusPathContainer))
hostConfig.Binds = append(hostConfig.Binds, getBindMountMapping(m.relayPathHost, m.relayPathContainer))
hostConfig.Binds = append(hostConfig.Binds, getBindMountMapping(hostPKIDirPath, hostPKIDirPath))

// create logging directory and bind mount, if customer has not configured a logging driver
if container.GetLogDriver() == "" {
Expand Down
3 changes: 2 additions & 1 deletion agent/engine/serviceconnect/manager_linux_test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ func testAgentContainerModificationsForServiceConnect(t *testing.T, privilegedMo
fmt.Sprintf("%s/status/%s:%s", tempDir, scTask.GetID(), "/some/other/run"),
fmt.Sprintf("%s/relay:%s", tempDir, "/not/var/run"),
fmt.Sprintf("%s/log/%s:%s", tempDir, scTask.GetID(), "/some/other/log"),
"/etc/pki:/etc/pki",
}
expectedENVs := map[string]string{
"ReLaYgOeShErE": "unix:///not/var/run/relay_file_of_holiness",
Expand Down Expand Up @@ -190,7 +191,7 @@ func testAgentContainerModificationsForServiceConnect(t *testing.T, privilegedMo
if err != nil {
t.Fatal(err)
}
assert.Equal(t, tc.expectedBinds, hostConfig.Binds)
assert.ElementsMatch(t, tc.expectedBinds, hostConfig.Binds)
assert.Equal(t, tc.expectedENV, tc.container.Environment)
if privilegedMode {
for _, bind := range hostConfig.Binds {
Expand Down
Loading