...

Source file src/github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta2/register.go

Documentation: github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta2

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

View as plain text