github.com/spotmaxtech/k8s-apimachinery-v0260@v0.0.1/pkg/types/nodename.go (about) 1 /* 2 Copyright 2015 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 types 18 19 // NodeName is a type that holds a api.Node's Name identifier. 20 // Being a type captures intent and helps make sure that the node name 21 // is not confused with similar concepts (the hostname, the cloud provider id, 22 // the cloud provider name etc) 23 // 24 // To clarify the various types: 25 // 26 // - Node.Name is the Name field of the Node in the API. This should be stored in a NodeName. 27 // Unfortunately, because Name is part of ObjectMeta, we can't store it as a NodeName at the API level. 28 // 29 // - Hostname is the hostname of the local machine (from uname -n). 30 // However, some components allow the user to pass in a --hostname-override flag, 31 // which will override this in most places. In the absence of anything more meaningful, 32 // kubelet will use Hostname as the Node.Name when it creates the Node. 33 // 34 // * The cloudproviders have the own names: GCE has InstanceName, AWS has InstanceId. 35 // 36 // For GCE, InstanceName is the Name of an Instance object in the GCE API. On GCE, Instance.Name becomes the 37 // Hostname, and thus it makes sense also to use it as the Node.Name. But that is GCE specific, and it is up 38 // to the cloudprovider how to do this mapping. 39 // 40 // For AWS, the InstanceID is not yet suitable for use as a Node.Name, so we actually use the 41 // PrivateDnsName for the Node.Name. And this is _not_ always the same as the hostname: if 42 // we are using a custom DHCP domain it won't be. 43 type NodeName string