...

Source file src/github.com/linkerd/linkerd2/controller/gen/apis/serviceprofile/v1alpha2/register.go

Documentation: github.com/linkerd/linkerd2/controller/gen/apis/serviceprofile/v1alpha2

     1  package v1alpha2
     2  
     3  import (
     4  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     5  	"k8s.io/apimachinery/pkg/runtime"
     6  	"k8s.io/apimachinery/pkg/runtime/schema"
     7  
     8  	"github.com/linkerd/linkerd2/controller/gen/apis/serviceprofile"
     9  )
    10  
    11  // SchemeGroupVersion is the identifier for the API which includes
    12  // the name of the group and the version of the API
    13  var SchemeGroupVersion = schema.GroupVersion{
    14  	Group:   serviceprofile.GroupName,
    15  	Version: "v1alpha2",
    16  }
    17  
    18  // Kind takes an unqualified kind and returns back a Group qualified GroupKind
    19  func Kind(kind string) schema.GroupKind {
    20  	return SchemeGroupVersion.WithKind(kind).GroupKind()
    21  }
    22  
    23  // Resource takes an unqualified resource and returns a Group qualified GroupResource
    24  func Resource(resource string) schema.GroupResource {
    25  	return SchemeGroupVersion.WithResource(resource).GroupResource()
    26  }
    27  
    28  var (
    29  	// SchemeBuilder collects functions that add things to a scheme. It's to allow
    30  	// code to compile without explicitly referencing generated types. You should
    31  	// declare one in each package that will have generated deep copy or conversion
    32  	// functions.
    33  	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
    34  
    35  	// AddToScheme applies all the stored functions to the scheme. A non-nil error
    36  	// indicates that one function failed and the attempt was abandoned.
    37  	AddToScheme = SchemeBuilder.AddToScheme
    38  )
    39  
    40  // Adds the list of known types to Scheme.
    41  func addKnownTypes(scheme *runtime.Scheme) error {
    42  	scheme.AddKnownTypes(SchemeGroupVersion,
    43  		&ServiceProfile{},
    44  		&ServiceProfileList{},
    45  	)
    46  	metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
    47  	return nil
    48  }
    49  

View as plain text