1 /* 2 Copyright 2014 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package securitycontext 18 19 import ( 20 "k8s.io/api/core/v1" 21 api "k8s.io/kubernetes/pkg/apis/core" 22 ) 23 24 // ValidSecurityContextWithContainerDefaults creates a valid security context provider based on 25 // empty container defaults. Used for testing. 26 func ValidSecurityContextWithContainerDefaults() *v1.SecurityContext { 27 priv := false 28 defProcMount := v1.DefaultProcMount 29 return &v1.SecurityContext{ 30 Capabilities: &v1.Capabilities{}, 31 Privileged: &priv, 32 ProcMount: &defProcMount, 33 } 34 } 35 36 // ValidInternalSecurityContextWithContainerDefaults creates a valid security context provider based on 37 // empty container defaults. Used for testing. 38 func ValidInternalSecurityContextWithContainerDefaults() *api.SecurityContext { 39 priv := false 40 dpm := api.DefaultProcMount 41 return &api.SecurityContext{ 42 Capabilities: &api.Capabilities{}, 43 Privileged: &priv, 44 ProcMount: &dpm, 45 } 46 } 47