...

Source file src/k8s.io/client-go/scale/scheme/appsint/register.go

Documentation: k8s.io/client-go/scale/scheme/appsint

     1  /*
     2  Copyright 2016 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package appsint
    18  
    19  import (
    20  	appsv1beta2 "k8s.io/api/apps/v1beta2"
    21  	"k8s.io/apimachinery/pkg/runtime"
    22  	"k8s.io/apimachinery/pkg/runtime/schema"
    23  	scalescheme "k8s.io/client-go/scale/scheme"
    24  )
    25  
    26  // GroupName is the group name use in this package
    27  const GroupName = appsv1beta2.GroupName
    28  
    29  // SchemeGroupVersion is group version used to register these objects
    30  var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
    31  
    32  // Kind takes an unqualified kind and returns a Group qualified GroupKind
    33  func Kind(kind string) schema.GroupKind {
    34  	return SchemeGroupVersion.WithKind(kind).GroupKind()
    35  }
    36  
    37  // Resource takes an unqualified resource and returns a Group qualified GroupResource
    38  func Resource(resource string) schema.GroupResource {
    39  	return SchemeGroupVersion.WithResource(resource).GroupResource()
    40  }
    41  
    42  var (
    43  	// SchemeBuilder points to a list of functions added to Scheme.
    44  	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
    45  	// AddToScheme applies all the stored functions to the scheme.
    46  	AddToScheme = SchemeBuilder.AddToScheme
    47  )
    48  
    49  // Adds the list of known types to api.Scheme.
    50  func addKnownTypes(scheme *runtime.Scheme) error {
    51  	scheme.AddKnownTypes(SchemeGroupVersion,
    52  		&scalescheme.Scale{},
    53  	)
    54  	return nil
    55  }
    56  

View as plain text