Documentation ¶
Index ¶
- Constants
- func Apply(c Client, f string) error
- func CreateClusterRoleBinding(c Client, name, role, user string) error
- func CreateNamespace(c Client, namespace string) (bool, error)
- func CreateSecretFromLiteral(c Client, namespace, name, key, value string, override bool) (bool, error)
- func DeleteResource(c Client, resourceType, namespace, resourceName string) error
- func Execute(c Client, args ...string) (string, error)
- func ExecuteJSON(c Client, o interface{}, args ...string) error
- func GetContainerRuntimeName(c Client) (string, error)
- func GetSecretValue(c Client, namespace, name, key string) (string, error)
- func GetVersionInfo(c Client) (string, string, error)
- func ResourceExists(c Client, resourceType, namespace, resourceName string) (bool, error)
- func TestDNS(c Client, domain string) (bool, error)
- type Client
- type ClusterInfo
- type LocalClient
Examples ¶
Constants ¶
const Command = "kubectl"
Command is the name of kubectl command
Variables ¶
This section is empty.
Functions ¶
func CreateClusterRoleBinding ¶
CreateClusterRoleBinding creates a new cluster role binding
func CreateNamespace ¶
CreateNamespace creates a new namespace and returns whether it was created or not
func CreateSecretFromLiteral ¶
func CreateSecretFromLiteral(c Client, namespace, name, key, value string, override bool) (bool, error)
CreateSecretFromLiteral creates a new secret with a single (key,value) pair.
func DeleteResource ¶
DeleteResource deletes a resource
func ExecuteJSON ¶
ExecuteJSON execute kubectl <args> and returns the combined json stdout and err output.
func GetContainerRuntimeName ¶
GetContainerRuntimeName returns the container runtime name the node uses.
func GetSecretValue ¶
GetSecretValue returns the value of a secret
func GetVersionInfo ¶
GetVersionInfo returns the version metadata from kubectl May return a value for the kubectl client version, despite also returning an error
func ResourceExists ¶
ResourceExists return true if the resource exists
Types ¶
type Client ¶
type Client interface { Execute(args ...string) (string, error) ExecuteOutputMatrix(args ...string) (stdout, stderr string, err error) }
Client implements a kubectl client to execute commands
type ClusterInfo ¶
ClusterInfo describes a Kubernetes cluster
func GetClusterInfo ¶
func GetClusterInfo(c Client) (ClusterInfo, error)
GetClusterInfo gets the current Kubernetes cluster information
type LocalClient ¶
LocalClient implements Kubectl
Example ¶
local := LocalClient{} local.Execute("apply", "-f", "service.yaml")
Output:
func (LocalClient) Execute ¶
func (k LocalClient) Execute(args ...string) (string, error)
Execute executes kubectl <args> and returns the combined stdout/err output.
func (LocalClient) ExecuteOutputMatrix ¶
func (k LocalClient) ExecuteOutputMatrix(args ...string) (stdout, stderr string, err error)
ExecuteOutputMatrix executes kubectl <args> and returns stdout and stderr
func (LocalClient) IsPresent ¶
func (k LocalClient) IsPresent() bool
IsPresent returns true if there's a kubectl command in the PATH.
func (LocalClient) LookPath ¶
func (k LocalClient) LookPath() (string, error)
LookPath conveniently wraps exec.LookPath(Command)