-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Deployment Status Command Does Not Respect -namespace Wildcard #16792
Conversation
44d2894
to
0c9ac1e
Compare
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.
LGTM!
allowableNamespaces, err := allowedNSes(aclObj, store, allow) | ||
if err != nil { | ||
if err == structs.ErrPermissionDenied { | ||
reply.Deployments = make([]*structs.Deployment, 0) | ||
return nil | ||
} | ||
return err | ||
} |
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.
Not blocking but something we might want to get agreement on with the team and then document in our RPC checklist...
There's a small inconsistency here between the behavior of the first permissions check (on line 458) and this permissions check in the blocking query:
- If you have no permission to any namespace when you make the query, you get
ErrPermissionDenied
- If you have permissions and make a blocking query, and while you're waiting on the blocking query the permissions are removed, you get an empty list.
I spot-checked some of the other List
RPCs and it looks like we're inconsistent with this across the code base; some RPCs have both checks (ex. Eval.List
, Job.List
) while others only have the second check (ex. Namespaces.ListNamespace
, Variables.List
).
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.
LGTM, minor inline suggestion which is not blocking. The PR will also need a changelog entry, so everyone can bask in the fix!
Something that isn't needed before merge would be to use must for all the new test additions, rather than a mix of must and assert/require.
nomad/deployment_endpoint.go
Outdated
var deploys []*structs.Deployment | ||
paginator, err := paginator.NewPaginator(iter, tokenizer, nil, args.QueryOptions, | ||
paginator, err := paginator.NewPaginator(iter, tokenizer, filters, args.QueryOptions, |
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.
While we are in this area, could we change the name of the paginator
variable as it clashes with an import.
ca50773
to
25e4c7c
Compare
* func: add namespace support for list deployment * func: add wildcard to namespace filter for deployments * Update deployment_endpoint.go * style: use must instead of require or asseert * style: rename paginator to avoid clash with import * style: add changelog entry * fix: add missing parameter for upsert jobs
* func: add namespace support for list deployment * func: add wildcard to namespace filter for deployments * Update deployment_endpoint.go * style: use must instead of require or asseert * style: rename paginator to avoid clash with import * style: add changelog entry * fix: add missing parameter for upsert jobs
…ace Wildcard (#16865) * Deployment Status Command Does Not Respect -namespace Wildcard (#16792) * func: add namespace support for list deployment * func: add wildcard to namespace filter for deployments * Update deployment_endpoint.go * style: use must instead of require or asseert * style: rename paginator to avoid clash with import * style: add changelog entry * fix: add missing parameter for upsert jobs * fix: remove extra parameter from upsert job
* func: add namespace support for list deployment * func: add wildcard to namespace filter for deployments * Update deployment_endpoint.go * style: use must instead of require or asseert * style: rename paginator to avoid clash with import * style: add changelog entry * fix: add missing parameter for upsert jobs
… (#16866) * func: add namespace support for list deployment * func: add wildcard to namespace filter for deployments * Update deployment_endpoint.go * style: use must instead of require or asseert * style: rename paginator to avoid clash with import * style: add changelog entry * fix: add missing parameter for upsert jobs
… (#16876) * func: add namespace support for list deployment * func: add wildcard to namespace filter for deployments * Update deployment_endpoint.go * style: use must instead of require or asseert * style: rename paginator to avoid clash with import * style: add changelog entry * fix: add missing parameter for upsert jobs
This PR addresses the bug reported here
The deployments Namespace filter did not take into account the namespace wildcard, resulting on an empty response every time it was used in conjunction with a prefix. This PR adds the missing wildcard check as well as filtering by the allowed namespaces according to the ACL token.