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

Remove configuration constraint for k8s_psat #5216

Merged
merged 6 commits into from
Jun 14, 2024

Conversation

edwbuck
Copy link
Contributor

@edwbuck edwbuck commented Jun 11, 2024

Closes #5211

We already scan the map of clusters at runtime, sending an error when the cluster is not found in the hclConfig.Clusters map. So, this just removes the need for at least one cluster to be configured.

When zero clusters are configured, all requests will fail.

Closes spiffe#5211

We already scan the map of clusters at runtime, sending an error when
the cluster is not found in the hclConfig.Clusters map.  So, this just
removes the need for at least one cluster to be configured.

When zero clusters are configured, all requests will fail.

Signed-off-by: Edwin Buck <edwbuck@gmail.com>
@@ -225,10 +226,6 @@ func (p *AttestorPlugin) Configure(_ context.Context, req *configv1.ConfigureReq
return nil, status.Error(codes.InvalidArgument, "core configuration missing trust domain")
}

if len(hclConfig.Clusters) == 0 {
Copy link
Member

@azdagron azdagron Jun 13, 2024

Choose a reason for hiding this comment

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

Not having any clusters defined would be a misconfiguration for (most?) users that aren't dynamically adjusting the list. To aid debuggability, can you change this to emit a warning log instead? The warning log should be emitted down below, just before the call to p.setConfig, so that we only emit the warning when the configuration is actually going to change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A WARNING log message is appropriate. Expect an update today.

@@ -20,6 +20,7 @@ The main configuration accepts the following values:
| Configuration | Description | Default |
|---------------|-----------------------------------------------------------------------------------|---------|
| `clusters` | A map of clusters, keyed by an arbitrary ID, that are authorized for attestation. | |
| | May be empty, when no clusters are authorized for attestation. | |
Copy link
Member

Choose a reason for hiding this comment

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

This renders as a separate row in the markdown and looks a little funny. I feel like we should just add this to the end of the sentence in the description above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Altered to be a warning note in the next push.

1. Log a warning when the k8s psat server count is zero.
2. Fix the documentation (markdown) to present better.

Signed-off-by: Edwin Buck <edwbuck@gmail.com>
Signed-off-by: Edwin Buck <edwbuck@gmail.com>
Signed-off-by: Edwin Buck <edwbuck@gmail.com>
@@ -226,6 +226,10 @@ func (p *AttestorPlugin) Configure(_ context.Context, req *configv1.ConfigureReq
return nil, status.Error(codes.InvalidArgument, "core configuration missing trust domain")
}

if len(hclConfig.Clusters) < 1 {
Copy link
Member

Choose a reason for hiding this comment

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

This warning should ideally be moved to down to line 274 just before the call to p.setConfig. The configure call can still fail at this point (i.e., line 240) leaving the configuration unchanged. Issuing the warning before the config is actually changed could be misleading.

By moving the warning to after the errors, the errors will
mask a warning on a config that doesn't get applied.

Signed-off-by: Edwin Buck <edwbuck@gmail.com>
Copy link
Member

@azdagron azdagron left a comment

Choose a reason for hiding this comment

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

Thanks, @edwbuck!

@azdagron azdagron merged commit e2e765c into spiffe:main Jun 14, 2024
33 checks passed
@azdagron azdagron added this to the 1.10.1 milestone Jun 14, 2024
@amartinezfayo amartinezfayo modified the milestones: 1.10.1, 1.10.0 Jun 17, 2024
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.

k8s_psat node attestor: allow empty list of clusters
3 participants