conversion.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. Copyright 2019 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 v1alpha1
  14. import (
  15. v1alpha1 "k8s.io/api/node/v1alpha1"
  16. conversion "k8s.io/apimachinery/pkg/conversion"
  17. runtime "k8s.io/apimachinery/pkg/runtime"
  18. node "k8s.io/kubernetes/pkg/apis/node"
  19. )
  20. func addConversionFuncs(s *runtime.Scheme) error {
  21. return s.AddConversionFuncs(
  22. Convert_v1alpha1_RuntimeClass_To_node_RuntimeClass,
  23. Convert_node_RuntimeClass_To_v1alpha1_RuntimeClass,
  24. )
  25. }
  26. func Convert_v1alpha1_RuntimeClass_To_node_RuntimeClass(in *v1alpha1.RuntimeClass, out *node.RuntimeClass, s conversion.Scope) error {
  27. out.ObjectMeta = in.ObjectMeta
  28. out.Handler = in.Spec.RuntimeHandler
  29. return nil
  30. }
  31. func Convert_node_RuntimeClass_To_v1alpha1_RuntimeClass(in *node.RuntimeClass, out *v1alpha1.RuntimeClass, s conversion.Scope) error {
  32. out.ObjectMeta = in.ObjectMeta
  33. out.Spec.RuntimeHandler = in.Handler
  34. return nil
  35. }