util

package
v1.0.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2019 PingCAP, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// LabelNodeRoleMaster specifies that a node is a master
	LabelNodeRoleMaster = "node-role.kubernetes.io/master"
)

Variables

View Source
var ExecutableFileExtensions = []string{""}

Valid file extensions for plugin executables.

Functions

func EnsureDirectoryExist

func EnsureDirectoryExist(dirName string) error

EnsureDirectoryExist create directory if does not exist

func FindInPath

func FindInPath(binary string, paths []string) (string, error)

FindInPath returns the full path of the binary by searching in the provided path

func GenURL

func GenURL(url string) string

GenURL adds 'http' prefix for URL

func GetContainerStatusFromPod

func GetContainerStatusFromPod(pod *corev1.Pod, cond func(corev1.ContainerStatus) bool) *corev1.ContainerStatus

func GetHostname

func GetHostname(hostnameOverride string) (string, error)

GetHostname returns OS's hostname if 'hostnameOverride' is empty; otherwise, return 'hostnameOverride'.

func ListK8sNodes

func ListK8sNodes(kubectlPath, labels string) ([]string, error)

ListK8sNodes returns k8s nodes base on node labels

func OpenDB

func OpenDB(dsn string, maxIdleConns int) (*sql.DB, error)

OpenDB opens db

func ParseTemplate

func ParseTemplate(strtmpl string, obj interface{}) ([]byte, error)

ParseTemplate validates and parses passed as argument template

func Sleep

func Sleep(ctx context.Context, sleepTime time.Duration)

Sleep defines special `sleep` with context

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL