Documentation ¶
Index ¶
- func AssignSecurityContext(provider SecurityContextConstraintsProvider, pod *kapi.Pod, ...) field.ErrorList
- func ConstraintAppliesTo(sccName string, sccUsers, sccGroups []string, userInfo user.Info, ...) bool
- type SCCMatcher
- type SecurityContextConstraintsProvider
- func CreateProviderFromConstraint(ns string, namespace *corev1.Namespace, ...) (SecurityContextConstraintsProvider, *corev1.Namespace, error)
- func CreateProvidersFromConstraints(ns string, sccs []*securityv1.SecurityContextConstraints, ...) ([]SecurityContextConstraintsProvider, []error)
- func NewSimpleProvider(scc *securityv1.SecurityContextConstraints) (SecurityContextConstraintsProvider, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignSecurityContext ¶
func AssignSecurityContext(provider SecurityContextConstraintsProvider, pod *kapi.Pod, fldPath *field.Path) field.ErrorList
AssignSecurityContext creates a security context for each container in the pod and validates that the sc falls within the scc constraints. All containers must validate against the same scc or is not considered valid.
func ConstraintAppliesTo ¶
func ConstraintAppliesTo(sccName string, sccUsers, sccGroups []string, userInfo user.Info, namespace string, a authorizer.Authorizer) bool
ConstraintAppliesTo inspects the constraint's users and groups against the userInfo to determine if it is usable by the userInfo. Anything we do here needs to work with a deny authorizer so the choices are limited to SAR / Authorizer
Types ¶
type SCCMatcher ¶
type SCCMatcher interface {
FindApplicableSCCs(namespace string, user ...user.Info) ([]*securityv1.SecurityContextConstraints, error)
}
func NewDefaultSCCMatcher ¶
func NewDefaultSCCMatcher(c securityv1listers.SecurityContextConstraintsLister, authorizer authorizer.Authorizer) SCCMatcher
type SecurityContextConstraintsProvider ¶
type SecurityContextConstraintsProvider interface { // Create a PodSecurityContext based on the given constraints. CreatePodSecurityContext(pod *api.Pod) (*api.PodSecurityContext, map[string]string, error) // Create a container SecurityContext based on the given constraints CreateContainerSecurityContext(pod *api.Pod, container *api.Container) (*api.SecurityContext, error) // Ensure a pod's SecurityContext is in compliance with the given constraints. ValidatePodSecurityContext(pod *api.Pod, fldPath *field.Path) field.ErrorList // Ensure a container's SecurityContext is in compliance with the given constraints ValidateContainerSecurityContext(pod *api.Pod, container *api.Container, fldPath *field.Path) field.ErrorList // Get the name of the SCC that this provider was initialized with. GetSCCName() string // Get the users associated to the SCC this provider was initialized with GetSCCUsers() []string // Get the groups associated to the SCC this provider was initialized with GetSCCGroups() []string }
SecurityContextConstraintsProvider provides the implementation to generate a new security context based on constraints or validate an existing security context against constraints.
func CreateProviderFromConstraint ¶
func CreateProviderFromConstraint(ns string, namespace *corev1.Namespace, constraint *securityv1.SecurityContextConstraints, client kubernetes.Interface) (SecurityContextConstraintsProvider, *corev1.Namespace, error)
CreateProviderFromConstraint creates a SecurityContextConstraintProvider from a SecurityContextConstraint
func CreateProvidersFromConstraints ¶
func CreateProvidersFromConstraints(ns string, sccs []*securityv1.SecurityContextConstraints, client kubernetes.Interface) ([]SecurityContextConstraintsProvider, []error)
CreateProvidersFromConstraints creates providers from the constraints supplied, including looking up pre-allocated values if necessary using the pod's namespace.
func NewSimpleProvider ¶
func NewSimpleProvider(scc *securityv1.SecurityContextConstraints) (SecurityContextConstraintsProvider, error)
NewSimpleProvider creates a new SecurityContextConstraintsProvider instance.