mirror of https://github.com/k3s-io/k3s
Merge pull request #48051 from xilabao/add-selfsubjectrulesreview-api
Automatic merge from submit-queue (batch tested with PRs 45724, 48051, 46444, 51056, 51605) Add selfsubjectrulesreview in authorization **What this PR does / why we need it**: **Which issue this PR fixes**: fixes #47834 #31292 **Special notes for your reviewer**: **Release note**: ```release-note Add selfsubjectrulesreview API for allowing users to query which permissions they have in a given namespace. ``` /cc @deads2k @liggittpull/6/head
commit
c84b3132a2
|
@ -28347,6 +28347,62 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"/apis/authorization.k8s.io/v1/selfsubjectrulesreviews": {
|
||||
"post": {
|
||||
"description": "create a SelfSubjectRulesReview",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"authorization_v1"
|
||||
],
|
||||
"operationId": "createAuthorizationV1SelfSubjectRulesReview",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.authorization.v1.SelfSubjectRulesReview"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.authorization.v1.SelfSubjectRulesReview"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-action": "post",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "authorization.k8s.io",
|
||||
"kind": "SelfSubjectRulesReview",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"name": "pretty",
|
||||
"in": "query"
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/authorization.k8s.io/v1/subjectaccessreviews": {
|
||||
"post": {
|
||||
"description": "create a SubjectAccessReview",
|
||||
|
@ -28556,6 +28612,62 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"/apis/authorization.k8s.io/v1beta1/selfsubjectrulesreviews": {
|
||||
"post": {
|
||||
"description": "create a SelfSubjectRulesReview",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"authorization_v1beta1"
|
||||
],
|
||||
"operationId": "createAuthorizationV1beta1SelfSubjectRulesReview",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.authorization.v1beta1.SelfSubjectRulesReview"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.authorization.v1beta1.SelfSubjectRulesReview"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-action": "post",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "authorization.k8s.io",
|
||||
"kind": "SelfSubjectRulesReview",
|
||||
"version": "v1beta1"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"name": "pretty",
|
||||
"in": "query"
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/authorization.k8s.io/v1beta1/subjectaccessreviews": {
|
||||
"post": {
|
||||
"description": "create a SubjectAccessReview",
|
||||
|
@ -56494,6 +56606,28 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1.NonResourceRule": {
|
||||
"description": "NonResourceRule holds information that describes a rule for the non-resource",
|
||||
"required": [
|
||||
"verbs"
|
||||
],
|
||||
"properties": {
|
||||
"nonResourceURLs": {
|
||||
"description": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path. \"*\" means all.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"verbs": {
|
||||
"description": "Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. \"*\" means all.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1.ResourceAttributes": {
|
||||
"description": "ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface",
|
||||
"properties": {
|
||||
|
@ -56527,6 +56661,42 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1.ResourceRule": {
|
||||
"description": "ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"required": [
|
||||
"verbs"
|
||||
],
|
||||
"properties": {
|
||||
"apiGroups": {
|
||||
"description": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"*\" means all.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resourceNames": {
|
||||
"description": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. \"*\" means all.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"description": "Resources is a list of resources this rule applies to. ResourceAll represents all resources. \"*\" means all.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"verbs": {
|
||||
"description": "Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. \"*\" means all.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1.SelfSubjectAccessReview": {
|
||||
"description": "SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means \"in all namespaces\". Self is a special case, because users should always be able to check whether they can perform an action",
|
||||
"required": [
|
||||
|
@ -56574,6 +56744,48 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1.SelfSubjectRulesReview": {
|
||||
"description": "SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.",
|
||||
"required": [
|
||||
"spec"
|
||||
],
|
||||
"properties": {
|
||||
"apiVersion": {
|
||||
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources",
|
||||
"type": "string"
|
||||
},
|
||||
"kind": {
|
||||
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"type": "string"
|
||||
},
|
||||
"metadata": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta"
|
||||
},
|
||||
"spec": {
|
||||
"description": "Spec holds information about the request being evaluated.",
|
||||
"$ref": "#/definitions/io.k8s.api.authorization.v1.SelfSubjectRulesReviewSpec"
|
||||
},
|
||||
"status": {
|
||||
"description": "Status is filled in by the server and indicates the set of actions a user can perform.",
|
||||
"$ref": "#/definitions/io.k8s.api.authorization.v1.SubjectRulesReviewStatus"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-group-version-kind": [
|
||||
{
|
||||
"group": "authorization.k8s.io",
|
||||
"kind": "SelfSubjectRulesReview",
|
||||
"version": "v1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"io.k8s.api.authorization.v1.SelfSubjectRulesReviewSpec": {
|
||||
"properties": {
|
||||
"namespace": {
|
||||
"description": "Namespace to evaluate rules for. Required.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1.SubjectAccessReview": {
|
||||
"description": "SubjectAccessReview checks whether or not a user or group can perform an action.",
|
||||
"required": [
|
||||
|
@ -56666,6 +56878,38 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1.SubjectRulesReviewStatus": {
|
||||
"description": "SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, even if that list is incomplete.",
|
||||
"required": [
|
||||
"resourceRules",
|
||||
"nonResourceRules",
|
||||
"incomplete"
|
||||
],
|
||||
"properties": {
|
||||
"evaluationError": {
|
||||
"description": "EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete.",
|
||||
"type": "string"
|
||||
},
|
||||
"incomplete": {
|
||||
"description": "Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"nonResourceRules": {
|
||||
"description": "NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/io.k8s.api.authorization.v1.NonResourceRule"
|
||||
}
|
||||
},
|
||||
"resourceRules": {
|
||||
"description": "ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/io.k8s.api.authorization.v1.ResourceRule"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1beta1.LocalSubjectAccessReview": {
|
||||
"description": "LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking.",
|
||||
"required": [
|
||||
|
@ -56713,6 +56957,28 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1beta1.NonResourceRule": {
|
||||
"description": "NonResourceRule holds information that describes a rule for the non-resource",
|
||||
"required": [
|
||||
"verbs"
|
||||
],
|
||||
"properties": {
|
||||
"nonResourceURLs": {
|
||||
"description": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path. \"*\" means all.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"verbs": {
|
||||
"description": "Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. \"*\" means all.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1beta1.ResourceAttributes": {
|
||||
"description": "ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface",
|
||||
"properties": {
|
||||
|
@ -56746,6 +57012,42 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1beta1.ResourceRule": {
|
||||
"description": "ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"required": [
|
||||
"verbs"
|
||||
],
|
||||
"properties": {
|
||||
"apiGroups": {
|
||||
"description": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"*\" means all.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resourceNames": {
|
||||
"description": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. \"*\" means all.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"description": "Resources is a list of resources this rule applies to. ResourceAll represents all resources. \"*\" means all.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"verbs": {
|
||||
"description": "Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. \"*\" means all.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1beta1.SelfSubjectAccessReview": {
|
||||
"description": "SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means \"in all namespaces\". Self is a special case, because users should always be able to check whether they can perform an action",
|
||||
"required": [
|
||||
|
@ -56793,6 +57095,48 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1beta1.SelfSubjectRulesReview": {
|
||||
"description": "SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.",
|
||||
"required": [
|
||||
"spec"
|
||||
],
|
||||
"properties": {
|
||||
"apiVersion": {
|
||||
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources",
|
||||
"type": "string"
|
||||
},
|
||||
"kind": {
|
||||
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||
"type": "string"
|
||||
},
|
||||
"metadata": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta"
|
||||
},
|
||||
"spec": {
|
||||
"description": "Spec holds information about the request being evaluated.",
|
||||
"$ref": "#/definitions/io.k8s.api.authorization.v1beta1.SelfSubjectRulesReviewSpec"
|
||||
},
|
||||
"status": {
|
||||
"description": "Status is filled in by the server and indicates the set of actions a user can perform.",
|
||||
"$ref": "#/definitions/io.k8s.api.authorization.v1beta1.SubjectRulesReviewStatus"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-group-version-kind": [
|
||||
{
|
||||
"group": "authorization.k8s.io",
|
||||
"kind": "SelfSubjectRulesReview",
|
||||
"version": "v1beta1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"io.k8s.api.authorization.v1beta1.SelfSubjectRulesReviewSpec": {
|
||||
"properties": {
|
||||
"namespace": {
|
||||
"description": "Namespace to evaluate rules for. Required.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1beta1.SubjectAccessReview": {
|
||||
"description": "SubjectAccessReview checks whether or not a user or group can perform an action.",
|
||||
"required": [
|
||||
|
@ -56885,6 +57229,38 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.authorization.v1beta1.SubjectRulesReviewStatus": {
|
||||
"description": "SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, even if that list is incomplete.",
|
||||
"required": [
|
||||
"resourceRules",
|
||||
"nonResourceRules",
|
||||
"incomplete"
|
||||
],
|
||||
"properties": {
|
||||
"evaluationError": {
|
||||
"description": "EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete.",
|
||||
"type": "string"
|
||||
},
|
||||
"incomplete": {
|
||||
"description": "Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"nonResourceRules": {
|
||||
"description": "NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/io.k8s.api.authorization.v1beta1.NonResourceRule"
|
||||
}
|
||||
},
|
||||
"resourceRules": {
|
||||
"description": "ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/io.k8s.api.authorization.v1beta1.ResourceRule"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"io.k8s.api.autoscaling.v1.CrossVersionObjectReference": {
|
||||
"description": "CrossVersionObjectReference contains enough information to let you identify the referred resource.",
|
||||
"required": [
|
||||
|
|
|
@ -106,6 +106,51 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/authorization.k8s.io/v1/selfsubjectrulesreviews",
|
||||
"description": "API at /apis/authorization.k8s.io/v1",
|
||||
"operations": [
|
||||
{
|
||||
"type": "v1.SelfSubjectRulesReview",
|
||||
"method": "POST",
|
||||
"summary": "create a SelfSubjectRulesReview",
|
||||
"nickname": "createSelfSubjectRulesReview",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "query",
|
||||
"name": "pretty",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"required": false,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "v1.SelfSubjectRulesReview",
|
||||
"paramType": "body",
|
||||
"name": "body",
|
||||
"description": "",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1.SelfSubjectRulesReview"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"consumes": [
|
||||
"*/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/authorization.k8s.io/v1/subjectaccessreviews",
|
||||
"description": "API at /apis/authorization.k8s.io/v1",
|
||||
|
@ -600,6 +645,136 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"v1.SelfSubjectRulesReview": {
|
||||
"id": "v1.SelfSubjectRulesReview",
|
||||
"description": "SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.",
|
||||
"required": [
|
||||
"spec"
|
||||
],
|
||||
"properties": {
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds"
|
||||
},
|
||||
"apiVersion": {
|
||||
"type": "string",
|
||||
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources"
|
||||
},
|
||||
"metadata": {
|
||||
"$ref": "v1.ObjectMeta"
|
||||
},
|
||||
"spec": {
|
||||
"$ref": "v1.SelfSubjectRulesReviewSpec",
|
||||
"description": "Spec holds information about the request being evaluated."
|
||||
},
|
||||
"status": {
|
||||
"$ref": "v1.SubjectRulesReviewStatus",
|
||||
"description": "Status is filled in by the server and indicates the set of actions a user can perform."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.SelfSubjectRulesReviewSpec": {
|
||||
"id": "v1.SelfSubjectRulesReviewSpec",
|
||||
"properties": {
|
||||
"namespace": {
|
||||
"type": "string",
|
||||
"description": "Namespace to evaluate rules for. Required."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.SubjectRulesReviewStatus": {
|
||||
"id": "v1.SubjectRulesReviewStatus",
|
||||
"description": "SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, even if that list is incomplete.",
|
||||
"required": [
|
||||
"resourceRules",
|
||||
"nonResourceRules",
|
||||
"incomplete"
|
||||
],
|
||||
"properties": {
|
||||
"resourceRules": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "v1.ResourceRule"
|
||||
},
|
||||
"description": "ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete."
|
||||
},
|
||||
"nonResourceRules": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "v1.NonResourceRule"
|
||||
},
|
||||
"description": "NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete."
|
||||
},
|
||||
"incomplete": {
|
||||
"type": "boolean",
|
||||
"description": "Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation."
|
||||
},
|
||||
"evaluationError": {
|
||||
"type": "string",
|
||||
"description": "EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.ResourceRule": {
|
||||
"id": "v1.ResourceRule",
|
||||
"description": "ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"required": [
|
||||
"verbs"
|
||||
],
|
||||
"properties": {
|
||||
"verbs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. \"*\" means all."
|
||||
},
|
||||
"apiGroups": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"*\" means all."
|
||||
},
|
||||
"resources": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Resources is a list of resources this rule applies to. ResourceAll represents all resources. \"*\" means all."
|
||||
},
|
||||
"resourceNames": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. \"*\" means all."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.NonResourceRule": {
|
||||
"id": "v1.NonResourceRule",
|
||||
"description": "NonResourceRule holds information that describes a rule for the non-resource",
|
||||
"required": [
|
||||
"verbs"
|
||||
],
|
||||
"properties": {
|
||||
"verbs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. \"*\" means all."
|
||||
},
|
||||
"nonResourceURLs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path. \"*\" means all."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.SubjectAccessReview": {
|
||||
"id": "v1.SubjectAccessReview",
|
||||
"description": "SubjectAccessReview checks whether or not a user or group can perform an action.",
|
||||
|
|
|
@ -106,6 +106,51 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/authorization.k8s.io/v1beta1/selfsubjectrulesreviews",
|
||||
"description": "API at /apis/authorization.k8s.io/v1beta1",
|
||||
"operations": [
|
||||
{
|
||||
"type": "v1beta1.SelfSubjectRulesReview",
|
||||
"method": "POST",
|
||||
"summary": "create a SelfSubjectRulesReview",
|
||||
"nickname": "createSelfSubjectRulesReview",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "query",
|
||||
"name": "pretty",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"required": false,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "v1beta1.SelfSubjectRulesReview",
|
||||
"paramType": "body",
|
||||
"name": "body",
|
||||
"description": "",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1beta1.SelfSubjectRulesReview"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"consumes": [
|
||||
"*/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/authorization.k8s.io/v1beta1/subjectaccessreviews",
|
||||
"description": "API at /apis/authorization.k8s.io/v1beta1",
|
||||
|
@ -600,6 +645,136 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"v1beta1.SelfSubjectRulesReview": {
|
||||
"id": "v1beta1.SelfSubjectRulesReview",
|
||||
"description": "SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.",
|
||||
"required": [
|
||||
"spec"
|
||||
],
|
||||
"properties": {
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds"
|
||||
},
|
||||
"apiVersion": {
|
||||
"type": "string",
|
||||
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources"
|
||||
},
|
||||
"metadata": {
|
||||
"$ref": "v1.ObjectMeta"
|
||||
},
|
||||
"spec": {
|
||||
"$ref": "v1beta1.SelfSubjectRulesReviewSpec",
|
||||
"description": "Spec holds information about the request being evaluated."
|
||||
},
|
||||
"status": {
|
||||
"$ref": "v1beta1.SubjectRulesReviewStatus",
|
||||
"description": "Status is filled in by the server and indicates the set of actions a user can perform."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1beta1.SelfSubjectRulesReviewSpec": {
|
||||
"id": "v1beta1.SelfSubjectRulesReviewSpec",
|
||||
"properties": {
|
||||
"namespace": {
|
||||
"type": "string",
|
||||
"description": "Namespace to evaluate rules for. Required."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1beta1.SubjectRulesReviewStatus": {
|
||||
"id": "v1beta1.SubjectRulesReviewStatus",
|
||||
"description": "SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, even if that list is incomplete.",
|
||||
"required": [
|
||||
"resourceRules",
|
||||
"nonResourceRules",
|
||||
"incomplete"
|
||||
],
|
||||
"properties": {
|
||||
"resourceRules": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "v1beta1.ResourceRule"
|
||||
},
|
||||
"description": "ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete."
|
||||
},
|
||||
"nonResourceRules": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "v1beta1.NonResourceRule"
|
||||
},
|
||||
"description": "NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete."
|
||||
},
|
||||
"incomplete": {
|
||||
"type": "boolean",
|
||||
"description": "Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation."
|
||||
},
|
||||
"evaluationError": {
|
||||
"type": "string",
|
||||
"description": "EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1beta1.ResourceRule": {
|
||||
"id": "v1beta1.ResourceRule",
|
||||
"description": "ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"required": [
|
||||
"verbs"
|
||||
],
|
||||
"properties": {
|
||||
"verbs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. \"*\" means all."
|
||||
},
|
||||
"apiGroups": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"*\" means all."
|
||||
},
|
||||
"resources": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Resources is a list of resources this rule applies to. ResourceAll represents all resources. \"*\" means all."
|
||||
},
|
||||
"resourceNames": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. \"*\" means all."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1beta1.NonResourceRule": {
|
||||
"id": "v1beta1.NonResourceRule",
|
||||
"description": "NonResourceRule holds information that describes a rule for the non-resource",
|
||||
"required": [
|
||||
"verbs"
|
||||
],
|
||||
"properties": {
|
||||
"verbs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. \"*\" means all."
|
||||
},
|
||||
"nonResourceURLs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path. \"*\" means all."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1beta1.SubjectAccessReview": {
|
||||
"id": "v1beta1.SubjectAccessReview",
|
||||
"description": "SubjectAccessReview checks whether or not a user or group can perform an action.",
|
||||
|
|
|
@ -441,7 +441,7 @@ func BuildGenericConfig(s *options.ServerRunOptions) (*genericapiserver.Config,
|
|||
return nil, nil, nil, nil, nil, fmt.Errorf("invalid authentication config: %v", err)
|
||||
}
|
||||
|
||||
genericConfig.Authorizer, err = BuildAuthorizer(s, sharedInformers)
|
||||
genericConfig.Authorizer, genericConfig.RuleResolver, err = BuildAuthorizer(s, sharedInformers)
|
||||
if err != nil {
|
||||
return nil, nil, nil, nil, nil, fmt.Errorf("invalid authorization config: %v", err)
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ func BuildAuthenticator(s *options.ServerRunOptions, storageFactory serverstorag
|
|||
}
|
||||
|
||||
// BuildAuthorizer constructs the authorizer
|
||||
func BuildAuthorizer(s *options.ServerRunOptions, sharedInformers informers.SharedInformerFactory) (authorizer.Authorizer, error) {
|
||||
func BuildAuthorizer(s *options.ServerRunOptions, sharedInformers informers.SharedInformerFactory) (authorizer.Authorizer, authorizer.RuleResolver, error) {
|
||||
authorizationConfig := s.Authorization.ToAuthorizationConfig(sharedInformers)
|
||||
return authorizationConfig.New()
|
||||
}
|
||||
|
|
|
@ -370,6 +370,9 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><a href="#_v1_selfsubjectrulesreview">v1.SelfSubjectRulesReview</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="#_v1_selfsubjectaccessreview">v1.SelfSubjectAccessReview</a></p>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -700,6 +703,37 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_selfsubjectrulesreviewspec">v1.SelfSubjectRulesReviewSpec</h3>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">namespace</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Namespace to evaluate rules for. Required.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_status">v1.Status</h3>
|
||||
|
@ -1165,6 +1199,61 @@ When an object is created, the system will populate this list with the current s
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_subjectrulesreviewstatus">v1.SubjectRulesReviewStatus</h3>
|
||||
<div class="paragraph">
|
||||
<p>SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it’s safe to assume the subject has that permission, even if that list is incomplete.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">resourceRules</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn’t significant, may contain duplicates, and possibly be incomplete.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_resourcerule">v1.ResourceRule</a> array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">nonResourceRules</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn’t significant, may contain duplicates, and possibly be incomplete.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_nonresourcerule">v1.NonResourceRule</a> array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">incomplete</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn’t support rules evaluation.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">evaluationError</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn’t support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_apiresource">v1.APIResource</h3>
|
||||
|
@ -1296,6 +1385,61 @@ When an object is created, the system will populate this list with the current s
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_resourcerule">v1.ResourceRule</h3>
|
||||
<div class="paragraph">
|
||||
<p>ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn’t significant, may contain duplicates, and possibly be incomplete.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">verbs</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">apiGroups</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. "*" means all.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">resources</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Resources is a list of resources this rule applies to. ResourceAll represents all resources. "*" means all.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">resourceNames</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_statuscause">v1.StatusCause</h3>
|
||||
|
@ -1410,6 +1554,47 @@ Examples:<br>
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_nonresourcerule">v1.NonResourceRule</h3>
|
||||
<div class="paragraph">
|
||||
<p>NonResourceRule holds information that describes a rule for the non-resource</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">verbs</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">nonResourceURLs</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">NonResourceURLs is a set of partial urls that a user should have access to. <strong>s are allowed, but only as the full, final step in the path. "</strong>" means all.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_selfsubjectaccessreview">v1.SelfSubjectAccessReview</h3>
|
||||
|
@ -1534,6 +1719,68 @@ Examples:<br>
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_selfsubjectrulesreview">v1.SelfSubjectRulesReview</h3>
|
||||
<div class="paragraph">
|
||||
<p>SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server’s authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">kind</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: <a href="https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds">https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">apiVersion</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: <a href="https://git.k8s.io/community/contributors/devel/api-conventions.md#resources">https://git.k8s.io/community/contributors/devel/api-conventions.md#resources</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">metadata</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_objectmeta">v1.ObjectMeta</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">spec</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Spec holds information about the request being evaluated.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_selfsubjectrulesreviewspec">v1.SelfSubjectRulesReviewSpec</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">status</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Status is filled in by the server and indicates the set of actions a user can perform.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_subjectrulesreviewstatus">v1.SubjectRulesReviewStatus</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_any">any</h3>
|
||||
|
|
|
@ -673,10 +673,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_create_a_subjectaccessreview">create a SubjectAccessReview</h3>
|
||||
<h3 id="_create_a_selfsubjectrulesreview">create a SelfSubjectRulesReview</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>POST /apis/authorization.k8s.io/v1/subjectaccessreviews</pre>
|
||||
<pre>POST /apis/authorization.k8s.io/v1/selfsubjectrulesreviews</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
|
@ -714,7 +714,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
<td class="tableblock halign-left valign-top"><p class="tableblock">body</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1_subjectaccessreview">v1.SubjectAccessReview</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1_selfsubjectrulesreview">v1.SelfSubjectRulesReview</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -740,7 +740,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1_subjectaccessreview">v1.SubjectAccessReview</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1_selfsubjectrulesreview">v1.SelfSubjectRulesReview</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -783,6 +783,117 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_create_a_subjectaccessreview">create a SubjectAccessReview</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>POST /apis/authorization.k8s.io/v1/subjectaccessreviews</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_parameters_4">Parameters</h4>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:16%;">
|
||||
<col style="width:16%;">
|
||||
<col style="width:16%;">
|
||||
<col style="width:16%;">
|
||||
<col style="width:16%;">
|
||||
<col style="width:16%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Type</th>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">QueryParameter</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">pretty</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">If <em>true</em>, then the output is pretty printed.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">BodyParameter</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">body</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1_subjectaccessreview">v1.SubjectAccessReview</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_responses_5">Responses</h4>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:33%;">
|
||||
<col style="width:33%;">
|
||||
<col style="width:33%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">HTTP Code</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1_subjectaccessreview">v1.SubjectAccessReview</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_consumes_5">Consumes</h4>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>/</strong></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_produces_5">Produces</h4>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p>application/json</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>application/yaml</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>application/vnd.kubernetes.protobuf</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_tags_5">Tags</h4>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p>apisauthorization.k8s.iov1</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -370,6 +370,9 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><a href="#_v1beta1_selfsubjectrulesreview">v1beta1.SelfSubjectRulesReview</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="#_v1beta1_selfsubjectaccessreview">v1beta1.SelfSubjectAccessReview</a></p>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -611,6 +614,61 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1beta1_subjectrulesreviewstatus">v1beta1.SubjectRulesReviewStatus</h3>
|
||||
<div class="paragraph">
|
||||
<p>SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it’s safe to assume the subject has that permission, even if that list is incomplete.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">resourceRules</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn’t significant, may contain duplicates, and possibly be incomplete.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1beta1_resourcerule">v1beta1.ResourceRule</a> array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">nonResourceRules</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn’t significant, may contain duplicates, and possibly be incomplete.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1beta1_nonresourcerule">v1beta1.NonResourceRule</a> array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">incomplete</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn’t support rules evaluation.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">evaluationError</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn’t support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_initializers">v1.Initializers</h3>
|
||||
|
@ -941,6 +999,68 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1beta1_selfsubjectrulesreview">v1beta1.SelfSubjectRulesReview</h3>
|
||||
<div class="paragraph">
|
||||
<p>SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server’s authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">kind</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: <a href="https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds">https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">apiVersion</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: <a href="https://git.k8s.io/community/contributors/devel/api-conventions.md#resources">https://git.k8s.io/community/contributors/devel/api-conventions.md#resources</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">metadata</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_objectmeta">v1.ObjectMeta</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">spec</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Spec holds information about the request being evaluated.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1beta1_selfsubjectrulesreviewspec">v1beta1.SelfSubjectRulesReviewSpec</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">status</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Status is filled in by the server and indicates the set of actions a user can perform.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1beta1_subjectrulesreviewstatus">v1beta1.SubjectRulesReviewStatus</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1beta1_subjectaccessreviewstatus">v1beta1.SubjectAccessReviewStatus</h3>
|
||||
|
@ -1213,6 +1333,133 @@ When an object is created, the system will populate this list with the current s
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1beta1_selfsubjectrulesreviewspec">v1beta1.SelfSubjectRulesReviewSpec</h3>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">namespace</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Namespace to evaluate rules for. Required.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1beta1_nonresourcerule">v1beta1.NonResourceRule</h3>
|
||||
<div class="paragraph">
|
||||
<p>NonResourceRule holds information that describes a rule for the non-resource</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">verbs</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">nonResourceURLs</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">NonResourceURLs is a set of partial urls that a user should have access to. <strong>s are allowed, but only as the full, final step in the path. "</strong>" means all.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1beta1_resourcerule">v1beta1.ResourceRule</h3>
|
||||
<div class="paragraph">
|
||||
<p>ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn’t significant, may contain duplicates, and possibly be incomplete.</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">verbs</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">apiGroups</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. "*" means all.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">resources</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Resources is a list of resources this rule applies to. ResourceAll represents all resources. "*" means all.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">resourceNames</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1beta1_selfsubjectaccessreview">v1beta1.SelfSubjectAccessReview</h3>
|
||||
|
|
|
@ -673,10 +673,10 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_create_a_subjectaccessreview">create a SubjectAccessReview</h3>
|
||||
<h3 id="_create_a_selfsubjectrulesreview">create a SelfSubjectRulesReview</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>POST /apis/authorization.k8s.io/v1beta1/subjectaccessreviews</pre>
|
||||
<pre>POST /apis/authorization.k8s.io/v1beta1/selfsubjectrulesreviews</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
|
@ -714,7 +714,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
<td class="tableblock halign-left valign-top"><p class="tableblock">body</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1beta1_subjectaccessreview">v1beta1.SubjectAccessReview</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1beta1_selfsubjectrulesreview">v1beta1.SelfSubjectRulesReview</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -740,7 +740,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1beta1_subjectaccessreview">v1beta1.SubjectAccessReview</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1beta1_selfsubjectrulesreview">v1beta1.SelfSubjectRulesReview</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -783,6 +783,117 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_create_a_subjectaccessreview">create a SubjectAccessReview</h3>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre>POST /apis/authorization.k8s.io/v1beta1/subjectaccessreviews</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_parameters_4">Parameters</h4>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:16%;">
|
||||
<col style="width:16%;">
|
||||
<col style="width:16%;">
|
||||
<col style="width:16%;">
|
||||
<col style="width:16%;">
|
||||
<col style="width:16%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Type</th>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">QueryParameter</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">pretty</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">If <em>true</em>, then the output is pretty printed.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">BodyParameter</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">body</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1beta1_subjectaccessreview">v1beta1.SubjectAccessReview</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_responses_5">Responses</h4>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:33%;">
|
||||
<col style="width:33%;">
|
||||
<col style="width:33%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">HTTP Code</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">success</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../definitions#_v1beta1_subjectaccessreview">v1beta1.SubjectAccessReview</a></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_consumes_5">Consumes</h4>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>/</strong></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_produces_5">Produces</h4>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p>application/json</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>application/yaml</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>application/vnd.kubernetes.protobuf</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_tags_5">Tags</h4>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p>apisauthorization.k8s.iov1beta1</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -190,7 +190,7 @@ func NonBlockingRun(s *options.ServerRunOptions, stopCh <-chan struct{}) error {
|
|||
sharedInformers := informers.NewSharedInformerFactory(client, 10*time.Minute)
|
||||
|
||||
authorizationConfig := s.Authorization.ToAuthorizationConfig(sharedInformers)
|
||||
apiAuthorizer, err := authorizationConfig.New()
|
||||
apiAuthorizer, _, err := authorizationConfig.New()
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid Authorization Config: %v", err)
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
|||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: authorization.GroupName,
|
||||
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version, v1beta1.SchemeGroupVersion.Version},
|
||||
RootScopedKinds: sets.NewString("SubjectAccessReview", "SelfSubjectAccessReview"),
|
||||
RootScopedKinds: sets.NewString("SubjectAccessReview", "SelfSubjectAccessReview", "SelfSubjectRulesReview"),
|
||||
AddInternalObjectsToScheme: authorization.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
|
|
@ -44,6 +44,7 @@ var (
|
|||
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&SelfSubjectRulesReview{},
|
||||
&SelfSubjectAccessReview{},
|
||||
&SubjectAccessReview{},
|
||||
&LocalSubjectAccessReview{},
|
||||
|
|
|
@ -149,3 +149,74 @@ type SubjectAccessReviewStatus struct {
|
|||
// For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.
|
||||
EvaluationError string
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +genclient:noVerbs
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace.
|
||||
// The returned list of actions may be incomplete depending on the server's authorization mode,
|
||||
// and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions,
|
||||
// or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to
|
||||
// drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns.
|
||||
// SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.
|
||||
type SelfSubjectRulesReview struct {
|
||||
metav1.TypeMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Spec holds information about the request being evaluated.
|
||||
Spec SelfSubjectRulesReviewSpec
|
||||
|
||||
// Status is filled in by the server and indicates the set of actions a user can perform.
|
||||
Status SubjectRulesReviewStatus
|
||||
}
|
||||
|
||||
type SelfSubjectRulesReviewSpec struct {
|
||||
// Namespace to evaluate rules for. Required.
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on
|
||||
// the set of authorizers the server is configured with and any errors experienced during evaluation.
|
||||
// Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission,
|
||||
// even if that list is incomplete.
|
||||
type SubjectRulesReviewStatus struct {
|
||||
// ResourceRules is the list of actions the subject is allowed to perform on resources.
|
||||
// The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
|
||||
ResourceRules []ResourceRule
|
||||
// NonResourceRules is the list of actions the subject is allowed to perform on non-resources.
|
||||
// The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
|
||||
NonResourceRules []NonResourceRule
|
||||
// Incomplete is true when the rules returned by this call are incomplete. This is most commonly
|
||||
// encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.
|
||||
Incomplete bool
|
||||
// EvaluationError can appear in combination with Rules. It indicates an error occurred during
|
||||
// rule evaluation, such as an authorizer that doesn't support rule evaluation, and that
|
||||
// ResourceRules and/or NonResourceRules may be incomplete.
|
||||
EvaluationError string
|
||||
}
|
||||
|
||||
// ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant,
|
||||
// may contain duplicates, and possibly be incomplete.
|
||||
type ResourceRule struct {
|
||||
// Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all.
|
||||
Verbs []string
|
||||
// APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of
|
||||
// the enumerated resources in any API group will be allowed. "*" means all.
|
||||
APIGroups []string
|
||||
// Resources is a list of resources this rule applies to. ResourceAll represents all resources. "*" means all.
|
||||
Resources []string
|
||||
// ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all.
|
||||
ResourceNames []string
|
||||
}
|
||||
|
||||
// NonResourceRule holds information that describes a rule for the non-resource
|
||||
type NonResourceRule struct {
|
||||
// Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all.
|
||||
Verbs []string
|
||||
|
||||
// NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full,
|
||||
// final step in the path. "*" means all.
|
||||
NonResourceURLs []string
|
||||
}
|
||||
|
|
|
@ -40,18 +40,28 @@ func RegisterConversions(scheme *runtime.Scheme) error {
|
|||
Convert_authorization_LocalSubjectAccessReview_To_v1_LocalSubjectAccessReview,
|
||||
Convert_v1_NonResourceAttributes_To_authorization_NonResourceAttributes,
|
||||
Convert_authorization_NonResourceAttributes_To_v1_NonResourceAttributes,
|
||||
Convert_v1_NonResourceRule_To_authorization_NonResourceRule,
|
||||
Convert_authorization_NonResourceRule_To_v1_NonResourceRule,
|
||||
Convert_v1_ResourceAttributes_To_authorization_ResourceAttributes,
|
||||
Convert_authorization_ResourceAttributes_To_v1_ResourceAttributes,
|
||||
Convert_v1_ResourceRule_To_authorization_ResourceRule,
|
||||
Convert_authorization_ResourceRule_To_v1_ResourceRule,
|
||||
Convert_v1_SelfSubjectAccessReview_To_authorization_SelfSubjectAccessReview,
|
||||
Convert_authorization_SelfSubjectAccessReview_To_v1_SelfSubjectAccessReview,
|
||||
Convert_v1_SelfSubjectAccessReviewSpec_To_authorization_SelfSubjectAccessReviewSpec,
|
||||
Convert_authorization_SelfSubjectAccessReviewSpec_To_v1_SelfSubjectAccessReviewSpec,
|
||||
Convert_v1_SelfSubjectRulesReview_To_authorization_SelfSubjectRulesReview,
|
||||
Convert_authorization_SelfSubjectRulesReview_To_v1_SelfSubjectRulesReview,
|
||||
Convert_v1_SelfSubjectRulesReviewSpec_To_authorization_SelfSubjectRulesReviewSpec,
|
||||
Convert_authorization_SelfSubjectRulesReviewSpec_To_v1_SelfSubjectRulesReviewSpec,
|
||||
Convert_v1_SubjectAccessReview_To_authorization_SubjectAccessReview,
|
||||
Convert_authorization_SubjectAccessReview_To_v1_SubjectAccessReview,
|
||||
Convert_v1_SubjectAccessReviewSpec_To_authorization_SubjectAccessReviewSpec,
|
||||
Convert_authorization_SubjectAccessReviewSpec_To_v1_SubjectAccessReviewSpec,
|
||||
Convert_v1_SubjectAccessReviewStatus_To_authorization_SubjectAccessReviewStatus,
|
||||
Convert_authorization_SubjectAccessReviewStatus_To_v1_SubjectAccessReviewStatus,
|
||||
Convert_v1_SubjectRulesReviewStatus_To_authorization_SubjectRulesReviewStatus,
|
||||
Convert_authorization_SubjectRulesReviewStatus_To_v1_SubjectRulesReviewStatus,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -109,6 +119,28 @@ func Convert_authorization_NonResourceAttributes_To_v1_NonResourceAttributes(in
|
|||
return autoConvert_authorization_NonResourceAttributes_To_v1_NonResourceAttributes(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_NonResourceRule_To_authorization_NonResourceRule(in *v1.NonResourceRule, out *authorization.NonResourceRule, s conversion.Scope) error {
|
||||
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
|
||||
out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_NonResourceRule_To_authorization_NonResourceRule is an autogenerated conversion function.
|
||||
func Convert_v1_NonResourceRule_To_authorization_NonResourceRule(in *v1.NonResourceRule, out *authorization.NonResourceRule, s conversion.Scope) error {
|
||||
return autoConvert_v1_NonResourceRule_To_authorization_NonResourceRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_authorization_NonResourceRule_To_v1_NonResourceRule(in *authorization.NonResourceRule, out *v1.NonResourceRule, s conversion.Scope) error {
|
||||
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
|
||||
out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_authorization_NonResourceRule_To_v1_NonResourceRule is an autogenerated conversion function.
|
||||
func Convert_authorization_NonResourceRule_To_v1_NonResourceRule(in *authorization.NonResourceRule, out *v1.NonResourceRule, s conversion.Scope) error {
|
||||
return autoConvert_authorization_NonResourceRule_To_v1_NonResourceRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_ResourceAttributes_To_authorization_ResourceAttributes(in *v1.ResourceAttributes, out *authorization.ResourceAttributes, s conversion.Scope) error {
|
||||
out.Namespace = in.Namespace
|
||||
out.Verb = in.Verb
|
||||
|
@ -141,6 +173,32 @@ func Convert_authorization_ResourceAttributes_To_v1_ResourceAttributes(in *autho
|
|||
return autoConvert_authorization_ResourceAttributes_To_v1_ResourceAttributes(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_ResourceRule_To_authorization_ResourceRule(in *v1.ResourceRule, out *authorization.ResourceRule, s conversion.Scope) error {
|
||||
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
|
||||
out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups))
|
||||
out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
|
||||
out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_ResourceRule_To_authorization_ResourceRule is an autogenerated conversion function.
|
||||
func Convert_v1_ResourceRule_To_authorization_ResourceRule(in *v1.ResourceRule, out *authorization.ResourceRule, s conversion.Scope) error {
|
||||
return autoConvert_v1_ResourceRule_To_authorization_ResourceRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_authorization_ResourceRule_To_v1_ResourceRule(in *authorization.ResourceRule, out *v1.ResourceRule, s conversion.Scope) error {
|
||||
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
|
||||
out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups))
|
||||
out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
|
||||
out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_authorization_ResourceRule_To_v1_ResourceRule is an autogenerated conversion function.
|
||||
func Convert_authorization_ResourceRule_To_v1_ResourceRule(in *authorization.ResourceRule, out *v1.ResourceRule, s conversion.Scope) error {
|
||||
return autoConvert_authorization_ResourceRule_To_v1_ResourceRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_SelfSubjectAccessReview_To_authorization_SelfSubjectAccessReview(in *v1.SelfSubjectAccessReview, out *authorization.SelfSubjectAccessReview, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1_SelfSubjectAccessReviewSpec_To_authorization_SelfSubjectAccessReviewSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
|
@ -195,6 +253,58 @@ func Convert_authorization_SelfSubjectAccessReviewSpec_To_v1_SelfSubjectAccessRe
|
|||
return autoConvert_authorization_SelfSubjectAccessReviewSpec_To_v1_SelfSubjectAccessReviewSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_SelfSubjectRulesReview_To_authorization_SelfSubjectRulesReview(in *v1.SelfSubjectRulesReview, out *authorization.SelfSubjectRulesReview, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1_SelfSubjectRulesReviewSpec_To_authorization_SelfSubjectRulesReviewSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1_SubjectRulesReviewStatus_To_authorization_SubjectRulesReviewStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_SelfSubjectRulesReview_To_authorization_SelfSubjectRulesReview is an autogenerated conversion function.
|
||||
func Convert_v1_SelfSubjectRulesReview_To_authorization_SelfSubjectRulesReview(in *v1.SelfSubjectRulesReview, out *authorization.SelfSubjectRulesReview, s conversion.Scope) error {
|
||||
return autoConvert_v1_SelfSubjectRulesReview_To_authorization_SelfSubjectRulesReview(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_authorization_SelfSubjectRulesReview_To_v1_SelfSubjectRulesReview(in *authorization.SelfSubjectRulesReview, out *v1.SelfSubjectRulesReview, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_authorization_SelfSubjectRulesReviewSpec_To_v1_SelfSubjectRulesReviewSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_authorization_SubjectRulesReviewStatus_To_v1_SubjectRulesReviewStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_authorization_SelfSubjectRulesReview_To_v1_SelfSubjectRulesReview is an autogenerated conversion function.
|
||||
func Convert_authorization_SelfSubjectRulesReview_To_v1_SelfSubjectRulesReview(in *authorization.SelfSubjectRulesReview, out *v1.SelfSubjectRulesReview, s conversion.Scope) error {
|
||||
return autoConvert_authorization_SelfSubjectRulesReview_To_v1_SelfSubjectRulesReview(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_SelfSubjectRulesReviewSpec_To_authorization_SelfSubjectRulesReviewSpec(in *v1.SelfSubjectRulesReviewSpec, out *authorization.SelfSubjectRulesReviewSpec, s conversion.Scope) error {
|
||||
out.Namespace = in.Namespace
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_SelfSubjectRulesReviewSpec_To_authorization_SelfSubjectRulesReviewSpec is an autogenerated conversion function.
|
||||
func Convert_v1_SelfSubjectRulesReviewSpec_To_authorization_SelfSubjectRulesReviewSpec(in *v1.SelfSubjectRulesReviewSpec, out *authorization.SelfSubjectRulesReviewSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1_SelfSubjectRulesReviewSpec_To_authorization_SelfSubjectRulesReviewSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_authorization_SelfSubjectRulesReviewSpec_To_v1_SelfSubjectRulesReviewSpec(in *authorization.SelfSubjectRulesReviewSpec, out *v1.SelfSubjectRulesReviewSpec, s conversion.Scope) error {
|
||||
out.Namespace = in.Namespace
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_authorization_SelfSubjectRulesReviewSpec_To_v1_SelfSubjectRulesReviewSpec is an autogenerated conversion function.
|
||||
func Convert_authorization_SelfSubjectRulesReviewSpec_To_v1_SelfSubjectRulesReviewSpec(in *authorization.SelfSubjectRulesReviewSpec, out *v1.SelfSubjectRulesReviewSpec, s conversion.Scope) error {
|
||||
return autoConvert_authorization_SelfSubjectRulesReviewSpec_To_v1_SelfSubjectRulesReviewSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_SubjectAccessReview_To_authorization_SubjectAccessReview(in *v1.SubjectAccessReview, out *authorization.SubjectAccessReview, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1_SubjectAccessReviewSpec_To_authorization_SubjectAccessReviewSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
|
@ -280,3 +390,29 @@ func autoConvert_authorization_SubjectAccessReviewStatus_To_v1_SubjectAccessRevi
|
|||
func Convert_authorization_SubjectAccessReviewStatus_To_v1_SubjectAccessReviewStatus(in *authorization.SubjectAccessReviewStatus, out *v1.SubjectAccessReviewStatus, s conversion.Scope) error {
|
||||
return autoConvert_authorization_SubjectAccessReviewStatus_To_v1_SubjectAccessReviewStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_SubjectRulesReviewStatus_To_authorization_SubjectRulesReviewStatus(in *v1.SubjectRulesReviewStatus, out *authorization.SubjectRulesReviewStatus, s conversion.Scope) error {
|
||||
out.ResourceRules = *(*[]authorization.ResourceRule)(unsafe.Pointer(&in.ResourceRules))
|
||||
out.NonResourceRules = *(*[]authorization.NonResourceRule)(unsafe.Pointer(&in.NonResourceRules))
|
||||
out.Incomplete = in.Incomplete
|
||||
out.EvaluationError = in.EvaluationError
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_SubjectRulesReviewStatus_To_authorization_SubjectRulesReviewStatus is an autogenerated conversion function.
|
||||
func Convert_v1_SubjectRulesReviewStatus_To_authorization_SubjectRulesReviewStatus(in *v1.SubjectRulesReviewStatus, out *authorization.SubjectRulesReviewStatus, s conversion.Scope) error {
|
||||
return autoConvert_v1_SubjectRulesReviewStatus_To_authorization_SubjectRulesReviewStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_authorization_SubjectRulesReviewStatus_To_v1_SubjectRulesReviewStatus(in *authorization.SubjectRulesReviewStatus, out *v1.SubjectRulesReviewStatus, s conversion.Scope) error {
|
||||
out.ResourceRules = *(*[]v1.ResourceRule)(unsafe.Pointer(&in.ResourceRules))
|
||||
out.NonResourceRules = *(*[]v1.NonResourceRule)(unsafe.Pointer(&in.NonResourceRules))
|
||||
out.Incomplete = in.Incomplete
|
||||
out.EvaluationError = in.EvaluationError
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_authorization_SubjectRulesReviewStatus_To_v1_SubjectRulesReviewStatus is an autogenerated conversion function.
|
||||
func Convert_authorization_SubjectRulesReviewStatus_To_v1_SubjectRulesReviewStatus(in *authorization.SubjectRulesReviewStatus, out *v1.SubjectRulesReviewStatus, s conversion.Scope) error {
|
||||
return autoConvert_authorization_SubjectRulesReviewStatus_To_v1_SubjectRulesReviewStatus(in, out, s)
|
||||
}
|
||||
|
|
|
@ -40,18 +40,28 @@ func RegisterConversions(scheme *runtime.Scheme) error {
|
|||
Convert_authorization_LocalSubjectAccessReview_To_v1beta1_LocalSubjectAccessReview,
|
||||
Convert_v1beta1_NonResourceAttributes_To_authorization_NonResourceAttributes,
|
||||
Convert_authorization_NonResourceAttributes_To_v1beta1_NonResourceAttributes,
|
||||
Convert_v1beta1_NonResourceRule_To_authorization_NonResourceRule,
|
||||
Convert_authorization_NonResourceRule_To_v1beta1_NonResourceRule,
|
||||
Convert_v1beta1_ResourceAttributes_To_authorization_ResourceAttributes,
|
||||
Convert_authorization_ResourceAttributes_To_v1beta1_ResourceAttributes,
|
||||
Convert_v1beta1_ResourceRule_To_authorization_ResourceRule,
|
||||
Convert_authorization_ResourceRule_To_v1beta1_ResourceRule,
|
||||
Convert_v1beta1_SelfSubjectAccessReview_To_authorization_SelfSubjectAccessReview,
|
||||
Convert_authorization_SelfSubjectAccessReview_To_v1beta1_SelfSubjectAccessReview,
|
||||
Convert_v1beta1_SelfSubjectAccessReviewSpec_To_authorization_SelfSubjectAccessReviewSpec,
|
||||
Convert_authorization_SelfSubjectAccessReviewSpec_To_v1beta1_SelfSubjectAccessReviewSpec,
|
||||
Convert_v1beta1_SelfSubjectRulesReview_To_authorization_SelfSubjectRulesReview,
|
||||
Convert_authorization_SelfSubjectRulesReview_To_v1beta1_SelfSubjectRulesReview,
|
||||
Convert_v1beta1_SelfSubjectRulesReviewSpec_To_authorization_SelfSubjectRulesReviewSpec,
|
||||
Convert_authorization_SelfSubjectRulesReviewSpec_To_v1beta1_SelfSubjectRulesReviewSpec,
|
||||
Convert_v1beta1_SubjectAccessReview_To_authorization_SubjectAccessReview,
|
||||
Convert_authorization_SubjectAccessReview_To_v1beta1_SubjectAccessReview,
|
||||
Convert_v1beta1_SubjectAccessReviewSpec_To_authorization_SubjectAccessReviewSpec,
|
||||
Convert_authorization_SubjectAccessReviewSpec_To_v1beta1_SubjectAccessReviewSpec,
|
||||
Convert_v1beta1_SubjectAccessReviewStatus_To_authorization_SubjectAccessReviewStatus,
|
||||
Convert_authorization_SubjectAccessReviewStatus_To_v1beta1_SubjectAccessReviewStatus,
|
||||
Convert_v1beta1_SubjectRulesReviewStatus_To_authorization_SubjectRulesReviewStatus,
|
||||
Convert_authorization_SubjectRulesReviewStatus_To_v1beta1_SubjectRulesReviewStatus,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -109,6 +119,28 @@ func Convert_authorization_NonResourceAttributes_To_v1beta1_NonResourceAttribute
|
|||
return autoConvert_authorization_NonResourceAttributes_To_v1beta1_NonResourceAttributes(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_NonResourceRule_To_authorization_NonResourceRule(in *v1beta1.NonResourceRule, out *authorization.NonResourceRule, s conversion.Scope) error {
|
||||
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
|
||||
out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_NonResourceRule_To_authorization_NonResourceRule is an autogenerated conversion function.
|
||||
func Convert_v1beta1_NonResourceRule_To_authorization_NonResourceRule(in *v1beta1.NonResourceRule, out *authorization.NonResourceRule, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_NonResourceRule_To_authorization_NonResourceRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_authorization_NonResourceRule_To_v1beta1_NonResourceRule(in *authorization.NonResourceRule, out *v1beta1.NonResourceRule, s conversion.Scope) error {
|
||||
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
|
||||
out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_authorization_NonResourceRule_To_v1beta1_NonResourceRule is an autogenerated conversion function.
|
||||
func Convert_authorization_NonResourceRule_To_v1beta1_NonResourceRule(in *authorization.NonResourceRule, out *v1beta1.NonResourceRule, s conversion.Scope) error {
|
||||
return autoConvert_authorization_NonResourceRule_To_v1beta1_NonResourceRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_ResourceAttributes_To_authorization_ResourceAttributes(in *v1beta1.ResourceAttributes, out *authorization.ResourceAttributes, s conversion.Scope) error {
|
||||
out.Namespace = in.Namespace
|
||||
out.Verb = in.Verb
|
||||
|
@ -141,6 +173,32 @@ func Convert_authorization_ResourceAttributes_To_v1beta1_ResourceAttributes(in *
|
|||
return autoConvert_authorization_ResourceAttributes_To_v1beta1_ResourceAttributes(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_ResourceRule_To_authorization_ResourceRule(in *v1beta1.ResourceRule, out *authorization.ResourceRule, s conversion.Scope) error {
|
||||
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
|
||||
out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups))
|
||||
out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
|
||||
out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_ResourceRule_To_authorization_ResourceRule is an autogenerated conversion function.
|
||||
func Convert_v1beta1_ResourceRule_To_authorization_ResourceRule(in *v1beta1.ResourceRule, out *authorization.ResourceRule, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_ResourceRule_To_authorization_ResourceRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_authorization_ResourceRule_To_v1beta1_ResourceRule(in *authorization.ResourceRule, out *v1beta1.ResourceRule, s conversion.Scope) error {
|
||||
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
|
||||
out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups))
|
||||
out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
|
||||
out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_authorization_ResourceRule_To_v1beta1_ResourceRule is an autogenerated conversion function.
|
||||
func Convert_authorization_ResourceRule_To_v1beta1_ResourceRule(in *authorization.ResourceRule, out *v1beta1.ResourceRule, s conversion.Scope) error {
|
||||
return autoConvert_authorization_ResourceRule_To_v1beta1_ResourceRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_SelfSubjectAccessReview_To_authorization_SelfSubjectAccessReview(in *v1beta1.SelfSubjectAccessReview, out *authorization.SelfSubjectAccessReview, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1beta1_SelfSubjectAccessReviewSpec_To_authorization_SelfSubjectAccessReviewSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
|
@ -195,6 +253,58 @@ func Convert_authorization_SelfSubjectAccessReviewSpec_To_v1beta1_SelfSubjectAcc
|
|||
return autoConvert_authorization_SelfSubjectAccessReviewSpec_To_v1beta1_SelfSubjectAccessReviewSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_SelfSubjectRulesReview_To_authorization_SelfSubjectRulesReview(in *v1beta1.SelfSubjectRulesReview, out *authorization.SelfSubjectRulesReview, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1beta1_SelfSubjectRulesReviewSpec_To_authorization_SelfSubjectRulesReviewSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_SubjectRulesReviewStatus_To_authorization_SubjectRulesReviewStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_SelfSubjectRulesReview_To_authorization_SelfSubjectRulesReview is an autogenerated conversion function.
|
||||
func Convert_v1beta1_SelfSubjectRulesReview_To_authorization_SelfSubjectRulesReview(in *v1beta1.SelfSubjectRulesReview, out *authorization.SelfSubjectRulesReview, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_SelfSubjectRulesReview_To_authorization_SelfSubjectRulesReview(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_authorization_SelfSubjectRulesReview_To_v1beta1_SelfSubjectRulesReview(in *authorization.SelfSubjectRulesReview, out *v1beta1.SelfSubjectRulesReview, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_authorization_SelfSubjectRulesReviewSpec_To_v1beta1_SelfSubjectRulesReviewSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_authorization_SubjectRulesReviewStatus_To_v1beta1_SubjectRulesReviewStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_authorization_SelfSubjectRulesReview_To_v1beta1_SelfSubjectRulesReview is an autogenerated conversion function.
|
||||
func Convert_authorization_SelfSubjectRulesReview_To_v1beta1_SelfSubjectRulesReview(in *authorization.SelfSubjectRulesReview, out *v1beta1.SelfSubjectRulesReview, s conversion.Scope) error {
|
||||
return autoConvert_authorization_SelfSubjectRulesReview_To_v1beta1_SelfSubjectRulesReview(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_SelfSubjectRulesReviewSpec_To_authorization_SelfSubjectRulesReviewSpec(in *v1beta1.SelfSubjectRulesReviewSpec, out *authorization.SelfSubjectRulesReviewSpec, s conversion.Scope) error {
|
||||
out.Namespace = in.Namespace
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_SelfSubjectRulesReviewSpec_To_authorization_SelfSubjectRulesReviewSpec is an autogenerated conversion function.
|
||||
func Convert_v1beta1_SelfSubjectRulesReviewSpec_To_authorization_SelfSubjectRulesReviewSpec(in *v1beta1.SelfSubjectRulesReviewSpec, out *authorization.SelfSubjectRulesReviewSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_SelfSubjectRulesReviewSpec_To_authorization_SelfSubjectRulesReviewSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_authorization_SelfSubjectRulesReviewSpec_To_v1beta1_SelfSubjectRulesReviewSpec(in *authorization.SelfSubjectRulesReviewSpec, out *v1beta1.SelfSubjectRulesReviewSpec, s conversion.Scope) error {
|
||||
out.Namespace = in.Namespace
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_authorization_SelfSubjectRulesReviewSpec_To_v1beta1_SelfSubjectRulesReviewSpec is an autogenerated conversion function.
|
||||
func Convert_authorization_SelfSubjectRulesReviewSpec_To_v1beta1_SelfSubjectRulesReviewSpec(in *authorization.SelfSubjectRulesReviewSpec, out *v1beta1.SelfSubjectRulesReviewSpec, s conversion.Scope) error {
|
||||
return autoConvert_authorization_SelfSubjectRulesReviewSpec_To_v1beta1_SelfSubjectRulesReviewSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_SubjectAccessReview_To_authorization_SubjectAccessReview(in *v1beta1.SubjectAccessReview, out *authorization.SubjectAccessReview, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1beta1_SubjectAccessReviewSpec_To_authorization_SubjectAccessReviewSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
|
@ -280,3 +390,29 @@ func autoConvert_authorization_SubjectAccessReviewStatus_To_v1beta1_SubjectAcces
|
|||
func Convert_authorization_SubjectAccessReviewStatus_To_v1beta1_SubjectAccessReviewStatus(in *authorization.SubjectAccessReviewStatus, out *v1beta1.SubjectAccessReviewStatus, s conversion.Scope) error {
|
||||
return autoConvert_authorization_SubjectAccessReviewStatus_To_v1beta1_SubjectAccessReviewStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_SubjectRulesReviewStatus_To_authorization_SubjectRulesReviewStatus(in *v1beta1.SubjectRulesReviewStatus, out *authorization.SubjectRulesReviewStatus, s conversion.Scope) error {
|
||||
out.ResourceRules = *(*[]authorization.ResourceRule)(unsafe.Pointer(&in.ResourceRules))
|
||||
out.NonResourceRules = *(*[]authorization.NonResourceRule)(unsafe.Pointer(&in.NonResourceRules))
|
||||
out.Incomplete = in.Incomplete
|
||||
out.EvaluationError = in.EvaluationError
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_SubjectRulesReviewStatus_To_authorization_SubjectRulesReviewStatus is an autogenerated conversion function.
|
||||
func Convert_v1beta1_SubjectRulesReviewStatus_To_authorization_SubjectRulesReviewStatus(in *v1beta1.SubjectRulesReviewStatus, out *authorization.SubjectRulesReviewStatus, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_SubjectRulesReviewStatus_To_authorization_SubjectRulesReviewStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_authorization_SubjectRulesReviewStatus_To_v1beta1_SubjectRulesReviewStatus(in *authorization.SubjectRulesReviewStatus, out *v1beta1.SubjectRulesReviewStatus, s conversion.Scope) error {
|
||||
out.ResourceRules = *(*[]v1beta1.ResourceRule)(unsafe.Pointer(&in.ResourceRules))
|
||||
out.NonResourceRules = *(*[]v1beta1.NonResourceRule)(unsafe.Pointer(&in.NonResourceRules))
|
||||
out.Incomplete = in.Incomplete
|
||||
out.EvaluationError = in.EvaluationError
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_authorization_SubjectRulesReviewStatus_To_v1beta1_SubjectRulesReviewStatus is an autogenerated conversion function.
|
||||
func Convert_authorization_SubjectRulesReviewStatus_To_v1beta1_SubjectRulesReviewStatus(in *authorization.SubjectRulesReviewStatus, out *v1beta1.SubjectRulesReviewStatus, s conversion.Scope) error {
|
||||
return autoConvert_authorization_SubjectRulesReviewStatus_To_v1beta1_SubjectRulesReviewStatus(in, out, s)
|
||||
}
|
||||
|
|
|
@ -50,6 +50,10 @@ func ValidateSelfSubjectAccessReviewSpec(spec authorizationapi.SelfSubjectAccess
|
|||
return allErrs
|
||||
}
|
||||
|
||||
func ValidateSelfSubjectRulesReview(review *authorizationapi.SelfSubjectRulesReview) field.ErrorList {
|
||||
return field.ErrorList{}
|
||||
}
|
||||
|
||||
func ValidateSubjectAccessReview(sar *authorizationapi.SubjectAccessReview) field.ErrorList {
|
||||
allErrs := ValidateSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec"))
|
||||
if !apiequality.Semantic.DeepEqual(metav1.ObjectMeta{}, sar.ObjectMeta) {
|
||||
|
|
|
@ -44,10 +44,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
|||
in.(*NonResourceAttributes).DeepCopyInto(out.(*NonResourceAttributes))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&NonResourceAttributes{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*NonResourceRule).DeepCopyInto(out.(*NonResourceRule))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&NonResourceRule{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*ResourceAttributes).DeepCopyInto(out.(*ResourceAttributes))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&ResourceAttributes{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*ResourceRule).DeepCopyInto(out.(*ResourceRule))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&ResourceRule{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SelfSubjectAccessReview).DeepCopyInto(out.(*SelfSubjectAccessReview))
|
||||
return nil
|
||||
|
@ -56,6 +64,14 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
|||
in.(*SelfSubjectAccessReviewSpec).DeepCopyInto(out.(*SelfSubjectAccessReviewSpec))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SelfSubjectAccessReviewSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SelfSubjectRulesReview).DeepCopyInto(out.(*SelfSubjectRulesReview))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SelfSubjectRulesReview{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SelfSubjectRulesReviewSpec).DeepCopyInto(out.(*SelfSubjectRulesReviewSpec))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SelfSubjectRulesReviewSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SubjectAccessReview).DeepCopyInto(out.(*SubjectAccessReview))
|
||||
return nil
|
||||
|
@ -68,6 +84,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
|||
in.(*SubjectAccessReviewStatus).DeepCopyInto(out.(*SubjectAccessReviewStatus))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SubjectAccessReviewStatus{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SubjectRulesReviewStatus).DeepCopyInto(out.(*SubjectRulesReviewStatus))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SubjectRulesReviewStatus{})},
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -116,6 +136,32 @@ func (in *NonResourceAttributes) DeepCopy() *NonResourceAttributes {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NonResourceRule) DeepCopyInto(out *NonResourceRule) {
|
||||
*out = *in
|
||||
if in.Verbs != nil {
|
||||
in, out := &in.Verbs, &out.Verbs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.NonResourceURLs != nil {
|
||||
in, out := &in.NonResourceURLs, &out.NonResourceURLs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NonResourceRule.
|
||||
func (in *NonResourceRule) DeepCopy() *NonResourceRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NonResourceRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceAttributes) DeepCopyInto(out *ResourceAttributes) {
|
||||
*out = *in
|
||||
|
@ -132,6 +178,42 @@ func (in *ResourceAttributes) DeepCopy() *ResourceAttributes {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceRule) DeepCopyInto(out *ResourceRule) {
|
||||
*out = *in
|
||||
if in.Verbs != nil {
|
||||
in, out := &in.Verbs, &out.Verbs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.APIGroups != nil {
|
||||
in, out := &in.APIGroups, &out.APIGroups
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Resources != nil {
|
||||
in, out := &in.Resources, &out.Resources
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ResourceNames != nil {
|
||||
in, out := &in.ResourceNames, &out.ResourceNames
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRule.
|
||||
func (in *ResourceRule) DeepCopy() *ResourceRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourceRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SelfSubjectAccessReview) DeepCopyInto(out *SelfSubjectAccessReview) {
|
||||
*out = *in
|
||||
|
@ -195,6 +277,51 @@ func (in *SelfSubjectAccessReviewSpec) DeepCopy() *SelfSubjectAccessReviewSpec {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SelfSubjectRulesReview) DeepCopyInto(out *SelfSubjectRulesReview) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Spec = in.Spec
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SelfSubjectRulesReview.
|
||||
func (in *SelfSubjectRulesReview) DeepCopy() *SelfSubjectRulesReview {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SelfSubjectRulesReview)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *SelfSubjectRulesReview) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SelfSubjectRulesReviewSpec) DeepCopyInto(out *SelfSubjectRulesReviewSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SelfSubjectRulesReviewSpec.
|
||||
func (in *SelfSubjectRulesReviewSpec) DeepCopy() *SelfSubjectRulesReviewSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SelfSubjectRulesReviewSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SubjectAccessReview) DeepCopyInto(out *SubjectAccessReview) {
|
||||
*out = *in
|
||||
|
@ -286,3 +413,33 @@ func (in *SubjectAccessReviewStatus) DeepCopy() *SubjectAccessReviewStatus {
|
|||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SubjectRulesReviewStatus) DeepCopyInto(out *SubjectRulesReviewStatus) {
|
||||
*out = *in
|
||||
if in.ResourceRules != nil {
|
||||
in, out := &in.ResourceRules, &out.ResourceRules
|
||||
*out = make([]ResourceRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.NonResourceRules != nil {
|
||||
in, out := &in.NonResourceRules, &out.NonResourceRules
|
||||
*out = make([]NonResourceRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubjectRulesReviewStatus.
|
||||
func (in *SubjectRulesReviewStatus) DeepCopy() *SubjectRulesReviewStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SubjectRulesReviewStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ go_library(
|
|||
"//pkg/apis/abac/v0:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/golang/glog"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apiserver/pkg/authentication/user"
|
||||
"k8s.io/apiserver/pkg/authorization/authorizer"
|
||||
api "k8s.io/kubernetes/pkg/apis/abac"
|
||||
_ "k8s.io/kubernetes/pkg/apis/abac/latest"
|
||||
|
@ -114,7 +115,7 @@ func NewFromFile(path string) (policyList, error) {
|
|||
}
|
||||
|
||||
func matches(p api.Policy, a authorizer.Attributes) bool {
|
||||
if subjectMatches(p, a) {
|
||||
if subjectMatches(p, a.GetUser()) {
|
||||
if verbMatches(p, a) {
|
||||
// Resource and non-resource requests are mutually exclusive, at most one will match a policy
|
||||
if resourceMatches(p, a) {
|
||||
|
@ -129,15 +130,14 @@ func matches(p api.Policy, a authorizer.Attributes) bool {
|
|||
}
|
||||
|
||||
// subjectMatches returns true if specified user and group properties in the policy match the attributes
|
||||
func subjectMatches(p api.Policy, a authorizer.Attributes) bool {
|
||||
func subjectMatches(p api.Policy, user user.Info) bool {
|
||||
matched := false
|
||||
|
||||
username := ""
|
||||
groups := []string{}
|
||||
if user := a.GetUser(); user != nil {
|
||||
username = user.GetName()
|
||||
groups = user.GetGroups()
|
||||
if user == nil {
|
||||
return false
|
||||
}
|
||||
username := user.GetName()
|
||||
groups := user.GetGroups()
|
||||
|
||||
// If the policy specified a user, ensure it matches
|
||||
if len(p.Spec.User) > 0 {
|
||||
|
@ -232,3 +232,42 @@ func (pl policyList) Authorize(a authorizer.Attributes) (bool, string, error) {
|
|||
// policy file, compared to other steps such as encoding/decoding.
|
||||
// Then, add Caching only if needed.
|
||||
}
|
||||
|
||||
func (pl policyList) RulesFor(user user.Info, namespace string) ([]authorizer.ResourceRuleInfo, []authorizer.NonResourceRuleInfo, bool, error) {
|
||||
var (
|
||||
resourceRules []authorizer.ResourceRuleInfo
|
||||
nonResourceRules []authorizer.NonResourceRuleInfo
|
||||
)
|
||||
|
||||
for _, p := range pl {
|
||||
if subjectMatches(*p, user) {
|
||||
if p.Spec.Namespace == "*" || p.Spec.Namespace == namespace {
|
||||
if len(p.Spec.Resource) > 0 {
|
||||
r := authorizer.DefaultResourceRuleInfo{
|
||||
Verbs: getVerbs(p.Spec.Readonly),
|
||||
APIGroups: []string{p.Spec.APIGroup},
|
||||
Resources: []string{p.Spec.Resource},
|
||||
}
|
||||
var resourceRule authorizer.ResourceRuleInfo = &r
|
||||
resourceRules = append(resourceRules, resourceRule)
|
||||
}
|
||||
if len(p.Spec.NonResourcePath) > 0 {
|
||||
r := authorizer.DefaultNonResourceRuleInfo{
|
||||
Verbs: getVerbs(p.Spec.Readonly),
|
||||
NonResourceURLs: []string{p.Spec.NonResourcePath},
|
||||
}
|
||||
var nonResourceRule authorizer.NonResourceRuleInfo = &r
|
||||
nonResourceRules = append(nonResourceRules, nonResourceRule)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resourceRules, nonResourceRules, false, nil
|
||||
}
|
||||
|
||||
func getVerbs(isReadOnly bool) []string {
|
||||
if isReadOnly {
|
||||
return []string{"get", "list", "watch"}
|
||||
}
|
||||
return []string{"*"}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package abac
|
|||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
@ -141,6 +142,203 @@ func TestAuthorizeV0(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func getResourceRules(infos []authorizer.ResourceRuleInfo) []authorizer.DefaultResourceRuleInfo {
|
||||
rules := make([]authorizer.DefaultResourceRuleInfo, len(infos))
|
||||
for i, info := range infos {
|
||||
rules[i] = authorizer.DefaultResourceRuleInfo{
|
||||
Verbs: info.GetVerbs(),
|
||||
APIGroups: info.GetAPIGroups(),
|
||||
Resources: info.GetResources(),
|
||||
ResourceNames: info.GetResourceNames(),
|
||||
}
|
||||
}
|
||||
return rules
|
||||
}
|
||||
|
||||
func getNonResourceRules(infos []authorizer.NonResourceRuleInfo) []authorizer.DefaultNonResourceRuleInfo {
|
||||
rules := make([]authorizer.DefaultNonResourceRuleInfo, len(infos))
|
||||
for i, info := range infos {
|
||||
rules[i] = authorizer.DefaultNonResourceRuleInfo{
|
||||
Verbs: info.GetVerbs(),
|
||||
NonResourceURLs: info.GetNonResourceURLs(),
|
||||
}
|
||||
}
|
||||
return rules
|
||||
}
|
||||
|
||||
func TestRulesFor(t *testing.T) {
|
||||
a, err := newWithContents(t, `
|
||||
{ "readonly": true, "resource": "events" }
|
||||
{"user":"scheduler", "readonly": true, "resource": "pods" }
|
||||
{"user":"scheduler", "resource": "bindings" }
|
||||
{"user":"kubelet", "readonly": true, "resource": "pods" }
|
||||
{"user":"kubelet", "resource": "events" }
|
||||
{"user":"alice", "namespace": "projectCaribou"}
|
||||
{"user":"bob", "readonly": true, "namespace": "projectCaribou"}
|
||||
{"user":"bob", "readonly": true, "nonResourcePath": "*"}
|
||||
{"group":"a", "resource": "bindings" }
|
||||
{"group":"b", "readonly": true, "nonResourcePath": "*"}
|
||||
`)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to read policy file: %v", err)
|
||||
}
|
||||
|
||||
authenticatedGroup := []string{user.AllAuthenticated}
|
||||
|
||||
uScheduler := user.DefaultInfo{Name: "scheduler", UID: "uid1", Groups: authenticatedGroup}
|
||||
uKubelet := user.DefaultInfo{Name: "kubelet", UID: "uid2", Groups: []string{"a", "b"}}
|
||||
uAlice := user.DefaultInfo{Name: "alice", UID: "uid3", Groups: authenticatedGroup}
|
||||
uBob := user.DefaultInfo{Name: "bob", UID: "uid4", Groups: authenticatedGroup}
|
||||
uChuck := user.DefaultInfo{Name: "chuck", UID: "uid5", Groups: []string{"a", "b"}}
|
||||
|
||||
testCases := []struct {
|
||||
User user.DefaultInfo
|
||||
Namespace string
|
||||
ExpectResourceRules []authorizer.DefaultResourceRuleInfo
|
||||
ExpectNonResourceRules []authorizer.DefaultNonResourceRuleInfo
|
||||
}{
|
||||
{
|
||||
User: uScheduler,
|
||||
Namespace: "ns1",
|
||||
ExpectResourceRules: []authorizer.DefaultResourceRuleInfo{
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"events"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"pods"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"*"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"bindings"},
|
||||
},
|
||||
},
|
||||
ExpectNonResourceRules: []authorizer.DefaultNonResourceRuleInfo{},
|
||||
},
|
||||
{
|
||||
User: uKubelet,
|
||||
Namespace: "ns1",
|
||||
ExpectResourceRules: []authorizer.DefaultResourceRuleInfo{
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"pods"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"*"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"events"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"*"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"bindings"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"*"},
|
||||
},
|
||||
},
|
||||
ExpectNonResourceRules: []authorizer.DefaultNonResourceRuleInfo{
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
NonResourceURLs: []string{"*"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
User: uAlice,
|
||||
Namespace: "projectCaribou",
|
||||
ExpectResourceRules: []authorizer.DefaultResourceRuleInfo{
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"events"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"*"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"*"},
|
||||
},
|
||||
},
|
||||
ExpectNonResourceRules: []authorizer.DefaultNonResourceRuleInfo{},
|
||||
},
|
||||
{
|
||||
User: uBob,
|
||||
Namespace: "projectCaribou",
|
||||
ExpectResourceRules: []authorizer.DefaultResourceRuleInfo{
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"events"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"*"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"*"},
|
||||
},
|
||||
},
|
||||
ExpectNonResourceRules: []authorizer.DefaultNonResourceRuleInfo{
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
NonResourceURLs: []string{"*"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
User: uChuck,
|
||||
Namespace: "ns1",
|
||||
ExpectResourceRules: []authorizer.DefaultResourceRuleInfo{
|
||||
{
|
||||
Verbs: []string{"*"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"bindings"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"*"},
|
||||
},
|
||||
},
|
||||
ExpectNonResourceRules: []authorizer.DefaultNonResourceRuleInfo{
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
NonResourceURLs: []string{"*"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for i, tc := range testCases {
|
||||
attr := authorizer.AttributesRecord{
|
||||
User: &tc.User,
|
||||
Namespace: tc.Namespace,
|
||||
}
|
||||
resourceRules, nonResourceRules, _, _ := a.RulesFor(attr.GetUser(), attr.GetNamespace())
|
||||
actualResourceRules := getResourceRules(resourceRules)
|
||||
if !reflect.DeepEqual(tc.ExpectResourceRules, actualResourceRules) {
|
||||
t.Logf("tc: %v -> attr %v", tc, attr)
|
||||
t.Errorf("%d: Expected: \n%#v\n but actual: \n%#v\n",
|
||||
i, tc.ExpectResourceRules, actualResourceRules)
|
||||
}
|
||||
actualNonResourceRules := getNonResourceRules(nonResourceRules)
|
||||
if !reflect.DeepEqual(tc.ExpectNonResourceRules, actualNonResourceRules) {
|
||||
t.Logf("tc: %v -> attr %v", tc, attr)
|
||||
t.Errorf("%d: Expected: \n%#v\n but actual: \n%#v\n",
|
||||
i, tc.ExpectNonResourceRules, actualNonResourceRules)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuthorizeV1beta1(t *testing.T) {
|
||||
a, err := newWithContents(t,
|
||||
`
|
||||
|
@ -609,7 +807,7 @@ func TestSubjectMatches(t *testing.T) {
|
|||
attr := authorizer.AttributesRecord{
|
||||
User: &tc.User,
|
||||
}
|
||||
actualMatch := subjectMatches(*policy, attr)
|
||||
actualMatch := subjectMatches(*policy, attr.GetUser())
|
||||
if tc.ExpectMatch != actualMatch {
|
||||
t.Errorf("%v: Expected actorMatches=%v but actually got=%v",
|
||||
k, tc.ExpectMatch, actualMatch)
|
||||
|
@ -617,7 +815,7 @@ func TestSubjectMatches(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func newWithContents(t *testing.T, contents string) (authorizer.Authorizer, error) {
|
||||
func newWithContents(t *testing.T, contents string) (policyList, error) {
|
||||
f, err := ioutil.TempFile("", "abac_test")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error creating policyfile: %v", err)
|
||||
|
|
|
@ -15,6 +15,8 @@ go_library(
|
|||
"localsubjectaccessreview_expansion.go",
|
||||
"selfsubjectaccessreview.go",
|
||||
"selfsubjectaccessreview_expansion.go",
|
||||
"selfsubjectrulesreview.go",
|
||||
"selfsubjectrulesreview_expansion.go",
|
||||
"subjectaccessreview.go",
|
||||
"subjectaccessreview_expansion.go",
|
||||
],
|
||||
|
|
|
@ -25,6 +25,7 @@ type AuthorizationInterface interface {
|
|||
RESTClient() rest.Interface
|
||||
LocalSubjectAccessReviewsGetter
|
||||
SelfSubjectAccessReviewsGetter
|
||||
SelfSubjectRulesReviewsGetter
|
||||
SubjectAccessReviewsGetter
|
||||
}
|
||||
|
||||
|
@ -41,6 +42,10 @@ func (c *AuthorizationClient) SelfSubjectAccessReviews() SelfSubjectAccessReview
|
|||
return newSelfSubjectAccessReviews(c)
|
||||
}
|
||||
|
||||
func (c *AuthorizationClient) SelfSubjectRulesReviews() SelfSubjectRulesReviewInterface {
|
||||
return newSelfSubjectRulesReviews(c)
|
||||
}
|
||||
|
||||
func (c *AuthorizationClient) SubjectAccessReviews() SubjectAccessReviewInterface {
|
||||
return newSubjectAccessReviews(c)
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ go_library(
|
|||
"fake_localsubjectaccessreview_expansion.go",
|
||||
"fake_selfsubjectaccessreview.go",
|
||||
"fake_selfsubjectaccessreview_expansion.go",
|
||||
"fake_selfsubjectrulesreview.go",
|
||||
"fake_selfsubjectrulesreview_expansion.go",
|
||||
"fake_subjectaccessreview.go",
|
||||
"fake_subjectaccessreview_expansion.go",
|
||||
],
|
||||
|
|
|
@ -34,6 +34,10 @@ func (c *FakeAuthorization) SelfSubjectAccessReviews() internalversion.SelfSubje
|
|||
return &FakeSelfSubjectAccessReviews{c}
|
||||
}
|
||||
|
||||
func (c *FakeAuthorization) SelfSubjectRulesReviews() internalversion.SelfSubjectRulesReviewInterface {
|
||||
return &FakeSelfSubjectRulesReviews{c}
|
||||
}
|
||||
|
||||
func (c *FakeAuthorization) SubjectAccessReviews() internalversion.SubjectAccessReviewInterface {
|
||||
return &FakeSubjectAccessReviews{c}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package fake
|
||||
|
||||
// FakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface
|
||||
type FakeSelfSubjectRulesReviews struct {
|
||||
Fake *FakeAuthorization
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
core "k8s.io/client-go/testing"
|
||||
authorizationapi "k8s.io/kubernetes/pkg/apis/authorization"
|
||||
)
|
||||
|
||||
func (c *FakeSelfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
|
||||
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"), srr), &authorizationapi.SelfSubjectRulesReview{})
|
||||
return obj.(*authorizationapi.SelfSubjectRulesReview), err
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// SelfSubjectRulesReviewsGetter has a method to return a SelfSubjectRulesReviewInterface.
|
||||
// A group's client should implement this interface.
|
||||
type SelfSubjectRulesReviewsGetter interface {
|
||||
SelfSubjectRulesReviews() SelfSubjectRulesReviewInterface
|
||||
}
|
||||
|
||||
// SelfSubjectRulesReviewInterface has methods to work with SelfSubjectRulesReview resources.
|
||||
type SelfSubjectRulesReviewInterface interface {
|
||||
SelfSubjectRulesReviewExpansion
|
||||
}
|
||||
|
||||
// selfSubjectRulesReviews implements SelfSubjectRulesReviewInterface
|
||||
type selfSubjectRulesReviews struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newSelfSubjectRulesReviews returns a SelfSubjectRulesReviews
|
||||
func newSelfSubjectRulesReviews(c *AuthorizationClient) *selfSubjectRulesReviews {
|
||||
return &selfSubjectRulesReviews{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
authorizationapi "k8s.io/kubernetes/pkg/apis/authorization"
|
||||
)
|
||||
|
||||
type SelfSubjectRulesReviewExpansion interface {
|
||||
Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error)
|
||||
}
|
||||
|
||||
func (c *selfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
|
||||
result = &authorizationapi.SelfSubjectRulesReview{}
|
||||
err = c.client.Post().
|
||||
Resource("selfsubjectrulesreviews").
|
||||
Body(srr).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -11,6 +11,7 @@ go_library(
|
|||
"expansion_generated.go",
|
||||
"localsubjectaccessreview.go",
|
||||
"selfsubjectaccessreview.go",
|
||||
"selfsubjectrulesreview.go",
|
||||
"subjectaccessreview.go",
|
||||
],
|
||||
deps = [
|
||||
|
|
|
@ -30,6 +30,10 @@ type LocalSubjectAccessReviewNamespaceListerExpansion interface{}
|
|||
// SelfSubjectAccessReviewLister.
|
||||
type SelfSubjectAccessReviewListerExpansion interface{}
|
||||
|
||||
// SelfSubjectRulesReviewListerExpansion allows custom methods to be added to
|
||||
// SelfSubjectRulesReviewLister.
|
||||
type SelfSubjectRulesReviewListerExpansion interface{}
|
||||
|
||||
// SubjectAccessReviewListerExpansion allows custom methods to be added to
|
||||
// SubjectAccessReviewLister.
|
||||
type SubjectAccessReviewListerExpansion interface{}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by lister-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
authorization "k8s.io/kubernetes/pkg/apis/authorization"
|
||||
)
|
||||
|
||||
// SelfSubjectRulesReviewLister helps list SelfSubjectRulesReviews.
|
||||
type SelfSubjectRulesReviewLister interface {
|
||||
// List lists all SelfSubjectRulesReviews in the indexer.
|
||||
List(selector labels.Selector) (ret []*authorization.SelfSubjectRulesReview, err error)
|
||||
// Get retrieves the SelfSubjectRulesReview from the index for a given name.
|
||||
Get(name string) (*authorization.SelfSubjectRulesReview, error)
|
||||
SelfSubjectRulesReviewListerExpansion
|
||||
}
|
||||
|
||||
// selfSubjectRulesReviewLister implements the SelfSubjectRulesReviewLister interface.
|
||||
type selfSubjectRulesReviewLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewSelfSubjectRulesReviewLister returns a new SelfSubjectRulesReviewLister.
|
||||
func NewSelfSubjectRulesReviewLister(indexer cache.Indexer) SelfSubjectRulesReviewLister {
|
||||
return &selfSubjectRulesReviewLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all SelfSubjectRulesReviews in the indexer.
|
||||
func (s *selfSubjectRulesReviewLister) List(selector labels.Selector) (ret []*authorization.SelfSubjectRulesReview, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*authorization.SelfSubjectRulesReview))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the SelfSubjectRulesReview from the index for a given name.
|
||||
func (s *selfSubjectRulesReviewLister) Get(name string) (*authorization.SelfSubjectRulesReview, error) {
|
||||
key := &authorization.SelfSubjectRulesReview{ObjectMeta: v1.ObjectMeta{Name: name}}
|
||||
obj, exists, err := s.indexer.Get(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(authorization.Resource("selfsubjectrulesreview"), name)
|
||||
}
|
||||
return obj.(*authorization.SelfSubjectRulesReview), nil
|
||||
}
|
|
@ -359,6 +359,7 @@ var ignoredResources = map[schema.GroupResource]struct{}{
|
|||
{Group: "authorization.k8s.io", Resource: "subjectaccessreviews"}: {},
|
||||
{Group: "authorization.k8s.io", Resource: "selfsubjectaccessreviews"}: {},
|
||||
{Group: "authorization.k8s.io", Resource: "localsubjectaccessreviews"}: {},
|
||||
{Group: "authorization.k8s.io", Resource: "selfsubjectrulesreviews"}: {},
|
||||
{Group: "apiregistration.k8s.io", Resource: "apiservices"}: {},
|
||||
{Group: "apiextensions.k8s.io", Resource: "customresourcedefinitions"}: {},
|
||||
}
|
||||
|
|
|
@ -56,17 +56,20 @@ type AuthorizationConfig struct {
|
|||
|
||||
// New returns the right sort of union of multiple authorizer.Authorizer objects
|
||||
// based on the authorizationMode or an error.
|
||||
func (config AuthorizationConfig) New() (authorizer.Authorizer, error) {
|
||||
func (config AuthorizationConfig) New() (authorizer.Authorizer, authorizer.RuleResolver, error) {
|
||||
if len(config.AuthorizationModes) == 0 {
|
||||
return nil, errors.New("At least one authorization mode should be passed")
|
||||
return nil, nil, errors.New("At least one authorization mode should be passed")
|
||||
}
|
||||
|
||||
var authorizers []authorizer.Authorizer
|
||||
var (
|
||||
authorizers []authorizer.Authorizer
|
||||
ruleResolvers []authorizer.RuleResolver
|
||||
)
|
||||
authorizerMap := make(map[string]bool)
|
||||
|
||||
for _, authorizationMode := range config.AuthorizationModes {
|
||||
if authorizerMap[authorizationMode] {
|
||||
return nil, fmt.Errorf("Authorization mode %s specified more than once", authorizationMode)
|
||||
return nil, nil, fmt.Errorf("Authorization mode %s specified more than once", authorizationMode)
|
||||
}
|
||||
// Keep cases in sync with constant list above.
|
||||
switch authorizationMode {
|
||||
|
@ -81,29 +84,35 @@ func (config AuthorizationConfig) New() (authorizer.Authorizer, error) {
|
|||
authorizers = append(authorizers, nodeAuthorizer)
|
||||
|
||||
case modes.ModeAlwaysAllow:
|
||||
authorizers = append(authorizers, authorizerfactory.NewAlwaysAllowAuthorizer())
|
||||
alwaysAllowAuthorizer := authorizerfactory.NewAlwaysAllowAuthorizer()
|
||||
authorizers = append(authorizers, alwaysAllowAuthorizer)
|
||||
ruleResolvers = append(ruleResolvers, alwaysAllowAuthorizer)
|
||||
case modes.ModeAlwaysDeny:
|
||||
authorizers = append(authorizers, authorizerfactory.NewAlwaysDenyAuthorizer())
|
||||
alwaysDenyAuthorizer := authorizerfactory.NewAlwaysDenyAuthorizer()
|
||||
authorizers = append(authorizers, alwaysDenyAuthorizer)
|
||||
ruleResolvers = append(ruleResolvers, alwaysDenyAuthorizer)
|
||||
case modes.ModeABAC:
|
||||
if config.PolicyFile == "" {
|
||||
return nil, errors.New("ABAC's authorization policy file not passed")
|
||||
return nil, nil, errors.New("ABAC's authorization policy file not passed")
|
||||
}
|
||||
abacAuthorizer, err := abac.NewFromFile(config.PolicyFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, nil, err
|
||||
}
|
||||
authorizers = append(authorizers, abacAuthorizer)
|
||||
ruleResolvers = append(ruleResolvers, abacAuthorizer)
|
||||
case modes.ModeWebhook:
|
||||
if config.WebhookConfigFile == "" {
|
||||
return nil, errors.New("Webhook's configuration file not passed")
|
||||
return nil, nil, errors.New("Webhook's configuration file not passed")
|
||||
}
|
||||
webhookAuthorizer, err := webhook.New(config.WebhookConfigFile,
|
||||
config.WebhookCacheAuthorizedTTL,
|
||||
config.WebhookCacheUnauthorizedTTL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, nil, err
|
||||
}
|
||||
authorizers = append(authorizers, webhookAuthorizer)
|
||||
ruleResolvers = append(ruleResolvers, webhookAuthorizer)
|
||||
case modes.ModeRBAC:
|
||||
rbacAuthorizer := rbac.New(
|
||||
&rbac.RoleGetter{Lister: config.InformerFactory.Rbac().InternalVersion().Roles().Lister()},
|
||||
|
@ -112,18 +121,19 @@ func (config AuthorizationConfig) New() (authorizer.Authorizer, error) {
|
|||
&rbac.ClusterRoleBindingLister{Lister: config.InformerFactory.Rbac().InternalVersion().ClusterRoleBindings().Lister()},
|
||||
)
|
||||
authorizers = append(authorizers, rbacAuthorizer)
|
||||
ruleResolvers = append(ruleResolvers, rbacAuthorizer)
|
||||
default:
|
||||
return nil, fmt.Errorf("Unknown authorization mode %s specified", authorizationMode)
|
||||
return nil, nil, fmt.Errorf("Unknown authorization mode %s specified", authorizationMode)
|
||||
}
|
||||
authorizerMap[authorizationMode] = true
|
||||
}
|
||||
|
||||
if !authorizerMap[modes.ModeABAC] && config.PolicyFile != "" {
|
||||
return nil, errors.New("Cannot specify --authorization-policy-file without mode ABAC")
|
||||
return nil, nil, errors.New("Cannot specify --authorization-policy-file without mode ABAC")
|
||||
}
|
||||
if !authorizerMap[modes.ModeWebhook] && config.WebhookConfigFile != "" {
|
||||
return nil, errors.New("Cannot specify --authorization-webhook-config-file without mode Webhook")
|
||||
return nil, nil, errors.New("Cannot specify --authorization-webhook-config-file without mode Webhook")
|
||||
}
|
||||
|
||||
return union.New(authorizers...), nil
|
||||
return union.New(authorizers...), union.NewRuleResolvers(ruleResolvers...), nil
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ func TestNew(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
_, err := tt.config.New()
|
||||
_, _, err := tt.config.New()
|
||||
if tt.wantErr && (err == nil) {
|
||||
t.Errorf("New %s", tt.msg)
|
||||
} else if !tt.wantErr && (err != nil) {
|
||||
|
|
|
@ -256,7 +256,7 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget)
|
|||
// handlers that we have.
|
||||
restStorageProviders := []RESTStorageProvider{
|
||||
authenticationrest.RESTStorageProvider{Authenticator: c.GenericConfig.Authenticator},
|
||||
authorizationrest.RESTStorageProvider{Authorizer: c.GenericConfig.Authorizer},
|
||||
authorizationrest.RESTStorageProvider{Authorizer: c.GenericConfig.Authorizer, RuleResolver: c.GenericConfig.RuleResolver},
|
||||
autoscalingrest.RESTStorageProvider{},
|
||||
batchrest.RESTStorageProvider{},
|
||||
certificatesrest.RESTStorageProvider{},
|
||||
|
|
|
@ -32,6 +32,7 @@ filegroup(
|
|||
"//pkg/registry/authorization/localsubjectaccessreview:all-srcs",
|
||||
"//pkg/registry/authorization/rest:all-srcs",
|
||||
"//pkg/registry/authorization/selfsubjectaccessreview:all-srcs",
|
||||
"//pkg/registry/authorization/selfsubjectrulesreview:all-srcs",
|
||||
"//pkg/registry/authorization/subjectaccessreview:all-srcs",
|
||||
"//pkg/registry/authorization/util:all-srcs",
|
||||
"//pkg/registry/autoscaling/horizontalpodautoscaler:all-srcs",
|
||||
|
|
|
@ -13,6 +13,7 @@ go_library(
|
|||
"//pkg/apis/authorization:go_default_library",
|
||||
"//pkg/registry/authorization/localsubjectaccessreview:go_default_library",
|
||||
"//pkg/registry/authorization/selfsubjectaccessreview:go_default_library",
|
||||
"//pkg/registry/authorization/selfsubjectrulesreview:go_default_library",
|
||||
"//pkg/registry/authorization/subjectaccessreview:go_default_library",
|
||||
"//vendor/k8s.io/api/authorization/v1:go_default_library",
|
||||
"//vendor/k8s.io/api/authorization/v1beta1:go_default_library",
|
||||
|
|
|
@ -28,11 +28,13 @@ import (
|
|||
"k8s.io/kubernetes/pkg/apis/authorization"
|
||||
"k8s.io/kubernetes/pkg/registry/authorization/localsubjectaccessreview"
|
||||
"k8s.io/kubernetes/pkg/registry/authorization/selfsubjectaccessreview"
|
||||
"k8s.io/kubernetes/pkg/registry/authorization/selfsubjectrulesreview"
|
||||
"k8s.io/kubernetes/pkg/registry/authorization/subjectaccessreview"
|
||||
)
|
||||
|
||||
type RESTStorageProvider struct {
|
||||
Authorizer authorizer.Authorizer
|
||||
Authorizer authorizer.Authorizer
|
||||
RuleResolver authorizer.RuleResolver
|
||||
}
|
||||
|
||||
func (p RESTStorageProvider) NewRESTStorage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (genericapiserver.APIGroupInfo, bool) {
|
||||
|
@ -70,6 +72,9 @@ func (p RESTStorageProvider) v1beta1Storage(apiResourceConfigSource serverstorag
|
|||
if apiResourceConfigSource.ResourceEnabled(version.WithResource("localsubjectaccessreviews")) {
|
||||
storage["localsubjectaccessreviews"] = localsubjectaccessreview.NewREST(p.Authorizer)
|
||||
}
|
||||
if apiResourceConfigSource.ResourceEnabled(version.WithResource("selfsubjectrulesreviews")) {
|
||||
storage["selfsubjectrulesreviews"] = selfsubjectrulesreview.NewREST(p.RuleResolver)
|
||||
}
|
||||
|
||||
return storage
|
||||
}
|
||||
|
@ -87,6 +92,9 @@ func (p RESTStorageProvider) v1Storage(apiResourceConfigSource serverstorage.API
|
|||
if apiResourceConfigSource.ResourceEnabled(version.WithResource("localsubjectaccessreviews")) {
|
||||
storage["localsubjectaccessreviews"] = localsubjectaccessreview.NewREST(p.Authorizer)
|
||||
}
|
||||
if apiResourceConfigSource.ResourceEnabled(version.WithResource("selfsubjectrulesreviews")) {
|
||||
storage["selfsubjectrulesreviews"] = selfsubjectrulesreview.NewREST(p.RuleResolver)
|
||||
}
|
||||
|
||||
return storage
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["rest.go"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//pkg/apis/authorization:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/endpoints/request:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package selfsubjectrulesreview
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apiserver/pkg/authorization/authorizer"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
authorizationapi "k8s.io/kubernetes/pkg/apis/authorization"
|
||||
)
|
||||
|
||||
// REST implements a RESTStorage for selfsubjectrulesreview.
|
||||
type REST struct {
|
||||
ruleResolver authorizer.RuleResolver
|
||||
}
|
||||
|
||||
// NewREST returns a RESTStorage object that will work against selfsubjectrulesreview.
|
||||
func NewREST(ruleResolver authorizer.RuleResolver) *REST {
|
||||
return &REST{ruleResolver}
|
||||
}
|
||||
|
||||
// New creates a new selfsubjectrulesreview object.
|
||||
func (r *REST) New() runtime.Object {
|
||||
return &authorizationapi.SelfSubjectRulesReview{}
|
||||
}
|
||||
|
||||
// Create attempts to get self subject rules in specific namespace.
|
||||
func (r *REST) Create(ctx genericapirequest.Context, obj runtime.Object, includeUninitialized bool) (runtime.Object, error) {
|
||||
selfSRR, ok := obj.(*authorizationapi.SelfSubjectRulesReview)
|
||||
if !ok {
|
||||
return nil, apierrors.NewBadRequest(fmt.Sprintf("not a SelfSubjectRulesReview: %#v", obj))
|
||||
}
|
||||
|
||||
user, ok := genericapirequest.UserFrom(ctx)
|
||||
if !ok {
|
||||
return nil, apierrors.NewBadRequest("no user present on request")
|
||||
}
|
||||
|
||||
namespace := selfSRR.Spec.Namespace
|
||||
if namespace == "" {
|
||||
return nil, apierrors.NewBadRequest("no namespace on request")
|
||||
}
|
||||
resourceInfo, nonResourceInfo, incomplete, err := r.ruleResolver.RulesFor(user, namespace)
|
||||
|
||||
ret := &authorizationapi.SelfSubjectRulesReview{
|
||||
Status: authorizationapi.SubjectRulesReviewStatus{
|
||||
ResourceRules: getResourceRules(resourceInfo),
|
||||
NonResourceRules: getNonResourceRules(nonResourceInfo),
|
||||
Incomplete: incomplete,
|
||||
},
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
ret.Status.EvaluationError = err.Error()
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func getResourceRules(infos []authorizer.ResourceRuleInfo) []authorizationapi.ResourceRule {
|
||||
rules := make([]authorizationapi.ResourceRule, len(infos))
|
||||
for i, info := range infos {
|
||||
rules[i] = authorizationapi.ResourceRule{
|
||||
Verbs: info.GetVerbs(),
|
||||
APIGroups: info.GetAPIGroups(),
|
||||
Resources: info.GetResources(),
|
||||
ResourceNames: info.GetResourceNames(),
|
||||
}
|
||||
}
|
||||
return rules
|
||||
}
|
||||
|
||||
func getNonResourceRules(infos []authorizer.NonResourceRuleInfo) []authorizationapi.NonResourceRule {
|
||||
rules := make([]authorizationapi.NonResourceRule, len(infos))
|
||||
for i, info := range infos {
|
||||
rules[i] = authorizationapi.NonResourceRule{
|
||||
Verbs: info.GetVerbs(),
|
||||
NonResourceURLs: info.GetNonResourceURLs(),
|
||||
}
|
||||
}
|
||||
return rules
|
||||
}
|
|
@ -123,6 +123,36 @@ func (r *RBACAuthorizer) Authorize(requestAttributes authorizer.Attributes) (boo
|
|||
return false, reason, nil
|
||||
}
|
||||
|
||||
func (r *RBACAuthorizer) RulesFor(user user.Info, namespace string) ([]authorizer.ResourceRuleInfo, []authorizer.NonResourceRuleInfo, bool, error) {
|
||||
var (
|
||||
resourceRules []authorizer.ResourceRuleInfo
|
||||
nonResourceRules []authorizer.NonResourceRuleInfo
|
||||
)
|
||||
|
||||
policyRules, err := r.authorizationRuleResolver.RulesFor(user, namespace)
|
||||
for _, policyRule := range policyRules {
|
||||
if len(policyRule.Resources) > 0 {
|
||||
r := authorizer.DefaultResourceRuleInfo{
|
||||
Verbs: policyRule.Verbs,
|
||||
APIGroups: policyRule.APIGroups,
|
||||
Resources: policyRule.Resources,
|
||||
ResourceNames: policyRule.ResourceNames,
|
||||
}
|
||||
var resourceRule authorizer.ResourceRuleInfo = &r
|
||||
resourceRules = append(resourceRules, resourceRule)
|
||||
}
|
||||
if len(policyRule.NonResourceURLs) > 0 {
|
||||
r := authorizer.DefaultNonResourceRuleInfo{
|
||||
Verbs: policyRule.Verbs,
|
||||
NonResourceURLs: policyRule.NonResourceURLs,
|
||||
}
|
||||
var nonResourceRule authorizer.NonResourceRuleInfo = &r
|
||||
nonResourceRules = append(nonResourceRules, nonResourceRule)
|
||||
}
|
||||
}
|
||||
return resourceRules, nonResourceRules, false, err
|
||||
}
|
||||
|
||||
func New(roles rbacregistryvalidation.RoleGetter, roleBindings rbacregistryvalidation.RoleBindingLister, clusterRoles rbacregistryvalidation.ClusterRoleGetter, clusterRoleBindings rbacregistryvalidation.ClusterRoleBindingLister) *RBACAuthorizer {
|
||||
authorizer := &RBACAuthorizer{
|
||||
authorizationRuleResolver: rbacregistryvalidation.NewDefaultRuleResolver(
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -65,6 +65,17 @@ message NonResourceAttributes {
|
|||
optional string verb = 2;
|
||||
}
|
||||
|
||||
// NonResourceRule holds information that describes a rule for the non-resource
|
||||
message NonResourceRule {
|
||||
// Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all.
|
||||
repeated string verbs = 1;
|
||||
|
||||
// NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full,
|
||||
// final step in the path. "*" means all.
|
||||
// +optional
|
||||
repeated string nonResourceURLs = 2;
|
||||
}
|
||||
|
||||
// ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface
|
||||
message ResourceAttributes {
|
||||
// Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces
|
||||
|
@ -99,6 +110,26 @@ message ResourceAttributes {
|
|||
optional string name = 7;
|
||||
}
|
||||
|
||||
// ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant,
|
||||
// may contain duplicates, and possibly be incomplete.
|
||||
message ResourceRule {
|
||||
// Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all.
|
||||
repeated string verbs = 1;
|
||||
|
||||
// APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of
|
||||
// the enumerated resources in any API group will be allowed. "*" means all.
|
||||
// +optional
|
||||
repeated string apiGroups = 2;
|
||||
|
||||
// Resources is a list of resources this rule applies to. ResourceAll represents all resources. "*" means all.
|
||||
// +optional
|
||||
repeated string resources = 3;
|
||||
|
||||
// ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all.
|
||||
// +optional
|
||||
repeated string resourceNames = 4;
|
||||
}
|
||||
|
||||
// SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a
|
||||
// spec.namespace means "in all namespaces". Self is a special case, because users should always be able
|
||||
// to check whether they can perform an action
|
||||
|
@ -126,6 +157,29 @@ message SelfSubjectAccessReviewSpec {
|
|||
optional NonResourceAttributes nonResourceAttributes = 2;
|
||||
}
|
||||
|
||||
// SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace.
|
||||
// The returned list of actions may be incomplete depending on the server's authorization mode,
|
||||
// and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions,
|
||||
// or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to
|
||||
// drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns.
|
||||
// SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.
|
||||
message SelfSubjectRulesReview {
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Spec holds information about the request being evaluated.
|
||||
optional SelfSubjectRulesReviewSpec spec = 2;
|
||||
|
||||
// Status is filled in by the server and indicates the set of actions a user can perform.
|
||||
// +optional
|
||||
optional SubjectRulesReviewStatus status = 3;
|
||||
}
|
||||
|
||||
message SelfSubjectRulesReviewSpec {
|
||||
// Namespace to evaluate rules for. Required.
|
||||
optional string namespace = 1;
|
||||
}
|
||||
|
||||
// SubjectAccessReview checks whether or not a user or group can perform an action.
|
||||
message SubjectAccessReview {
|
||||
// +optional
|
||||
|
@ -185,3 +239,27 @@ message SubjectAccessReviewStatus {
|
|||
optional string evaluationError = 3;
|
||||
}
|
||||
|
||||
// SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on
|
||||
// the set of authorizers the server is configured with and any errors experienced during evaluation.
|
||||
// Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission,
|
||||
// even if that list is incomplete.
|
||||
message SubjectRulesReviewStatus {
|
||||
// ResourceRules is the list of actions the subject is allowed to perform on resources.
|
||||
// The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
|
||||
repeated ResourceRule resourceRules = 1;
|
||||
|
||||
// NonResourceRules is the list of actions the subject is allowed to perform on non-resources.
|
||||
// The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
|
||||
repeated NonResourceRule nonResourceRules = 2;
|
||||
|
||||
// Incomplete is true when the rules returned by this call are incomplete. This is most commonly
|
||||
// encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.
|
||||
optional bool incomplete = 3;
|
||||
|
||||
// EvaluationError can appear in combination with Rules. It indicates an error occurred during
|
||||
// rule evaluation, such as an authorizer that doesn't support rule evaluation, and that
|
||||
// ResourceRules and/or NonResourceRules may be incomplete.
|
||||
// +optional
|
||||
optional string evaluationError = 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ var (
|
|||
// Adds the list of known types to api.Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&SelfSubjectRulesReview{},
|
||||
&SelfSubjectAccessReview{},
|
||||
&SubjectAccessReview{},
|
||||
&LocalSubjectAccessReview{},
|
||||
|
|
|
@ -180,3 +180,82 @@ type SubjectAccessReviewStatus struct {
|
|||
// +optional
|
||||
EvaluationError string `json:"evaluationError,omitempty" protobuf:"bytes,3,opt,name=evaluationError"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +genclient:noVerbs
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace.
|
||||
// The returned list of actions may be incomplete depending on the server's authorization mode,
|
||||
// and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions,
|
||||
// or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to
|
||||
// drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns.
|
||||
// SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.
|
||||
type SelfSubjectRulesReview struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Spec holds information about the request being evaluated.
|
||||
Spec SelfSubjectRulesReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||
|
||||
// Status is filled in by the server and indicates the set of actions a user can perform.
|
||||
// +optional
|
||||
Status SubjectRulesReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||
}
|
||||
|
||||
type SelfSubjectRulesReviewSpec struct {
|
||||
// Namespace to evaluate rules for. Required.
|
||||
Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"`
|
||||
}
|
||||
|
||||
// SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on
|
||||
// the set of authorizers the server is configured with and any errors experienced during evaluation.
|
||||
// Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission,
|
||||
// even if that list is incomplete.
|
||||
type SubjectRulesReviewStatus struct {
|
||||
// ResourceRules is the list of actions the subject is allowed to perform on resources.
|
||||
// The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
|
||||
ResourceRules []ResourceRule `json:"resourceRules" protobuf:"bytes,1,rep,name=resourceRules"`
|
||||
// NonResourceRules is the list of actions the subject is allowed to perform on non-resources.
|
||||
// The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
|
||||
NonResourceRules []NonResourceRule `json:"nonResourceRules" protobuf:"bytes,2,rep,name=nonResourceRules"`
|
||||
// Incomplete is true when the rules returned by this call are incomplete. This is most commonly
|
||||
// encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.
|
||||
Incomplete bool `json:"incomplete" protobuf:"bytes,3,rep,name=incomplete"`
|
||||
// EvaluationError can appear in combination with Rules. It indicates an error occurred during
|
||||
// rule evaluation, such as an authorizer that doesn't support rule evaluation, and that
|
||||
// ResourceRules and/or NonResourceRules may be incomplete.
|
||||
// +optional
|
||||
EvaluationError string `json:"evaluationError,omitempty" protobuf:"bytes,4,opt,name=evaluationError"`
|
||||
}
|
||||
|
||||
// ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant,
|
||||
// may contain duplicates, and possibly be incomplete.
|
||||
type ResourceRule struct {
|
||||
// Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all.
|
||||
Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"`
|
||||
|
||||
// APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of
|
||||
// the enumerated resources in any API group will be allowed. "*" means all.
|
||||
// +optional
|
||||
APIGroups []string `json:"apiGroups,omitempty" protobuf:"bytes,2,rep,name=apiGroups"`
|
||||
// Resources is a list of resources this rule applies to. ResourceAll represents all resources. "*" means all.
|
||||
// +optional
|
||||
Resources []string `json:"resources,omitempty" protobuf:"bytes,3,rep,name=resources"`
|
||||
// ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all.
|
||||
// +optional
|
||||
ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,4,rep,name=resourceNames"`
|
||||
}
|
||||
|
||||
// NonResourceRule holds information that describes a rule for the non-resource
|
||||
type NonResourceRule struct {
|
||||
// Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all.
|
||||
Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"`
|
||||
|
||||
// NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full,
|
||||
// final step in the path. "*" means all.
|
||||
// +optional
|
||||
NonResourceURLs []string `json:"nonResourceURLs,omitempty" protobuf:"bytes,2,rep,name=nonResourceURLs"`
|
||||
}
|
||||
|
|
|
@ -47,6 +47,16 @@ func (NonResourceAttributes) SwaggerDoc() map[string]string {
|
|||
return map_NonResourceAttributes
|
||||
}
|
||||
|
||||
var map_NonResourceRule = map[string]string{
|
||||
"": "NonResourceRule holds information that describes a rule for the non-resource",
|
||||
"verbs": "Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. \"*\" means all.",
|
||||
"nonResourceURLs": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path. \"*\" means all.",
|
||||
}
|
||||
|
||||
func (NonResourceRule) SwaggerDoc() map[string]string {
|
||||
return map_NonResourceRule
|
||||
}
|
||||
|
||||
var map_ResourceAttributes = map[string]string{
|
||||
"": "ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface",
|
||||
"namespace": "Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces \"\" (empty) is defaulted for LocalSubjectAccessReviews \"\" (empty) is empty for cluster-scoped resources \"\" (empty) means \"all\" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview",
|
||||
|
@ -62,6 +72,18 @@ func (ResourceAttributes) SwaggerDoc() map[string]string {
|
|||
return map_ResourceAttributes
|
||||
}
|
||||
|
||||
var map_ResourceRule = map[string]string{
|
||||
"": "ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"verbs": "Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. \"*\" means all.",
|
||||
"apiGroups": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"*\" means all.",
|
||||
"resources": "Resources is a list of resources this rule applies to. ResourceAll represents all resources. \"*\" means all.",
|
||||
"resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. \"*\" means all.",
|
||||
}
|
||||
|
||||
func (ResourceRule) SwaggerDoc() map[string]string {
|
||||
return map_ResourceRule
|
||||
}
|
||||
|
||||
var map_SelfSubjectAccessReview = map[string]string{
|
||||
"": "SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means \"in all namespaces\". Self is a special case, because users should always be able to check whether they can perform an action",
|
||||
"spec": "Spec holds information about the request being evaluated. user and groups must be empty",
|
||||
|
@ -82,6 +104,24 @@ func (SelfSubjectAccessReviewSpec) SwaggerDoc() map[string]string {
|
|||
return map_SelfSubjectAccessReviewSpec
|
||||
}
|
||||
|
||||
var map_SelfSubjectRulesReview = map[string]string{
|
||||
"": "SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.",
|
||||
"spec": "Spec holds information about the request being evaluated.",
|
||||
"status": "Status is filled in by the server and indicates the set of actions a user can perform.",
|
||||
}
|
||||
|
||||
func (SelfSubjectRulesReview) SwaggerDoc() map[string]string {
|
||||
return map_SelfSubjectRulesReview
|
||||
}
|
||||
|
||||
var map_SelfSubjectRulesReviewSpec = map[string]string{
|
||||
"namespace": "Namespace to evaluate rules for. Required.",
|
||||
}
|
||||
|
||||
func (SelfSubjectRulesReviewSpec) SwaggerDoc() map[string]string {
|
||||
return map_SelfSubjectRulesReviewSpec
|
||||
}
|
||||
|
||||
var map_SubjectAccessReview = map[string]string{
|
||||
"": "SubjectAccessReview checks whether or not a user or group can perform an action.",
|
||||
"spec": "Spec holds information about the request being evaluated",
|
||||
|
@ -117,4 +157,16 @@ func (SubjectAccessReviewStatus) SwaggerDoc() map[string]string {
|
|||
return map_SubjectAccessReviewStatus
|
||||
}
|
||||
|
||||
var map_SubjectRulesReviewStatus = map[string]string{
|
||||
"": "SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, even if that list is incomplete.",
|
||||
"resourceRules": "ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"nonResourceRules": "NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"incomplete": "Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.",
|
||||
"evaluationError": "EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete.",
|
||||
}
|
||||
|
||||
func (SubjectRulesReviewStatus) SwaggerDoc() map[string]string {
|
||||
return map_SubjectRulesReviewStatus
|
||||
}
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS END HERE
|
||||
|
|
|
@ -44,10 +44,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
|||
in.(*NonResourceAttributes).DeepCopyInto(out.(*NonResourceAttributes))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&NonResourceAttributes{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*NonResourceRule).DeepCopyInto(out.(*NonResourceRule))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&NonResourceRule{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*ResourceAttributes).DeepCopyInto(out.(*ResourceAttributes))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&ResourceAttributes{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*ResourceRule).DeepCopyInto(out.(*ResourceRule))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&ResourceRule{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SelfSubjectAccessReview).DeepCopyInto(out.(*SelfSubjectAccessReview))
|
||||
return nil
|
||||
|
@ -56,6 +64,14 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
|||
in.(*SelfSubjectAccessReviewSpec).DeepCopyInto(out.(*SelfSubjectAccessReviewSpec))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SelfSubjectAccessReviewSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SelfSubjectRulesReview).DeepCopyInto(out.(*SelfSubjectRulesReview))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SelfSubjectRulesReview{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SelfSubjectRulesReviewSpec).DeepCopyInto(out.(*SelfSubjectRulesReviewSpec))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SelfSubjectRulesReviewSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SubjectAccessReview).DeepCopyInto(out.(*SubjectAccessReview))
|
||||
return nil
|
||||
|
@ -68,6 +84,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
|||
in.(*SubjectAccessReviewStatus).DeepCopyInto(out.(*SubjectAccessReviewStatus))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SubjectAccessReviewStatus{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SubjectRulesReviewStatus).DeepCopyInto(out.(*SubjectRulesReviewStatus))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SubjectRulesReviewStatus{})},
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -116,6 +136,32 @@ func (in *NonResourceAttributes) DeepCopy() *NonResourceAttributes {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NonResourceRule) DeepCopyInto(out *NonResourceRule) {
|
||||
*out = *in
|
||||
if in.Verbs != nil {
|
||||
in, out := &in.Verbs, &out.Verbs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.NonResourceURLs != nil {
|
||||
in, out := &in.NonResourceURLs, &out.NonResourceURLs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NonResourceRule.
|
||||
func (in *NonResourceRule) DeepCopy() *NonResourceRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NonResourceRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceAttributes) DeepCopyInto(out *ResourceAttributes) {
|
||||
*out = *in
|
||||
|
@ -132,6 +178,42 @@ func (in *ResourceAttributes) DeepCopy() *ResourceAttributes {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceRule) DeepCopyInto(out *ResourceRule) {
|
||||
*out = *in
|
||||
if in.Verbs != nil {
|
||||
in, out := &in.Verbs, &out.Verbs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.APIGroups != nil {
|
||||
in, out := &in.APIGroups, &out.APIGroups
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Resources != nil {
|
||||
in, out := &in.Resources, &out.Resources
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ResourceNames != nil {
|
||||
in, out := &in.ResourceNames, &out.ResourceNames
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRule.
|
||||
func (in *ResourceRule) DeepCopy() *ResourceRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourceRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SelfSubjectAccessReview) DeepCopyInto(out *SelfSubjectAccessReview) {
|
||||
*out = *in
|
||||
|
@ -195,6 +277,51 @@ func (in *SelfSubjectAccessReviewSpec) DeepCopy() *SelfSubjectAccessReviewSpec {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SelfSubjectRulesReview) DeepCopyInto(out *SelfSubjectRulesReview) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Spec = in.Spec
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SelfSubjectRulesReview.
|
||||
func (in *SelfSubjectRulesReview) DeepCopy() *SelfSubjectRulesReview {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SelfSubjectRulesReview)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *SelfSubjectRulesReview) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SelfSubjectRulesReviewSpec) DeepCopyInto(out *SelfSubjectRulesReviewSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SelfSubjectRulesReviewSpec.
|
||||
func (in *SelfSubjectRulesReviewSpec) DeepCopy() *SelfSubjectRulesReviewSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SelfSubjectRulesReviewSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SubjectAccessReview) DeepCopyInto(out *SubjectAccessReview) {
|
||||
*out = *in
|
||||
|
@ -286,3 +413,33 @@ func (in *SubjectAccessReviewStatus) DeepCopy() *SubjectAccessReviewStatus {
|
|||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SubjectRulesReviewStatus) DeepCopyInto(out *SubjectRulesReviewStatus) {
|
||||
*out = *in
|
||||
if in.ResourceRules != nil {
|
||||
in, out := &in.ResourceRules, &out.ResourceRules
|
||||
*out = make([]ResourceRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.NonResourceRules != nil {
|
||||
in, out := &in.NonResourceRules, &out.NonResourceRules
|
||||
*out = make([]NonResourceRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubjectRulesReviewStatus.
|
||||
func (in *SubjectRulesReviewStatus) DeepCopy() *SubjectRulesReviewStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SubjectRulesReviewStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -65,6 +65,17 @@ message NonResourceAttributes {
|
|||
optional string verb = 2;
|
||||
}
|
||||
|
||||
// NonResourceRule holds information that describes a rule for the non-resource
|
||||
message NonResourceRule {
|
||||
// Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all.
|
||||
repeated string verbs = 1;
|
||||
|
||||
// NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full,
|
||||
// final step in the path. "*" means all.
|
||||
// +optional
|
||||
repeated string nonResourceURLs = 2;
|
||||
}
|
||||
|
||||
// ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface
|
||||
message ResourceAttributes {
|
||||
// Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces
|
||||
|
@ -99,6 +110,26 @@ message ResourceAttributes {
|
|||
optional string name = 7;
|
||||
}
|
||||
|
||||
// ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant,
|
||||
// may contain duplicates, and possibly be incomplete.
|
||||
message ResourceRule {
|
||||
// Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all.
|
||||
repeated string verbs = 1;
|
||||
|
||||
// APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of
|
||||
// the enumerated resources in any API group will be allowed. "*" means all.
|
||||
// +optional
|
||||
repeated string apiGroups = 2;
|
||||
|
||||
// Resources is a list of resources this rule applies to. ResourceAll represents all resources. "*" means all.
|
||||
// +optional
|
||||
repeated string resources = 3;
|
||||
|
||||
// ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all.
|
||||
// +optional
|
||||
repeated string resourceNames = 4;
|
||||
}
|
||||
|
||||
// SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a
|
||||
// spec.namespace means "in all namespaces". Self is a special case, because users should always be able
|
||||
// to check whether they can perform an action
|
||||
|
@ -126,6 +157,29 @@ message SelfSubjectAccessReviewSpec {
|
|||
optional NonResourceAttributes nonResourceAttributes = 2;
|
||||
}
|
||||
|
||||
// SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace.
|
||||
// The returned list of actions may be incomplete depending on the server's authorization mode,
|
||||
// and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions,
|
||||
// or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to
|
||||
// drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns.
|
||||
// SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.
|
||||
message SelfSubjectRulesReview {
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Spec holds information about the request being evaluated.
|
||||
optional SelfSubjectRulesReviewSpec spec = 2;
|
||||
|
||||
// Status is filled in by the server and indicates the set of actions a user can perform.
|
||||
// +optional
|
||||
optional SubjectRulesReviewStatus status = 3;
|
||||
}
|
||||
|
||||
message SelfSubjectRulesReviewSpec {
|
||||
// Namespace to evaluate rules for. Required.
|
||||
optional string namespace = 1;
|
||||
}
|
||||
|
||||
// SubjectAccessReview checks whether or not a user or group can perform an action.
|
||||
message SubjectAccessReview {
|
||||
// +optional
|
||||
|
@ -185,3 +239,27 @@ message SubjectAccessReviewStatus {
|
|||
optional string evaluationError = 3;
|
||||
}
|
||||
|
||||
// SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on
|
||||
// the set of authorizers the server is configured with and any errors experienced during evaluation.
|
||||
// Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission,
|
||||
// even if that list is incomplete.
|
||||
message SubjectRulesReviewStatus {
|
||||
// ResourceRules is the list of actions the subject is allowed to perform on resources.
|
||||
// The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
|
||||
repeated ResourceRule resourceRules = 1;
|
||||
|
||||
// NonResourceRules is the list of actions the subject is allowed to perform on non-resources.
|
||||
// The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
|
||||
repeated NonResourceRule nonResourceRules = 2;
|
||||
|
||||
// Incomplete is true when the rules returned by this call are incomplete. This is most commonly
|
||||
// encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.
|
||||
optional bool incomplete = 3;
|
||||
|
||||
// EvaluationError can appear in combination with Rules. It indicates an error occurred during
|
||||
// rule evaluation, such as an authorizer that doesn't support rule evaluation, and that
|
||||
// ResourceRules and/or NonResourceRules may be incomplete.
|
||||
// +optional
|
||||
optional string evaluationError = 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ var (
|
|||
// Adds the list of known types to api.Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&SelfSubjectRulesReview{},
|
||||
&SelfSubjectAccessReview{},
|
||||
&SubjectAccessReview{},
|
||||
&LocalSubjectAccessReview{},
|
||||
|
|
|
@ -180,3 +180,82 @@ type SubjectAccessReviewStatus struct {
|
|||
// +optional
|
||||
EvaluationError string `json:"evaluationError,omitempty" protobuf:"bytes,3,opt,name=evaluationError"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +genclient:noVerbs
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace.
|
||||
// The returned list of actions may be incomplete depending on the server's authorization mode,
|
||||
// and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions,
|
||||
// or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to
|
||||
// drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns.
|
||||
// SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.
|
||||
type SelfSubjectRulesReview struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Spec holds information about the request being evaluated.
|
||||
Spec SelfSubjectRulesReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||
|
||||
// Status is filled in by the server and indicates the set of actions a user can perform.
|
||||
// +optional
|
||||
Status SubjectRulesReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||
}
|
||||
|
||||
type SelfSubjectRulesReviewSpec struct {
|
||||
// Namespace to evaluate rules for. Required.
|
||||
Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"`
|
||||
}
|
||||
|
||||
// SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on
|
||||
// the set of authorizers the server is configured with and any errors experienced during evaluation.
|
||||
// Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission,
|
||||
// even if that list is incomplete.
|
||||
type SubjectRulesReviewStatus struct {
|
||||
// ResourceRules is the list of actions the subject is allowed to perform on resources.
|
||||
// The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
|
||||
ResourceRules []ResourceRule `json:"resourceRules" protobuf:"bytes,1,rep,name=resourceRules"`
|
||||
// NonResourceRules is the list of actions the subject is allowed to perform on non-resources.
|
||||
// The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
|
||||
NonResourceRules []NonResourceRule `json:"nonResourceRules" protobuf:"bytes,2,rep,name=nonResourceRules"`
|
||||
// Incomplete is true when the rules returned by this call are incomplete. This is most commonly
|
||||
// encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.
|
||||
Incomplete bool `json:"incomplete" protobuf:"bytes,3,rep,name=incomplete"`
|
||||
// EvaluationError can appear in combination with Rules. It indicates an error occurred during
|
||||
// rule evaluation, such as an authorizer that doesn't support rule evaluation, and that
|
||||
// ResourceRules and/or NonResourceRules may be incomplete.
|
||||
// +optional
|
||||
EvaluationError string `json:"evaluationError,omitempty" protobuf:"bytes,4,opt,name=evaluationError"`
|
||||
}
|
||||
|
||||
// ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant,
|
||||
// may contain duplicates, and possibly be incomplete.
|
||||
type ResourceRule struct {
|
||||
// Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all.
|
||||
Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"`
|
||||
|
||||
// APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of
|
||||
// the enumerated resources in any API group will be allowed. "*" means all.
|
||||
// +optional
|
||||
APIGroups []string `json:"apiGroups,omitempty" protobuf:"bytes,2,rep,name=apiGroups"`
|
||||
// Resources is a list of resources this rule applies to. ResourceAll represents all resources. "*" means all.
|
||||
// +optional
|
||||
Resources []string `json:"resources,omitempty" protobuf:"bytes,3,rep,name=resources"`
|
||||
// ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all.
|
||||
// +optional
|
||||
ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,4,rep,name=resourceNames"`
|
||||
}
|
||||
|
||||
// NonResourceRule holds information that describes a rule for the non-resource
|
||||
type NonResourceRule struct {
|
||||
// Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all.
|
||||
Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"`
|
||||
|
||||
// NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full,
|
||||
// final step in the path. "*" means all.
|
||||
// +optional
|
||||
NonResourceURLs []string `json:"nonResourceURLs,omitempty" protobuf:"bytes,2,rep,name=nonResourceURLs"`
|
||||
}
|
||||
|
|
|
@ -47,6 +47,16 @@ func (NonResourceAttributes) SwaggerDoc() map[string]string {
|
|||
return map_NonResourceAttributes
|
||||
}
|
||||
|
||||
var map_NonResourceRule = map[string]string{
|
||||
"": "NonResourceRule holds information that describes a rule for the non-resource",
|
||||
"verbs": "Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. \"*\" means all.",
|
||||
"nonResourceURLs": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path. \"*\" means all.",
|
||||
}
|
||||
|
||||
func (NonResourceRule) SwaggerDoc() map[string]string {
|
||||
return map_NonResourceRule
|
||||
}
|
||||
|
||||
var map_ResourceAttributes = map[string]string{
|
||||
"": "ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface",
|
||||
"namespace": "Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces \"\" (empty) is defaulted for LocalSubjectAccessReviews \"\" (empty) is empty for cluster-scoped resources \"\" (empty) means \"all\" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview",
|
||||
|
@ -62,6 +72,18 @@ func (ResourceAttributes) SwaggerDoc() map[string]string {
|
|||
return map_ResourceAttributes
|
||||
}
|
||||
|
||||
var map_ResourceRule = map[string]string{
|
||||
"": "ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"verbs": "Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. \"*\" means all.",
|
||||
"apiGroups": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"*\" means all.",
|
||||
"resources": "Resources is a list of resources this rule applies to. ResourceAll represents all resources. \"*\" means all.",
|
||||
"resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. \"*\" means all.",
|
||||
}
|
||||
|
||||
func (ResourceRule) SwaggerDoc() map[string]string {
|
||||
return map_ResourceRule
|
||||
}
|
||||
|
||||
var map_SelfSubjectAccessReview = map[string]string{
|
||||
"": "SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means \"in all namespaces\". Self is a special case, because users should always be able to check whether they can perform an action",
|
||||
"spec": "Spec holds information about the request being evaluated. user and groups must be empty",
|
||||
|
@ -82,6 +104,24 @@ func (SelfSubjectAccessReviewSpec) SwaggerDoc() map[string]string {
|
|||
return map_SelfSubjectAccessReviewSpec
|
||||
}
|
||||
|
||||
var map_SelfSubjectRulesReview = map[string]string{
|
||||
"": "SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.",
|
||||
"spec": "Spec holds information about the request being evaluated.",
|
||||
"status": "Status is filled in by the server and indicates the set of actions a user can perform.",
|
||||
}
|
||||
|
||||
func (SelfSubjectRulesReview) SwaggerDoc() map[string]string {
|
||||
return map_SelfSubjectRulesReview
|
||||
}
|
||||
|
||||
var map_SelfSubjectRulesReviewSpec = map[string]string{
|
||||
"namespace": "Namespace to evaluate rules for. Required.",
|
||||
}
|
||||
|
||||
func (SelfSubjectRulesReviewSpec) SwaggerDoc() map[string]string {
|
||||
return map_SelfSubjectRulesReviewSpec
|
||||
}
|
||||
|
||||
var map_SubjectAccessReview = map[string]string{
|
||||
"": "SubjectAccessReview checks whether or not a user or group can perform an action.",
|
||||
"spec": "Spec holds information about the request being evaluated",
|
||||
|
@ -117,4 +157,16 @@ func (SubjectAccessReviewStatus) SwaggerDoc() map[string]string {
|
|||
return map_SubjectAccessReviewStatus
|
||||
}
|
||||
|
||||
var map_SubjectRulesReviewStatus = map[string]string{
|
||||
"": "SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, even if that list is incomplete.",
|
||||
"resourceRules": "ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"nonResourceRules": "NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.",
|
||||
"incomplete": "Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.",
|
||||
"evaluationError": "EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete.",
|
||||
}
|
||||
|
||||
func (SubjectRulesReviewStatus) SwaggerDoc() map[string]string {
|
||||
return map_SubjectRulesReviewStatus
|
||||
}
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS END HERE
|
||||
|
|
|
@ -44,10 +44,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
|||
in.(*NonResourceAttributes).DeepCopyInto(out.(*NonResourceAttributes))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&NonResourceAttributes{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*NonResourceRule).DeepCopyInto(out.(*NonResourceRule))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&NonResourceRule{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*ResourceAttributes).DeepCopyInto(out.(*ResourceAttributes))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&ResourceAttributes{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*ResourceRule).DeepCopyInto(out.(*ResourceRule))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&ResourceRule{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SelfSubjectAccessReview).DeepCopyInto(out.(*SelfSubjectAccessReview))
|
||||
return nil
|
||||
|
@ -56,6 +64,14 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
|||
in.(*SelfSubjectAccessReviewSpec).DeepCopyInto(out.(*SelfSubjectAccessReviewSpec))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SelfSubjectAccessReviewSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SelfSubjectRulesReview).DeepCopyInto(out.(*SelfSubjectRulesReview))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SelfSubjectRulesReview{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SelfSubjectRulesReviewSpec).DeepCopyInto(out.(*SelfSubjectRulesReviewSpec))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SelfSubjectRulesReviewSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SubjectAccessReview).DeepCopyInto(out.(*SubjectAccessReview))
|
||||
return nil
|
||||
|
@ -68,6 +84,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
|||
in.(*SubjectAccessReviewStatus).DeepCopyInto(out.(*SubjectAccessReviewStatus))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SubjectAccessReviewStatus{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SubjectRulesReviewStatus).DeepCopyInto(out.(*SubjectRulesReviewStatus))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SubjectRulesReviewStatus{})},
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -116,6 +136,32 @@ func (in *NonResourceAttributes) DeepCopy() *NonResourceAttributes {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NonResourceRule) DeepCopyInto(out *NonResourceRule) {
|
||||
*out = *in
|
||||
if in.Verbs != nil {
|
||||
in, out := &in.Verbs, &out.Verbs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.NonResourceURLs != nil {
|
||||
in, out := &in.NonResourceURLs, &out.NonResourceURLs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NonResourceRule.
|
||||
func (in *NonResourceRule) DeepCopy() *NonResourceRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NonResourceRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceAttributes) DeepCopyInto(out *ResourceAttributes) {
|
||||
*out = *in
|
||||
|
@ -132,6 +178,42 @@ func (in *ResourceAttributes) DeepCopy() *ResourceAttributes {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceRule) DeepCopyInto(out *ResourceRule) {
|
||||
*out = *in
|
||||
if in.Verbs != nil {
|
||||
in, out := &in.Verbs, &out.Verbs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.APIGroups != nil {
|
||||
in, out := &in.APIGroups, &out.APIGroups
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Resources != nil {
|
||||
in, out := &in.Resources, &out.Resources
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ResourceNames != nil {
|
||||
in, out := &in.ResourceNames, &out.ResourceNames
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRule.
|
||||
func (in *ResourceRule) DeepCopy() *ResourceRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourceRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SelfSubjectAccessReview) DeepCopyInto(out *SelfSubjectAccessReview) {
|
||||
*out = *in
|
||||
|
@ -195,6 +277,51 @@ func (in *SelfSubjectAccessReviewSpec) DeepCopy() *SelfSubjectAccessReviewSpec {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SelfSubjectRulesReview) DeepCopyInto(out *SelfSubjectRulesReview) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Spec = in.Spec
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SelfSubjectRulesReview.
|
||||
func (in *SelfSubjectRulesReview) DeepCopy() *SelfSubjectRulesReview {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SelfSubjectRulesReview)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *SelfSubjectRulesReview) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SelfSubjectRulesReviewSpec) DeepCopyInto(out *SelfSubjectRulesReviewSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SelfSubjectRulesReviewSpec.
|
||||
func (in *SelfSubjectRulesReviewSpec) DeepCopy() *SelfSubjectRulesReviewSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SelfSubjectRulesReviewSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SubjectAccessReview) DeepCopyInto(out *SubjectAccessReview) {
|
||||
*out = *in
|
||||
|
@ -286,3 +413,33 @@ func (in *SubjectAccessReviewStatus) DeepCopy() *SubjectAccessReviewStatus {
|
|||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SubjectRulesReviewStatus) DeepCopyInto(out *SubjectRulesReviewStatus) {
|
||||
*out = *in
|
||||
if in.ResourceRules != nil {
|
||||
in, out := &in.ResourceRules, &out.ResourceRules
|
||||
*out = make([]ResourceRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.NonResourceRules != nil {
|
||||
in, out := &in.NonResourceRules, &out.NonResourceRules
|
||||
*out = make([]NonResourceRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubjectRulesReviewStatus.
|
||||
func (in *SubjectRulesReviewStatus) DeepCopy() *SubjectRulesReviewStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SubjectRulesReviewStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
|
|
@ -7,7 +7,10 @@ load(
|
|||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["interfaces.go"],
|
||||
srcs = [
|
||||
"interfaces.go",
|
||||
"rule.go",
|
||||
],
|
||||
deps = ["//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library"],
|
||||
)
|
||||
|
||||
|
|
|
@ -76,6 +76,12 @@ func (f AuthorizerFunc) Authorize(a Attributes) (bool, string, error) {
|
|||
return f(a)
|
||||
}
|
||||
|
||||
// RuleResolver provides a mechanism for resolving the list of rules that apply to a given user within a namespace.
|
||||
type RuleResolver interface {
|
||||
// RulesFor get the list of cluster wide rules, the list of rules in the specific namespace, incomplete status and errors.
|
||||
RulesFor(user user.Info, namespace string) ([]ResourceRuleInfo, []NonResourceRuleInfo, bool, error)
|
||||
}
|
||||
|
||||
// RequestAttributesGetter provides a function that extracts Attributes from an http.Request
|
||||
type RequestAttributesGetter interface {
|
||||
GetRequestAttributes(user.Info, *http.Request) Attributes
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package authorizer
|
||||
|
||||
type ResourceRuleInfo interface {
|
||||
// GetVerbs returns a list of kubernetes resource API verbs.
|
||||
GetVerbs() []string
|
||||
// GetAPIGroups return the names of the APIGroup that contains the resources.
|
||||
GetAPIGroups() []string
|
||||
// GetResources return a list of resources the rule applies to.
|
||||
GetResources() []string
|
||||
// GetResourceNames return a white list of names that the rule applies to.
|
||||
GetResourceNames() []string
|
||||
}
|
||||
|
||||
// DefaultResourceRuleInfo holds information that describes a rule for the resource
|
||||
type DefaultResourceRuleInfo struct {
|
||||
Verbs []string
|
||||
APIGroups []string
|
||||
Resources []string
|
||||
ResourceNames []string
|
||||
}
|
||||
|
||||
func (i *DefaultResourceRuleInfo) GetVerbs() []string {
|
||||
return i.Verbs
|
||||
}
|
||||
|
||||
func (i *DefaultResourceRuleInfo) GetAPIGroups() []string {
|
||||
return i.APIGroups
|
||||
}
|
||||
|
||||
func (i *DefaultResourceRuleInfo) GetResources() []string {
|
||||
return i.Resources
|
||||
}
|
||||
|
||||
func (i *DefaultResourceRuleInfo) GetResourceNames() []string {
|
||||
return i.ResourceNames
|
||||
}
|
||||
|
||||
type NonResourceRuleInfo interface {
|
||||
// GetVerbs returns a list of kubernetes resource API verbs.
|
||||
GetVerbs() []string
|
||||
// GetNonResourceURLs return a set of partial urls that a user should have access to.
|
||||
GetNonResourceURLs() []string
|
||||
}
|
||||
|
||||
// DefaultNonResourceRuleInfo holds information that describes a rule for the non-resource
|
||||
type DefaultNonResourceRuleInfo struct {
|
||||
Verbs []string
|
||||
NonResourceURLs []string
|
||||
}
|
||||
|
||||
func (i *DefaultNonResourceRuleInfo) GetVerbs() []string {
|
||||
return i.Verbs
|
||||
}
|
||||
|
||||
func (i *DefaultNonResourceRuleInfo) GetNonResourceURLs() []string {
|
||||
return i.NonResourceURLs
|
||||
}
|
|
@ -23,6 +23,7 @@ go_library(
|
|||
"delegating.go",
|
||||
],
|
||||
deps = [
|
||||
"//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/plugin/pkg/authorizer/webhook:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1:go_default_library",
|
||||
|
|
|
@ -19,6 +19,7 @@ package authorizerfactory
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"k8s.io/apiserver/pkg/authentication/user"
|
||||
"k8s.io/apiserver/pkg/authorization/authorizer"
|
||||
)
|
||||
|
||||
|
@ -31,7 +32,22 @@ func (alwaysAllowAuthorizer) Authorize(a authorizer.Attributes) (authorized bool
|
|||
return true, "", nil
|
||||
}
|
||||
|
||||
func NewAlwaysAllowAuthorizer() authorizer.Authorizer {
|
||||
func (alwaysAllowAuthorizer) RulesFor(user user.Info, namespace string) ([]authorizer.ResourceRuleInfo, []authorizer.NonResourceRuleInfo, bool, error) {
|
||||
return []authorizer.ResourceRuleInfo{
|
||||
&authorizer.DefaultResourceRuleInfo{
|
||||
Verbs: []string{"*"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"*"},
|
||||
},
|
||||
}, []authorizer.NonResourceRuleInfo{
|
||||
&authorizer.DefaultNonResourceRuleInfo{
|
||||
Verbs: []string{"*"},
|
||||
NonResourceURLs: []string{"*"},
|
||||
},
|
||||
}, false, nil
|
||||
}
|
||||
|
||||
func NewAlwaysAllowAuthorizer() *alwaysAllowAuthorizer {
|
||||
return new(alwaysAllowAuthorizer)
|
||||
}
|
||||
|
||||
|
@ -44,7 +60,11 @@ func (alwaysDenyAuthorizer) Authorize(a authorizer.Attributes) (authorized bool,
|
|||
return false, "Everything is forbidden.", nil
|
||||
}
|
||||
|
||||
func NewAlwaysDenyAuthorizer() authorizer.Authorizer {
|
||||
func (alwaysDenyAuthorizer) RulesFor(user user.Info, namespace string) ([]authorizer.ResourceRuleInfo, []authorizer.NonResourceRuleInfo, bool, error) {
|
||||
return []authorizer.ResourceRuleInfo{}, []authorizer.NonResourceRuleInfo{}, false, nil
|
||||
}
|
||||
|
||||
func NewAlwaysDenyAuthorizer() *alwaysDenyAuthorizer {
|
||||
return new(alwaysDenyAuthorizer)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,10 @@ go_test(
|
|||
name = "go_default_test",
|
||||
srcs = ["union_test.go"],
|
||||
library = ":go_default_library",
|
||||
deps = ["//vendor/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library"],
|
||||
deps = [
|
||||
"//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
go_library(
|
||||
|
@ -18,6 +21,7 @@ go_library(
|
|||
srcs = ["union.go"],
|
||||
deps = [
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -20,6 +20,7 @@ import (
|
|||
"strings"
|
||||
|
||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
"k8s.io/apiserver/pkg/authentication/user"
|
||||
"k8s.io/apiserver/pkg/authorization/authorizer"
|
||||
)
|
||||
|
||||
|
@ -55,3 +56,40 @@ func (authzHandler unionAuthzHandler) Authorize(a authorizer.Attributes) (bool,
|
|||
|
||||
return false, strings.Join(reasonlist, "\n"), utilerrors.NewAggregate(errlist)
|
||||
}
|
||||
|
||||
// unionAuthzRulesHandler authorizer against a chain of authorizer.RuleResolver
|
||||
type unionAuthzRulesHandler []authorizer.RuleResolver
|
||||
|
||||
// NewRuleResolvers returns an authorizer that authorizes against a chain of authorizer.Authorizer objects
|
||||
func NewRuleResolvers(authorizationHandlers ...authorizer.RuleResolver) authorizer.RuleResolver {
|
||||
return unionAuthzRulesHandler(authorizationHandlers)
|
||||
}
|
||||
|
||||
// RulesFor against a chain of authorizer.RuleResolver objects and returns nil if successful and returns error if unsuccessful
|
||||
func (authzHandler unionAuthzRulesHandler) RulesFor(user user.Info, namespace string) ([]authorizer.ResourceRuleInfo, []authorizer.NonResourceRuleInfo, bool, error) {
|
||||
var (
|
||||
errList []error
|
||||
resourceRulesList []authorizer.ResourceRuleInfo
|
||||
nonResourceRulesList []authorizer.NonResourceRuleInfo
|
||||
)
|
||||
incompleteStatus := false
|
||||
|
||||
for _, currAuthzHandler := range authzHandler {
|
||||
resourceRules, nonResourceRules, incomplete, err := currAuthzHandler.RulesFor(user, namespace)
|
||||
|
||||
if incomplete == true {
|
||||
incompleteStatus = true
|
||||
}
|
||||
if err != nil {
|
||||
errList = append(errList, err)
|
||||
}
|
||||
if len(resourceRules) > 0 {
|
||||
resourceRulesList = append(resourceRulesList, resourceRules...)
|
||||
}
|
||||
if len(nonResourceRules) > 0 {
|
||||
nonResourceRulesList = append(nonResourceRulesList, nonResourceRules...)
|
||||
}
|
||||
}
|
||||
|
||||
return resourceRulesList, nonResourceRulesList, incompleteStatus, utilerrors.NewAggregate(errList)
|
||||
}
|
||||
|
|
|
@ -18,8 +18,10 @@ package union
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"k8s.io/apiserver/pkg/authentication/user"
|
||||
"k8s.io/apiserver/pkg/authorization/authorizer"
|
||||
)
|
||||
|
||||
|
@ -81,3 +83,143 @@ func TestAuthorizationError(t *testing.T) {
|
|||
t.Errorf("Expected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
type mockAuthzRuleHandler struct {
|
||||
resourceRules []authorizer.ResourceRuleInfo
|
||||
nonResourceRules []authorizer.NonResourceRuleInfo
|
||||
err error
|
||||
}
|
||||
|
||||
func (mock *mockAuthzRuleHandler) RulesFor(user user.Info, namespace string) ([]authorizer.ResourceRuleInfo, []authorizer.NonResourceRuleInfo, bool, error) {
|
||||
if mock.err != nil {
|
||||
return []authorizer.ResourceRuleInfo{}, []authorizer.NonResourceRuleInfo{}, false, mock.err
|
||||
}
|
||||
return mock.resourceRules, mock.nonResourceRules, false, nil
|
||||
}
|
||||
|
||||
func TestAuthorizationResourceRules(t *testing.T) {
|
||||
handler1 := &mockAuthzRuleHandler{
|
||||
resourceRules: []authorizer.ResourceRuleInfo{
|
||||
&authorizer.DefaultResourceRuleInfo{
|
||||
Verbs: []string{"*"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"bindings"},
|
||||
},
|
||||
&authorizer.DefaultResourceRuleInfo{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"*"},
|
||||
},
|
||||
},
|
||||
}
|
||||
handler2 := &mockAuthzRuleHandler{
|
||||
resourceRules: []authorizer.ResourceRuleInfo{
|
||||
&authorizer.DefaultResourceRuleInfo{
|
||||
Verbs: []string{"*"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"events"},
|
||||
},
|
||||
&authorizer.DefaultResourceRuleInfo{
|
||||
Verbs: []string{"get"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"*"},
|
||||
ResourceNames: []string{"foo"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
expected := []authorizer.DefaultResourceRuleInfo{
|
||||
{
|
||||
Verbs: []string{"*"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"bindings"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"get", "list", "watch"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"*"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"*"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"events"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"get"},
|
||||
APIGroups: []string{"*"},
|
||||
Resources: []string{"*"},
|
||||
ResourceNames: []string{"foo"},
|
||||
},
|
||||
}
|
||||
|
||||
authzRulesHandler := NewRuleResolvers(handler1, handler2)
|
||||
|
||||
rules, _, _, _ := authzRulesHandler.RulesFor(nil, "")
|
||||
actual := getResourceRules(rules)
|
||||
if !reflect.DeepEqual(expected, actual) {
|
||||
t.Errorf("Expected: \n%#v\n but actual: \n%#v\n", expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuthorizationNonResourceRules(t *testing.T) {
|
||||
handler1 := &mockAuthzRuleHandler{
|
||||
nonResourceRules: []authorizer.NonResourceRuleInfo{
|
||||
&authorizer.DefaultNonResourceRuleInfo{
|
||||
Verbs: []string{"get"},
|
||||
NonResourceURLs: []string{"/api"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
handler2 := &mockAuthzRuleHandler{
|
||||
nonResourceRules: []authorizer.NonResourceRuleInfo{
|
||||
&authorizer.DefaultNonResourceRuleInfo{
|
||||
Verbs: []string{"get"},
|
||||
NonResourceURLs: []string{"/api/*"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
expected := []authorizer.DefaultNonResourceRuleInfo{
|
||||
{
|
||||
Verbs: []string{"get"},
|
||||
NonResourceURLs: []string{"/api"},
|
||||
},
|
||||
{
|
||||
Verbs: []string{"get"},
|
||||
NonResourceURLs: []string{"/api/*"},
|
||||
},
|
||||
}
|
||||
|
||||
authzRulesHandler := NewRuleResolvers(handler1, handler2)
|
||||
|
||||
_, rules, _, _ := authzRulesHandler.RulesFor(nil, "")
|
||||
actual := getNonResourceRules(rules)
|
||||
if !reflect.DeepEqual(expected, actual) {
|
||||
t.Errorf("Expected: \n%#v\n but actual: \n%#v\n", expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
func getResourceRules(infos []authorizer.ResourceRuleInfo) []authorizer.DefaultResourceRuleInfo {
|
||||
rules := make([]authorizer.DefaultResourceRuleInfo, len(infos))
|
||||
for i, info := range infos {
|
||||
rules[i] = authorizer.DefaultResourceRuleInfo{
|
||||
Verbs: info.GetVerbs(),
|
||||
APIGroups: info.GetAPIGroups(),
|
||||
Resources: info.GetResources(),
|
||||
ResourceNames: info.GetResourceNames(),
|
||||
}
|
||||
}
|
||||
return rules
|
||||
}
|
||||
|
||||
func getNonResourceRules(infos []authorizer.NonResourceRuleInfo) []authorizer.DefaultNonResourceRuleInfo {
|
||||
rules := make([]authorizer.DefaultNonResourceRuleInfo, len(infos))
|
||||
for i, info := range infos {
|
||||
rules[i] = authorizer.DefaultNonResourceRuleInfo{
|
||||
Verbs: info.GetVerbs(),
|
||||
NonResourceURLs: info.GetNonResourceURLs(),
|
||||
}
|
||||
}
|
||||
return rules
|
||||
}
|
||||
|
|
|
@ -87,6 +87,9 @@ type Config struct {
|
|||
// Authorizer determines whether the subject is allowed to make the request based only
|
||||
// on the RequestURI
|
||||
Authorizer authorizer.Authorizer
|
||||
// RuleResolver is required to get the list of rules that apply to a given user
|
||||
// in a given namespace
|
||||
RuleResolver authorizer.RuleResolver
|
||||
// AdmissionControl performs deep inspection of a given request (including content)
|
||||
// to set values and determine whether its allowed
|
||||
AdmissionControl admission.Interface
|
||||
|
|
|
@ -32,6 +32,7 @@ go_library(
|
|||
"//vendor/k8s.io/apimachinery/pkg/apimachinery/registered:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/cache:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/util/webhook:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
||||
|
|
|
@ -28,6 +28,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/cache"
|
||||
"k8s.io/apiserver/pkg/authentication/user"
|
||||
"k8s.io/apiserver/pkg/authorization/authorizer"
|
||||
"k8s.io/apiserver/pkg/util/webhook"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
|
@ -196,6 +197,16 @@ func (w *WebhookAuthorizer) Authorize(attr authorizer.Attributes) (authorized bo
|
|||
return r.Status.Allowed, r.Status.Reason, nil
|
||||
}
|
||||
|
||||
//TODO: need to finish the method to get the rules when using webhook mode
|
||||
func (w *WebhookAuthorizer) RulesFor(user user.Info, namespace string) ([]authorizer.ResourceRuleInfo, []authorizer.NonResourceRuleInfo, bool, error) {
|
||||
var (
|
||||
resourceRules []authorizer.ResourceRuleInfo
|
||||
nonResourceRules []authorizer.NonResourceRuleInfo
|
||||
)
|
||||
incomplete := true
|
||||
return resourceRules, nonResourceRules, incomplete, fmt.Errorf("webhook authorizer does not support user rule resolution")
|
||||
}
|
||||
|
||||
func convertToSARExtra(extra map[string][]string) map[string]authorization.ExtraValue {
|
||||
if extra == nil {
|
||||
return nil
|
||||
|
|
|
@ -15,6 +15,8 @@ go_library(
|
|||
"localsubjectaccessreview_expansion.go",
|
||||
"selfsubjectaccessreview.go",
|
||||
"selfsubjectaccessreview_expansion.go",
|
||||
"selfsubjectrulesreview.go",
|
||||
"selfsubjectrulesreview_expansion.go",
|
||||
"subjectaccessreview.go",
|
||||
"subjectaccessreview_expansion.go",
|
||||
],
|
||||
|
|
|
@ -27,6 +27,7 @@ type AuthorizationV1Interface interface {
|
|||
RESTClient() rest.Interface
|
||||
LocalSubjectAccessReviewsGetter
|
||||
SelfSubjectAccessReviewsGetter
|
||||
SelfSubjectRulesReviewsGetter
|
||||
SubjectAccessReviewsGetter
|
||||
}
|
||||
|
||||
|
@ -43,6 +44,10 @@ func (c *AuthorizationV1Client) SelfSubjectAccessReviews() SelfSubjectAccessRevi
|
|||
return newSelfSubjectAccessReviews(c)
|
||||
}
|
||||
|
||||
func (c *AuthorizationV1Client) SelfSubjectRulesReviews() SelfSubjectRulesReviewInterface {
|
||||
return newSelfSubjectRulesReviews(c)
|
||||
}
|
||||
|
||||
func (c *AuthorizationV1Client) SubjectAccessReviews() SubjectAccessReviewInterface {
|
||||
return newSubjectAccessReviews(c)
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ go_library(
|
|||
"fake_localsubjectaccessreview_expansion.go",
|
||||
"fake_selfsubjectaccessreview.go",
|
||||
"fake_selfsubjectaccessreview_expansion.go",
|
||||
"fake_selfsubjectrulesreview.go",
|
||||
"fake_selfsubjectrulesreview_expansion.go",
|
||||
"fake_subjectaccessreview.go",
|
||||
"fake_subjectaccessreview_expansion.go",
|
||||
],
|
||||
|
|
|
@ -34,6 +34,10 @@ func (c *FakeAuthorizationV1) SelfSubjectAccessReviews() v1.SelfSubjectAccessRev
|
|||
return &FakeSelfSubjectAccessReviews{c}
|
||||
}
|
||||
|
||||
func (c *FakeAuthorizationV1) SelfSubjectRulesReviews() v1.SelfSubjectRulesReviewInterface {
|
||||
return &FakeSelfSubjectRulesReviews{c}
|
||||
}
|
||||
|
||||
func (c *FakeAuthorizationV1) SubjectAccessReviews() v1.SubjectAccessReviewInterface {
|
||||
return &FakeSubjectAccessReviews{c}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package fake
|
||||
|
||||
// FakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface
|
||||
type FakeSelfSubjectRulesReviews struct {
|
||||
Fake *FakeAuthorizationV1
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
authorizationapi "k8s.io/api/authorization/v1"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeSelfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
|
||||
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"), srr), &authorizationapi.SelfSubjectRulesReview{})
|
||||
return obj.(*authorizationapi.SelfSubjectRulesReview), err
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// SelfSubjectRulesReviewsGetter has a method to return a SelfSubjectRulesReviewInterface.
|
||||
// A group's client should implement this interface.
|
||||
type SelfSubjectRulesReviewsGetter interface {
|
||||
SelfSubjectRulesReviews() SelfSubjectRulesReviewInterface
|
||||
}
|
||||
|
||||
// SelfSubjectRulesReviewInterface has methods to work with SelfSubjectRulesReview resources.
|
||||
type SelfSubjectRulesReviewInterface interface {
|
||||
SelfSubjectRulesReviewExpansion
|
||||
}
|
||||
|
||||
// selfSubjectRulesReviews implements SelfSubjectRulesReviewInterface
|
||||
type selfSubjectRulesReviews struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newSelfSubjectRulesReviews returns a SelfSubjectRulesReviews
|
||||
func newSelfSubjectRulesReviews(c *AuthorizationV1Client) *selfSubjectRulesReviews {
|
||||
return &selfSubjectRulesReviews{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
authorizationapi "k8s.io/api/authorization/v1"
|
||||
)
|
||||
|
||||
type SelfSubjectRulesReviewExpansion interface {
|
||||
Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error)
|
||||
}
|
||||
|
||||
func (c *selfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
|
||||
result = &authorizationapi.SelfSubjectRulesReview{}
|
||||
err = c.client.Post().
|
||||
Resource("selfsubjectrulesreviews").
|
||||
Body(srr).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -15,6 +15,8 @@ go_library(
|
|||
"localsubjectaccessreview_expansion.go",
|
||||
"selfsubjectaccessreview.go",
|
||||
"selfsubjectaccessreview_expansion.go",
|
||||
"selfsubjectrulesreview.go",
|
||||
"selfsubjectrulesreview_expansion.go",
|
||||
"subjectaccessreview.go",
|
||||
"subjectaccessreview_expansion.go",
|
||||
],
|
||||
|
|
|
@ -27,6 +27,7 @@ type AuthorizationV1beta1Interface interface {
|
|||
RESTClient() rest.Interface
|
||||
LocalSubjectAccessReviewsGetter
|
||||
SelfSubjectAccessReviewsGetter
|
||||
SelfSubjectRulesReviewsGetter
|
||||
SubjectAccessReviewsGetter
|
||||
}
|
||||
|
||||
|
@ -43,6 +44,10 @@ func (c *AuthorizationV1beta1Client) SelfSubjectAccessReviews() SelfSubjectAcces
|
|||
return newSelfSubjectAccessReviews(c)
|
||||
}
|
||||
|
||||
func (c *AuthorizationV1beta1Client) SelfSubjectRulesReviews() SelfSubjectRulesReviewInterface {
|
||||
return newSelfSubjectRulesReviews(c)
|
||||
}
|
||||
|
||||
func (c *AuthorizationV1beta1Client) SubjectAccessReviews() SubjectAccessReviewInterface {
|
||||
return newSubjectAccessReviews(c)
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ go_library(
|
|||
"fake_localsubjectaccessreview_expansion.go",
|
||||
"fake_selfsubjectaccessreview.go",
|
||||
"fake_selfsubjectaccessreview_expansion.go",
|
||||
"fake_selfsubjectrulesreview.go",
|
||||
"fake_selfsubjectrulesreview_expansion.go",
|
||||
"fake_subjectaccessreview.go",
|
||||
"fake_subjectaccessreview_expansion.go",
|
||||
],
|
||||
|
|
|
@ -34,6 +34,10 @@ func (c *FakeAuthorizationV1beta1) SelfSubjectAccessReviews() v1beta1.SelfSubjec
|
|||
return &FakeSelfSubjectAccessReviews{c}
|
||||
}
|
||||
|
||||
func (c *FakeAuthorizationV1beta1) SelfSubjectRulesReviews() v1beta1.SelfSubjectRulesReviewInterface {
|
||||
return &FakeSelfSubjectRulesReviews{c}
|
||||
}
|
||||
|
||||
func (c *FakeAuthorizationV1beta1) SubjectAccessReviews() v1beta1.SubjectAccessReviewInterface {
|
||||
return &FakeSubjectAccessReviews{c}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package fake
|
||||
|
||||
// FakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface
|
||||
type FakeSelfSubjectRulesReviews struct {
|
||||
Fake *FakeAuthorizationV1beta1
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
authorizationapi "k8s.io/api/authorization/v1beta1"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeSelfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
|
||||
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"), srr), &authorizationapi.SelfSubjectRulesReview{})
|
||||
return obj.(*authorizationapi.SelfSubjectRulesReview), err
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// SelfSubjectRulesReviewsGetter has a method to return a SelfSubjectRulesReviewInterface.
|
||||
// A group's client should implement this interface.
|
||||
type SelfSubjectRulesReviewsGetter interface {
|
||||
SelfSubjectRulesReviews() SelfSubjectRulesReviewInterface
|
||||
}
|
||||
|
||||
// SelfSubjectRulesReviewInterface has methods to work with SelfSubjectRulesReview resources.
|
||||
type SelfSubjectRulesReviewInterface interface {
|
||||
SelfSubjectRulesReviewExpansion
|
||||
}
|
||||
|
||||
// selfSubjectRulesReviews implements SelfSubjectRulesReviewInterface
|
||||
type selfSubjectRulesReviews struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newSelfSubjectRulesReviews returns a SelfSubjectRulesReviews
|
||||
func newSelfSubjectRulesReviews(c *AuthorizationV1beta1Client) *selfSubjectRulesReviews {
|
||||
return &selfSubjectRulesReviews{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
authorizationapi "k8s.io/api/authorization/v1beta1"
|
||||
)
|
||||
|
||||
type SelfSubjectRulesReviewExpansion interface {
|
||||
Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error)
|
||||
}
|
||||
|
||||
func (c *selfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
|
||||
result = &authorizationapi.SelfSubjectRulesReview{}
|
||||
err = c.client.Post().
|
||||
Resource("selfsubjectrulesreviews").
|
||||
Body(srr).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -11,6 +11,7 @@ go_library(
|
|||
"expansion_generated.go",
|
||||
"localsubjectaccessreview.go",
|
||||
"selfsubjectaccessreview.go",
|
||||
"selfsubjectrulesreview.go",
|
||||
"subjectaccessreview.go",
|
||||
],
|
||||
deps = [
|
||||
|
|
|
@ -30,6 +30,10 @@ type LocalSubjectAccessReviewNamespaceListerExpansion interface{}
|
|||
// SelfSubjectAccessReviewLister.
|
||||
type SelfSubjectAccessReviewListerExpansion interface{}
|
||||
|
||||
// SelfSubjectRulesReviewListerExpansion allows custom methods to be added to
|
||||
// SelfSubjectRulesReviewLister.
|
||||
type SelfSubjectRulesReviewListerExpansion interface{}
|
||||
|
||||
// SubjectAccessReviewListerExpansion allows custom methods to be added to
|
||||
// SubjectAccessReviewLister.
|
||||
type SubjectAccessReviewListerExpansion interface{}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by lister-gen
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/authorization/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// SelfSubjectRulesReviewLister helps list SelfSubjectRulesReviews.
|
||||
type SelfSubjectRulesReviewLister interface {
|
||||
// List lists all SelfSubjectRulesReviews in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1.SelfSubjectRulesReview, err error)
|
||||
// Get retrieves the SelfSubjectRulesReview from the index for a given name.
|
||||
Get(name string) (*v1.SelfSubjectRulesReview, error)
|
||||
SelfSubjectRulesReviewListerExpansion
|
||||
}
|
||||
|
||||
// selfSubjectRulesReviewLister implements the SelfSubjectRulesReviewLister interface.
|
||||
type selfSubjectRulesReviewLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewSelfSubjectRulesReviewLister returns a new SelfSubjectRulesReviewLister.
|
||||
func NewSelfSubjectRulesReviewLister(indexer cache.Indexer) SelfSubjectRulesReviewLister {
|
||||
return &selfSubjectRulesReviewLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all SelfSubjectRulesReviews in the indexer.
|
||||
func (s *selfSubjectRulesReviewLister) List(selector labels.Selector) (ret []*v1.SelfSubjectRulesReview, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.SelfSubjectRulesReview))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the SelfSubjectRulesReview from the index for a given name.
|
||||
func (s *selfSubjectRulesReviewLister) Get(name string) (*v1.SelfSubjectRulesReview, error) {
|
||||
key := &v1.SelfSubjectRulesReview{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
|
||||
obj, exists, err := s.indexer.Get(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("selfsubjectrulesreview"), name)
|
||||
}
|
||||
return obj.(*v1.SelfSubjectRulesReview), nil
|
||||
}
|
|
@ -11,6 +11,7 @@ go_library(
|
|||
"expansion_generated.go",
|
||||
"localsubjectaccessreview.go",
|
||||
"selfsubjectaccessreview.go",
|
||||
"selfsubjectrulesreview.go",
|
||||
"subjectaccessreview.go",
|
||||
],
|
||||
deps = [
|
||||
|
|
|
@ -30,6 +30,10 @@ type LocalSubjectAccessReviewNamespaceListerExpansion interface{}
|
|||
// SelfSubjectAccessReviewLister.
|
||||
type SelfSubjectAccessReviewListerExpansion interface{}
|
||||
|
||||
// SelfSubjectRulesReviewListerExpansion allows custom methods to be added to
|
||||
// SelfSubjectRulesReviewLister.
|
||||
type SelfSubjectRulesReviewListerExpansion interface{}
|
||||
|
||||
// SubjectAccessReviewListerExpansion allows custom methods to be added to
|
||||
// SubjectAccessReviewLister.
|
||||
type SubjectAccessReviewListerExpansion interface{}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by lister-gen
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1beta1 "k8s.io/api/authorization/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// SelfSubjectRulesReviewLister helps list SelfSubjectRulesReviews.
|
||||
type SelfSubjectRulesReviewLister interface {
|
||||
// List lists all SelfSubjectRulesReviews in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1beta1.SelfSubjectRulesReview, err error)
|
||||
// Get retrieves the SelfSubjectRulesReview from the index for a given name.
|
||||
Get(name string) (*v1beta1.SelfSubjectRulesReview, error)
|
||||
SelfSubjectRulesReviewListerExpansion
|
||||
}
|
||||
|
||||
// selfSubjectRulesReviewLister implements the SelfSubjectRulesReviewLister interface.
|
||||
type selfSubjectRulesReviewLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewSelfSubjectRulesReviewLister returns a new SelfSubjectRulesReviewLister.
|
||||
func NewSelfSubjectRulesReviewLister(indexer cache.Indexer) SelfSubjectRulesReviewLister {
|
||||
return &selfSubjectRulesReviewLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all SelfSubjectRulesReviews in the indexer.
|
||||
func (s *selfSubjectRulesReviewLister) List(selector labels.Selector) (ret []*v1beta1.SelfSubjectRulesReview, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1beta1.SelfSubjectRulesReview))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the SelfSubjectRulesReview from the index for a given name.
|
||||
func (s *selfSubjectRulesReviewLister) Get(name string) (*v1beta1.SelfSubjectRulesReview, error) {
|
||||
key := &v1beta1.SelfSubjectRulesReview{ObjectMeta: v1.ObjectMeta{Name: name}}
|
||||
obj, exists, err := s.indexer.Get(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1beta1.Resource("selfsubjectrulesreview"), name)
|
||||
}
|
||||
return obj.(*v1beta1.SelfSubjectRulesReview), nil
|
||||
}
|
|
@ -74,7 +74,7 @@ func TestNodeAuthorizer(t *testing.T) {
|
|||
AuthorizationModes: []string{"Node", "RBAC"},
|
||||
InformerFactory: informerFactory,
|
||||
}
|
||||
nodeRBACAuthorizer, err := authorizerConfig.New()
|
||||
nodeRBACAuthorizer, _, err := authorizerConfig.New()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -393,6 +393,8 @@ var ephemeralWhiteList = createEphemeralWhiteList(
|
|||
|
||||
// k8s.io/kubernetes/pkg/apis/authorization/v1beta1
|
||||
|
||||
// SRR objects that are not stored in etcd
|
||||
gvr("authorization.k8s.io", "v1beta1", "selfsubjectrulesreviews"),
|
||||
// SAR objects that are not stored in etcd
|
||||
gvr("authorization.k8s.io", "v1beta1", "selfsubjectaccessreviews"),
|
||||
gvr("authorization.k8s.io", "v1beta1", "localsubjectaccessreviews"),
|
||||
|
@ -401,6 +403,8 @@ var ephemeralWhiteList = createEphemeralWhiteList(
|
|||
|
||||
// k8s.io/kubernetes/pkg/apis/authorization/v1
|
||||
|
||||
// SRR objects that are not stored in etcd
|
||||
gvr("authorization.k8s.io", "v1", "selfsubjectrulesreviews"),
|
||||
// SAR objects that are not stored in etcd
|
||||
gvr("authorization.k8s.io", "v1", "selfsubjectaccessreviews"),
|
||||
gvr("authorization.k8s.io", "v1", "localsubjectaccessreviews"),
|
||||
|
|
Loading…
Reference in New Issue