runasany.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. Copyright 2016 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 user
  14. import (
  15. policy "k8s.io/api/policy/v1beta1"
  16. "k8s.io/apimachinery/pkg/util/validation/field"
  17. api "k8s.io/kubernetes/pkg/apis/core"
  18. )
  19. // runAsAny implements the interface RunAsUserStrategy.
  20. type runAsAny struct{}
  21. var _ RunAsUserStrategy = &runAsAny{}
  22. // NewRunAsAny provides a strategy that will return nil.
  23. func NewRunAsAny(options *policy.RunAsUserStrategyOptions) (RunAsUserStrategy, error) {
  24. return &runAsAny{}, nil
  25. }
  26. // Generate creates the uid based on policy rules.
  27. func (s *runAsAny) Generate(pod *api.Pod, container *api.Container) (*int64, error) {
  28. return nil, nil
  29. }
  30. // Validate ensures that the specified values fall within the range of the strategy.
  31. func (s *runAsAny) Validate(_ *field.Path, _ *api.Pod, _ *api.Container, runAsNonRoot *bool, runAsUser *int64) field.ErrorList {
  32. return field.ErrorList{}
  33. }