Skip to content

Conversation

azdagron
Copy link
Member

This change introduces a new configurable, disable_container_selectors which configures the K8s Workload Attestor to only produce pod-related selectors. This allows for workload attesation to succeed when the attestor can positively locate the workload pod but cannot yet locate the workload container at the time of attestation (e.g. postStart hook is still executing).

See issue #3092 for more details.

Fixes: #3092

This change introduces a new configurable, `disable_container_selectors`
which configures the K8s Workload Attestor to only produce pod-related
selectors. This allows for workload attesation to succeed when the
attestor can positively locate the workload pod but cannot yet locate
the workload container at the time of attestation (e.g. postStart hook
is still executing).

See issue spiffe#3092 for more details.

Fixes: spiffe#3092

Signed-off-by: Andrew Harding <[email protected]>
@azdagron azdagron added this to the 1.4.3 milestone Sep 23, 2022
Copy link
Collaborator

@MarcosDY MarcosDY left a comment

Choose a reason for hiding this comment

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

Looks great!! Just some minor comments about windows implementation

// succeed with just pod related selectors when the workload pod is known
// but the container may not be in a ready state at the time of attestation
// (e.g. when a postStart hook has yet to complete).
DisableContainerSelectors bool `hcl:"disable_container_selectors"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

This config will work on windows to get only pod information, but we requires to have containerID in order to get the pod metadata. I'm not sure if we can just allow this in case someone is not interested to have container metadata?

s.requireAttestSuccess(p, testPodSelectors)
}

func (s *Suite) TestAttestWhenContainerNotReadyButContainerSelectorsDisabled() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this test will not work on windows since we require ContainerID in order to get pod

Signed-off-by: Andrew Harding <[email protected]>
Signed-off-by: Andrew Harding <[email protected]>
Copy link
Collaborator

@MarcosDY MarcosDY left a comment

Choose a reason for hiding this comment

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

LGTM!!!

@azdagron azdagron merged commit 598e28e into spiffe:main Sep 28, 2022
@azdagron azdagron deleted the disable-container-selectors branch September 28, 2022 21:28
stevend-uber pushed a commit to stevend-uber/spire that referenced this pull request Oct 16, 2023
This change introduces a new configurable, `disable_container_selectors`
which configures the K8s Workload Attestor to only produce pod-related
selectors. This allows for workload attesation to succeed when the
attestor can positively locate the workload pod but cannot yet locate
the workload container at the time of attestation (e.g. postStart hook
is still executing).

See issue spiffe#3092 for more details.

Fixes: spiffe#3092

Signed-off-by: Andrew Harding <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants