Documentation ¶
Overview ¶
Package kubernetes provides objects for starting the Kubernetes master and node code.
Index ¶
- Constants
- func BuildDefaultAPIServer(options configapi.MasterConfig) (*apiserveroptions.APIServer, genericapiserver.StorageFactory, error)
- func SetFakeCadvisorInterfaceForIntegrationTest()
- func SetFakeContainerManagerInterfaceForIntegrationTest()
- type MasterConfig
- func (c *MasterConfig) InstallAPI(container *restful.Container) ([]string, error)
- func (c *MasterConfig) RunDaemonSetsController(client *client.Client)
- func (c *MasterConfig) RunDeploymentController(client *client.Client)
- func (c *MasterConfig) RunDisruptionBudgetController(client *client.Client)
- func (c *MasterConfig) RunEndpointController(client *client.Client)
- func (c *MasterConfig) RunGCController(client *client.Client)
- func (c *MasterConfig) RunGarbageCollectorController(client *osclient.Client, config *restclient.Config)
- func (c *MasterConfig) RunHPAController(oc *osclient.Client, kc *client.Client, heapsterNamespace string)
- func (c *MasterConfig) RunJobController(client *client.Client)
- func (c *MasterConfig) RunNamespaceController(kubeClient internalclientset.Interface, clientPool dynamic.ClientPool)
- func (c *MasterConfig) RunNodeController()
- func (c *MasterConfig) RunPersistentVolumeAttachDetachController(client *client.Client)
- func (c *MasterConfig) RunPersistentVolumeController(client *client.Client, ...)
- func (c *MasterConfig) RunPetSetController(client *client.Client)
- func (c *MasterConfig) RunReplicaSetController(client *client.Client)
- func (c *MasterConfig) RunReplicationController(client *client.Client)
- func (c *MasterConfig) RunScheduledJobController(config *restclient.Config)
- func (c *MasterConfig) RunScheduler()
- func (c *MasterConfig) RunServiceLoadBalancerController(client *client.Client)
- type NodeAuthorizerAttributesGetter
- type NodeConfig
- func (c *NodeConfig) EnsureDocker(docker *dockerutil.Helper)
- func (c *NodeConfig) EnsureKubeletAccess()
- func (c *NodeConfig) EnsureLocalQuota(nodeConfig configapi.NodeConfig)
- func (c *NodeConfig) EnsureVolumeDir()
- func (c *NodeConfig) HandleDockerError(message string)
- func (c *NodeConfig) RunDNS()
- func (c *NodeConfig) RunKubelet()
- func (c *NodeConfig) RunPlugin()
- func (c *NodeConfig) RunProxy()
- func (c *NodeConfig) RunServiceStores(enableProxy, enableDNS bool)
- type ProxyConfig
Constants ¶
const ( KubeAPIPrefix = "/api" KubeAPIGroupPrefix = "/apis" )
Variables ¶
This section is empty.
Functions ¶
func BuildDefaultAPIServer ¶
func BuildDefaultAPIServer(options configapi.MasterConfig) (*apiserveroptions.APIServer, genericapiserver.StorageFactory, error)
BuildDefaultAPIServer constructs the appropriate APIServer and StorageFactory for the kubernetes server. It returns an error if no KubernetesMasterConfig was defined.
func SetFakeCadvisorInterfaceForIntegrationTest ¶
func SetFakeCadvisorInterfaceForIntegrationTest()
SetFakeCadvisorInterfaceForIntegrationTest sets a fake cadvisor implementation to allow the node to run in integration tests
func SetFakeContainerManagerInterfaceForIntegrationTest ¶
func SetFakeContainerManagerInterfaceForIntegrationTest()
SetFakeContainerManagerInterfaceForIntegrationTest sets a fake container manager implementation to allow the node to run in integration tests
Types ¶
type MasterConfig ¶
type MasterConfig struct { Options configapi.KubernetesMasterConfig KubeClient *kclient.Client Master *master.Config ControllerManager *cmapp.CMServer SchedulerServer *scheduleroptions.SchedulerServer CloudProvider cloudprovider.Interface Informers shared.InformerFactory }
MasterConfig defines the required values to start a Kubernetes master
func BuildKubernetesMasterConfig ¶
func BuildKubernetesMasterConfig(options configapi.MasterConfig, requestContextMapper kapi.RequestContextMapper, kubeClient *kclient.Client, informers shared.InformerFactory, admissionControl admission.Interface, originAuthenticator authenticator.Request) (*MasterConfig, error)
func (*MasterConfig) InstallAPI ¶
func (c *MasterConfig) InstallAPI(container *restful.Container) ([]string, error)
InstallAPI starts a Kubernetes master and registers the supported REST APIs into the provided mux, then returns an array of strings indicating what endpoints were started (these are format strings that will expect to be sent a single string value).
func (*MasterConfig) RunDaemonSetsController ¶
func (c *MasterConfig) RunDaemonSetsController(client *client.Client)
func (*MasterConfig) RunDeploymentController ¶
func (c *MasterConfig) RunDeploymentController(client *client.Client)
func (*MasterConfig) RunDisruptionBudgetController ¶
func (c *MasterConfig) RunDisruptionBudgetController(client *client.Client)
RunDisruptionBudgetController starts the Kubernetes disruption budget controller
func (*MasterConfig) RunEndpointController ¶
func (c *MasterConfig) RunEndpointController(client *client.Client)
RunEndpointController starts the Kubernetes replication controller sync loop
func (*MasterConfig) RunGCController ¶
func (c *MasterConfig) RunGCController(client *client.Client)
RunGCController handles deletion of terminated pods.
func (*MasterConfig) RunGarbageCollectorController ¶
func (c *MasterConfig) RunGarbageCollectorController(client *osclient.Client, config *restclient.Config)
RunGarbageCollectorController starts generic garbage collection for the cluster.
func (*MasterConfig) RunHPAController ¶
func (c *MasterConfig) RunHPAController(oc *osclient.Client, kc *client.Client, heapsterNamespace string)
RunHPAController starts the Kubernetes hpa controller sync loop
func (*MasterConfig) RunJobController ¶
func (c *MasterConfig) RunJobController(client *client.Client)
RunJobController starts the Kubernetes job controller sync loop
func (*MasterConfig) RunNamespaceController ¶
func (c *MasterConfig) RunNamespaceController(kubeClient internalclientset.Interface, clientPool dynamic.ClientPool)
RunNamespaceController starts the Kubernetes Namespace Manager
func (*MasterConfig) RunNodeController ¶
func (c *MasterConfig) RunNodeController()
RunNodeController starts the node controller TODO: handle node CIDR and route allocation
func (*MasterConfig) RunPersistentVolumeAttachDetachController ¶
func (c *MasterConfig) RunPersistentVolumeAttachDetachController(client *client.Client)
func (*MasterConfig) RunPersistentVolumeController ¶
func (c *MasterConfig) RunPersistentVolumeController(client *client.Client, namespace, recyclerImageName, recyclerServiceAccountName string)
func (*MasterConfig) RunPetSetController ¶
func (c *MasterConfig) RunPetSetController(client *client.Client)
RunPetSetController starts the PetSet controller
func (*MasterConfig) RunReplicaSetController ¶
func (c *MasterConfig) RunReplicaSetController(client *client.Client)
func (*MasterConfig) RunReplicationController ¶
func (c *MasterConfig) RunReplicationController(client *client.Client)
RunReplicationController starts the Kubernetes replication controller sync loop
func (*MasterConfig) RunScheduledJobController ¶
func (c *MasterConfig) RunScheduledJobController(config *restclient.Config)
RunScheduledJobController starts the Kubernetes scheduled job controller sync loop
func (*MasterConfig) RunScheduler ¶
func (c *MasterConfig) RunScheduler()
RunScheduler starts the Kubernetes scheduler
func (*MasterConfig) RunServiceLoadBalancerController ¶
func (c *MasterConfig) RunServiceLoadBalancerController(client *client.Client)
RunServiceLoadBalancerController starts the service loadbalancer controller if the cloud provider is configured.
type NodeAuthorizerAttributesGetter ¶
type NodeAuthorizerAttributesGetter struct {
// contains filtered or unexported fields
}
func (NodeAuthorizerAttributesGetter) GetRequestAttributes ¶
func (n NodeAuthorizerAttributesGetter) GetRequestAttributes(u user.Info, r *http.Request) kauthorizer.Attributes
GetRequestAttributes populates authorizer attributes for the requests to the kubelet API. Default attributes are {apiVersion=v1,verb=proxy,resource=nodes,resourceName=<node name>} More specific verb/resource is set for the following request patterns:
/stats/* => verb=<api verb from request>, resource=nodes/stats /metrics/* => verb=<api verb from request>, resource=nodes/metrics /logs/* => verb=<api verb from request>, resource=nodes/log
type NodeConfig ¶
type NodeConfig struct { // BindAddress is the address to bind to BindAddress string // VolumeDir is the directory that volumes will be stored under VolumeDir string // AllowDisabledDocker if true, will make the Kubelet ignore errors from Docker AllowDisabledDocker bool // Containerized is true if we are expected to be running inside of a container Containerized bool // Client to connect to the master. Client *client.Client // DockerClient is a client to connect to Docker DockerClient dockertools.DockerInterface // KubeletServer contains the KubeletServer configuration KubeletServer *kubeletoptions.KubeletServer // KubeletDeps are the injected code dependencies for the kubelet, fully initialized KubeletDeps *kubelet.KubeletDeps // ProxyConfig is the configuration for the kube-proxy, fully initialized ProxyConfig *proxyoptions.ProxyServerConfig // IPTablesSyncPeriod is how often iptable rules are refreshed IPTablesSyncPeriod string // EnableUnidling indicates whether or not the unidling hybrid proxy should be used EnableUnidling bool // ServiceStore is reused between proxy and DNS ServiceStore cache.Store // EndpointsStore is reused between proxy and DNS EndpointsStore cache.Store // ServicesReady is closed when the service and endpoint stores are ready to be used ServicesReady chan struct{} // DNSConfig controls the DNS configuration. DNSServer *dns.Server // SDNPlugin is an optional SDN plugin SDNPlugin *sdnplugin.OsdnNode // SDNProxy is an optional service endpoints filterer SDNProxy *sdnplugin.OsdnProxy }
NodeConfig represents the required parameters to start the OpenShift node through Kubernetes. All fields are required.
func BuildKubernetesNodeConfig ¶
func BuildKubernetesNodeConfig(options configapi.NodeConfig, enableProxy, enableDNS bool) (*NodeConfig, error)
func (*NodeConfig) EnsureDocker ¶
func (c *NodeConfig) EnsureDocker(docker *dockerutil.Helper)
EnsureDocker attempts to connect to the Docker daemon defined by the helper, and if it is unable to it will print a warning.
func (*NodeConfig) EnsureKubeletAccess ¶
func (c *NodeConfig) EnsureKubeletAccess()
EnsureKubeletAccess performs a number of test operations that the Kubelet requires to properly function. All errors here are fatal.
func (*NodeConfig) EnsureLocalQuota ¶
func (c *NodeConfig) EnsureLocalQuota(nodeConfig configapi.NodeConfig)
EnsureLocalQuota checks if the node config specifies a local storage perFSGroup quota, and if so will test that the volumeDirectory is on a filesystem suitable for quota enforcement. If checks pass the k8s emptyDir volume plugin will be replaced with a wrapper version which adds quota functionality.
func (*NodeConfig) EnsureVolumeDir ¶
func (c *NodeConfig) EnsureVolumeDir()
EnsureVolumeDir attempts to convert the provided volume directory argument to an absolute path and create the directory if it does not exist. Will exit if an error is encountered.
func (*NodeConfig) HandleDockerError ¶
func (c *NodeConfig) HandleDockerError(message string)
HandleDockerError handles an an error from the docker daemon
func (*NodeConfig) RunDNS ¶
func (c *NodeConfig) RunDNS()
RunDNS starts the DNS server as soon as services are loaded.
func (*NodeConfig) RunPlugin ¶
func (c *NodeConfig) RunPlugin()
RunPlugin starts the local SDN plugin, if enabled in configuration.
func (*NodeConfig) RunServiceStores ¶
func (c *NodeConfig) RunServiceStores(enableProxy, enableDNS bool)
RunServiceStores retrieves service info from the master, and closes the ServicesReady channel when done.
type ProxyConfig ¶
type ProxyConfig struct {
ClientConfig *restclient.Config
}
func (*ProxyConfig) InstallAPI ¶
func (c *ProxyConfig) InstallAPI(container *restful.Container) ([]string, error)