Documentation ¶
Index ¶
- Constants
- func CloneMap(src map[string]interface{}) map[string]interface{}
- func CopyMap(src, dest map[string]interface{})
- func CreateSelectorsString(namespace, labelSelector, fieldSelector string) string
- func GetBool(dict map[string]interface{}, key string) (bool, error)
- func GetBoolOrDefault(dict map[string]interface{}, key string, defaultValue bool) (bool, error)
- func GetDuration(dict map[string]interface{}, key string) (time.Duration, error)
- func GetDurationOrDefault(dict map[string]interface{}, key string, defaultValue time.Duration) (time.Duration, error)
- func GetFloat64(dict map[string]interface{}, key string) (float64, error)
- func GetFloat64OrDefault(dict map[string]interface{}, key string, defaultValue float64) (float64, error)
- func GetInt(dict map[string]interface{}, key string) (int, error)
- func GetIntOrDefault(dict map[string]interface{}, key string, defaultValue int) (int, error)
- func GetLabelSelector(dict map[string]interface{}, key string) (*labels.Selector, error)
- func GetMap(dict map[string]interface{}, key string) (map[string]interface{}, error)
- func GetMapArray(dict map[string]interface{}, key string) ([]map[string]interface{}, error)
- func GetMasterIPs(c clientset.Interface, addressType corev1.NodeAddressType) ([]string, error)
- func GetMasterName(c clientset.Interface) (string, error)
- func GetSchedulableUntainedNodes(c clientset.Interface) ([]corev1.Node, error)
- func GetSchedulableUntainedNodesNumber(c clientset.Interface) (int, error)
- func GetSigner(provider string) (ssh.Signer, error)
- func GetString(dict map[string]interface{}, key string) (string, error)
- func GetStringArray(dict map[string]interface{}, key string) ([]string, error)
- func GetStringOrDefault(dict map[string]interface{}, key string, defaultValue string) (string, error)
- func IsControlPlaneNode(node *corev1.Node) bool
- func IsErrKeyNotFound(err error) bool
- func IsNodeSchedulableAndUntainted(node *corev1.Node) bool
- func IssueSSHCommand(ctx context.Context, cmd, provider string, node *v1.Node) error
- func LegacyIsMasterNode(node *corev1.Node) bool
- func LogClusterNodes(c clientset.Interface) error
- func LogResult(result Result)
- func NodeSSHHosts(ctx context.Context, c clientset.Interface) ([]string, error)
- func PrettyPrintJSON(data interface{}) (string, error)
- func RandomDNS1123String(length int) string
- func ToStruct(dict map[string]interface{}, out interface{}) error
- type ErrKeyNotFound
- type GCloudSSHExecutor
- type ObjectSelector
- type Result
- type SSHExecutor
Constants ¶
const (
// SSHPort is tcp port number of SSH
SSHPort = "22"
)
Variables ¶
This section is empty.
Functions ¶
func CopyMap ¶
func CopyMap(src, dest map[string]interface{})
CopyMap copies values from one map to the other.
func CreateSelectorsString ¶
CreateSelectorsString creates a string representation for given namespace, label selector and field selector.
func GetBool ¶
GetBool tries to return value from map cast to bool type. If value doesn't exist, error is returned.
func GetBoolOrDefault ¶
GetBoolOrDefault tries to return value from map cast to bool type. If value doesn't exist default value is used.
func GetDuration ¶
GetDuration tries to return value from map cast to duration type. If value doesn't exist, error is returned.
func GetDurationOrDefault ¶
func GetDurationOrDefault(dict map[string]interface{}, key string, defaultValue time.Duration) (time.Duration, error)
GetDurationOrDefault tries to return value from map cast to duration type. If value doesn't exist default value is used.
func GetFloat64 ¶
GetFloat64 tries to return value from map cast to float64 type. If value doesn't exist, error is returned.
func GetFloat64OrDefault ¶
func GetFloat64OrDefault(dict map[string]interface{}, key string, defaultValue float64) (float64, error)
GetFloat64OrDefault tries to return value from map cast to float64 type. If value doesn't exist default value is used.
func GetInt ¶
GetInt tries to return value from map cast to int type. If value doesn't exist, error is returned.
func GetIntOrDefault ¶
GetIntOrDefault tries to return value from map cast to int type. If value doesn't exist default value is used.
func GetLabelSelector ¶
GetLabelSelector tries to return value from map parsed as labels.Selector type. If value doesn't exist, error is returned.
func GetMap ¶
GetMap tries to return value from map of type map. If value doesn't exist, error is returned.
func GetMapArray ¶
GetMapArray tries to return value from map of type []map. If value doesn't exist, error is returned.
func GetMasterIPs ¶
GetMasterIPs returns master node ips of the given type.
func GetMasterName ¶
GetMasterName returns master node name.
func GetSchedulableUntainedNodes ¶
GetSchedulableUntainedNodes returns nodes in the cluster.
func GetSchedulableUntainedNodesNumber ¶
GetSchedulableUntainedNodesNumber returns number of nodes in the cluster.
func GetSigner ¶
GetSigner returns an ssh.Signer for the provider ("gce", etc.) that can be used to SSH to their nodes.
func GetString ¶
GetString tries to return value from map cast to string type. If value doesn't exist, error is returned.
func GetStringArray ¶
GetStringArray tries to return value from map cast to a []string, using fmt.Sprintf for elements. If value doesn't exist, error is returned.
func GetStringOrDefault ¶
func GetStringOrDefault(dict map[string]interface{}, key string, defaultValue string) (string, error)
GetStringOrDefault tries to return value from map cast to string type. If value doesn't exist default value is used.
func IsControlPlaneNode ¶
func IsErrKeyNotFound ¶
IsErrKeyNotFound returns true only if error type is ErrKeyNotFound.
func IsNodeSchedulableAndUntainted ¶
IsNodeSchedulableAndUntainted returns true whether node is schedulable and untainted.
func IssueSSHCommand ¶
IssueSSHCommand tries to execute a SSH command
func LegacyIsMasterNode ¶
LegacyIsMasterNode returns true if given node is a registered master according to the logic historically used for this function. This code path is deprecated and the node disruption exclusion label should be used in the future. This code will not be allowed to update to use the node-role label, since node-roles may not be used for feature enablement. DEPRECATED: this will be removed in Kubernetes 1.19
func LogClusterNodes ¶
LogClusterNodes prints nodes information (name, internal ip, external ip) to log.
func NodeSSHHosts ¶
NodeSSHHosts returns SSH-able host names for all schedulable nodes. If it can't find any external IPs, it falls back to looking for internal IPs. If it can't find an internal IP for every node it returns an error, though it still returns all hosts that it found in that case.
func PrettyPrintJSON ¶
PrettyPrintJSON converts given data into formatted json.
func RandomDNS1123String ¶
RandomDNS1123String generates random string of a given length.
Types ¶
type ErrKeyNotFound ¶
type ErrKeyNotFound struct {
// contains filtered or unexported fields
}
ErrKeyNotFound is returned when key doesn't exists in a map.
func (*ErrKeyNotFound) Error ¶
func (e *ErrKeyNotFound) Error() string
Erros is an error interface implementation.
type GCloudSSHExecutor ¶
type GCloudSSHExecutor struct{}
GCloudSSHExecutor runs commands in GCloud cluster nodes
type ObjectSelector ¶
ObjectSelector is an aggregation of namespace, labelSelector and fieldSelector.
func NewObjectSelector ¶
func NewObjectSelector() *ObjectSelector
NewObjectSelector creates default object selector.
func (*ObjectSelector) ApplySelectors ¶
func (o *ObjectSelector) ApplySelectors(options *metav1.ListOptions)
ApplySelectors sets label and field selectors in a given ListOptions object.
func (*ObjectSelector) Parse ¶
func (o *ObjectSelector) Parse(params map[string]interface{}) error
Parse parses namespace, labelSelector and fieldSelector from params map.
func (*ObjectSelector) String ¶
func (o *ObjectSelector) String() string
String returns string representation of the selector.