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 agent-inject-containers annotation #163

Conversation

luke-dd
Copy link

@luke-dd luke-dd commented Aug 3, 2020

Adds the following annotation which allows you to specify which containers will have the secrets volume mounted.

vault.hashicorp.com/agent-inject-containers

The reasoning behind this annotation is to allow for the limiting of the presence of plaintext secrets to only containers that absolutely need them.

@hashicorp-cla
Copy link

hashicorp-cla commented Aug 3, 2020

CLA assistant check
All committers have signed the CLA.

Comment on lines +802 to +805
name string
annotations map[string]string
expected string
hasPatch bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: gofmt needs to be run on this file.

Comment on lines +813 to +818
{
name: "InjectContainers annotation with container name",
annotations: map[string]string{AnnotationAgentInjectContainers: "baz"},
expected: "baz",
hasPatch: false,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need another test here for multiple containers being selected via this annotation.

Comment on lines +387 to +395
raw, ok := a.Pod.Annotations[AnnotationAgentInjectContainers];
if !ok {
return patches, fmt.Errorf("vault.hashicorp.com/agent-inject-containers annotation not found")
}

names := make(map[string]struct{})
for _, name := range strings.Split(raw, ",") {
names[name] = struct{}{}
}
Copy link
Contributor

@jasonodonnell jasonodonnell Aug 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking this code isn't necessary because we could extend the Agent struct to have a Containers []string type, then populate that using the Init function. If the slice is empty, apply to all containers, if it's not, only mount to containers that match.

@Chili-Man
Copy link

hey @luke-dd , I'm interested in this functionality; do you need help with this or do you mind if I take this forward?

@jasonodonnell
Copy link
Contributor

Bumping this 😄

@luke-dd
Copy link
Author

luke-dd commented Apr 1, 2021

Sorry for not closing the loop on this! Feel free to take it over @Chili-Man

@HamzaZo
Copy link
Contributor

HamzaZo commented Apr 11, 2021

Hello @jasonodonnell I created a PR to continue the work of @luke-dd

@tvoran
Copy link
Member

tvoran commented Oct 12, 2021

Continued in #245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants