register.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 core
  14. import (
  15. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  16. "k8s.io/apimachinery/pkg/runtime"
  17. "k8s.io/apimachinery/pkg/runtime/schema"
  18. )
  19. // GroupName is the group name use in this package
  20. const GroupName = ""
  21. // SchemeGroupVersion is group version used to register these objects
  22. var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
  23. // Kind takes an unqualified kind and returns a Group qualified GroupKind
  24. func Kind(kind string) schema.GroupKind {
  25. return SchemeGroupVersion.WithKind(kind).GroupKind()
  26. }
  27. // Resource takes an unqualified resource and returns a Group qualified GroupResource
  28. func Resource(resource string) schema.GroupResource {
  29. return SchemeGroupVersion.WithResource(resource).GroupResource()
  30. }
  31. var (
  32. // SchemeBuilder object to register various known types
  33. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
  34. // AddToScheme represents a func that can be used to apply all the registered
  35. // funcs in a scheme
  36. AddToScheme = SchemeBuilder.AddToScheme
  37. )
  38. func addKnownTypes(scheme *runtime.Scheme) error {
  39. if err := scheme.AddIgnoredConversionType(&metav1.TypeMeta{}, &metav1.TypeMeta{}); err != nil {
  40. return err
  41. }
  42. scheme.AddKnownTypes(SchemeGroupVersion,
  43. &Pod{},
  44. &PodList{},
  45. &PodStatusResult{},
  46. &PodTemplate{},
  47. &PodTemplateList{},
  48. &ReplicationControllerList{},
  49. &ReplicationController{},
  50. &ServiceList{},
  51. &Service{},
  52. &ServiceProxyOptions{},
  53. &NodeList{},
  54. &Node{},
  55. &NodeProxyOptions{},
  56. &Endpoints{},
  57. &EndpointsList{},
  58. &Binding{},
  59. &Event{},
  60. &EventList{},
  61. &List{},
  62. &LimitRange{},
  63. &LimitRangeList{},
  64. &ResourceQuota{},
  65. &ResourceQuotaList{},
  66. &Namespace{},
  67. &NamespaceList{},
  68. &ServiceAccount{},
  69. &ServiceAccountList{},
  70. &Secret{},
  71. &SecretList{},
  72. &PersistentVolume{},
  73. &PersistentVolumeList{},
  74. &PersistentVolumeClaim{},
  75. &PersistentVolumeClaimList{},
  76. &PodAttachOptions{},
  77. &PodLogOptions{},
  78. &PodExecOptions{},
  79. &PodPortForwardOptions{},
  80. &PodProxyOptions{},
  81. &ComponentStatus{},
  82. &ComponentStatusList{},
  83. &SerializedReference{},
  84. &RangeAllocation{},
  85. &ConfigMap{},
  86. &ConfigMapList{},
  87. &EphemeralContainers{},
  88. )
  89. return nil
  90. }