...

Source file src/github.com/linkerd/linkerd2/controller/gen/apis/policy/v1beta3/register.go

Documentation: github.com/linkerd/linkerd2/controller/gen/apis/policy/v1beta3

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

View as plain text