kubesphere.io/api@v0.0.0-20231107125330-c9a03957060c/network/calicov3/register.go (about)

     1  // Copyright (c) 2016-2017 Tigera, Inc. All rights reserved.
     2  
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package calicov3
    16  
    17  import (
    18  	"k8s.io/apimachinery/pkg/runtime/schema"
    19  	"sigs.k8s.io/controller-runtime/pkg/scheme"
    20  )
    21  
    22  var (
    23  	// SchemeGroupVersion is group version used to register these objects
    24  	SchemeGroupVersion = schema.GroupVersion{Group: "crd.projectcalico.org", Version: "v1"}
    25  
    26  	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
    27  	SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
    28  
    29  	// AddToScheme is required by pkg/client/...
    30  	AddToScheme = SchemeBuilder.AddToScheme
    31  )
    32  
    33  func init() {
    34  	SchemeBuilder.Register(&BlockAffinity{}, &BlockAffinityList{})
    35  	SchemeBuilder.Register(&IPAMBlock{}, &IPAMBlockList{})
    36  	SchemeBuilder.Register(&IPPool{}, &IPPoolList{})
    37  }
    38  
    39  // Resource is required by pkg/client/listers/...
    40  func Resource(resource string) schema.GroupResource {
    41  	return SchemeGroupVersion.WithResource(resource).GroupResource()
    42  }