fake.go 1.4 KB

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