...

Source file src/k8s.io/kubernetes/cmd/kube-controller-manager/app/config/config.go

Documentation: k8s.io/kubernetes/cmd/kube-controller-manager/app/config

     1  /*
     2  Copyright 2018 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 config
    18  
    19  import (
    20  	apiserver "k8s.io/apiserver/pkg/server"
    21  	clientset "k8s.io/client-go/kubernetes"
    22  	restclient "k8s.io/client-go/rest"
    23  	"k8s.io/client-go/tools/record"
    24  	kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
    25  )
    26  
    27  // Config is the main context object for the controller manager.
    28  type Config struct {
    29  	ComponentConfig kubectrlmgrconfig.KubeControllerManagerConfiguration
    30  
    31  	SecureServing *apiserver.SecureServingInfo
    32  	// LoopbackClientConfig is a config for a privileged loopback connection
    33  	LoopbackClientConfig *restclient.Config
    34  
    35  	Authentication apiserver.AuthenticationInfo
    36  	Authorization  apiserver.AuthorizationInfo
    37  
    38  	// the general kube client
    39  	Client *clientset.Clientset
    40  
    41  	// the rest config for the master
    42  	Kubeconfig *restclient.Config
    43  
    44  	EventBroadcaster record.EventBroadcaster
    45  	EventRecorder    record.EventRecorder
    46  }
    47  
    48  type completedConfig struct {
    49  	*Config
    50  }
    51  
    52  // CompletedConfig same as Config, just to swap private object.
    53  type CompletedConfig struct {
    54  	// Embed a private pointer that cannot be instantiated outside of this package.
    55  	*completedConfig
    56  }
    57  
    58  // Complete fills in any fields not set that are required to have valid data. It's mutating the receiver.
    59  func (c *Config) Complete() *CompletedConfig {
    60  	cc := completedConfig{c}
    61  
    62  	apiserver.AuthorizeClientBearerToken(c.LoopbackClientConfig, &c.Authentication, &c.Authorization)
    63  
    64  	return &CompletedConfig{&cc}
    65  }
    66  

View as plain text