...

Source file src/k8s.io/kubernetes/cmd/kubeadm/app/apis/output/scheme/scheme.go

Documentation: k8s.io/kubernetes/cmd/kubeadm/app/apis/output/scheme

     1  /*
     2  Copyright 2019 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 scheme
    18  
    19  import (
    20  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    21  	"k8s.io/apimachinery/pkg/runtime"
    22  	"k8s.io/apimachinery/pkg/runtime/schema"
    23  	"k8s.io/apimachinery/pkg/runtime/serializer"
    24  	utilruntime "k8s.io/apimachinery/pkg/util/runtime"
    25  
    26  	"k8s.io/kubernetes/cmd/kubeadm/app/apis/output"
    27  	"k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha2"
    28  	"k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha3"
    29  )
    30  
    31  // Scheme is the runtime.Scheme to which all kubeadm api types are registered.
    32  var Scheme = runtime.NewScheme()
    33  
    34  // Codecs provides access to encoding and decoding for the scheme.
    35  var Codecs = serializer.NewCodecFactory(Scheme)
    36  
    37  func init() {
    38  	metav1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
    39  	AddToScheme(Scheme)
    40  }
    41  
    42  // AddToScheme builds the kubeadm scheme using all known versions of the kubeadm api.
    43  func AddToScheme(scheme *runtime.Scheme) {
    44  	utilruntime.Must(output.AddToScheme(scheme))
    45  	utilruntime.Must(v1alpha2.AddToScheme(scheme))
    46  	utilruntime.Must(v1alpha3.AddToScheme(scheme))
    47  	utilruntime.Must(scheme.SetVersionPriority(v1alpha3.SchemeGroupVersion, v1alpha2.SchemeGroupVersion))
    48  }
    49  

View as plain text