-
Notifications
You must be signed in to change notification settings - Fork 497
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
Shutdown agent when it is banned #3308
Conversation
Signed-off-by: Marcos Yacob <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank @MarcosDY, looks great!
pkg/common/nodeutil/node.go
Outdated
return isExpectedPermissionDenied(err, shouldReattest) | ||
} | ||
|
||
// ShouldAgentShutdown returns true if the Server returned an error worth shutdowning the Agent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ShouldAgentShutdown returns true if the Server returned an error worth shutdowning the Agent | |
// ShouldAgentShutdown returns true if the Server returned an error worth shutting down the Agent |
pkg/agent/svid/rotator_test.go
Outdated
func TestRotationFails(t *testing.T) { | ||
caCert, caKey := testca.CreateCACertificate(t, nil, nil) | ||
|
||
expiredStatus := status.New(codes.PermissionDenied, "agent is expired") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
Even if it's a test, it may be confusing
expiredStatus := status.New(codes.PermissionDenied, "agent is expired") | |
expiredStatus := status.New(codes.PermissionDenied, "agent is not active") |
/opt/spire/bin/spire-server agent evict \ | ||
-spiffeID "spiffe://domain.test/spire/agent/x509pop/$(fingerprint conf/agent/agent.crt.pem)" | ||
|
||
# Check at most 30 times (with one second in between) than agent is going shutdown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Check at most 30 times (with one second in between) than agent is going shutdown | |
# Check at most 30 times (with one second in between) that the agent is going to shut down |
sleep "${CHECKINTERVAL}" | ||
done | ||
|
||
fail-now "timed out waiting for agent to sync down entry" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fail-now "timed out waiting for agent to sync down entry" | |
fail-now "timed out waiting for agent to shut down" |
MAXCHECKS=30 | ||
CHECKINTERVAL=1 | ||
for ((i=1;i<=MAXCHECKS;i++)); do | ||
log-info "checking agent is not able to start ($i of $MAXCHECKS max)..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log-info "checking agent is not able to start ($i of $MAXCHECKS max)..." | |
log-info "checking that the agent is not able to start ($i of $MAXCHECKS max)..." |
Signed-off-by: Marcos Yacob <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Shut down agent when it is banned Signed-off-by: Marcos Yacob <[email protected]>
Make Agent shutdown when it is banned
Which issue this PR fixes
fixes #3278