Documentation ¶
Index ¶
- func BasicAdminPod(node string, namespace string, podNamePrefix string, toolbox bool) *v1.Pod
- func CertHashesFromKubeconfig(kubeconfigPath string) ([]string, error)
- func CertsFromKubeconfig(kubeconfigPath string) ([]*x509.Certificate, error)
- func CreateConfigMapWithData(client kubernetes.Interface, namespace string, name string, ...) error
- func CreateConfigmap(client kubernetes.Interface, configMap *corev1.ConfigMap) error
- func CreateJoin(kubeconfigPath string) (string, []string, error)
- func CreateJoinToken(kubeconfigPath string, generateOnly bool) (string, error)
- func CreateNamespaceIfNotExists(client kubernetes.Interface, name string) error
- func CreateResource(restConf *rest.Config, u *unstructured.Unstructured) error
- func CreateResourceIfNotExist(restConf *rest.Config, u *unstructured.Unstructured) error
- func CreateScriptsPod(client kubernetes.Interface, p *PodOptions) error
- func CreateSecret(client kubernetes.Interface, namespace string, secret *v1.Secret) error
- func CreateService(client kubernetes.Interface, svc *v1.Service) error
- func DeleteConfigmap(client kubernetes.Interface, namespace string, name string) error
- func DeletePod(client kubernetes.Interface, namespace string, name string) error
- func DeleteResource(restConf *rest.Config, u *unstructured.Unstructured) error
- func DeleteResourceByIdentifier(restConf *rest.Config, group string, version string, kind string, name string, ...) error
- func DeleteService(client kubernetes.Interface, namespace string, name string) error
- func FindAll(haystack string, filter func(unstructured.Unstructured) bool) ([]unstructured.Unstructured, error)
- func FindIn(haystack string, filter func(unstructured.Unstructured) bool) (unstructured.Unstructured, error)
- func FindSecretsByLabelKey(client kubernetes.Interface, namespace string, key string) (*v1.SecretList, error)
- func FindSecretsByLabelKeyVal(client kubernetes.Interface, namespace string, key string, val string) (*v1.SecretList, error)
- func FindSecretsByLabelSelector(client kubernetes.Interface, namespace string, selector labels.Selector) (*v1.SecretList, error)
- func FindServicesByLabelKey(client kubernetes.Interface, namespace string, key string) (*v1.ServiceList, error)
- func FindServicesByLabelKeyVal(client kubernetes.Interface, namespace string, key string, val string) (*v1.ServiceList, error)
- func FindServicesByLabelSelector(client kubernetes.Interface, namespace string, selector labels.Selector) (*v1.ServiceList, error)
- func GetConfigmap(client kubernetes.Interface, namespace string, name string) (*corev1.ConfigMap, error)
- func GetControlPlaneNodes(cli kubernetes.Interface) (*v1.NodeList, error)
- func GetNamespaceList(client kubernetes.Interface) (*v1.NamespaceList, error)
- func GetNamespaces(cli kubernetes.Interface) ([]string, error)
- func GetNode(client kubernetes.Interface, name string) (*v1.Node, error)
- func GetNodeList(client kubernetes.Interface) (*v1.NodeList, error)
- func GetNodeNames(cli kubernetes.Interface) ([]string, error)
- func GetPod(client kubernetes.Interface, namespace string, name string) (*v1.Pod, error)
- func GetPodsBySelector(client kubernetes.Interface, namespace string, selector string) (*v1.PodList, error)
- func GetResource(restConf *rest.Config, u *unstructured.Unstructured) error
- func GetResourceByIdentifier(restConf *rest.Config, group string, version string, kind string, name string, ...) (*unstructured.Unstructured, error)
- func GetRole(node *v1.Node) (bool, string)
- func GetService(client kubernetes.Interface, namespace string, name string) (*v1.Service, error)
- func GrabContainer(objectsToSearch []v1.Container, name string) (v1.Container, int, error)
- func GrabDeployment(objectsToSearch []unstructured.Unstructured) (v1Apps.Deployment, int, error)
- func IsControlPlane(node *v1.Node) bool
- func IsNodeReady(status v1.NodeStatus) bool
- func IsNotExist(err error) bool
- func IsUpdateAvailable(node *v1.Node) bool
- func PortForwardToService(kubeConfigPath string, serviceNsn types.NamespacedName, remotePort string) (int, error)
- func StartAdminPodOnNode(client kubernetes.Interface, node string, namespace string, ...) (*v1.Pod, error)
- func StartPortForwardToService(kubeInfo *client.KubeInfo, forwardSpec *PortForwardSpec) (int, error)
- func Unmarshall(reader *bufio.Reader) ([]unstructured.Unstructured, error)
- func UpdateConfigMap(client kubernetes.Interface, configMap *corev1.ConfigMap, namespace string) (*corev1.ConfigMap, error)
- func UploadCertificateStanza(kubeconfigPath string, key string) (string, error)
- func UploadCertificates(kubeconfigPath string, key string) error
- func WaitForDeployment(client kubernetes.Interface, namespace string, name string, ...) error
- func WaitForPod(client kubernetes.Interface, namespace string, name string) error
- func WaitForService(client kubernetes.Interface, namespace string, name string) error
- func WaitForServiceAccount(client kubernetes.Interface, accountName string, namespace string) error
- func WaitUntilGetNodesSucceeds(client kubernetes.Interface) (*v1.NodeList, error)
- func WaitUntilNodeIsReady(client kubernetes.Interface, nodeName string) error
- func WaitUntilPodReady(client kubernetes.Interface, namespace string, name string) error
- type ErrorNotExist
- type PodOptions
- type PortForwardSpec
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicAdminPod ¶
BasicAdminPod returns the skeleton of a pod specification that can be used to create a privileged pod on a node.
func CertHashesFromKubeconfig ¶
CertHashesFromKubeconfig returns a list of hashes, one for each x509 certificate in a kubeconfig
func CertsFromKubeconfig ¶
func CertsFromKubeconfig(kubeconfigPath string) ([]*x509.Certificate, error)
CertsFromKubeconfig gets the list of x509 certificates embedded in a kubeconfig.
func CreateConfigMapWithData ¶
func CreateConfigmap ¶
func CreateConfigmap(client kubernetes.Interface, configMap *corev1.ConfigMap) error
func CreateJoin ¶
CreateJoin creates a join token on an existing cluster and returns the token as well as the hashes of the CA certs for the input kubeconfig
func CreateJoinToken ¶
func CreateNamespaceIfNotExists ¶
func CreateNamespaceIfNotExists(client kubernetes.Interface, name string) error
CreateNamespaceIfNotExists creates a namespace if it does not already exist
func CreateResource ¶
func CreateResource(restConf *rest.Config, u *unstructured.Unstructured) error
func CreateResourceIfNotExist ¶
func CreateResourceIfNotExist(restConf *rest.Config, u *unstructured.Unstructured) error
func CreateScriptsPod ¶
func CreateScriptsPod(client kubernetes.Interface, p *PodOptions) error
CreateScriptsPod create a pod that mounts the config map with the same name as the pod
func CreateSecret ¶
CreateSecret creates a Secret
func CreateService ¶
func CreateService(client kubernetes.Interface, svc *v1.Service) error
func DeleteConfigmap ¶
func DeleteConfigmap(client kubernetes.Interface, namespace string, name string) error
func DeleteResource ¶
func DeleteResource(restConf *rest.Config, u *unstructured.Unstructured) error
func DeleteService ¶
func DeleteService(client kubernetes.Interface, namespace string, name string) error
func FindAll ¶
func FindAll(haystack string, filter func(unstructured.Unstructured) bool) ([]unstructured.Unstructured, error)
FindAll finds all objects that mateches the criteria in a multi-doc yaml string.
func FindIn ¶
func FindIn(haystack string, filter func(unstructured.Unstructured) bool) (unstructured.Unstructured, error)
FindIn finds the first object that matches the criteria in a multi-doc yaml string.
func FindSecretsByLabelKey ¶
func FindSecretsByLabelKey(client kubernetes.Interface, namespace string, key string) (*v1.SecretList, error)
FindSecretsByLabelKey returns a SecretList for services that match the specified label key
func FindSecretsByLabelKeyVal ¶
func FindSecretsByLabelKeyVal(client kubernetes.Interface, namespace string, key string, val string) (*v1.SecretList, error)
FindSecretsByLabelKeyVal returns a SecretList for services that match the specified label key/value pair
func FindSecretsByLabelSelector ¶
func FindSecretsByLabelSelector(client kubernetes.Interface, namespace string, selector labels.Selector) (*v1.SecretList, error)
FindSecretsByLabelSelector returns a SecretList for services that match the label selector
func FindServicesByLabelKey ¶
func FindServicesByLabelKey(client kubernetes.Interface, namespace string, key string) (*v1.ServiceList, error)
FindServicesByLabelKey returns a ServiceList for services that match the specified label key
func FindServicesByLabelKeyVal ¶
func FindServicesByLabelKeyVal(client kubernetes.Interface, namespace string, key string, val string) (*v1.ServiceList, error)
FindServicesByLabelKeyVal returns a ServiceList for services that match the specified label key/value pair
func FindServicesByLabelSelector ¶
func FindServicesByLabelSelector(client kubernetes.Interface, namespace string, selector labels.Selector) (*v1.ServiceList, error)
FindServicesByLabelSelector returns a ServiceList for services that match the label selector
func GetConfigmap ¶
func GetControlPlaneNodes ¶
func GetControlPlaneNodes(cli kubernetes.Interface) (*v1.NodeList, error)
GetControlPlaneNodes gets all nodes that run control plane components. It looks for data other than labels and annotations to make a reasonable guess at what those nodes are.
func GetNamespaceList ¶
func GetNamespaceList(client kubernetes.Interface) (*v1.NamespaceList, error)
GetNamespaceList returns the list of namespaces
func GetNamespaces ¶
func GetNamespaces(cli kubernetes.Interface) ([]string, error)
GetNamespaces returns the namespace names
func GetNodeList ¶
func GetNodeList(client kubernetes.Interface) (*v1.NodeList, error)
GetNodeList returns a list of Kubernetes nodes.
func GetNodeNames ¶
func GetNodeNames(cli kubernetes.Interface) ([]string, error)
GetNodeNames returns the cluster node naems
func GetPodsBySelector ¶
func GetResource ¶
func GetResource(restConf *rest.Config, u *unstructured.Unstructured) error
func GetResourceByIdentifier ¶
func GetResourceByIdentifier(restConf *rest.Config, group string, version string, kind string, name string, namespace string) (*unstructured.Unstructured, error)
func GetRole ¶
GetRole returns true if the node is a control-plane node, along with a string indicating the node's role
func GetService ¶
GetService returns the specified service.
func GrabContainer ¶
func GrabDeployment ¶
func GrabDeployment(objectsToSearch []unstructured.Unstructured) (v1Apps.Deployment, int, error)
func IsControlPlane ¶
IsControlPlane returns true if the node is a control-plane node
func IsNodeReady ¶
func IsNodeReady(status v1.NodeStatus) bool
func IsNotExist ¶
IsNotExist checks if an error represents non-existence
func IsUpdateAvailable ¶
IsUpdateAvailable returns true if an update is available on that node
func PortForwardToService ¶
func PortForwardToService(kubeConfigPath string, serviceNsn types.NamespacedName, remotePort string) (int, error)
PortForwardToService does a port forward to a service and returns the local port
func StartAdminPodOnNode ¶
func StartAdminPodOnNode(client kubernetes.Interface, node string, namespace string, podNamePrefix string, toolbox bool) (*v1.Pod, error)
StartAdminPodOnNode creates a privileged pod on a node, executes a command, and tears down the pod.
func StartPortForwardToService ¶
func StartPortForwardToService(kubeInfo *client.KubeInfo, forwardSpec *PortForwardSpec) (int, error)
StartPortForwardToService starts a port-forward to a service in the background, then returns the local port. The caller can then send data to http://localhost:<localport> The port-forwarding session remains until the CLI exits.
func Unmarshall ¶
func Unmarshall(reader *bufio.Reader) ([]unstructured.Unstructured, error)
Unmarshall a reader containing YAML to a list of unstructured objects
func UpdateConfigMap ¶
func UploadCertificateStanza ¶
UploadCertificateStanza returns a command to run that will upload certificates to the cluster to enable joining new control plane nodes.
func UploadCertificates ¶
UploadCertificates uploads the key material required for control plane nodes to join clusters.
func WaitForDeployment ¶
func WaitForDeployment(client kubernetes.Interface, namespace string, name string, expectedReplicas int32) error
WaitForDeployment - wait for deployment to be ready
func WaitForPod ¶
func WaitForPod(client kubernetes.Interface, namespace string, name string) error
func WaitForService ¶
func WaitForService(client kubernetes.Interface, namespace string, name string) error
WaitForService - wait for service to exist
func WaitForServiceAccount ¶
func WaitForServiceAccount(client kubernetes.Interface, accountName string, namespace string) error
WaitForServiceAccount waits for a service account to exist.
func WaitUntilGetNodesSucceeds ¶
func WaitUntilGetNodesSucceeds(client kubernetes.Interface) (*v1.NodeList, error)
WaitUntilGetNodesSucceeds until Kubernetes returns node list
func WaitUntilNodeIsReady ¶
func WaitUntilNodeIsReady(client kubernetes.Interface, nodeName string) error
WaitUntilNodeIsReady until Kubernetes node is ready
func WaitUntilPodReady ¶
func WaitUntilPodReady(client kubernetes.Interface, namespace string, name string) error
WaitUntilPodReady waits until a pod is ready
Types ¶
type ErrorNotExist ¶
type ErrorNotExist struct { }
func (*ErrorNotExist) Error ¶
func (e *ErrorNotExist) Error() string
type PodOptions ¶
type PodOptions struct { NodeName string Namespace string PodName string ImageName string ConfigMapName string HostPID bool HostNetwork bool Env []v1.EnvVar }
PodOptions are used to create a pod that mounts a configmap
type PortForwardSpec ¶
type PortForwardSpec struct { // ServiceNsn is the namespace and name of the service which the target of the port forward. // Required ServiceNsn types.NamespacedName // LocalPort is the port on the local system (where the CLI is) where HTTP requests will be sent // This is normally left blank and the port-forwarding code will assign an ephemeral port, which // is returned to the caller when the port-forward is started. Only set it if you really // want to use a specific port. // Optional LocalPort string // RemotePort is the service port which will receive forwarded traffic. // Required RemotePort string }
PortForwardSpec contains the information needed to do the port forward