apiserver: k8s.io/apiserver/pkg/audit/policy Index | Files

package policy

import "k8s.io/apiserver/pkg/audit/policy"


Package Files

checker.go enforce.go reader.go util.go


const (
    // DefaultAuditLevel is the default level to audit at, if no policy rules are matched.
    DefaultAuditLevel = audit.LevelNone

func AllLevels Uses

func AllLevels() sets.String

AllLevels returns all possible levels

func AllStages Uses

func AllStages() sets.String

AllStages returns all possible stages

func ConvertStagesToStrings Uses

func ConvertStagesToStrings(stages []audit.Stage) []string

ConvertStagesToStrings converts an array of stages to a string array

func ConvertStringSetToStages Uses

func ConvertStringSetToStages(set sets.String) []audit.Stage

ConvertStringSetToStages converts a string set to an array of stages

func EnforcePolicy Uses

func EnforcePolicy(event *audit.Event, level audit.Level, omitStages []audit.Stage) (*audit.Event, error)

EnforcePolicy drops any part of the event that doesn't conform to a policy level or omitStages and sets the event level accordingly

func InvertStages Uses

func InvertStages(stages []audit.Stage) []audit.Stage

InvertStages subtracts the given array of stages from all stages

func LoadPolicyFromBytes Uses

func LoadPolicyFromBytes(policyDef []byte) (*auditinternal.Policy, error)

func LoadPolicyFromFile Uses

func LoadPolicyFromFile(filePath string) (*auditinternal.Policy, error)

type Checker Uses

type Checker interface {
    // Check the audit level for a request with the given authorizer attributes.
    LevelAndStages(authorizer.Attributes) (audit.Level, []audit.Stage)

Checker exposes methods for checking the policy rules.

func FakeChecker Uses

func FakeChecker(level audit.Level, stage []audit.Stage) Checker

FakeChecker creates a checker that returns a constant level for all requests (for testing).

func NewChecker Uses

func NewChecker(policy *audit.Policy) Checker

NewChecker creates a new policy checker.

Package policy imports 13 packages (graph) and is imported by 7 packages. Updated 2020-05-30. Refresh now. Tools for package owners.