Documentation ¶
Index ¶
- type SuiteController
- func (s *SuiteController) AddRegistryAuthSecretToSA(registryAuth, namespace string) error
- func (s *SuiteController) CheckWorkspaceShare(user, namespace string) error
- func (s *SuiteController) CreateConfigMap(cm *corev1.ConfigMap, namespace string) (*corev1.ConfigMap, error)
- func (s *SuiteController) CreatePod(pod *corev1.Pod, namespace string) (*corev1.Pod, error)
- func (s *SuiteController) CreateProxyPlugin(proxyPluginName, proxyPluginNamespace, routeName, routeNamespace string) (*toolchainv1alpha1.ProxyPlugin, error)
- func (s *SuiteController) CreateQuayRegistrySecret(namespace string) error
- func (s *SuiteController) CreateRegistryAuthSecret(secretName, namespace, secretStringData string) (*corev1.Secret, error)
- func (s *SuiteController) CreateRegistryJsonSecret(name, namespace, authKey, keyName string) (*corev1.Secret, error)
- func (s *SuiteController) CreateRole(roleName, namespace string, roleRules map[string][]string) (*rbacv1.Role, error)
- func (s *SuiteController) CreateRoleBinding(roleBindingName, namespace, subjectKind, serviceAccountName, ... string) (*rbacv1.RoleBinding, error)
- func (s *SuiteController) CreateSecret(ns string, secret *corev1.Secret) (*corev1.Secret, error)
- func (s *SuiteController) CreateServiceAccount(name, namespace string, serviceAccountSecretList []corev1.ObjectReference, ...) (*corev1.ServiceAccount, error)
- func (s *SuiteController) CreateSpaceBinding(murName, spaceName, spaceRole string) (*toolchainApi.SpaceBinding, error)
- func (s *SuiteController) CreateTestNamespace(name string) (*corev1.Namespace, error)
- func (h *SuiteController) DeleteAllServiceAccountsInASpecificNamespace(namespace string) error
- func (s *SuiteController) DeleteConfigMap(name, namespace string, returnErrorOnNotFound bool) error
- func (s *SuiteController) DeleteNamespace(namespace string) error
- func (s *SuiteController) DeletePod(podName string, namespace string) error
- func (s *SuiteController) DeleteProxyPlugin(proxyPluginName, proxyPluginNamespace string) (bool, error)
- func (s *SuiteController) DeleteSecret(ns string, name string) error
- func (h *SuiteController) DeploymentIsCompleted(deploymentName, namespace string, readyReplicas int32) wait.ConditionFunc
- func (s *SuiteController) GetConfigMap(name, namespace string) (*corev1.ConfigMap, error)
- func (s *SuiteController) GetCronJob(namespace, name string) (*batchv1.CronJob, error)
- func (h *SuiteController) GetDeployment(deploymentName string, namespace string) (*appsv1.Deployment, error)
- func (s *SuiteController) GetNamespace(namespace string) (*corev1.Namespace, error)
- func (h *SuiteController) GetOpenshiftRoute(routeName string, routeNamespace string) (*routev1.Route, error)
- func (h *SuiteController) GetOpenshiftRouteByComponentName(componentName string, componentNamespace string) (*routev1.Route, error)
- func (s *SuiteController) GetPod(namespace, podName string) (*corev1.Pod, error)
- func (s *SuiteController) GetPodLogs(pod *corev1.Pod) map[string][]byte
- func (s *SuiteController) GetPodLogsByName(podName, namespace string) (map[string][]byte, error)
- func (s *SuiteController) GetRole(roleName, namespace string) (*rbacv1.Role, error)
- func (s *SuiteController) GetRoleBinding(rolebindingName, namespace string) (*rbacv1.RoleBinding, error)
- func (s *SuiteController) GetSecret(ns string, name string) (*corev1.Secret, error)
- func (s *SuiteController) GetServiceAccount(saName, namespace string) (*corev1.ServiceAccount, error)
- func (h *SuiteController) GetServiceByName(serviceName string, serviceNamespace string) (*corev1.Service, error)
- func (s *SuiteController) HaveTestsFinished(snapshot *appstudioApi.Snapshot) bool
- func (s *SuiteController) HaveTestsSucceeded(snapshot *appstudioApi.Snapshot) bool
- func (s *SuiteController) IsPodRunning(podName, namespace string) wait.ConditionFunc
- func (s *SuiteController) IsPodSuccessful(podName, namespace string) wait.ConditionFunc
- func (s *SuiteController) LinkSecretToServiceAccount(ns, secret, serviceaccount string, addImagePullSecrets bool) error
- func (s *SuiteController) ListAllPods(namespace string) (*corev1.PodList, error)
- func (s *SuiteController) ListNamespaceScopedResourcesAsString(namespace string, k8sInterface kubernetes.Interface, ...) string
- func (s *SuiteController) ListPods(namespace, labelKey, labelValue string, selectionLimit int64) (*corev1.PodList, error)
- func (s *SuiteController) ListRoleBindings(namespace string) (*rbacv1.RoleBindingList, error)
- func (s *SuiteController) ListRoles(namespace string) (*rbacv1.RoleList, error)
- func (s *SuiteController) MarkTestsSucceeded(snapshot *appstudioApi.Snapshot) (*appstudioApi.Snapshot, error)
- func (h *SuiteController) RouteEndpointIsAccessible(route *routev1.Route, endpoint string) error
- func (h *SuiteController) RouteHostnameIsAccessible(routeName string, namespace string) wait.ConditionFunc
- func (s *SuiteController) ServiceAccountPresent(saName, namespace string) wait.ConditionFunc
- func (s *SuiteController) StoreAllPods(namespace string) error
- func (s *SuiteController) StorePod(pod *corev1.Pod) error
- func (s *SuiteController) UnlinkSecretFromServiceAccount(namespace, secretName, serviceAccount string, rmImagePullSecrets bool) error
- func (s *SuiteController) UpdateConfigMap(cm *corev1.ConfigMap, namespace string) (*corev1.ConfigMap, error)
- func (s *SuiteController) WaitForPod(cond wait.ConditionFunc, timeout int) error
- func (s *SuiteController) WaitForPodSelector(fn func(podName, namespace string) wait.ConditionFunc, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SuiteController ¶
type SuiteController struct { // Wrap K8S client go to interact with Kube cluster *kubeCl.CustomClient Git git.Client // Github client to interact with GH apis Github *github.Github Gitlab *gitlab.GitlabClient }
Create the struct for kubernetes and github clients.
func NewSuiteController ¶
func NewSuiteController(kubeC *kubeCl.CustomClient) (*SuiteController, error)
Create controller for the common kubernetes API crud operations. This controller should be used only to interact with non RHTAP/AppStudio APIS like routes, deployment, pods etc... Check if a github organization env var is set, if not use by default the redhat-appstudio-qe org. See: https://github.com/redhat-appstudio-qe
func (*SuiteController) AddRegistryAuthSecretToSA ¶
func (s *SuiteController) AddRegistryAuthSecretToSA(registryAuth, namespace string) error
AddRegistryAuthSecretToSA adds registry auth secret to service account
func (*SuiteController) CheckWorkspaceShare ¶
func (s *SuiteController) CheckWorkspaceShare(user, namespace string) error
CheckWorkspaceShare checks if the given user was added to given namespace
func (*SuiteController) CreateConfigMap ¶
func (s *SuiteController) CreateConfigMap(cm *corev1.ConfigMap, namespace string) (*corev1.ConfigMap, error)
Create and return a configmap by cm name and namespace from the cluster
func (*SuiteController) CreateProxyPlugin ¶
func (s *SuiteController) CreateProxyPlugin(proxyPluginName, proxyPluginNamespace, routeName, routeNamespace string) (*toolchainv1alpha1.ProxyPlugin, error)
CreateProxyPlugin creates an object of ProxyPlugin for the OpenShift route target
func (*SuiteController) CreateQuayRegistrySecret ¶
func (s *SuiteController) CreateQuayRegistrySecret(namespace string) error
copy the quay secret to a user defined namespace
func (*SuiteController) CreateRegistryAuthSecret ¶
func (s *SuiteController) CreateRegistryAuthSecret(secretName, namespace, secretStringData string) (*corev1.Secret, error)
CreateRegistryAuthSecret create a docker registry secret in a given ns
func (*SuiteController) CreateRegistryJsonSecret ¶
func (s *SuiteController) CreateRegistryJsonSecret(name, namespace, authKey, keyName string) (*corev1.Secret, error)
CreateRegistryJsonSecret creates a secret for registry repository in namespace given with key passed.
func (*SuiteController) CreateRole ¶
func (s *SuiteController) CreateRole(roleName, namespace string, roleRules map[string][]string) (*rbacv1.Role, error)
CreateRole creates a role with the provided name and namespace using the given list of rules
func (*SuiteController) CreateRoleBinding ¶
func (s *SuiteController) CreateRoleBinding(roleBindingName, namespace, subjectKind, serviceAccountName, serviceAccountNamespace, roleRefKind, roleRefName, roleRefApiGroup string) (*rbacv1.RoleBinding, error)
CreateRoleBinding creates an object of Role Binding in namespace with service account provided and role reference api group.
func (*SuiteController) CreateSecret ¶
Creates a new secret in a specified namespace
func (*SuiteController) CreateServiceAccount ¶
func (s *SuiteController) CreateServiceAccount(name, namespace string, serviceAccountSecretList []corev1.ObjectReference, labels map[string]string) (*corev1.ServiceAccount, error)
CreateServiceAccount creates a service account with the provided name and namespace using the given list of secrets.
func (*SuiteController) CreateSpaceBinding ¶
func (s *SuiteController) CreateSpaceBinding(murName, spaceName, spaceRole string) (*toolchainApi.SpaceBinding, error)
CreateSpaceBinding creates SpaceBinding resource for the given murName and spaceName
func (*SuiteController) CreateTestNamespace ¶
func (s *SuiteController) CreateTestNamespace(name string) (*corev1.Namespace, error)
CreateTestNamespace creates a namespace where Application and Component CR will be created
func (*SuiteController) DeleteAllServiceAccountsInASpecificNamespace ¶
func (h *SuiteController) DeleteAllServiceAccountsInASpecificNamespace(namespace string) error
DeleteAllServiceAccountsInASpecificNamespace deletes all ServiceAccount from a given namespace
func (*SuiteController) DeleteConfigMap ¶
func (s *SuiteController) DeleteConfigMap(name, namespace string, returnErrorOnNotFound bool) error
DeleteConfigMaps delete a ConfigMap. Optionally, it can avoid returning an error if the resource did not exist: - specify 'false' if it's likely the ConfigMap has already been deleted (for example, because the Namespace was deleted)
func (*SuiteController) DeleteNamespace ¶
func (s *SuiteController) DeleteNamespace(namespace string) error
DeleteNamespace deletes the give namespace.
func (*SuiteController) DeletePod ¶
func (s *SuiteController) DeletePod(podName string, namespace string) error
func (*SuiteController) DeleteProxyPlugin ¶
func (s *SuiteController) DeleteProxyPlugin(proxyPluginName, proxyPluginNamespace string) (bool, error)
DeleteProxyPlugin deletes the ProxyPlugin object
func (*SuiteController) DeleteSecret ¶
func (s *SuiteController) DeleteSecret(ns string, name string) error
Deleted a secret in a specified namespace
func (*SuiteController) DeploymentIsCompleted ¶
func (h *SuiteController) DeploymentIsCompleted(deploymentName, namespace string, readyReplicas int32) wait.ConditionFunc
Checks and waits for a kubernetes deployment object to be completed or not
func (*SuiteController) GetConfigMap ¶
func (s *SuiteController) GetConfigMap(name, namespace string) (*corev1.ConfigMap, error)
Get a configmap by name and namespace from the cluster
func (*SuiteController) GetCronJob ¶
func (s *SuiteController) GetCronJob(namespace, name string) (*batchv1.CronJob, error)
GetCronJob returns cronjob if found in namespace with the given name, else an error will be returned
func (*SuiteController) GetDeployment ¶
func (h *SuiteController) GetDeployment(deploymentName string, namespace string) (*appsv1.Deployment, error)
GetAppDeploymentByName returns the deployment for a given component name
func (*SuiteController) GetNamespace ¶
func (s *SuiteController) GetNamespace(namespace string) (*corev1.Namespace, error)
GetNamespace returns the requested Namespace object
func (*SuiteController) GetOpenshiftRoute ¶
func (h *SuiteController) GetOpenshiftRoute(routeName string, routeNamespace string) (*routev1.Route, error)
GetOpenshiftRoute returns the route for a given component name
func (*SuiteController) GetOpenshiftRouteByComponentName ¶
func (h *SuiteController) GetOpenshiftRouteByComponentName(componentName string, componentNamespace string) (*routev1.Route, error)
GetOpenshiftRouteByComponentName returns a route associated with the given component Routes that belong to a given component will have the following label: 'app.kubernetes.io/name: <component-name>'
func (*SuiteController) GetPod ¶
func (s *SuiteController) GetPod(namespace, podName string) (*corev1.Pod, error)
GetPod returns the pod object from a given namespace and pod name
func (*SuiteController) GetPodLogs ¶
func (s *SuiteController) GetPodLogs(pod *corev1.Pod) map[string][]byte
func (*SuiteController) GetPodLogsByName ¶
func (s *SuiteController) GetPodLogsByName(podName, namespace string) (map[string][]byte, error)
func (*SuiteController) GetRole ¶
func (s *SuiteController) GetRole(roleName, namespace string) (*rbacv1.Role, error)
func (*SuiteController) GetRoleBinding ¶
func (s *SuiteController) GetRoleBinding(rolebindingName, namespace string) (*rbacv1.RoleBinding, error)
func (*SuiteController) GetServiceAccount ¶
func (s *SuiteController) GetServiceAccount(saName, namespace string) (*corev1.ServiceAccount, error)
func (*SuiteController) GetServiceByName ¶
func (h *SuiteController) GetServiceByName(serviceName string, serviceNamespace string) (*corev1.Service, error)
GetServiceByName returns the service for a given component name
func (*SuiteController) HaveTestsFinished ¶
func (s *SuiteController) HaveTestsFinished(snapshot *appstudioApi.Snapshot) bool
func (*SuiteController) HaveTestsSucceeded ¶
func (s *SuiteController) HaveTestsSucceeded(snapshot *appstudioApi.Snapshot) bool
func (*SuiteController) IsPodRunning ¶
func (s *SuiteController) IsPodRunning(podName, namespace string) wait.ConditionFunc
func (*SuiteController) IsPodSuccessful ¶
func (s *SuiteController) IsPodSuccessful(podName, namespace string) wait.ConditionFunc
Checks phases of a given pod name in a given namespace
func (*SuiteController) LinkSecretToServiceAccount ¶
func (s *SuiteController) LinkSecretToServiceAccount(ns, secret, serviceaccount string, addImagePullSecrets bool) error
Links a secret to a specified serviceaccount, if argument addImagePullSecrets is true secret will be added also to ImagePullSecrets of SA.
func (*SuiteController) ListAllPods ¶
func (s *SuiteController) ListAllPods(namespace string) (*corev1.PodList, error)
ListAllPods returns a list of all pods in a namespace.
func (*SuiteController) ListNamespaceScopedResourcesAsString ¶
func (s *SuiteController) ListNamespaceScopedResourcesAsString(namespace string, k8sInterface kubernetes.Interface, dynamicInterface dynamic.Interface) string
ListNamespaceScopedResourcesAsString returns a list of resources in a namespace as a string, for test debugging purposes.
func (*SuiteController) ListPods ¶
func (s *SuiteController) ListPods(namespace, labelKey, labelValue string, selectionLimit int64) (*corev1.PodList, error)
ListPods return a list of pods from a namespace by labels and selection limits
func (*SuiteController) ListRoleBindings ¶
func (s *SuiteController) ListRoleBindings(namespace string) (*rbacv1.RoleBindingList, error)
func (*SuiteController) ListRoles ¶
func (s *SuiteController) ListRoles(namespace string) (*rbacv1.RoleList, error)
func (*SuiteController) MarkTestsSucceeded ¶
func (s *SuiteController) MarkTestsSucceeded(snapshot *appstudioApi.Snapshot) (*appstudioApi.Snapshot, error)
func (*SuiteController) RouteEndpointIsAccessible ¶
func (h *SuiteController) RouteEndpointIsAccessible(route *routev1.Route, endpoint string) error
Checks that the deployed route endpoint is actually reachable and returns 200
func (*SuiteController) RouteHostnameIsAccessible ¶
func (h *SuiteController) RouteHostnameIsAccessible(routeName string, namespace string) wait.ConditionFunc
func (*SuiteController) ServiceAccountPresent ¶
func (s *SuiteController) ServiceAccountPresent(saName, namespace string) wait.ConditionFunc
func (*SuiteController) StoreAllPods ¶
func (s *SuiteController) StoreAllPods(namespace string) error
StoreAllPods stores all pods in a given namespace.
func (*SuiteController) StorePod ¶
func (s *SuiteController) StorePod(pod *corev1.Pod) error
StorePod stores a given pod as an artifact.
func (*SuiteController) UnlinkSecretFromServiceAccount ¶
func (s *SuiteController) UnlinkSecretFromServiceAccount(namespace, secretName, serviceAccount string, rmImagePullSecrets bool) error
UnlinkSecretFromServiceAccount unlinks secret from service account
func (*SuiteController) UpdateConfigMap ¶
func (s *SuiteController) UpdateConfigMap(cm *corev1.ConfigMap, namespace string) (*corev1.ConfigMap, error)
Update and return a configmap by configmap cm name and namespace from the cluster
func (*SuiteController) WaitForPod ¶
func (s *SuiteController) WaitForPod(cond wait.ConditionFunc, timeout int) error
wait for a pod based on a condition. cond can be IsPodSuccessful for example
func (*SuiteController) WaitForPodSelector ¶
func (s *SuiteController) WaitForPodSelector( fn func(podName, namespace string) wait.ConditionFunc, namespace, labelKey string, labelValue string, timeout int, selectionLimit int64) error
Wait for a pod selector until exists