register.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 apps
  14. import (
  15. "k8s.io/apimachinery/pkg/runtime"
  16. "k8s.io/apimachinery/pkg/runtime/schema"
  17. "k8s.io/kubernetes/pkg/apis/autoscaling"
  18. )
  19. var (
  20. // SchemeBuilder stores functions to add things to a scheme.
  21. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
  22. // AddToScheme applies all stored functions t oa scheme.
  23. AddToScheme = SchemeBuilder.AddToScheme
  24. )
  25. // GroupName is the group name use in this package
  26. const GroupName = "apps"
  27. // SchemeGroupVersion is group version used to register these objects
  28. var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
  29. // Kind takes an unqualified kind and returns a Group qualified GroupKind
  30. func Kind(kind string) schema.GroupKind {
  31. return SchemeGroupVersion.WithKind(kind).GroupKind()
  32. }
  33. // Resource takes an unqualified resource and returns a Group qualified GroupResource
  34. func Resource(resource string) schema.GroupResource {
  35. return SchemeGroupVersion.WithResource(resource).GroupResource()
  36. }
  37. // Adds the list of known types to the given scheme.
  38. func addKnownTypes(scheme *runtime.Scheme) error {
  39. // TODO this will get cleaned up with the scheme types are fixed
  40. scheme.AddKnownTypes(SchemeGroupVersion,
  41. &DaemonSet{},
  42. &DaemonSetList{},
  43. &Deployment{},
  44. &DeploymentList{},
  45. &DeploymentRollback{},
  46. &autoscaling.Scale{},
  47. &StatefulSet{},
  48. &StatefulSetList{},
  49. &ControllerRevision{},
  50. &ControllerRevisionList{},
  51. &ReplicaSet{},
  52. &ReplicaSetList{},
  53. )
  54. return nil
  55. }