GitOps for k8s
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

register.go 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package v1alpha2
  2. import (
  3. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  4. "k8s.io/apimachinery/pkg/runtime"
  5. "k8s.io/apimachinery/pkg/runtime/schema"
  6. fluxintegrations "github.com/fluxcd/flux/integrations/apis/helm.integrations.flux.weave.works"
  7. )
  8. // SchemeGroupVersion is group version used to register these objects
  9. var SchemeGroupVersion = schema.GroupVersion{Group: fluxintegrations.GroupName, Version: "v1alpha2"}
  10. // Resource takes an unqualified resource and returns a Group qualified GroupResource
  11. func Resource(resource string) schema.GroupResource {
  12. return SchemeGroupVersion.WithResource(resource).GroupResource()
  13. }
  14. var (
  15. // SchemeBuilder will stay in k8s.io/kubernetes.
  16. SchemeBuilder runtime.SchemeBuilder
  17. localSchemeBuilder = &SchemeBuilder
  18. // AddToScheme will stay in k8s.io/kubernetes.
  19. AddToScheme = localSchemeBuilder.AddToScheme
  20. )
  21. func init() {
  22. // We only register manually written functions here. The registration of the
  23. // generated functions takes place in the generated files. The separation
  24. // makes the code compile even when the generated files are missing.
  25. localSchemeBuilder.Register(addKnownTypes)
  26. }
  27. // Adds the list of known types to api.Scheme.
  28. func addKnownTypes(scheme *runtime.Scheme) error {
  29. scheme.AddKnownTypes(SchemeGroupVersion,
  30. &FluxHelmRelease{},
  31. &FluxHelmReleaseList{},
  32. )
  33. metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
  34. return nil
  35. }