Documentation ¶
Overview ¶
Package kube provides steps implementations related to Kubernetes.
Index ¶
- Constants
- Variables
- type Client
- func (kc *Client) ClusterRbacIsFound(resource, name string) error
- func (kc *Client) DeleteAllTestResources() error
- func (kc *Client) DeleteResourcesAtPath(resourcesPath string) error
- func (kc *Client) GetDaemonset(name, namespace string) (*appsv1.DaemonSet, error)
- func (kc *Client) GetDeployment(name, namespace string) (*appsv1.Deployment, error)
- func (kc *Client) GetIngress(name, namespace string) (*networkingv1.Ingress, error)
- func (kc *Client) GetIngressEndpoint(name, namespace string, port int, path string) (string, error)
- func (kc *Client) GetNodes() error
- func (kc *Client) GetPersistentVolume(name string) (*corev1.PersistentVolume, error)
- func (kc *Client) GetPods(namespace string) error
- func (kc *Client) GetPodsWithSelector(namespace, selector string) error
- func (kc *Client) IngressAvailable(name, namespace string, port int, path string) error
- func (kc *Client) KubernetesCluster() error
- func (kc *Client) KubernetesClusterShouldBe(state string) error
- func (kc *Client) ListInstanceGroups() (*unstructured.UnstructuredList, error)
- func (kc *Client) ListNodes() (*corev1.NodeList, error)
- func (kc *Client) ListPersistentVolumes() (*corev1.PersistentVolumeList, error)
- func (kc *Client) ListPodsWithLabelSelector(namespace, selector string) (*corev1.PodList, error)
- func (kc *Client) ListStatefulSets(namespace string) (*appsv1.StatefulSetList, error)
- func (kc *Client) MultiResourceOperation(operation, resourceFileName string) error
- func (kc *Client) MultiResourceOperationInNamespace(operation, resourceFileName, ns string) error
- func (kc *Client) NodesWithSelectorShouldBe(n int, selector, state string) error
- func (kc *Client) PersistentVolExists(volName, expectedPhase string) error
- func (kc *Client) PodsWithSelectorHaveRestartCountLessThan(namespace string, selector string, expectedRestartCountLessThan int) error
- func (kc *Client) ResourceConditionShouldBe(resourceFileName, cType, status string) error
- func (kc *Client) ResourceInNamespace(resource, name, ns string) error
- func (kc *Client) ResourceIsRunning(kind, name, namespace string) error
- func (kc *Client) ResourceOperation(operation, resourceFileName string) error
- func (kc *Client) ResourceOperationInNamespace(operation, resourceFileName, ns string) error
- func (kc *Client) ResourceOperationWithResult(operation, resourceFileName, expectedResult string) error
- func (kc *Client) ResourceOperationWithResultInNamespace(operation, resourceFileName, namespace, expectedResult string) error
- func (kc *Client) ResourceShouldBe(resourceFileName, state string) error
- func (kc *Client) ResourceShouldConvergeToSelector(resourceFileName, selector string) error
- func (kc *Client) ScaleDeployment(name, ns string, replica int32) error
- func (kc *Client) SecretDelete(secretName, namespace string) error
- func (kc *Client) SecretOperationFromEnvironmentVariable(operation, secretName, namespace, environmentVariable string) error
- func (kc *Client) SendTrafficToIngress(tps int, name, namespace string, port int, path string, duration int, ...) error
- func (kc *Client) SetTimestamp(timestampName string) error
- func (kc *Client) SomeOrAllPodsInNamespaceWithSelectorHaveStringInLogsSinceTime(SomeOrAll, namespace, selector, searchkeyword, sinceTime string) error
- func (kc *Client) SomePodsInNamespaceWithSelectorDontHaveStringInLogsSinceTime(namespace, selector, searchkeyword, sinceTime string) error
- func (kc *Client) ThePodsInNamespaceShouldHaveLabels(podName string, namespace string, labels string) error
- func (kc *Client) ThePodsInNamespaceWithSelectorHaveNoErrorsInLogsSinceTime(namespace string, selector string, sinceTime string) error
- func (kc *Client) ThePodsInNamespaceWithSelectorHaveSomeErrorsInLogsSinceTime(namespace string, selector string, sinceTime string) error
- func (kc *Client) ThePodsInNamespaceWithSelectorShouldHaveLabels(namespace string, selector string, labels string) error
- func (kc *Client) UpdateResourceWithField(resourceFileName, key string, value string) error
- func (kc *Client) Validate() error
- func (kc *Client) ValidatePrometheusVolumeClaimTemplatesName(statefulsetName string, namespace string, volumeClaimTemplatesName string) error
- func (kc *Client) VerifyInstanceGroups() error
Constants ¶
const ( OperationCreate = "create" OperationSubmit = "submit" OperationUpdate = "update" OperationDelete = "delete" StateCreated = "created" StateDeleted = "deleted" StateUpgraded = "upgraded" NodeStateReady = "ready" NodeStateFound = "found" DefaultWaiterInterval = time.Second * 30 DefaultWaiterTries = 40 DefaultFilePath = "templates" SomePodsKeyword = "some" AllPodsKeyword = "all" )
const ( // InstanceGroupNamespace is the default namespace to use of instance-group submission InstanceGroupNamespace = "instance-manager" // CustomResourceGroup is the group of the instance-manager API/custom resource definition CustomResourceGroup = "instancemgr" // CustomResourceAPIVersion is the version of the instance-manager API/custom resource definition CustomResourceAPIVersion = "v1alpha1" // CustomeResourceDomain is the domain of the instance-manager API/custom resource definition CustomeResourceDomain = "keikoproj.io" // CustomResourceKind is the resource kind (plural) of the instance-manager API/custom resource definition CustomResourceKind = "instancegroups" )
Variables ¶
var ( // CustomResourceName is the name of the API/custom resource definition CustomResourceName = fmt.Sprintf("%v.%v", CustomResourceGroup, CustomeResourceDomain) InstanceGroupResource = schema.GroupVersionResource{Group: CustomResourceName, Version: CustomResourceAPIVersion, Resource: CustomResourceKind} )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { KubeInterface kubernetes.Interface DynamicInterface dynamic.Interface DiscoveryInterface discovery.DiscoveryInterface FilesPath string TemplateArguments interface{} WaiterInterval time.Duration WaiterTries int Timestamps map[string]time.Time }
func (*Client) ClusterRbacIsFound ¶ added in v0.4.0
Cluster scoped role and bindings are found.
func (*Client) DeleteAllTestResources ¶
DeleteAllTestResources deletes all the resources defined by yaml files in the path given by FilesPath: if FilesPath is empty, it will look for the files in ./templates. Meant to be use in the before/after suite/scenario/step hooks
func (*Client) DeleteResourcesAtPath ¶ added in v0.8.0
DeleteResourcesAtPath deletes all the resources defined by yaml files in the path provided
func (*Client) GetDaemonset ¶ added in v0.8.0
GetDaemonset gets a daemonset
func (*Client) GetDeployment ¶ added in v0.8.0
func (kc *Client) GetDeployment(name, namespace string) (*appsv1.Deployment, error)
GetDeployment gets a deployment
func (*Client) GetIngress ¶ added in v0.8.0
func (kc *Client) GetIngress(name, namespace string) (*networkingv1.Ingress, error)
func (*Client) GetIngressEndpoint ¶ added in v0.8.0
func (*Client) GetPersistentVolume ¶ added in v0.8.0
func (kc *Client) GetPersistentVolume(name string) (*corev1.PersistentVolume, error)
GetPersistentVolume gets a pv
func (*Client) GetPodsWithSelector ¶ added in v0.8.0
func (*Client) IngressAvailable ¶ added in v0.8.0
func (*Client) KubernetesCluster ¶ added in v0.8.0
AKubernetesCluster sets the Kubernetes clients given a valid kube config file in ~/.kube or the path set in the environment variable KUBECONFIG.
func (*Client) KubernetesClusterShouldBe ¶ added in v0.8.0
func (*Client) ListInstanceGroups ¶ added in v0.8.0
func (kc *Client) ListInstanceGroups() (*unstructured.UnstructuredList, error)
func (*Client) ListPersistentVolumes ¶ added in v0.8.0
func (kc *Client) ListPersistentVolumes() (*corev1.PersistentVolumeList, error)
ListPersistentVolume lists pvs
func (*Client) ListPodsWithLabelSelector ¶ added in v0.8.0
ListPodsWithLabelSelector lists pods with a label selector
func (*Client) ListStatefulSets ¶ added in v0.8.0
func (kc *Client) ListStatefulSets(namespace string) (*appsv1.StatefulSetList, error)
ListStatefulSets lists statefulsets
func (*Client) MultiResourceOperation ¶ added in v0.2.0
MultiResourceOperation performs the given operation on the resources defined in resourceFileName. The operation could be “create”, “submit” or “delete”. Files created using this function cannot individually be addressed by filename.
func (*Client) MultiResourceOperationInNamespace ¶ added in v0.7.0
func (*Client) NodesWithSelectorShouldBe ¶
NodesWithSelectorShouldBe checks that n amount of nodes with the given selector are in the desired state. It retries every 30 seconds for a total of 40 times. Selector in the form <key>=<value>, the state can be "ready" or "found".
func (*Client) PersistentVolExists ¶ added in v0.8.0
func (*Client) PodsWithSelectorHaveRestartCountLessThan ¶ added in v0.8.0
func (*Client) ResourceConditionShouldBe ¶
ResourceConditionShouldBe checks that the resource defined in resourceFileName has the condition of type cType in the desired status. It retries every 30 seconds for a total of 40 times.
func (*Client) ResourceInNamespace ¶ added in v0.3.0
ResourceInNamespace check if (deployment|service) in the related namespace
func (*Client) ResourceIsRunning ¶ added in v0.8.0
func (*Client) ResourceOperation ¶
ResourceOperation performs the given operation on the resource defined in resourceFileName. The operation could be “create”, “submit”, “delete”, or "update".
func (*Client) ResourceOperationInNamespace ¶ added in v0.7.0
ResourceOperationInNamespace performs the given operation on the resource defined in resourceFileName in a specified namespace. The operation could be “create”, “submit”, “delete”, or "update".
func (*Client) ResourceOperationWithResult ¶ added in v0.8.0
func (*Client) ResourceOperationWithResultInNamespace ¶ added in v0.8.0
func (*Client) ResourceShouldBe ¶
ResourceShouldBe checks if the resource defined in resourceFileName is in the desired state. It retries every 30 seconds for a total of 40 times. The state could be “created” or “deleted”.
func (*Client) ResourceShouldConvergeToSelector ¶
ResourceShouldConvergeToSelector checks if the resource defined in resourceFileName has the desired selector. It retries every 30 seconds for a total of 40 times. Selector in the form <keys>=<value>.
func (*Client) ScaleDeployment ¶ added in v0.0.2
ScaleDeployment scale up/down for the deployment
func (*Client) SecretDelete ¶ added in v0.8.0
func (*Client) SecretOperationFromEnvironmentVariable ¶ added in v0.8.0
func (*Client) SendTrafficToIngress ¶ added in v0.8.0
func (*Client) SetTimestamp ¶ added in v0.8.0
func (*Client) SomeOrAllPodsInNamespaceWithSelectorHaveStringInLogsSinceTime ¶ added in v0.8.1
func (*Client) SomePodsInNamespaceWithSelectorDontHaveStringInLogsSinceTime ¶ added in v0.8.1
func (*Client) ThePodsInNamespaceShouldHaveLabels ¶ added in v0.8.0
func (*Client) ThePodsInNamespaceWithSelectorHaveNoErrorsInLogsSinceTime ¶ added in v0.8.0
func (*Client) ThePodsInNamespaceWithSelectorHaveSomeErrorsInLogsSinceTime ¶ added in v0.8.0
func (*Client) ThePodsInNamespaceWithSelectorShouldHaveLabels ¶ added in v0.8.0
func (*Client) UpdateResourceWithField ¶
UpdateResourceWithField it updates the field found in the key of the resource defined in resourceFileName with value.