mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
Add Subresource & Name to webhook authorizer.
This commit is contained in:
parent
4638f2f355
commit
e53aa93836
@ -151,10 +151,13 @@ func (w *WebhookAuthorizer) Authorize(attr authorizer.Attributes) (err error) {
|
|||||||
}
|
}
|
||||||
if attr.IsResourceRequest() {
|
if attr.IsResourceRequest() {
|
||||||
r.Spec.ResourceAttributes = &v1beta1.ResourceAttributes{
|
r.Spec.ResourceAttributes = &v1beta1.ResourceAttributes{
|
||||||
Namespace: attr.GetNamespace(),
|
Namespace: attr.GetNamespace(),
|
||||||
Verb: attr.GetVerb(),
|
Verb: attr.GetVerb(),
|
||||||
Group: attr.GetAPIGroup(),
|
Group: attr.GetAPIGroup(),
|
||||||
Resource: attr.GetResource(),
|
Version: attr.GetAPIVersion(),
|
||||||
|
Resource: attr.GetResource(),
|
||||||
|
Subresource: attr.GetSubresource(),
|
||||||
|
Name: attr.GetName(),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
r.Spec.NonResourceAttributes = &v1beta1.NonResourceAttributes{
|
r.Spec.NonResourceAttributes = &v1beta1.NonResourceAttributes{
|
||||||
|
@ -435,7 +435,10 @@ func TestWebhook(t *testing.T) {
|
|||||||
Verb: "GET",
|
Verb: "GET",
|
||||||
Namespace: "kittensandponies",
|
Namespace: "kittensandponies",
|
||||||
APIGroup: "group3",
|
APIGroup: "group3",
|
||||||
|
APIVersion: "v7beta3",
|
||||||
Resource: "pods",
|
Resource: "pods",
|
||||||
|
Subresource: "proxy",
|
||||||
|
Name: "my-pod",
|
||||||
ResourceRequest: true,
|
ResourceRequest: true,
|
||||||
Path: "/foo",
|
Path: "/foo",
|
||||||
},
|
},
|
||||||
@ -445,10 +448,13 @@ func TestWebhook(t *testing.T) {
|
|||||||
User: "jane",
|
User: "jane",
|
||||||
Groups: []string{"group1", "group2"},
|
Groups: []string{"group1", "group2"},
|
||||||
ResourceAttributes: &v1beta1.ResourceAttributes{
|
ResourceAttributes: &v1beta1.ResourceAttributes{
|
||||||
Verb: "GET",
|
Verb: "GET",
|
||||||
Namespace: "kittensandponies",
|
Namespace: "kittensandponies",
|
||||||
Group: "group3",
|
Group: "group3",
|
||||||
Resource: "pods",
|
Version: "v7beta3",
|
||||||
|
Resource: "pods",
|
||||||
|
Subresource: "proxy",
|
||||||
|
Name: "my-pod",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user