expose user info to admission controllers
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package admission
|
||||
|
||||
import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/auth/user"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||
)
|
||||
|
||||
@@ -26,15 +27,17 @@ type attributesRecord struct {
|
||||
resource string
|
||||
operation string
|
||||
object runtime.Object
|
||||
userInfo user.Info
|
||||
}
|
||||
|
||||
func NewAttributesRecord(object runtime.Object, kind, namespace, resource, operation string) Attributes {
|
||||
func NewAttributesRecord(object runtime.Object, kind, namespace, resource, operation string, userInfo user.Info) Attributes {
|
||||
return &attributesRecord{
|
||||
kind: kind,
|
||||
namespace: namespace,
|
||||
resource: resource,
|
||||
operation: operation,
|
||||
object: object,
|
||||
userInfo: userInfo,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,3 +60,7 @@ func (record *attributesRecord) GetOperation() string {
|
||||
func (record *attributesRecord) GetObject() runtime.Object {
|
||||
return record.object
|
||||
}
|
||||
|
||||
func (record *attributesRecord) GetUserInfo() user.Info {
|
||||
return record.userInfo
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package admission
|
||||
|
||||
import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/auth/user"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||
)
|
||||
|
||||
@@ -28,6 +29,7 @@ type Attributes interface {
|
||||
GetOperation() string
|
||||
GetObject() runtime.Object
|
||||
GetKind() string
|
||||
GetUserInfo() user.Info
|
||||
}
|
||||
|
||||
// Interface is an abstract, pluggable interface for Admission Control decisions.
|
||||
|
Reference in New Issue
Block a user