Documentation
¶
Overview ¶
Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
Index ¶
- Constants
- func APIExtensionsClientSet() *apixv1beta1client.ApiextensionsV1beta1Client
- func AssertURLAccessibleAndAuthorized(client *retryablehttp.Client, url string, credentials *UsernamePassword) bool
- func BodyContains(expected string) types.GomegaMatcher
- func BodyDoesNotContain(unexpected string) types.GomegaMatcher
- func BodyEquals(expected string) types.GomegaMatcher
- func BodyNotEmpty() types.GomegaMatcher
- func CanI(userOCID string, namespace string, verb string, resource string) (bool, string, error)
- func CanIForAPIGroup(userOCID string, namespace string, verb string, resource string, group string) (bool, string, error)
- func CanIForAPIGroupForServiceAccountOrUser(saOrUserOCID string, namespace string, verb string, resource string, ...) (bool, string, error)
- func CheckNoServerHeader(resp *HTTPResponse) bool
- func Concurrently(assertions ...func())
- func CreateCredentialsSecret(namespace string, name string, username string, pw string, ...) (*corev1.Secret, error)
- func CreateCredentialsSecretFromMap(namespace string, name string, values, labels map[string]string) (*corev1.Secret, error)
- func CreateDockerSecret(namespace string, name string, server string, username string, password string) (*corev1.Secret, error)
- func CreateLogFile(filename string, content string) error
- func CreateNamespace(name string, labels map[string]string) (*corev1.Namespace, error)
- func CreateOrUpdateResourceFromFile(file string) error
- func CreateOrUpdateResourceFromFileInCluster(file string, kubeconfigPath string) error
- func CreatePasswordSecret(namespace string, name string, pw string, labels map[string]string) (*corev1.Secret, error)
- func CreateRoleBinding(userOCID string, namespace string, rolebindingname string, ...) error
- func DeleteNamespace(name string) error
- func DeleteNamespaceInCluster(name string, kubeconfigPath string) error
- func DeleteResourceFromFile(file string) error
- func DeleteResourceFromFileInCluster(file string, kubeconfigPath string) error
- func DeleteSecret(namespace string, name string) error
- func DoesCRDExist(crdName string) (bool, error)
- func DoesClusterRoleBindingExist(name string) (bool, error)
- func DoesClusterRoleExist(name string) (bool, error)
- func DoesNamespaceExist(name string) (bool, error)
- func DoesNamespaceExistInCluster(name string, kubeconfigPath string) (bool, error)
- func DoesPodExist(namespace string, name string) bool
- func DoesRoleBindingContainSubject(namespace, name, subjectKind, subjectName string) (bool, error)
- func DoesRoleBindingExist(name string, namespace string) bool
- func DoesServiceAccountExist(namespace, name string) (bool, error)
- func DoesServiceExist(namespace string, name string) bool
- func Execute(podName, containerName, namespace string, command []string) (string, string, error)
- func ExecuteClusterDump(command string, kubeconfig string, directory string) error
- func ExecuteClusterDumpWithEnvVarConfig() error
- func FindAnyLog(index string, match []Match, mustNot []Match) bool
- func FindLog(index string, match []Match, mustNot []Match) bool
- func FindLogIndexWithPrefix(prefix string) []string
- func FindTestDataFile(file string) (string, error)
- func GetBindingVmiHTTPClient(bindingName string, kubeconfigPath string) (*retryablehttp.Client, error)
- func GetCertificates(url string) ([]*x509.Certificate, error)
- func GetClusterRole(name string) (*rbacv1.ClusterRole, error)
- func GetClusterRoleBinding(name string) (*rbacv1.ClusterRoleBinding, error)
- func GetConfigMap(configMapName string, namespace string) (*corev1.ConfigMap, error)
- func GetDynamicClient() dynamic.Interface
- func GetHostnameFromGateway(namespace string, appConfigName string) string
- func GetIstioClientset() *istioClient.Clientset
- func GetKeycloakHTTPClient(kubeconfigPath string) (*retryablehttp.Client, error)
- func GetKubeConfig() *restclient.Config
- func GetKubeConfigGivenPath(kubeconfigPath string) *restclient.Config
- func GetKubeConfigPathFromEnv() string
- func GetKubernetesClientset() *kubernetes.Clientset
- func GetKubernetesClientsetForCluster(kubeconfigPath string) *kubernetes.Clientset
- func GetNamespace(name string) (*corev1.Namespace, error)
- func GetNamespaceInCluster(name string, kubeconfigPath string) (*corev1.Namespace, error)
- func GetPersistentVolumes(namespace string) (map[string]*corev1.PersistentVolumeClaim, error)
- func GetPodsFromSelector(selector *metav1.LabelSelector, namespace string) ([]corev1.Pod, error)
- func GetRancherHTTPClient(kubeconfigPath string) (*retryablehttp.Client, error)
- func GetRequiredEnvVarOrFail(name string) string
- func GetRetryPolicy() func(ctx context.Context, resp *http.Response, err error) (bool, error)
- func GetSecret(namespace string, name string) (*corev1.Secret, error)
- func GetSecretInCluster(namespace string, name string, kubeconfigPath string) (*corev1.Secret, error)
- func GetServiceAccount(namespace, name string) (*corev1.ServiceAccount, error)
- func GetSystemVmiHTTPClient() (*retryablehttp.Client, error)
- func GetTokenForServiceAccount(sa string, namespace string) ([]byte, error)
- func GetVerrazzanoHTTPClient(kubeconfigPath string) (*retryablehttp.Client, error)
- func GetVerrazzanoInstallResourceInCluster(kubeconfigPath string) *v1alpha1.Verrazzano
- func GetVerrazzanoManagedClusterClientset() *vmcClient.Clientset
- func GetVerrazzanoNoRetryHTTPClient(kubeconfigPath string) (*http.Client, error)
- func GetVerrazzanoPassword() string
- func GetVerrazzanoPasswordInCluster(kubeconfigPath string) string
- func GetWildcardDNS(s string) string
- func HasStatus(expected int) types.GomegaMatcher
- func HasWildcardDNS(s string) bool
- func Ingress() string
- func IsACMEStagingEnabledInCluster(kubeconfigPath string) bool
- func IsDevProfile() bool
- func IsManagedClusterProfile() bool
- func IsProdProfile() bool
- func JTq(jtext string, path ...string) interface{}
- func Jq(node interface{}, path ...string) interface{}
- func ListClusterRoleBindings() (*rbacv1.ClusterRoleBindingList, error)
- func ListDeployments(namespace string) (*appsv1.DeploymentList, error)
- func ListIngresses(namespace string) (*extensionsv1beta1.IngressList, error)
- func ListNamespaces(opts metav1.ListOptions) (*corev1.NamespaceList, error)
- func ListNamespacesInCluster(opts metav1.ListOptions, kubeconfigPath string) (*corev1.NamespaceList, error)
- func ListNodes() (*corev1.NodeList, error)
- func ListPods(namespace string, opts metav1.ListOptions) (*corev1.PodList, error)
- func ListPodsInCluster(namespace string, clientset *kubernetes.Clientset) (*corev1.PodList, error)
- func ListSecrets(namespace string) (*corev1.SecretList, error)
- func ListServices(namespace string) (*corev1.ServiceList, error)
- func Log(level LogLevel, message string)
- func LogIndexFound(indexName string) bool
- func LogIndexFoundInCluster(indexName, kubeconfigPath string) bool
- func LogRecordFound(indexName string, after time.Time, fields map[string]string) bool
- func LogRecordFoundInCluster(indexName string, after time.Time, fields map[string]string, ...) bool
- func MetricsExist(metricsName, key, value string) bool
- func MetricsExistInCluster(metricsName, key, value, kubeconfigPath string) bool
- func NoLog(index string, match []Match, mustNot []Match) bool
- func PatchResourceFromFileInCluster(gvr schema.GroupVersionResource, namespace string, name string, ...) error
- func PodsNotRunning(namespace string, namePrefixes []string) bool
- func PodsRunning(namespace string, namePrefixes []string) bool
- func PodsRunningInCluster(namespace string, namePrefixes []string, kubeconfigPath string) bool
- func PolicyRulesEqual(rule1, rule2 rbacv1.PolicyRule) bool
- func QueryMetric(metricsName string, kubeconfigPath string) (string, error)
- func SearchLog(index string, query ElasticQuery) map[string]interface{}
- func SecretsCreated(namespace string, names ...string) bool
- func SliceContainsPolicyRule(ruleSlice []rbacv1.PolicyRule, rule rbacv1.PolicyRule) bool
- func SliceContainsString(slice []string, s string) bool
- func SlicesContainSameStrings(strings1, strings2 []string) bool
- type ACMEStagingCerts
- type APIEndpoint
- func (api *APIEndpoint) Delete(path string) (*HTTPResponse, error)
- func (api *APIEndpoint) Get(path string) (*HTTPResponse, error)
- func (api *APIEndpoint) GetElasticURL() (string, error)
- func (api *APIEndpoint) GetIngress(namespace, name string) (*extensionsv1beta1.Ingress, error)
- func (api *APIEndpoint) Patch(path string, body io.Reader) (*HTTPResponse, error)
- func (api *APIEndpoint) Post(path string, body io.Reader) (*HTTPResponse, error)
- func (api *APIEndpoint) Request(method, path string, body io.Reader) (*HTTPResponse, error)
- type ElasticQuery
- type HTTPResponse
- func Delete(url string, hostHeader string) (*HTTPResponse, error)
- func GetWebPage(url string, hostHeader string) (*HTTPResponse, error)
- func GetWebPageWithBasicAuth(url string, hostHeader string, username string, password string, ...) (*HTTPResponse, error)
- func GetWebPageWithClient(httpClient *retryablehttp.Client, url string, hostHeader string) (*HTTPResponse, error)
- func PostWithBasicAuth(url, body, username, password, kubeconfigPath string) (*HTTPResponse, error)
- func PostWithHostHeader(url, contentType string, hostHeader string, body io.Reader) (*HTTPResponse, error)
- func ProcessHTTPResponse(resp *http.Response) (*HTTPResponse, error)
- func PutWithHostHeader(url, contentType string, hostHeader string, body io.Reader) (*HTTPResponse, error)
- type KeycloakRESTClient
- func (c *KeycloakRESTClient) CreateUser(userRealm string, userName string, firstName string, lastName string, ...) (string, error)
- func (c *KeycloakRESTClient) DeleteUser(userRealm string, userID string) error
- func (c *KeycloakRESTClient) GetRealm(realm string) (map[string]interface{}, error)
- func (c *KeycloakRESTClient) SetPassword(userRealm string, userID string, password string) error
- type LogLevel
- type Match
- type UsernamePassword
Constants ¶
const ( // NumRetries - maximum number of retries NumRetries = 7 // RetryWaitMin - minimum retry wait RetryWaitMin = 1 * time.Second // RetryWaitMax - maximum retry wait RetryWaitMax = 30 * time.Second )
const ( // ClusterTypeKind represents a Kind cluster ClusterTypeKind = "kind" // ClusterTypeOlcne represents an OLCNE cluster ClusterTypeOlcne = "OLCNE" )
const (
// ISO8601Layout defines the timestamp format
ISO8601Layout = "2006-01-02T15:04:05.999999999-07:00"
)
const (
// Username - the username of the verrazzano admin user
Username = "verrazzano"
)
Variables ¶
This section is empty.
Functions ¶
func APIExtensionsClientSet ¶
func APIExtensionsClientSet() *apixv1beta1client.ApiextensionsV1beta1Client
APIExtensionsClientSet returns a Kubernetes ClientSet for this cluster.
func AssertURLAccessibleAndAuthorized ¶
func AssertURLAccessibleAndAuthorized(client *retryablehttp.Client, url string, credentials *UsernamePassword) bool
AssertURLAccessibleAndAuthorized - Assert that a URL is accessible using the provided credentials
func BodyContains ¶ added in v0.17.0
func BodyContains(expected string) types.GomegaMatcher
BodyContains asserts that an HTTPResponse body contains a given substring.
func BodyDoesNotContain ¶ added in v0.17.0
func BodyDoesNotContain(unexpected string) types.GomegaMatcher
BodyDoesNotContain asserts that an HTTPResponse body does not contain a given substring.
func BodyEquals ¶ added in v0.17.0
func BodyEquals(expected string) types.GomegaMatcher
BodyEquals asserts that an HTTPResponse body equals a given string.
func BodyNotEmpty ¶ added in v0.17.0
func BodyNotEmpty() types.GomegaMatcher
BodyNotEmpty asserts that an HTTPResponse body is not empty.
func CanIForAPIGroup ¶ added in v0.13.0
func CanIForAPIGroupForServiceAccountOrUser ¶ added in v0.15.0
func CheckNoServerHeader ¶ added in v0.16.0
func CheckNoServerHeader(resp *HTTPResponse) bool
CheckNoServerHeader validates that the response does not include a Server header.
func Concurrently ¶
func Concurrently(assertions ...func())
Concurrently executes the given assertions in parallel and waits for them all to complete
func CreateCredentialsSecret ¶
func CreateCredentialsSecret(namespace string, name string, username string, pw string, labels map[string]string) (*corev1.Secret, error)
CreateCredentialsSecret creates opaque secret
func CreateCredentialsSecretFromMap ¶
func CreateCredentialsSecretFromMap(namespace string, name string, values, labels map[string]string) (*corev1.Secret, error)
CreateCredentialsSecretFromMap creates opaque secret from the given map of values
func CreateDockerSecret ¶
func CreateDockerSecret(namespace string, name string, server string, username string, password string) (*corev1.Secret, error)
CreateDockerSecret creates docker secret
func CreateLogFile ¶
CreateLogFile creates a file with the given name (or truncates the file if it already exists) and writes the given content string to the file.
func CreateNamespace ¶
CreateNamespace creates a namespace
func CreateOrUpdateResourceFromFile ¶
CreateOrUpdateResourceFromFile creates or updates a Kubernetes resources from a YAML test data file. The test data file is found using the FindTestDataFile function. This is intended to be equivalent to `kubectl apply` The cluster used is the one set by default in the environment
func CreateOrUpdateResourceFromFileInCluster ¶ added in v0.14.0
CreateOrUpdateResourceFromFileInCluster is identical to CreateOrUpdateResourceFromFile, except that it uses the cluster specified by the kubeconfigPath argument instead of the default cluster in the environment
func CreatePasswordSecret ¶
func CreatePasswordSecret(namespace string, name string, pw string, labels map[string]string) (*corev1.Secret, error)
CreatePasswordSecret creates opaque secret
func CreateRoleBinding ¶ added in v0.13.0
func DeleteNamespace ¶
DeleteNamespace deletes a namespace in the cluster specified in the environment
func DeleteNamespaceInCluster ¶ added in v0.14.0
func DeleteResourceFromFile ¶
DeleteResourceFromFile deletes Kubernetes resources using names found in a YAML test data file. This is intended to be equivalent to `kubectl delete` The test data file is found using the FindTestDataFile function.
func DeleteResourceFromFileInCluster ¶ added in v0.14.0
DeleteResourceFromFileInCluster is identical to DeleteResourceFromFile, except that // it uses the cluster specified by the kubeconfigPath argument instead of the default cluster in the environment
func DeleteSecret ¶
DeleteSecret deletes the specified secret in the specified namespace
func DoesCRDExist ¶
DoesCRDExist returns whether a CRD with the given name exists for the cluster
func DoesClusterRoleBindingExist ¶
DoesClusterRoleBindingExist returns whether a cluster role with the given name exists in the cluster
func DoesClusterRoleExist ¶
DoesClusterRoleExist returns whether a cluster role with the given name exists in the cluster
func DoesNamespaceExist ¶
DoesNamespaceExist returns whether a namespace with the given name exists for the cluster set in the environment
func DoesNamespaceExistInCluster ¶ added in v0.14.0
DoesNamespaceExistInCluster returns whether a namespace with the given name exists in the specified cluster
func DoesPodExist ¶
DoesPodExist returns whether a pod with the given name and namespace exists for the cluster
func DoesRoleBindingContainSubject ¶ added in v0.13.0
DoesRoleBindingContainSubject returns true if the RoleBinding exists and it contains the specified subject
func DoesRoleBindingExist ¶ added in v0.13.0
DoesClusterRoleBindingExist returns whether a cluster role with the given name exists in the cluster
func DoesServiceAccountExist ¶ added in v0.13.0
DoesServiceAccountExist returns whether a service account with the given name and namespace exists in the cluster
func DoesServiceExist ¶
DoesServiceExist returns whether a service with the given name and namespace exists for the cluster
func Execute ¶ added in v0.15.0
Execute executes the given command on the pod and container identified by the given names and returns the resulting stdout and stderr
func ExecuteClusterDump ¶ added in v0.14.0
ExecuteClusterDump executes the cluster dump tool. command - The fully quallified cluster dump executable. kubeconfig - The kube config file to use when executing the cluster dump tool. directory - The directory to store the cluster dump within.
func ExecuteClusterDumpWithEnvVarConfig ¶ added in v0.14.0
func ExecuteClusterDumpWithEnvVarConfig() error
ExecuteClusterDumpWithEnvVarConfig executes the cluster dump tool using config from environment variables. DUMP_KUBECONFIG - The kube config file to use when executing the cluster dump tool. DUMP_DIRECTORY - The directory to store the cluster dump within. DUMP_COMMAND - The fully quallified cluster dump executable.
func FindAnyLog ¶ added in v0.15.0
FindAnyLog returns true if a log record of any time can be found in the index with matching filters.
func FindLog ¶ added in v0.14.0
FindLog returns true if a recent log record can be found in the index with matching filters.
func FindLogIndexWithPrefix ¶ added in v0.14.0
FindLogIndexWithPrefix find indices with the specified index name prefix
func FindTestDataFile ¶
FindTestDataFile finds a test data file by searching up from the working directory looking for a relative file. This is done to simplify the execution of tests in both local and remote environments.
func GetBindingVmiHTTPClient ¶
func GetBindingVmiHTTPClient(bindingName string, kubeconfigPath string) (*retryablehttp.Client, error)
GetBindingVmiHTTPClient returns the VMI client for the prided binding
func GetCertificates ¶
func GetCertificates(url string) ([]*x509.Certificate, error)
GetCertificates will return the server SSL certificates for the given URL.
func GetClusterRole ¶
func GetClusterRole(name string) (*rbacv1.ClusterRole, error)
GetClusterRole returns the cluster role with the given name
func GetClusterRoleBinding ¶
func GetClusterRoleBinding(name string) (*rbacv1.ClusterRoleBinding, error)
GetClusterRoleBinding returns the cluster role with the given name
func GetConfigMap ¶
GetConfigMap returns the config map for the passed in ConfigMap Name and Namespace
func GetDynamicClient ¶ added in v0.15.0
GetDynamicClient returns a dynamic client needed to access Unstructured data
func GetHostnameFromGateway ¶
GetHostnameFromGateway returns the host name from the application gateway that was created by the ingress trait controller
func GetIstioClientset ¶
func GetIstioClientset() *istioClient.Clientset
GetIstioClientset returns the clientset object for Istio
func GetKeycloakHTTPClient ¶
GetKeycloakHTTPClient returns a retryable Http client configured with the Keycloak CA cert
func GetKubeConfig ¶
func GetKubeConfig() *restclient.Config
GetKubeConfig will get the kubeconfig from the TEST_KUBECONFIG env var if set, then the env var KUBECONFIG, if set, or else from $HOME/.kube/config
func GetKubeConfigGivenPath ¶ added in v0.14.0
func GetKubeConfigGivenPath(kubeconfigPath string) *restclient.Config
GetKubeConfig will get the kubeconfig from the given kubeconfigPath
func GetKubeConfigPathFromEnv ¶ added in v0.14.0
func GetKubeConfigPathFromEnv() string
GetKubeConfigPathFromEnv returns the path to the default kubernetes config file in use (from the TEST_KUBECONFIG env var if set, then the env var KUBECONFIG, if set, or else from $HOME/.kube/config
func GetKubernetesClientset ¶
func GetKubernetesClientset() *kubernetes.Clientset
GetKubernetesClientset returns the Kubernetes clientset for the cluster set in the environment
func GetKubernetesClientsetForCluster ¶ added in v0.14.0
func GetKubernetesClientsetForCluster(kubeconfigPath string) *kubernetes.Clientset
GetKubernetesClientsetForCluster returns the Kubernetes clientset for the cluster whose kubeconfig path is specified
func GetNamespace ¶
GetNamespace returns a namespace
func GetNamespaceInCluster ¶ added in v0.14.0
GetNamespaceInCluster returns a namespace in the cluster whose kubeconfigPath is specified
func GetPersistentVolumes ¶ added in v0.15.1
func GetPersistentVolumes(namespace string) (map[string]*corev1.PersistentVolumeClaim, error)
func GetPodsFromSelector ¶ added in v0.15.0
GetPodsFromSelector returns a collection of pods for the given namespace and selector
func GetRancherHTTPClient ¶ added in v0.14.0
GetRancherHTTPClient returns a retryable Http client configured with the Rancher CA cert
func GetRequiredEnvVarOrFail ¶
GetRequiredEnvVarOrFail returns the values of the provided environment variable name or fails.
func GetRetryPolicy ¶
GetRetryPolicy returns the standard retry policy
func GetSecret ¶
GetSecret returns the a secret in a given namespace for the cluster specified in the environment
func GetSecretInCluster ¶ added in v0.14.0
func GetSecretInCluster(namespace string, name string, kubeconfigPath string) (*corev1.Secret, error)
GetSecretInCluster returns the secret in a given namespace for the given cluster
func GetServiceAccount ¶ added in v0.14.0
func GetServiceAccount(namespace, name string) (*corev1.ServiceAccount, error)
func GetSystemVmiHTTPClient ¶
func GetSystemVmiHTTPClient() (*retryablehttp.Client, error)
GetSystemVmiHTTPClient returns a retryable HTTP client configured with the system vmi CA cert
func GetTokenForServiceAccount ¶ added in v0.15.0
GetTokenForServiceAccount returns the token associated with service account
func GetVerrazzanoHTTPClient ¶
GetVerrazzanoHTTPClient returns a retryable Http client configured with the verrazzano CA cert
func GetVerrazzanoInstallResourceInCluster ¶ added in v0.14.0
func GetVerrazzanoInstallResourceInCluster(kubeconfigPath string) *v1alpha1.Verrazzano
GetVerrazzanoInstallResourceInCluster returns the installed Verrazzano CR in the given cluster (there should only be 1 per cluster)
func GetVerrazzanoManagedClusterClientset ¶ added in v0.13.0
GetVerrazzanoManagedClusterClientset returns the Kubernetes clientset for the VerrazzanoManagedCluster
func GetVerrazzanoNoRetryHTTPClient ¶
GetVerrazzanoNoRetryHTTPClient returns an Http client configured with the verrazzano CA cert
func GetVerrazzanoPassword ¶
func GetVerrazzanoPassword() string
GetVerrazzanoPassword returns the password credential for the verrazzano secret
func GetVerrazzanoPasswordInCluster ¶ added in v0.14.0
func GetWildcardDNS ¶ added in v0.14.0
Returns well-known wildcard DNS name is used
func HasStatus ¶ added in v0.17.0
func HasStatus(expected int) types.GomegaMatcher
HasStatus asserts that an HTTPResponse has a given status.
func HasWildcardDNS ¶ added in v0.14.0
Returns true if string has DNS wildcard name
func IsACMEStagingEnabledInCluster ¶ added in v0.15.0
IsACMEStagingEnabledInCluster returns true if the ACME staging environment is configured
func IsDevProfile ¶ added in v0.13.0
func IsDevProfile() bool
IsDevProfile returns true if the deployed resource is a Dev profile
func IsManagedClusterProfile ¶ added in v0.13.0
func IsManagedClusterProfile() bool
IsManagedClusterProfile returns true if the deployed resource is a 'managed-cluster' profile
func IsProdProfile ¶ added in v0.13.0
func IsProdProfile() bool
IsProdProfile returns true if the deployed resource is a 'prod' profile
func Jq ¶
func Jq(node interface{}, path ...string) interface{}
Jq queries JSON nodes with a JSON path
func ListClusterRoleBindings ¶ added in v0.14.0
func ListClusterRoleBindings() (*rbacv1.ClusterRoleBindingList, error)
ListClusterRoleBindings returns the list of cluster role bindings for the cluster
func ListDeployments ¶
func ListDeployments(namespace string) (*appsv1.DeploymentList, error)
ListDeployments returns the list of deployments in a given namespace for the cluster
func ListIngresses ¶
func ListIngresses(namespace string) (*extensionsv1beta1.IngressList, error)
ListIngresses lists ingresses in namespace
func ListNamespaces ¶
func ListNamespaces(opts metav1.ListOptions) (*corev1.NamespaceList, error)
ListNamespaces returns a namespace list for the given list options
func ListNamespacesInCluster ¶ added in v0.16.0
func ListNamespacesInCluster(opts metav1.ListOptions, kubeconfigPath string) (*corev1.NamespaceList, error)
ListNamespaces returns a namespace list for the given list options in the specified cluster
func ListPodsInCluster ¶ added in v0.14.0
ListPodsInCluster returns the list of pods in a given namespace for the cluster
func ListSecrets ¶
func ListSecrets(namespace string) (*corev1.SecretList, error)
ListSecrets returns the list of secrets in a given namespace for the cluster
func ListServices ¶
func ListServices(namespace string) (*corev1.ServiceList, error)
ListServices returns the list of services in a given namespace for the cluster
func Log ¶
Log prints out a log message in a standard format and filters out messages based on the global log level
func LogIndexFound ¶
LogIndexFound confirms a named index can be found in Elasticsearch in the cluster specified in the environment
func LogIndexFoundInCluster ¶ added in v0.14.0
LogIndexFoundInCluster confirms a named index can be found in Elasticsearch on the given cluster
func LogRecordFound ¶
LogRecordFound confirms a recent log record for the index with matching fields can be found in the cluster specified in the environment
func LogRecordFoundInCluster ¶ added in v0.14.0
func LogRecordFoundInCluster(indexName string, after time.Time, fields map[string]string, kubeconfigPath string) bool
LogRecordFoundInCluster confirms a recent log record for the index with matching fields can be found in the given cluster
func MetricsExist ¶
MetricsExist is identical to MetricsExistInCluster, except that it uses the cluster specified in the environment
func MetricsExistInCluster ¶ added in v0.14.0
MetricsExist validates the availability of a given metric in the given cluster
func NoLog ¶ added in v0.15.0
NoLog returns true if no matched log record can be found in the index.
func PatchResourceFromFileInCluster ¶ added in v0.15.0
func PatchResourceFromFileInCluster(gvr schema.GroupVersionResource, namespace string, name string, patchFile string, kubeconfigPath string) error
PatchResourceFromFileInCluster patches a Kubernetes resource from a given patch file in the specified cluster If the given patch file has a ".yaml" extension, the contents will be converted to JSON This is intended to be equivalent to `kubectl patch`
func PodsNotRunning ¶
PodsNotRunning waits for all the pods in namePrefixes to be terminated
func PodsRunning ¶
PodsRunning is identical to PodsRunningInCluster, except that it uses the cluster specified in the environment
func PodsRunningInCluster ¶ added in v0.14.0
PodsRunning checks if all the pods identified by namePrefixes are ready and running in the given cluster
func PolicyRulesEqual ¶
func PolicyRulesEqual(rule1, rule2 rbacv1.PolicyRule) bool
PolicyRulesEqual compares two RBAC PolicyRules for semantic equality
func QueryMetric ¶
QueryMetric queries a metric from the Prometheus host, derived from the kubeconfig
func SearchLog ¶ added in v0.14.0
func SearchLog(index string, query ElasticQuery) map[string]interface{}
SearchLog search recent log records for the index with matching filters.
func SecretsCreated ¶
SecretsCreated checks if all the secrets identified by names are created
func SliceContainsPolicyRule ¶
func SliceContainsPolicyRule(ruleSlice []rbacv1.PolicyRule, rule rbacv1.PolicyRule) bool
SliceContainsPolicyRule determines if a given rule is in a slice of rules
func SliceContainsString ¶
SliceContainsString checks if the input slice (an array of strings) contains an entry which matches the string s
func SlicesContainSameStrings ¶
SlicesContainSameStrings compares two slices and returns true if they contain the same strings in any order
Types ¶
type ACMEStagingCerts ¶ added in v0.14.0
type ACMEStagingCerts struct {
// contains filtered or unexported fields
}
type APIEndpoint ¶
type APIEndpoint struct { AccessToken string `json:"access_token"` APIURL string HTTPClient *retryablehttp.Client }
APIEndpoint contains information needed to access an API
func GetAPIEndpoint ¶
func GetAPIEndpoint(kubeconfigPath string) (*APIEndpoint, error)
GetAPIEndpoint returns the APIEndpoint stub with AccessToken, from the given cluster
func (*APIEndpoint) Delete ¶
func (api *APIEndpoint) Delete(path string) (*HTTPResponse, error)
Delete Invoke DELETE API Request
func (*APIEndpoint) Get ¶
func (api *APIEndpoint) Get(path string) (*HTTPResponse, error)
Get Invoke GET API Request
func (*APIEndpoint) GetElasticURL ¶
func (api *APIEndpoint) GetElasticURL() (string, error)
GetElasticURL fetches ElasticSearch endpoint URL
func (*APIEndpoint) GetIngress ¶
func (api *APIEndpoint) GetIngress(namespace, name string) (*extensionsv1beta1.Ingress, error)
GetIngress fetches ingress from api
func (*APIEndpoint) Patch ¶
func (api *APIEndpoint) Patch(path string, body io.Reader) (*HTTPResponse, error)
Patch Invoke POST API Request
func (*APIEndpoint) Post ¶
func (api *APIEndpoint) Post(path string, body io.Reader) (*HTTPResponse, error)
Post Invoke POST API Request
func (*APIEndpoint) Request ¶
func (api *APIEndpoint) Request(method, path string, body io.Reader) (*HTTPResponse, error)
Request Invoke API
type ElasticQuery ¶ added in v0.14.0
ElasticQuery describes an Elasticsearch Query
type HTTPResponse ¶
HTTPResponse represents an HTTP response including the read body
func Delete ¶
func Delete(url string, hostHeader string) (*HTTPResponse, error)
Delete executes an HTTP DELETE
func GetWebPage ¶ added in v0.17.0
func GetWebPage(url string, hostHeader string) (*HTTPResponse, error)
GetWebPage makes an HTTP GET request using a retryable client configured with the Verrazzano cert bundle
func GetWebPageWithBasicAuth ¶
func GetWebPageWithBasicAuth(url string, hostHeader string, username string, password string, kubeconfigPath string) (*HTTPResponse, error)
GetWebPageWithBasicAuth gets a web page using basic auth, using a given kubeconfig
func GetWebPageWithClient ¶ added in v0.17.0
func GetWebPageWithClient(httpClient *retryablehttp.Client, url string, hostHeader string) (*HTTPResponse, error)
GetWebPageWithClient submits a GET request using the specified client.
func PostWithBasicAuth ¶ added in v0.17.0
func PostWithBasicAuth(url, body, username, password, kubeconfigPath string) (*HTTPResponse, error)
PostWithBasicAuth retries POST using basic auth
func PostWithHostHeader ¶
func PostWithHostHeader(url, contentType string, hostHeader string, body io.Reader) (*HTTPResponse, error)
PostWithHostHeader posts a request with a specified Host header
func ProcessHTTPResponse ¶ added in v0.17.0
func ProcessHTTPResponse(resp *http.Response) (*HTTPResponse, error)
ProcessHTTPResponse processes the HTTP response by reading and closing the body, then returning the HTTPResponse object. This function is used to prevent file descriptor leaks and other problems. See https://github.com/golang/go/blob/master/src/net/http/response.go
Params
resp: Http response returned by http call httpErr: Http error returned by the http call
Returns
HttpReponse which has the body and status code.
func PutWithHostHeader ¶
func PutWithHostHeader(url, contentType string, hostHeader string, body io.Reader) (*HTTPResponse, error)
PutWithHostHeader PUTs a request with a specified Host header
type KeycloakRESTClient ¶ added in v0.14.0
type KeycloakRESTClient struct {
// contains filtered or unexported fields
}
func NewKeycloakAdminRESTClient ¶ added in v0.15.0
func NewKeycloakAdminRESTClient() (*KeycloakRESTClient, error)
NewKeycloakRESTClient creates a new Keycloak REST client.
func (*KeycloakRESTClient) CreateUser ¶ added in v0.14.0
func (c *KeycloakRESTClient) CreateUser(userRealm string, userName string, firstName string, lastName string, password string) (string, error)
CreateUser creates a user in Keycloak curl -v http://localhost:8080/auth/admin/realms/apiv2/users -H "Content-Type: application/json" -H "Authorization: bearer $TOKEN" --data '{"username":"someuser", "firstName":"xyz", "lastName":"xyz", "email":"demo2@gmail.com", "enabled":"true"}'
func (*KeycloakRESTClient) DeleteUser ¶ added in v0.14.0
func (c *KeycloakRESTClient) DeleteUser(userRealm string, userID string) error
DeleteUser deletes a user from Keycloak DELETE /auth/admin/realms/<realm>/users/<userID>
func (*KeycloakRESTClient) GetRealm ¶ added in v0.14.0
func (c *KeycloakRESTClient) GetRealm(realm string) (map[string]interface{}, error)
GetRealm gets realm data from Keycloak.
func (*KeycloakRESTClient) SetPassword ¶ added in v0.14.0
func (c *KeycloakRESTClient) SetPassword(userRealm string, userID string, password string) error
SetPassword sets a user's password in Keycloak PUT /auth/admin/realms/{realm}/users/{id}/reset-password { "type": "password", "temporary": false, "value": "..." }
type LogLevel ¶
type LogLevel int
LogLevel is the logging level used to control log output
const ( // Error level designates error events that might still allow the application to continue running Error LogLevel = 1 // Info level designates informational messages that highlight the progress of the application at coarse-grained level Info LogLevel = 4 // Debug level designates fine-grained informational events that are most useful to debug an application Debug LogLevel = 7 )
type UsernamePassword ¶
UsernamePassword - Username and Password credentials
func GetSystemVMICredentials ¶
func GetSystemVMICredentials() (*UsernamePassword, error)
GetSystemVMICredentials - Obtain VMI system credentials