install.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 install installs the certificates API group, making it available as
  14. // an option to all of the API encoding/decoding machinery.
  15. package install
  16. import (
  17. "k8s.io/apimachinery/pkg/apimachinery/announced"
  18. "k8s.io/apimachinery/pkg/apimachinery/registered"
  19. "k8s.io/apimachinery/pkg/runtime"
  20. "k8s.io/apimachinery/pkg/util/sets"
  21. "k8s.io/client-go/pkg/api"
  22. "k8s.io/client-go/pkg/apis/certificates"
  23. "k8s.io/client-go/pkg/apis/certificates/v1beta1"
  24. )
  25. func init() {
  26. Install(api.GroupFactoryRegistry, api.Registry, api.Scheme)
  27. }
  28. // Install registers the API group and adds types to a scheme
  29. func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
  30. if err := announced.NewGroupMetaFactory(
  31. &announced.GroupMetaFactoryArgs{
  32. GroupName: certificates.GroupName,
  33. VersionPreferenceOrder: []string{v1beta1.SchemeGroupVersion.Version},
  34. ImportPrefix: "k8s.io/client-go/pkg/apis/certificates",
  35. RootScopedKinds: sets.NewString("CertificateSigningRequest"),
  36. AddInternalObjectsToScheme: certificates.AddToScheme,
  37. },
  38. announced.VersionToSchemeFunc{
  39. v1beta1.SchemeGroupVersion.Version: v1beta1.AddToScheme,
  40. },
  41. ).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
  42. panic(err)
  43. }
  44. }