Documentation ¶
Index ¶
- func Apply(namespace string, yamlFilePath string) error
- func Create(namespace string, yamlFilePath string) error
- func CreateNamespace(name string) error
- func CreateSecretFromLiteral(namespace string, secretName string, literalValues map[string]string) error
- func Delete(namespace string, yamlFilePath string) error
- func DeleteLabelFilter(namespace string, resourceName string, labelName string) error
- func DeleteNamespace(ns string) error
- func DeleteResource(namespace string, resourceName string, name string) error
- func DeleteSecret(namespace string, secretName string) error
- func DeleteWebhooks(ns string, name string) error
- func GetData(namespace string, resourceName string, name string, templatePath string) ([]byte, error)
- func GetObject(name, namespace, resourceType string, obj interface{}) (err error)
- func HelmBinaryVersion() (string, error)
- func PatchNamespace(name string, patch string) error
- func Run(s ...string) (string, error)
- func RunCommandWithOutput(namespace string, podName string, commandInPod string) (string, error)
- func RunHelmBinaryWithCustomErr(args ...string) error
- func RunHelmBinaryWithOutput(args ...string) (string, error)
- func RunWithoutErr(s ...string) (string, error)
- func SecretCheckData(namespace string, secretName string, fieldPath string) error
- type ClusterCrd
- type ConfigMap
- type Container
- type ContainerState
- type ContainerStateRunning
- type ContainerStateTerminated
- type ContainerStateWaiting
- type ContainerStatus
- type CustomError
- type EnvVar
- type Kubectl
- func (k *Kubectl) ApplyJSON(namespace string, name string, v interface{}) error
- func (k *Kubectl) ApplyYAML(namespace string, name string, v interface{}) error
- func (k *Kubectl) CreateRoleBinding(namespace string, clusterrole, serviceaccount, role string) error
- func (k *Kubectl) CreateServiceAccount(namespace string, serviceaccount string) error
- func (k *Kubectl) Delete(args ...string) error
- func (k *Kubectl) DeleteRoleBinding(namespace string, role string) error
- func (k *Kubectl) DeleteServiceAccount(namespace string, serviceaccount string) error
- func (k *Kubectl) EventuallyPodMatch(namespace, label string, timeout, poll time.Duration, mm gomega.OmegaMatcher)
- func (k *Kubectl) Exists(namespace, resource, name string) (bool, error)
- func (k *Kubectl) GetConfigMap(namespace string, name string) (ConfigMap, error)
- func (k *Kubectl) GetPodNames(namespace string, selector string) ([]string, error)
- func (k *Kubectl) NamespaceWithReadyPod(namespace string, labelName string) (bool, error)
- func (k *Kubectl) PodExists(namespace string, labelName string, podName string) (bool, error)
- func (k *Kubectl) PodStatus(namespace string, podName string) (*PodStatus, error)
- func (k *Kubectl) RunCommandWithCheckString(namespace string, podName string, commandInPod string, result string) error
- func (k *Kubectl) SecretExists(namespace string, secretName string) (bool, error)
- func (k *Kubectl) ServiceExists(namespace string, serviceName string) (bool, error)
- func (k *Kubectl) Wait(namespace string, requiredStatus string, resourceName string, ...) error
- func (k *Kubectl) WaitForData(namespace string, resourceName string, name string, template string, ...) error
- func (k *Kubectl) WaitForNamespaceDelete(namespace string) error
- func (k *Kubectl) WaitForNamespaceWithPod(namespace string, labelName string) error
- func (k *Kubectl) WaitForPVC(namespace string, pvcName string) error
- func (k *Kubectl) WaitForPod(namespace string, labelName string, podName string) error
- func (k *Kubectl) WaitForPodDelete(namespace string, podName string) error
- func (k *Kubectl) WaitForSecret(namespace string, secretName string) error
- func (k *Kubectl) WaitForService(namespace string, serviceName string) error
- func (k *Kubectl) WaitLabelFilter(namespace string, requiredStatus string, resourceName string, labelName string) error
- func (k *Kubectl) WaitNamespacePodsDelete(namespace string) error
- type Metadata
- type Pod
- type PodCondition
- type PodSpec
- type PodStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNamespace ¶
CreateNamespace create the namespace using kubectl command
func CreateSecretFromLiteral ¶
func CreateSecretFromLiteral(namespace string, secretName string, literalValues map[string]string) error
CreateSecretFromLiteral creates a generic type secret using kubectl command
func DeleteLabelFilter ¶
DeleteLabelFilter deletes the resource based on label using kubectl command
func DeleteResource ¶
DeleteResource deletes the resource using kubectl command
func DeleteSecret ¶
DeleteSecret deletes the namespace using kubectl command
func DeleteWebhooks ¶
DeleteWebhooks removes existing webhookconfiguration and validatingwebhookconfiguration
func GetData ¶
func GetData(namespace string, resourceName string, name string, templatePath string) ([]byte, error)
GetData fetches the specified output by the given templatePath
func HelmBinaryVersion ¶
HelmBinaryVersion executes helm version and return 2 or 3
func PatchNamespace ¶
PatchNamespace patche the namespace resource using kubectl command
func RunCommandWithOutput ¶
RunCommandWithOutput runs the command specified in the container and returns output
func RunHelmBinaryWithCustomErr ¶
RunHelmBinaryWithCustomErr executes a desire binary
func RunHelmBinaryWithOutput ¶
RunHelmBinaryWithOutput executes a desired binary and returns the output
func RunWithoutErr ¶
RunWithoutErr allow to control kubectl directly but without any StdErr
Types ¶
type ClusterCrd ¶
type ClusterCrd struct { Items []struct { APIVersion string `json:"apiVersion"` Kind string `json:"kind"` Metadata struct { Name string `json:"name"` } `json:"metadata"` } `json:"items"` }
ClusterCrd defines a list of CRDs
func (*ClusterCrd) ContainsElement ¶
func (c *ClusterCrd) ContainsElement(element string) bool
ContainsElement verify if a CRD exist
type ConfigMap ¶
type ConfigMap struct { APIVersion string `json:"apiVersion" yaml:"apiVersion"` Kind string `json:"kind" yaml:"kind"` Metadata struct { Name string `json:"name" yaml:"name"` } `json:"metadata" yaml:"metadata"` Data map[string]string `json:"data" yaml:"data"` }
ConfigMap defines a kube ConfigMap
type Container ¶
type Container struct { Name string `yaml:"name"` Image string `yaml:"image,omitempty"` Command []string `yaml:"command,omitempty"` Args []string `yaml:"args,omitempty"` Env []EnvVar `yaml:"envs,omitempty"` }
Container is a single application container that you want to run within a pod.
type ContainerState ¶
type ContainerState struct { Waiting *ContainerStateWaiting `yaml:"waiting,omitempty" protobuf:"bytes,1,opt,name=waiting"` Running *ContainerStateRunning `yaml:"running,omitempty" protobuf:"bytes,2,opt,name=running"` Terminated *ContainerStateTerminated `yaml:"terminated,omitempty" protobuf:"bytes,3,opt,name=terminated"` }
ContainerState is the known state of a container in a pod
type ContainerStateRunning ¶
ContainerStateRunning is a running state of a container.
type ContainerStateTerminated ¶
type ContainerStateTerminated struct { ExitCode int32 `yaml:"exitCode"` Signal int32 `yaml:"signal,omitempty"` Reason string `yaml:"reason,omitempty"` Message string `yaml:"message,omitempty"` StartedAt time.Time `yaml:"startedAt,omitempty"` FinishedAt time.Time `yaml:"finishedAt,omitempty"` ContainerID string `yaml:"containerID,omitempty"` }
ContainerStateTerminated is a terminated state of a container.
type ContainerStateWaiting ¶
type ContainerStateWaiting struct { Reason string `yaml:"reason,omitempty"` Message string `yaml:"message,omitempty"` }
ContainerStateWaiting is a waiting state of a container.
type ContainerStatus ¶
type ContainerStatus struct { Name string `yaml:"name"` State ContainerState `yaml:"state,omitempty"` LastTerminationState ContainerState `yaml:"lastState,omitempty"` Ready bool `yaml:"ready"` RestartCount int32 `yaml:"restartCount"` Image string `yaml:"image"` ImageID string `yaml:"imageID"` ContainerID string `yaml:"containerID,omitempty"` Started *bool `yaml:"started,omitempty"` }
ContainerStatus contains details for the current status of this container.
type CustomError ¶
CustomError containing stdOutput of a binary execution
func (*CustomError) Error ¶
func (e *CustomError) Error() string
type Kubectl ¶
type Kubectl struct { Log *zap.SugaredLogger Namespace string PollTimeout time.Duration PollInterval time.Duration }
Kubectl is used as a command to test e2e tests
func (*Kubectl) CreateRoleBinding ¶
func (k *Kubectl) CreateRoleBinding(namespace string, clusterrole, serviceaccount, role string) error
CreateRoleBinding Create a new rolebinding in a namespace from a cluster role
func (*Kubectl) CreateServiceAccount ¶
CreateServiceAccount Create a new serviceaccount in a namespace
func (*Kubectl) DeleteRoleBinding ¶
DeleteRoleBinding Deletes a rolebinding in a namespace
func (*Kubectl) DeleteServiceAccount ¶
DeleteServiceAccount Deletes a serviceaccount in a namespace
func (*Kubectl) EventuallyPodMatch ¶
func (k *Kubectl) EventuallyPodMatch(namespace, label string, timeout, poll time.Duration, mm gomega.OmegaMatcher)
EventuallyPodMatch uses ginkgo/gomega matcher to satisfy against a namespace/label pod
func (*Kubectl) GetConfigMap ¶
GetConfigMap blocks until the specified data is available. It fails after the timeout.
func (*Kubectl) GetPodNames ¶
GetPodNames returns the names of the pods matching the selector
func (*Kubectl) NamespaceWithReadyPod ¶
NamespaceWithReadyPod returns true if pods by that label are present in the given namespace
func (*Kubectl) RunCommandWithCheckString ¶
func (k *Kubectl) RunCommandWithCheckString(namespace string, podName string, commandInPod string, result string) error
RunCommandWithCheckString runs the command specified helper in the container
func (*Kubectl) SecretExists ¶
SecretExists returns true if the pod by that name is in state running
func (*Kubectl) ServiceExists ¶
ServiceExists returns true if the pod by that name is in state running
func (*Kubectl) Wait ¶
func (k *Kubectl) Wait(namespace string, requiredStatus string, resourceName string, customTimeout time.Duration) error
Wait waits for the condition on the resource using kubectl command
func (*Kubectl) WaitForData ¶
func (k *Kubectl) WaitForData(namespace string, resourceName string, name string, template string, expectation string) error
WaitForData blocks until the specified data is available. It fails after the timeout.
func (*Kubectl) WaitForNamespaceDelete ¶
WaitForNamespaceDelete blocks while the namespace is available. It fails after the timeout.
func (*Kubectl) WaitForNamespaceWithPod ¶
WaitForNamespaceWithPod blocks until pods matching the selector are available in the specified namespace. It fails after the timeout.
func (*Kubectl) WaitForPVC ¶
WaitForPVC blocks until the pvc is available. It fails after the timeout.
func (*Kubectl) WaitForPod ¶
WaitForPod blocks until the pod is available. It fails after the timeout.
func (*Kubectl) WaitForPodDelete ¶
WaitForPodDelete blocks while the pod is available. It fails after the timeout.
func (*Kubectl) WaitForSecret ¶
WaitForSecret blocks until the secret is available. It fails after the timeout.
func (*Kubectl) WaitForService ¶
WaitForService blocks until the service is available. It fails after the timeout.
func (*Kubectl) WaitLabelFilter ¶
func (k *Kubectl) WaitLabelFilter(namespace string, requiredStatus string, resourceName string, labelName string) error
WaitLabelFilter waits for the condition on the resource based on label using kubectl command
func (*Kubectl) WaitNamespacePodsDelete ¶
WaitNamespacePodsDelete blocks until pods are still available in the given namespace. It fails after the timeout.
type Metadata ¶
type Metadata struct { Name string `yaml:"name"` GenerateName string `yaml:"generateName"` ResourceVersion string `yaml:"resourceVersion"` Labels map[string]string `yaml:"labels"` Annotations map[string]string `yaml:"annotations"` UID string `yaml:"uid"` Namespace string `yaml:"namespace"` }
Metadata is metadata attached to any object
type Pod ¶
type Pod struct { APIVersion string `yaml:"apiVersion"` Kind string `yaml:"kind,omitempty"` Metadata Metadata `yaml:"metadata"` Spec PodSpec `yaml:"spec"` Status PodStatus `yaml:"status,omitempty"` }
Pod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts.
type PodCondition ¶
type PodCondition struct { Type string `yaml:"type"` // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions Status string `yaml:"status"` Reason string `yaml:"reason,omitempty"` Message string `yaml:"message,omitempty"` }
PodCondition is the pod condition status
type PodSpec ¶
type PodSpec struct { Containers []Container `yaml:"containers"` NodeSelector map[string]string `yaml:"nodeSelector"` }
PodSpec is a description of a pod.
type PodStatus ¶
type PodStatus struct { Phase string `yaml:"phase,omitempty"` Conditions []PodCondition `yaml:"conditions,omitempty"` Message string `yaml:"message,omitempty"` Reason string `yaml:"reason,omitempty"` ContainerStatuses []ContainerStatus `yaml:"containerStatuses,omitempty" protobuf:"bytes,8,rep,name=containerStatuses"` }
PodStatus has all the pod status information