Skip to content

Commit

Permalink
Merge pull request #24600 from pweil-/psp
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

PSP admission

```release-note
Update PodSecurityPolicy types and add admission controller that could enforce them
```

Still working on removing the non-relevant parts of the tests but I wanted to get this open to start soliciting feedback.

- [x] bring PSP up to date with any new features we've added to SCC for discussion
- [x] create admission controller that is a pared down version of SCC (no ns based strategies, no user/groups/service account permissioning)
- [x] fix tests

@liggitt @pmorie - this is the simple implementation requested that assumes all PSPs should be checked for each requests.  It is a slimmed down version of our SCC admission controller

@erictune @smarterclayton
  • Loading branch information
k8s-merge-robot committed May 12, 2016
2 parents b1560f3 + 65c8a1f commit 4e57c80
Show file tree
Hide file tree
Showing 57 changed files with 8,426 additions and 504 deletions.
32 changes: 32 additions & 0 deletions cluster/addons/podsecuritypolicies/privileged.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
annotations:
kubernetes.io/description: 'privileged allows access to all privileged and host
features and the ability to run as any user, any group, any fsGroup, and with
any SELinux context.'
creationTimestamp: 2016-05-06T19:28:58Z
name: privileged
spec:
privileged: true
defaultAddCapabilities: null
requiredDropCapabilities: null
allowedCapabilities: null
volumes:
- '*'
hostNetwork: true
hostPorts:
-
min: 0
max: 65535
hostIPC: true
hostPID: true
runAsUser:
rule: 'RunAsAny'
seLinux:
rule: 'RunAsAny'
supplementalGroups:
rule: 'RunAsAny'
fsGroup:
rule: 'RunAsAny'
readOnlyRootFilesystem: false
1 change: 1 addition & 0 deletions cmd/kube-apiserver/app/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
_ "k8s.io/kubernetes/plugin/pkg/admission/namespace/lifecycle"
_ "k8s.io/kubernetes/plugin/pkg/admission/persistentvolume/label"
_ "k8s.io/kubernetes/plugin/pkg/admission/resourcequota"
_ "k8s.io/kubernetes/plugin/pkg/admission/security/podsecuritypolicy"
_ "k8s.io/kubernetes/plugin/pkg/admission/securitycontext/scdeny"
_ "k8s.io/kubernetes/plugin/pkg/admission/serviceaccount"
)
4 changes: 2 additions & 2 deletions docs/admin/kube-apiserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ kube-apiserver
### Options

```
--admission-control="AlwaysAdmit": Ordered list of plug-ins to do admission control of resources into cluster. Comma-delimited list of: AlwaysAdmit, AlwaysDeny, AlwaysPullImages, DenyEscalatingExec, DenyExecOnPrivileged, InitialResources, LimitPodHardAntiAffinityTopology, LimitRanger, NamespaceAutoProvision, NamespaceExists, NamespaceLifecycle, PersistentVolumeLabel, ResourceQuota, SecurityContextDeny, ServiceAccount
--admission-control="AlwaysAdmit": Ordered list of plug-ins to do admission control of resources into cluster. Comma-delimited list of: AlwaysAdmit, AlwaysDeny, AlwaysPullImages, DenyEscalatingExec, DenyExecOnPrivileged, InitialResources, LimitPodHardAntiAffinityTopology, LimitRanger, NamespaceAutoProvision, NamespaceExists, NamespaceLifecycle, PersistentVolumeLabel, PodSecurityPolicy, ResourceQuota, SecurityContextDeny, ServiceAccount
--admission-control-config-file="": File with admission control configuration.
--advertise-address=<nil>: The IP address on which to advertise the apiserver to members of the cluster. This address must be reachable by the rest of the cluster. If blank, the --bind-address will be used. If --bind-address is unspecified, the host's default interface will be used.
--allow-privileged[=false]: If true, allow privileged containers.
Expand Down Expand Up @@ -119,7 +119,7 @@ kube-apiserver
--watch-cache-sizes=[]: List of watch cache sizes for every resource (pods, nodes, etc.), comma separated. The individual override format: resource#size, where size is a number. It takes effect when watch-cache is enabled.
```

###### Auto generated by spf13/cobra on 9-May-2016
###### Auto generated by spf13/cobra on 10-May-2016


<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
Expand Down
65 changes: 62 additions & 3 deletions pkg/apis/extensions/deep_copy_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func init() {
DeepCopy_extensions_DeploymentSpec,
DeepCopy_extensions_DeploymentStatus,
DeepCopy_extensions_DeploymentStrategy,
DeepCopy_extensions_FSGroupStrategyOptions,
DeepCopy_extensions_HTTPIngressPath,
DeepCopy_extensions_HTTPIngressRuleValue,
DeepCopy_extensions_HostPortRange,
Expand Down Expand Up @@ -72,6 +73,7 @@ func init() {
DeepCopy_extensions_Scale,
DeepCopy_extensions_ScaleSpec,
DeepCopy_extensions_ScaleStatus,
DeepCopy_extensions_SupplementalGroupsStrategyOptions,
DeepCopy_extensions_ThirdPartyResource,
DeepCopy_extensions_ThirdPartyResourceData,
DeepCopy_extensions_ThirdPartyResourceDataList,
Expand Down Expand Up @@ -311,6 +313,22 @@ func DeepCopy_extensions_DeploymentStrategy(in DeploymentStrategy, out *Deployme
return nil
}

func DeepCopy_extensions_FSGroupStrategyOptions(in FSGroupStrategyOptions, out *FSGroupStrategyOptions, c *conversion.Cloner) error {
out.Rule = in.Rule
if in.Ranges != nil {
in, out := in.Ranges, &out.Ranges
*out = make([]IDRange, len(in))
for i := range in {
if err := DeepCopy_extensions_IDRange(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Ranges = nil
}
return nil
}

func DeepCopy_extensions_HTTPIngressPath(in HTTPIngressPath, out *HTTPIngressPath, c *conversion.Cloner) error {
out.Path = in.Path
if err := DeepCopy_extensions_IngressBackend(in.Backend, &out.Backend, c); err != nil {
Expand Down Expand Up @@ -502,14 +520,32 @@ func DeepCopy_extensions_PodSecurityPolicyList(in PodSecurityPolicyList, out *Po

func DeepCopy_extensions_PodSecurityPolicySpec(in PodSecurityPolicySpec, out *PodSecurityPolicySpec, c *conversion.Cloner) error {
out.Privileged = in.Privileged
if in.Capabilities != nil {
in, out := in.Capabilities, &out.Capabilities
if in.DefaultAddCapabilities != nil {
in, out := in.DefaultAddCapabilities, &out.DefaultAddCapabilities
*out = make([]api.Capability, len(in))
for i := range in {
(*out)[i] = in[i]
}
} else {
out.DefaultAddCapabilities = nil
}
if in.RequiredDropCapabilities != nil {
in, out := in.RequiredDropCapabilities, &out.RequiredDropCapabilities
*out = make([]api.Capability, len(in))
for i := range in {
(*out)[i] = in[i]
}
} else {
out.RequiredDropCapabilities = nil
}
if in.AllowedCapabilities != nil {
in, out := in.AllowedCapabilities, &out.AllowedCapabilities
*out = make([]api.Capability, len(in))
for i := range in {
(*out)[i] = in[i]
}
} else {
out.Capabilities = nil
out.AllowedCapabilities = nil
}
if in.Volumes != nil {
in, out := in.Volumes, &out.Volumes
Expand Down Expand Up @@ -540,6 +576,13 @@ func DeepCopy_extensions_PodSecurityPolicySpec(in PodSecurityPolicySpec, out *Po
if err := DeepCopy_extensions_RunAsUserStrategyOptions(in.RunAsUser, &out.RunAsUser, c); err != nil {
return err
}
if err := DeepCopy_extensions_SupplementalGroupsStrategyOptions(in.SupplementalGroups, &out.SupplementalGroups, c); err != nil {
return err
}
if err := DeepCopy_extensions_FSGroupStrategyOptions(in.FSGroup, &out.FSGroup, c); err != nil {
return err
}
out.ReadOnlyRootFilesystem = in.ReadOnlyRootFilesystem
return nil
}

Expand Down Expand Up @@ -691,6 +734,22 @@ func DeepCopy_extensions_ScaleStatus(in ScaleStatus, out *ScaleStatus, c *conver
return nil
}

func DeepCopy_extensions_SupplementalGroupsStrategyOptions(in SupplementalGroupsStrategyOptions, out *SupplementalGroupsStrategyOptions, c *conversion.Cloner) error {
out.Rule = in.Rule
if in.Ranges != nil {
in, out := in.Ranges, &out.Ranges
*out = make([]IDRange, len(in))
for i := range in {
if err := DeepCopy_extensions_IDRange(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Ranges = nil
}
return nil
}

func DeepCopy_extensions_ThirdPartyResource(in ThirdPartyResource, out *ThirdPartyResource, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
Expand Down
Loading

0 comments on commit 4e57c80

Please sign in to comment.