pkg

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2023 License: UPL-1.0 Imports: 83 Imported by: 0

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.

Copyright (c) 2021, 2022, 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

View Source
const (
	// NumRetries - maximum number of retries
	NumRetries = 10

	// RetryWaitMinimum - minimum retry wait
	RetryWaitMinimum = 1 * time.Second

	// RetryWaitMaximum - maximum retry wait
	RetryWaitMaximum = 30 * time.Second

	// VerrazzanoNamespace - namespace hosting verrazzano resources
	VerrazzanoNamespace = "verrazzano-system"

	// VerrzzanoSecretName - name of the secret for verrazzano user
	VerrzzanoSecretName = "verrazzano"

	// SystemIndexPatternPrefix - prefix for verrazzano system logs
	SystemIndexPatternPrefix = "verrazzano-system"

	// ApplicationIndexPatternPrefix - prefix for verrazzano application logs
	ApplicationIndexPatternPrefix = "verrazzano-application"

	// kubeConfigErrorFmt - error format for reporting kubeconfig related errors
	KubeConfigErrorFmt = "Error getting kubeconfig, error: %v"
)
View Source
const (
	CrashLoopBackOff    = "CrashLoopBackOff"
	ImagePullBackOff    = "ImagePullBackOff"
	InitContainerPrefix = "Init"
)
View Source
const (
	NipDomain   = "nip.io"
	SslipDomain = "sslip.io"
)
View Source
const (
	SystemLogIsmPolicyName      = "verrazzano-system"
	ApplicationLogIsmPolicyName = "verrazzano-application"
)

Retention/Rollover policy names in ISM plugin

View Source
const (
	// ClusterTypeKind represents a Kind cluster
	ClusterTypeKind = "kind"
	// ClusterTypeOlcne represents an OCNE cluster
	ClusterTypeOlcne = "OCNE"
)
View Source
const (
	TestKeycloakMasterUserIDKey     = "TEST_KEYCLOAK_MASTER_USERID"
	TestKeycloakVerrazzanoUserIDKey = "TEST_KEYCLOAK_VZ_USERID"

	TestKeycloakNamespace = "keycloak-test-ns"
	TestKeycloakConfigMap = "keycloak-test-cm"
)
View Source
const (
	// ISO8601Layout defines the timestamp format
	ISO8601Layout = "2006-01-02T15:04:05.999999999-07:00"
)
View Source
const (
	KialiName = "vmi-system-kiali"
)
View Source
const (
	// Username - the username of the Verrazzano admin user
	Username = "verrazzano"
)
View Source
const VmiESInternalSecret = "verrazzano-es-internal" //nolint:gosec //#gosec G101
View Source
const VmiESLegacySecret = "verrazzano" //nolint:gosec //#gosec G101
View Source
const VmiESURL = "http://verrazzano-authproxy-opensearch:8775"

Variables

View Source
var (
	DefaultRetentionPeriod = "7d"
	DefaultRolloverPeriod  = "1d"
)

Default values for Retention period and Rollover period

View Source
var SimpleNameGenerator = newNameGenerator()

Functions

func APIExtensionsClientSet

func APIExtensionsClientSet() (*apiextv1.ApiextensionsV1Client, error)

APIExtensionsClientSet returns a Kubernetes ClientSet for this cluster.

func AddAccessTokenToRancherForLoggedInUser added in v1.6.4

func AddAccessTokenToRancherForLoggedInUser(log *zap.SugaredLogger, adminKubeConfig, managedClusterName, usernameForRancher, ttl string) (string, error)

This function adds an access token to Rancher gven that a ttl and clusterID string is provided

func AssertBearerAuthorized added in v1.1.0

func AssertBearerAuthorized(httpClient *retryablehttp.Client, url string) bool

func AssertFluentdURLAndSecret added in v1.1.0

func AssertFluentdURLAndSecret(expectedURL, expectedSecret string) bool

AssertFluentdURLAndSecret makes sure that expectedURL and expectedSecret are the same as what is configured in the fluentd daemonset. empty string expectedURL means skip comparing URL. Verrazzano prior to 1.1 could configure URL differently.

func AssertOauthURLAccessibleAndUnauthorized added in v1.1.0

func AssertOauthURLAccessibleAndUnauthorized(httpClient *retryablehttp.Client, url string) bool

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 CalculateSeconds added in v1.3.0

func CalculateSeconds(age string) (int64, error)

CalculateSeconds validates the duration pattern and if valid calculates the seconds for the given duration. eg: 1d returns integer of value 1 * 24 * 60 * 60

func CanI added in v0.13.0

func CanI(userOCID string, namespace string, verb string, resource string) (bool, string, error)

func CanIForAPIGroup added in v0.13.0

func CanIForAPIGroup(userOCID string, namespace string, verb string, resource string, group string) (bool, string, error)

func CanIForAPIGroupForServiceAccountOrUser added in v0.15.0

func CanIForAPIGroupForServiceAccountOrUser(saOrUserOCID string, namespace string, verb string, resource string, group string, isServiceAccount bool, saNamespace string) (bool, string, error)

func CheckAllImagesPulled added in v1.3.0

func CheckAllImagesPulled(pods *v1.PodList, events *v1.EventList, namePrefixes []string) bool

CheckAllImagesPulled checks if all the images of the target pods have been pulled or not. The idea here is to periodically enumerate the containers from the target pods and watch the events related image pulls, such that we can make a smarter decision about pod deployment i.e. keep waiting if the process is slow, and stop waiting in case of unrecoverable failures.

func CheckForDataStream added in v1.3.0

func CheckForDataStream(name string) bool

func CheckISMPolicy added in v1.5.3

func CheckISMPolicy() (bool, error)

func CheckNSFinalizerRemoved added in v1.3.0

func CheckNSFinalizerRemoved(ns string, clientset *kubernetes.Clientset) bool

CheckNamespaceFinalizerRemoved checks whether namespace finalizers are removed, using the given Clientset

func CheckNamespaceFinalizerRemoved added in v1.3.0

func CheckNamespaceFinalizerRemoved(ns string) bool

CheckNamespaceFinalizerRemoved checks whether namespace finalizers are removed

func CheckNoServerHeader added in v0.16.0

func CheckNoServerHeader(resp *HTTPResponse) bool

CheckNoServerHeader validates that the response does not include a Server header.

func CheckPodsForEnvoySidecar added in v1.1.0

func CheckPodsForEnvoySidecar(namespace string, imageName string) bool

CheckPodsForEnvoySidecar checks if a pods which have Envoy sidecars, have the specified image

func CheckStatusAndResponseHeaderAbsent added in v1.2.0

func CheckStatusAndResponseHeaderAbsent(httpClient *retryablehttp.Client, req *retryablehttp.Request, badRespHeader string, statusCode int) error

CheckStatusAndResponseHeaderAbsent checks that the given header name is not present in the http response, and that the response status code is as expected. If the statusCode is <= 0, the status code check is skipped. If the badRespHeader is "", the response headers are not checked.

func Concurrently

func Concurrently(assertions ...func())

Concurrently executes the given assertions in parallel and waits for them all to complete

func ConditionalSpec added in v1.1.0

func ConditionalSpec(description string, skipMessage string, condition ConditionalCheckFunc, specFunc interface{})

ConditionalSpec Executes the specified test spec/func when the condition function passes without error

func ContainerHasExpectedArgs added in v1.3.0

func ContainerHasExpectedArgs(namespace string, deploymentName string, containerName string, arguments []string) (bool, error)

ContainerHasExpectedArgs returns true if each of the arguments matches a substring of one of the arguments found in the deployment

func ContainerImagePullWait added in v1.3.0

func ContainerImagePullWait(namespace string, namePrefixes []string) bool

func ContainerImagePullWaitInCluster added in v1.3.0

func ContainerImagePullWaitInCluster(namespace string, namePrefixes []string, kubeconfigPath string) bool

func ContainsDocsOlderThanRetentionPeriod added in v1.3.0

func ContainsDocsOlderThanRetentionPeriod(indexName string, retentionPeriod string) (bool, error)

ContainsDocsOlderThanRetentionPeriod returns true if the given index contains any doc that is older than the retention period, returns false otherwise.

func ContainsIndicesOlderThanRetentionPeriod added in v1.3.0

func ContainsIndicesOlderThanRetentionPeriod(indexMetadataList []IndexMetadata, oldestTimestamp int64) (bool, error)

ContainsIndicesOlderThanRetentionPeriod returns true if there are any old (backing) indices present for the given data stream that is older than the retention period. Returns false otherwise.

func CreateArgoCDGitApplication added in v1.5.0

func CreateArgoCDGitApplication() error

CreateArgoCDGitApplication creates an application in Argo CD by connecting to the Git repo Applies the Argo CD Application to the kubernetes cluster

func CreateConfigMap added in v1.3.1

func CreateConfigMap(configMap *corev1.ConfigMap) error

CreateConfigMap creates the ConfigMap

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 CreateCredentialsSecretFromMapInCluster added in v1.1.0

func CreateCredentialsSecretFromMapInCluster(namespace string, name string, values, labels map[string]string, kubeconfigPath string) (*corev1.Secret, error)

CreateCredentialsSecretFromMapInCluster creates opaque secret from the given map of values

func CreateCredentialsSecretInCluster added in v1.1.0

func CreateCredentialsSecretInCluster(namespace string, name string, username string, pw string, labels map[string]string, kubeconfigPath string) (*corev1.Secret, error)

CreateCredentialsSecretInCluster creates opaque secret

func CreateDockerSecret

func CreateDockerSecret(namespace string, name string, server string, username string, password string) (*corev1.Secret, error)

CreateDockerSecret creates docker secret

func CreateDockerSecretInCluster added in v1.1.0

func CreateDockerSecretInCluster(namespace string, name string, server string, username string, password string, kubeconfigPath string) (*corev1.Secret, error)

CreateDockerSecretInCluster creates docker secret

func CreateIndexPattern added in v1.3.0

func CreateIndexPattern(pattern string) map[string]interface{}

CreateIndexPattern creates the specified index pattern in OpenSearch Dashboards

func CreateLogFile

func CreateLogFile(filename string, content string) error

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

func CreateNamespace(name string, labels map[string]string) (*corev1.Namespace, error)

CreateNamespace creates a namespace

func CreateNamespaceWithAnnotations added in v1.2.0

func CreateNamespaceWithAnnotations(name string, labels map[string]string, annotations map[string]string) (*corev1.Namespace, error)

func CreateNamespaceWithClientSet added in v1.3.0

func CreateNamespaceWithClientSet(name string, labels map[string]string, clientset *kubernetes.Clientset, annotations map[string]string) (*corev1.Namespace, error)

CreateNamespaceWithClientSet creates a namespace using the given Clientset

func CreateNewRancherConfig added in v1.5.0

func CreateNewRancherConfig(log *zap.SugaredLogger, kubeconfigPath string) (*rancherutil.RancherConfig, error)

func CreateNewRancherConfigForUser added in v1.5.0

func CreateNewRancherConfigForUser(log *zap.SugaredLogger, kubeconfigPath string, username string, password string) (*rancherutil.RancherConfig, error)

func CreateOrUpdateNamespace added in v1.5.0

func CreateOrUpdateNamespace(name string, labels map[string]string, annotations map[string]string) (*corev1.Namespace, error)

CreateOrUpdateNamespace creates or updates a namespace

func CreateOverridesOrDie added in v1.4.0

func CreateOverridesOrDie(yamlString string) []v1beta1.Overrides

CreateOverridesOrDie converts the yaml string to JSON object

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 CreateRoleBinding(userOCID string, namespace string, rolebindingname string, clusterrolename string) error

func CreateSecret added in v1.3.1

func CreateSecret(secret *corev1.Secret) error

CreateSecret creates the given secret

func DeleteApplicationDataStream added in v1.3.0

func DeleteApplicationDataStream(datastreamName string) error

DeleteApplicationDataStream deletes the given applicatoin data stream

func DeleteConfigMap added in v1.3.1

func DeleteConfigMap(namespace string, name string) error

DeleteConfigMap to delete the ConfigMap with the given name and namespace

func DeleteNamespace

func DeleteNamespace(name string) error

DeleteNamespace deletes a namespace in the cluster specified in the environment

func DeleteNamespaceInCluster added in v0.14.0

func DeleteNamespaceInCluster(name string, kubeconfigPath string) error

func DeleteNamespaceWithClientSet added in v1.3.0

func DeleteNamespaceWithClientSet(name string, clientset *kubernetes.Clientset) error

DeleteNamespaceWithClientSet deletes the namespace using the given Clientset

func DeleteSecret

func DeleteSecret(namespace string, name string) error

DeleteSecret deletes the specified secret in the specified namespace

func DeployHelloHelidonApplication added in v1.2.0

func DeployHelloHelidonApplication(namespace string, ociLogID string, istioInjection string, customComponent string, customAppConfig string)

DeployHelloHelidonApplication deploys the Hello Helidon example application. It accepts an optional OCI Log ID that is added as an annotation on the namespace to test the OCI Logging service integration.

func DeploySpringBootApplication added in v1.2.0

func DeploySpringBootApplication(namespace string, istioInjection string)

DeploySpringBootApplication deploys the Springboot example application.

func DoesCRDExist

func DoesCRDExist(crdName string) (bool, error)

DoesCRDExist returns whether a CRD with the given name exists for the cluster

func DoesClusterRoleBindingExist

func DoesClusterRoleBindingExist(name string) (bool, error)

DoesClusterRoleBindingExist returns whether a cluster role with the given name exists in the cluster

func DoesClusterRoleExist

func DoesClusterRoleExist(name string) (bool, error)

DoesClusterRoleExist returns whether a cluster role with the given name exists in the cluster

func DoesCronJobExist added in v1.4.0

func DoesCronJobExist(kubeconfigPath, namespace string, name string) (bool, error)

DoesCronJobExist returns whether a cronjob with the given name and namespace exists for the cluster

func DoesDeploymentExist added in v1.2.0

func DoesDeploymentExist(namespace string, name string) (bool, error)

DoesDeploymentExist returns whether a deployment with the given name and namespace exists for the cluster

func DoesLoggingSidecarExist added in v1.1.0

func DoesLoggingSidecarExist(kubeconfigPath string, name types.NamespacedName, containerName string) (bool, error)

func DoesNamespaceExist

func DoesNamespaceExist(name string) (bool, error)

DoesNamespaceExist returns whether a namespace with the given name exists for the cluster set in the environment

func DoesNamespaceExistInCluster added in v0.14.0

func DoesNamespaceExistInCluster(name string, kubeconfigPath string) (bool, error)

DoesNamespaceExistInCluster returns whether a namespace with the given name exists in the specified cluster

func DoesNamespaceHasVerrazzanoLabel added in v1.6.1

func DoesNamespaceHasVerrazzanoLabel(ns string) (bool, error)

DoesNamespaceHasVerrazzanoLabel checks whether the namespace has the verrazzano.io/namespace label

func DoesPodExist

func DoesPodExist(namespace string, name string) (bool, error)

DoesPodExist returns whether a pod with the given name and namespace exists for the cluster

func DoesRoleBindingContainSubject added in v0.13.0

func DoesRoleBindingContainSubject(namespace, name, subjectKind, subjectName string) (bool, error)

DoesRoleBindingContainSubject returns true if the RoleBinding exists and it contains the specified subject

func DoesRoleBindingExist added in v0.13.0

func DoesRoleBindingExist(name string, namespace string) (bool, error)

DoesRoleBindingExist returns whether a cluster role with the given name exists in the cluster

func DoesSecretExist added in v1.5.0

func DoesSecretExist(namespace string, name string) (bool, error)

DoesSecretExist returns whether a Secret with the given name and namespace exists for the cluster

func DoesServiceAccountExist added in v0.13.0

func DoesServiceAccountExist(namespace, name string) (bool, error)

DoesServiceAccountExist returns whether a service account with the given name and namespace exists in the cluster

func DoesServiceExist

func DoesServiceExist(namespace string, name string) (bool, error)

DoesServiceExist returns whether a Service with the given name and namespace exists for the cluster

func DoesStatefulSetExist added in v1.4.0

func DoesStatefulSetExist(namespace string, name string) (bool, error)

DoesStatefulSetExist returns whether a StatefulSet with the given name and namespace exists for the cluster

func DoesVerrazzanoProjectExistInCluster added in v1.1.0

func DoesVerrazzanoProjectExistInCluster(name string, kubeconfigPath string) (bool, error)

DoesVerrazzanoProjectExistInCluster returns whether a VerrazzanoProject with the given name exists in the specified cluster

func DoesVirtualServiceExist added in v1.5.0

func DoesVirtualServiceExist(namespace string, name string) (bool, error)

DoesVirtualServiceExist returns whether a VirtualService with the given name and namespace exists for the cluster

func EventuallyGetAccessToken added in v1.7.0

func EventuallyGetAccessToken(kubeconfigPath string, isOIDCProviderDex bool) *string

EventuallyGetAccessToken eventually returns the AccessToken from the OIDC provider in the given cluster

func EventuallyGetIngressHost added in v1.5.0

func EventuallyGetIngressHost(log *zap.SugaredLogger, api *APIEndpoint, namespace string, name string) string

func EventuallyGetKialiHost added in v1.4.0

func EventuallyGetKialiHost(cs *kubernetes.Clientset) string

func EventuallyGetRancherHost added in v1.5.0

func EventuallyGetRancherHost(log *zap.SugaredLogger, api *APIEndpoint) (string, error)

func EventuallyGetURLForIngress added in v1.4.0

func EventuallyGetURLForIngress(log *zap.SugaredLogger, api *APIEndpoint, namespace string, name string, scheme string) string

func EventuallyPodsReady added in v1.6.0

func EventuallyPodsReady(log *zap.SugaredLogger, master, data, ingest int)

EventuallyPodsReady check whether the required number of master, data and ingest pods are ready or not

func EventuallyVerrazzanoRetryableHTTPClient added in v1.4.0

func EventuallyVerrazzanoRetryableHTTPClient() *retryablehttp.Client

func Execute added in v0.15.0

func Execute(podName, containerName, namespace string, command []string) (string, string, error)

Execute executes the given command on the pod and container identified by the given names and returns the resulting stdout and stderr

func ExecuteDeleteRequestForToken added in v1.6.4

func ExecuteDeleteRequestForToken(log *zap.SugaredLogger, adminKubeconfig, managedClusterName, usernameForRancher, tokenName string) error

This function is a wrapper function to delete a given token for a specified user in Rancher

func ExecuteGetRequestToReturnAllTokens added in v1.6.4

func ExecuteGetRequestToReturnAllTokens(log *zap.SugaredLogger, adminKubeconfig, managedClusterName, usernameForRancher string) ([]byte, error)

This function is a wrapper function that executes a GET Request to return all tokens in Rancher for a given user

func ExecutePostRequestToAddAToken added in v1.6.4

func ExecutePostRequestToAddAToken(log *zap.SugaredLogger, adminKubeconfig, managedClusterName, usernameForRancher, ttl string) ([]byte, error)

This function is a wrapper function that executes a POST Request to add a token in Rancher for a given user

func FindAnyLog added in v0.15.0

func FindAnyLog(index string, match []Match, mustNot []Match) bool

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

func FindLog(index string, match []Match, mustNot []Match) bool

FindLog returns true if a recent log record can be found in the index with matching filters.

func FindTestDataFile

func FindTestDataFile(file string) (string, error)

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 GenerateNamespace added in v1.2.0

func GenerateNamespace(name string) string

GenerateNamespace takes a string and combines that with a UUID to generate a namespace

func GenerateTrafficForTraces added in v1.4.0

func GenerateTrafficForTraces(namespace, appConfigName, urlPath, kubeconfigPath string) error

GenerateTrafficForTraces creates some HTTP requests to the application so that the corresponding traces would be generated for them.

func GetACMEEnvironment added in v1.1.0

func GetACMEEnvironment(kubeconfigPath string) (string, error)

GetACMEEnvironment returns true if

func GetAndDeleteTokenNamesForLoggedInUserBasedOnClusterID added in v1.6.4

func GetAndDeleteTokenNamesForLoggedInUserBasedOnClusterID(log *zap.SugaredLogger, adminKubeConfig, managedClusterName, usernameForRancher string) error

This function returns the list of token names that correspond to the cluster ID and this user before when this is called If no error occurs, this means that these tokens were found and deleted in Rancher

func GetAppConfig added in v1.2.0

func GetAppConfig(namespace string, name string) (*unstructured.Unstructured, error)

GetAppConfig returns the specified appconfig in a given namespace

func GetAppServiceMonitorName added in v1.4.0

func GetAppServiceMonitorName(namespace string, appName string, component string) string

GetAppServiceMonitorName returns the service monitor name used in VZ 1.4+ for the given namespace and app name

func GetApplicationDataStreamNames added in v1.3.0

func GetApplicationDataStreamNames() ([]string, error)

GetApplicationDataStreamNames returns the data stream names of all application logs having prefix 'verrazzano-application-'

func GetApplicationsWithClient added in v1.5.0

func GetApplicationsWithClient(log *zap.SugaredLogger, argoCDURL string, token string) (bool, error)

GetApplicationsWithClient returns true if the user is able to access the applications page post Argo CD install

func GetBOMDoc added in v1.4.0

func GetBOMDoc() (*bom.BomDoc, error)

Get the BOM from the platform operator in the cluster and build the BOM structure from it

func GetCACertFromSecret added in v1.5.0

func GetCACertFromSecret(secretName string, namespace string, caKey string, kubeconfigPath string) ([]byte, error)

GetCACertFromSecret returns the CA cert from the specified kubernetes secret in the given cluster

func GetCertificate added in v1.1.0

func GetCertificate(namespace string, name string) (*unstructured.Unstructured, error)

GetCertificate returns the a cert in a given namespace for the cluster specified in the environment

func GetCertificateList added in v1.3.0

func GetCertificateList(namespace string) (*certmanagerv1.CertificateList, error)

GetCertificateList returns a list of certificates in the given namespace

func GetCertificates

func GetCertificates(url string) ([]*x509.Certificate, error)

GetCertificates will return the server SSL certificates for the given URL.

func GetClusterKubeconfig added in v1.5.0

func GetClusterKubeconfig(log *zap.SugaredLogger, httpClient *retryablehttp.Client, rc *rancherutil.RancherConfig, clusterID string) (string, error)

func GetClusterNameMetricLabel added in v1.1.0

func GetClusterNameMetricLabel(kubeconfigPath string) (string, error)

GetClusterNameMetricLabel returns the label name used for labeling metrics with the Verrazzano cluster This is different in pre-1.1 VZ releases versus later releases

func GetClusterOperatorClientset added in v1.5.0

func GetClusterOperatorClientset(kubeconfigPath string) (*vcoClient.Clientset, error)

GetClusterOperatorClientset returns the Kubernetes clientset for the Verrazzano Cluster Operator for a given kubeconfig

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

func GetConfigMap(configMapName string, namespace string) (*corev1.ConfigMap, error)

GetConfigMap returns the config map for the passed in ConfigMap Name and Namespace

func GetContainerEnv added in v1.3.0

func GetContainerEnv(namespace string, deploymentName string, containerName string) ([]corev1.EnvVar, error)

GetContainerEnv returns an array of environment variables in the specified container for the specified deployment

func GetContainerImage added in v1.3.0

func GetContainerImage(namespace string, deploymentName string, containerName string) (string, error)

GetContainerImage returns the image used by the specified container for the specified deployment

func GetDNS added in v1.5.0

func GetDNS(cr *vzapi.Verrazzano) string

GetDNS gets the DNS configured in the CR

func GetDaemonSet added in v1.3.0

func GetDaemonSet(namespace string, daemonSetName string) (*appsv1.DaemonSet, error)

GetDaemonSet returns a GetDaemonSet with the given name and namespace

func GetDeployment added in v1.2.0

func GetDeployment(namespace string, deploymentName string) (*appsv1.Deployment, error)

GetDeployment returns a deployment with the given name and namespace

func GetDeploymentLabelSelector added in v1.4.0

func GetDeploymentLabelSelector(namespace, deploymentName string) (*metav1.LabelSelector, error)

func GetDynamicClient added in v0.15.0

func GetDynamicClient() (dynamic.Interface, error)

GetDynamicClient returns a dynamic client needed to access Unstructured data

func GetDynamicClientInCluster added in v1.1.0

func GetDynamicClientInCluster(kubeconfigPath string) (dynamic.Interface, error)

GetDynamicClientInCluster returns a dynamic client needed to access Unstructured data

func GetEffectiveKeyCloakPersistenceOverride added in v1.1.0

func GetEffectiveKeyCloakPersistenceOverride(kubeconfigPath string) (*v1beta1.VolumeClaimSpecTemplate, error)

GetEffectiveKeyCloakPersistenceOverride returns the effective PVC override for Keycloak, if it exists

func GetEffectiveVMIPersistenceOverride added in v1.1.0

func GetEffectiveVMIPersistenceOverride(kubeconfigPath string) (*v1beta1.VolumeClaimSpecTemplate, error)

GetEffectiveVMIPersistenceOverride returns the effective PVC override for the VMI components, if it exists

func GetEnvFallback added in v1.6.2

func GetEnvFallback(envVar, fallback string) string

GetEnvFallback returns the value of the desired environment variable, but returns a fallback value if the environment variable is not set

func GetEnvFallbackBool added in v1.6.2

func GetEnvFallbackBool(envVar string, fallback bool) bool

GetEnvFallbackBool returns the value of the desired boolean environment variable, but returns a fallback value if the environment variable is not set or isn't a bool value

func GetEnvFallbackInt added in v1.6.2

func GetEnvFallbackInt(envVar string, fallback int) int

GetEnvFallbackInt returns the value of the desired integer environment variable, but returns a fallback value if the environment variable is not set or isn't an int value

func GetEnvName added in v1.1.0

func GetEnvName(kubeconfigPath string) (string, error)

func GetEnvironmentName added in v1.5.0

func GetEnvironmentName(cr *vzapi.Verrazzano) string

GetEnvironmentName returns the name of the Verrazzano install environment

func GetExternalOpenSearchURL added in v1.3.0

func GetExternalOpenSearchURL(kubeconfigPath string) string

GetExternalOpenSearchURL gets the external Opensearch URL

func GetISMRolloverPeriod added in v1.3.0

func GetISMRolloverPeriod(policyName string) (string, error)

func GetImagePrefix added in v1.3.0

func GetImagePrefix() string

GetImagePrefix Gets the image prefix for container images (accounts for private registry)

func GetIngress added in v1.4.0

func GetIngress(namespace string, ingressName string) (*netv1.Ingress, error)

GetIngress returns the ingress given a namespace and ingress name

func GetIngressIP added in v1.6.0

func GetIngressIP(cr *vzapi.Verrazzano) string

GetIngressIP returns the externalIP required to create ingress

func GetIngressList added in v1.3.0

func GetIngressList(namespace string) (*netv1.IngressList, error)

GetIngressList returns a list of ingresses in the given namespace

func GetIssuerList added in v1.3.0

func GetIssuerList(namespace string) (*certmanagerv1.IssuerList, error)

GetIssuerList returns a list of cluster issuers

func GetJaegerCollectorDeployments added in v1.4.0

func GetJaegerCollectorDeployments(kubeconfigPath, jaegerCRName string) ([]appsv1.Deployment, error)

GetJaegerCollectorDeployments returns the deployment object of the Jaeger collector corresponding to the given

Jaeger instance. If no instance name is provided, then it returns all Jaeger collector pods in the

// verrazzano-monitoring namespace.

func GetJaegerQueryDeployments added in v1.4.0

func GetJaegerQueryDeployments(kubeconfigPath, jaegerCRName string) ([]appsv1.Deployment, error)

GetJaegerQueryDeployments returns the deployment object of the Jaeger query corresponding to the given

Jaeger instance. If no Jaeger instance name is provided, then it returns all Jaeger query pods in the
verrazzano-monitoring namespace

func GetJaegerSpanIndexName added in v1.4.0

func GetJaegerSpanIndexName(kubeconfigPath string) (string, error)

GetJaegerSpanIndexName returns the index name used in OpenSearch used for storage

func GetJaegerSystemServicesInAdminCluster added in v1.4.0

func GetJaegerSystemServicesInAdminCluster() []string

GetJaegerSystemServicesInAdminCluster returns the system services that needs to be running in a admin cluster

func GetJaegerSystemServicesInManagedCluster added in v1.4.0

func GetJaegerSystemServicesInManagedCluster() []string

GetJaegerSystemServicesInManagedCluster returns the system services that needs to be running in a managed cluster

func GetKubernetesClientsetForCluster added in v0.14.0

func GetKubernetesClientsetForCluster(kubeconfigPath string) (*kubernetes.Clientset, error)

GetKubernetesClientsetForCluster returns the Kubernetes clientset for the cluster whose kubeconfig path is specified

func GetNamespace

func GetNamespace(name string) (*corev1.Namespace, error)

GetNamespace returns a namespace

func GetNamespaceInCluster added in v0.14.0

func GetNamespaceInCluster(name string, kubeconfigPath string) (*corev1.Namespace, error)

GetNamespaceInCluster returns a namespace in the cluster whose kubeconfigPath is specified

func GetNamespaceWithClientSet added in v1.3.0

func GetNamespaceWithClientSet(name string, clientset *kubernetes.Clientset) (*corev1.Namespace, error)

GetNamespaceWithClientSet returns a namespace for the given Clientset

func GetNodeCount added in v1.3.1

func GetNodeCount() (uint32, error)

GetNodeCount returns the number of nodes for the cluster

func GetNodeCountInCluster added in v1.6.1

func GetNodeCountInCluster(kubeconfigPath string) (int, error)

Gets the number of nodes in the cluster specified by kubeconfigPath. If an error occurs, returns 0 for the number of nodes.

func GetOpenSearchAppIndex added in v1.3.0

func GetOpenSearchAppIndex(namespace string) (string, error)

GetOpenSearchAppIndex in Verrazzano 1.3.0, application indices have been migrated to data streams following the pattern 'verrazzano-application-<application name>'

func GetOpenSearchAppIndexWithKC added in v1.3.0

func GetOpenSearchAppIndexWithKC(namespace, kubeconfigPath string) (string, error)

GetOpenSearchAppIndexWithKC is the same as GetOpenSearchAppIndex but kubeconfig may be specified for MC tests

func GetOpenSearchSystemIndex added in v1.3.0

func GetOpenSearchSystemIndex(name string) (string, error)

GetOpenSearchSystemIndex in Verrazzano 1.3.0, indices in the verrazzano-system namespace have been migrated to the verrazzano-system data stream

func GetOpenSearchSystemIndexWithKC added in v1.3.0

func GetOpenSearchSystemIndexWithKC(name, kubeconfigPath string) (string, error)

GetOpenSearchSystemIndexWithKC is the same as GetOpenSearchSystemIndex but the kubeconfig may be specified for MC tests

func GetPersistentVolumeClaims added in v1.3.0

func GetPersistentVolumeClaims(namespace string) (map[string]*corev1.PersistentVolumeClaim, error)

func GetPersistentVolumes added in v0.15.1

func GetPersistentVolumes() (map[string]*corev1.PersistentVolume, error)

func GetPodsFromSelector added in v0.15.0

func GetPodsFromSelector(selector *metav1.LabelSelector, namespace string) ([]corev1.Pod, error)

GetPodsFromSelector returns a collection of pods for the given namespace and selector

func GetPrometheusConfig added in v1.3.0

func GetPrometheusConfig() (*v1.ConfigMap, []interface{}, map[interface{}]interface{}, error)

GetPrometheusConfig - Returns the Prometehus Configmap, Marshalled prometehus.yml and the scrape config list

func GetPrometheusIngressHost added in v1.4.0

func GetPrometheusIngressHost(kubeconfigPath string) string

GetPrometheusIngressHost gets the host used for ingress to the system Prometheus in the given cluster

func GetQueryStoreIngressHost added in v1.6.0

func GetQueryStoreIngressHost(kubeconfigPath string) string

GetQueryStoreIngressHost gets the host used for ingress to Thanos Query Store in the given cluster

func GetRancherAdminToken added in v1.4.0

func GetRancherAdminToken(log *zap.SugaredLogger, httpClient *retryablehttp.Client, rancherURL string) string

func GetReplicaCounts added in v1.3.0

func GetReplicaCounts(expectedDeployments []types.NamespacedName, optsBuilder func(name types.NamespacedName) (metav1.ListOptions, error)) (map[string]uint32, error)

GetReplicaCounts Builds a map of pod counts for a list of deployments expectedDeployments - a list of namespaced names for deployments to look for optsBuilder - a callback func to build the right set of options to select pods for the deployment

func GetRequiredEnvVarOrFail

func GetRequiredEnvVarOrFail(name string) string

GetRequiredEnvVarOrFail returns the values of the provided environment variable name or fails.

func GetRetentionPeriod added in v1.3.0

func GetRetentionPeriod(policyName string) (string, error)

func GetRetryPolicy

func GetRetryPolicy() func(ctx context.Context, resp *http.Response, err error) (bool, error)

GetRetryPolicy returns the standard retry policy

func GetRulesFromThanosRuler added in v1.7.0

func GetRulesFromThanosRuler(kubeconfigPath string) (interface{}, error)

GetRulesFromThanosRuler returns the rule data from the Thanos Ruler API given a kubeconfig

func GetSchedulableNodeCount added in v1.5.0

func GetSchedulableNodeCount() (uint32, error)

GetSchedulableNodeCount returns the number of schedulabe nodes in the cluster

func GetScrapePools added in v1.6.0

func GetScrapePools(namespace, appName string, componentNames []string, isMinVersion140 bool) []string

func GetSecret

func GetSecret(namespace string, name string) (*corev1.Secret, error)

GetSecret returns the 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 GetService

func GetService(namespace string, serviceName string) (*corev1.Service, error)

GetService returns a Service with the given name and namespace

func GetServiceAccount added in v0.14.0

func GetServiceAccount(namespace, name string) (*corev1.ServiceAccount, error)

func GetServiceMonitor added in v1.4.0

func GetServiceMonitor(namespace, name string) (*promoperapi.ServiceMonitor, error)

GetServiceMonitor returns the ServiceMonitor identified by namespace and name

func GetStatefulSet added in v1.3.0

func GetStatefulSet(namespace string, stsName string) (*appsv1.StatefulSet, error)

GetStatefulSet returns a StatefulSet with the given name and namespace

func GetSystemGrafanaIngressURL added in v1.4.0

func GetSystemGrafanaIngressURL(kubeconfigPath string) string

GetSystemGrafanaIngressURL gets the system Grafana Ingress host in the given cluster

func GetSystemOpenSearchIngressURL added in v1.3.0

func GetSystemOpenSearchIngressURL(kubeconfigPath string) string

GetSystemOpenSearchIngressURL gets the system Opensearch Ingress host in the given cluster

func GetSystemThanosRulerURL added in v1.7.0

func GetSystemThanosRulerURL(kubeconfigPath string) string

GetSystemThanosRulerURL gets the system Thanos Ingress host in the given cluster

func GetThanosQueryIngressHost added in v1.6.0

func GetThanosQueryIngressHost(kubeconfigPath string) string

GetThanosQueryIngressHost gets the host used for ingress to Thanos Query in the given cluster

func GetTokenForServiceAccount added in v0.15.0

func GetTokenForServiceAccount(sa string, namespace string) ([]byte, error)

GetTokenForServiceAccount returns the token associated with service account

func GetURLForIngress added in v1.5.0

func GetURLForIngress(log *zap.SugaredLogger, api *APIEndpoint, namespace string, name string, scheme string) (string, error)

func GetV1Beta1ControllerRuntimeClient added in v1.7.0

func GetV1Beta1ControllerRuntimeClient(config *restclient.Config) (client.Client, error)

GetV1Beta1ControllerRuntimeClient, given a kubeconfig, returns a controller runtime client with verrazzano v1beta1 as part of its scheme.

func GetVerrazzano added in v1.3.0

func GetVerrazzano() (*v1alpha1.Verrazzano, error)

GetVerrazzano returns the installed Verrazzano

func GetVerrazzanoApplicationOperatorClientSet added in v1.4.0

func GetVerrazzanoApplicationOperatorClientSet() (*vaoClient.Clientset, error)

GetVerrazzanoApplicationOperatorClientSet returns the Kubernetes clientset for the Verrazzano Application Operator

func GetVerrazzanoClientset added in v1.3.0

func GetVerrazzanoClientset() (*vpoClient.Clientset, error)

GetVerrazzanoClientset returns the Kubernetes clientset for the Verrazzano CRD

func GetVerrazzanoHTTPClient

func GetVerrazzanoHTTPClient(kubeconfigPath string) (*retryablehttp.Client, error)

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, error)

GetVerrazzanoInstallResourceInCluster returns the installed Verrazzano CR in the given cluster (there should only be 1 per cluster)

func GetVerrazzanoInstallResourceInClusterV1beta1 added in v1.4.0

func GetVerrazzanoInstallResourceInClusterV1beta1(kubeconfigPath string) (*v1beta1.Verrazzano, error)

GetVerrazzanoInstallResourceInClusterV1beta1 returns the installed Verrazzano CR in the given cluster (there should only be 1 per cluster)

func GetVerrazzanoNoRetryHTTPClient

func GetVerrazzanoNoRetryHTTPClient(kubeconfigPath string) (*http.Client, error)

GetVerrazzanoNoRetryHTTPClient returns an Http client configured with the Verrazzano CA cert

func GetVerrazzanoPassword

func GetVerrazzanoPassword() (string, error)

GetVerrazzanoPassword returns the password credential for the Verrazzano secret

func GetVerrazzanoPasswordInCluster added in v0.14.0

func GetVerrazzanoPasswordInCluster(kubeconfigPath string) (string, error)

GetVerrazzanoPasswordInCluster returns the password credential for the Verrazzano secret in the "verrazzano-system" namespace for the given cluster

func GetVerrazzanoProjectClientsetInCluster added in v1.1.0

func GetVerrazzanoProjectClientsetInCluster(kubeconfigPath string) (*vaoClient.Clientset, error)

GetVerrazzanoProjectClientsetInCluster returns the Kubernetes clientset for the VerrazzanoProject

func GetVerrazzanoRetentionPolicy added in v1.3.0

func GetVerrazzanoRetentionPolicy(retentionPolicyName string) (v12.IndexManagementPolicy, error)

GetVerrazzanoRetentionPolicy returns the retention policy configured in the VZ CR If not explicitly configured, it returns the default retention policy with retention period of 7 days.

func GetVerrazzanoRetryableHTTPClient added in v1.3.0

func GetVerrazzanoRetryableHTTPClient() (*retryablehttp.Client, error)

GetVerrazzanoRetryableHTTPClient returns a retryable HTTP client configured with the CA cert

func GetVerrazzanoRolloverPolicy added in v1.3.0

func GetVerrazzanoRolloverPolicy(rolloverPolicyName string) (v12.RolloverPolicy, error)

GetVerrazzanoRolloverPolicy returns the rollover policy configured in the VZ CR

func GetVerrazzanoV1beta1 added in v1.4.0

func GetVerrazzanoV1beta1() (*v1beta1.Verrazzano, error)

GetVerrazzanoV1beta1 returns the installed Verrazzano using v1beta1 API client

func GetVerrazzanoVersion added in v1.1.0

func GetVerrazzanoVersion(kubeconfigPath string) (string, error)

GetVerrazzanoVersion returns the Verrazzano Version

func GetVirtualServiceList added in v1.3.0

func GetVirtualServiceList(namespace string) (*istionetv1beta1.VirtualServiceList, error)

GetVirtualServiceList returns a list of virtual services in the given namespace

func GetWildcardDNS added in v0.14.0

func GetWildcardDNS(s string) string

Returns well-known wildcard DNS name is used

func GvkToGvr added in v1.3.7

GvkToGvr converts a GroupVersionKind to corresponding GroupVersionResource

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

func HasWildcardDNS(s string) bool

Returns true if string has DNS wildcard name

func ISMPolicyExists added in v1.3.0

func ISMPolicyExists(policyName string) (bool, error)

func IndicesNotExists added in v1.3.0

func IndicesNotExists(patterns []string) bool

func Ingress

func Ingress() string

Ingress returns the ingress address

func IngressesExist added in v1.6.0

func IngressesExist(vz *v1beta1.Verrazzano, namespace string, ingressNames []string) (bool, error)

func InstallOrUpdateOpenSearchOperator added in v1.6.0

func InstallOrUpdateOpenSearchOperator(log *zap.SugaredLogger, master, data, ingest int) error

InstallOrUpdateOpenSearchOperator creates or updates the CM for the dev-controller to install or upgrade the opensearch-operator helm chart

func IsArgoCDEnabled added in v1.5.0

func IsArgoCDEnabled(kubeconfigPath string) bool

IsArgoCDEnabled returns false if the Argocd component is not set, or the value of its Enabled field otherwise

func IsCAIssuerConfig added in v1.6.0

func IsCAIssuerConfig(certConfig v1beta1.Certificate) (isCAConfig bool, err error)

func IsCertManagerEnabled added in v1.5.0

func IsCertManagerEnabled(kubeconfigPath string) bool

IsCertManagerEnabled returns true if the Cert Manager component is not set, or the value of its Enabled field otherwise

func IsClusterAPIEnabled added in v1.6.0

func IsClusterAPIEnabled(kubeconfigPath string) bool

IsClusterAPIEnabled returns true if the ClusterAPI component is not set, or the value of its Enabled field otherwise

func IsClusterAgentEnabled added in v1.6.0

func IsClusterAgentEnabled(kubeconfigPath string) bool

IsClusterAgentEnabled returns true if the Cluster Agent component is not set, or the value of its Enabled field otherwise

func IsCoherenceOperatorEnabled added in v1.1.0

func IsCoherenceOperatorEnabled(kubeconfigPath string) bool

IsCoherenceOperatorEnabled returns true if the COH operator component is not set, or the value of its Enabled field otherwise

func IsDataStreamSupported added in v1.3.0

func IsDataStreamSupported() bool

IsDataStreamSupported returns true if data stream is supported false otherwise

func IsDefaultDNS added in v1.4.0

func IsDefaultDNS(dns *vzapi.DNSComponent) bool

func IsDevProfile added in v0.13.0

func IsDevProfile() bool

IsDevProfile returns true if the deployed resource is a 'dev' profile

func IsDexEnabled added in v1.7.0

func IsDexEnabled(kubeconfigPath string) bool

IsDexEnabled returns true if the Dex component is enabled, false otherwise

func IsGrafanaEnabled added in v1.4.0

func IsGrafanaEnabled(kubeconfigPath string) bool

IsGrafanaEnabled returns false if the Grafana component is not set, or the value of its Enabled field otherwise

func IsIngressEnabled added in v1.6.0

func IsIngressEnabled(kubeconfigPath string) bool

IsIngressEnabled returns false if the IngressNGINX component is not set and the IngressNGINX is enabled, or the value of its Enabled field otherwise

func IsIstioEnabled added in v1.6.0

func IsIstioEnabled(kubeconfigPath string) bool

IsIstioEnabled returns true if the Istio component is not set, or the value of its Enabled field otherwise

func IsJaegerInstanceCreated added in v1.4.0

func IsJaegerInstanceCreated(kubeconfigPath string) (bool, error)

IsJaegerInstanceCreated checks whether the default Jaeger CR is created

func IsJaegerOperatorEnabled added in v1.3.0

func IsJaegerOperatorEnabled(kubeconfigPath string) bool

IsJaegerOperatorEnabled returns false if the Jaeger Operator component is not set, or the value of its Enabled field otherwise

func IsKeycloakEnabled added in v1.4.0

func IsKeycloakEnabled(kubeconfigPath string) bool

IsKeycloakEnabled returns false if the Keycloak component is not set, or the value of its Enabled field otherwise

func IsKubeStateMetricsEnabled added in v1.3.0

func IsKubeStateMetricsEnabled(kubeconfigPath string) bool

IsKubeStateMetricsEnabled returns false if the Kube State Metrics component is not set, or the value of its Enabled field otherwise

func IsManagedClusterProfile added in v0.13.0

func IsManagedClusterProfile() bool

IsManagedClusterProfile returns true if the deployed resource is a 'managed-cluster' profile

func IsMinVersion added in v1.4.0

func IsMinVersion(vzVersion, minVersion string) (bool, error)

IsMinVersion returns true if the given version >= minVersion

func IsMySQLOperatorEnabled added in v1.5.0

func IsMySQLOperatorEnabled(kubeconfigPath string) bool

IsMySQLOperatorEnabled returns false if the MySQLOperator component is not set, or the value of its Enabled field otherwise

func IsOCIDNSEnabled added in v1.6.0

func IsOCIDNSEnabled(kubeconfigPath string) bool

IsOCIDNSEnabled returns true if OCI DNS is enabled in the configuration

func IsOCIDNSWebhookEnabled added in v1.6.0

func IsOCIDNSWebhookEnabled(kubeconfigPath string) bool

IsOCIDNSWebhookEnabled returns true if the Cert Manager component is not set, or the value of its Enabled field otherwise

func IsOpenSearchDashboardsEnabled added in v1.3.0

func IsOpenSearchDashboardsEnabled(kubeconfigPath string) bool

IsOpenSearchDashboardsEnabled returns true if the OpenSearchDashboards component is not set, or the value of its Enabled field otherwise

func IsOpenSearchEnabled added in v1.3.0

func IsOpenSearchEnabled(kubeconfigPath string) (bool, error)

IsOpenSearchEnabled returns true if the OpenSearch component is not set, or the value of its Enabled field otherwise

func IsOpensearchEnabled added in v1.3.0

func IsOpensearchEnabled(kubeconfigPath string) bool

func IsProdProfile added in v0.13.0

func IsProdProfile() bool

IsProdProfile returns true if the deployed resource is a 'prod' profile

func IsPrometheusAdapterEnabled added in v1.3.0

func IsPrometheusAdapterEnabled(kubeconfigPath string) bool

IsPrometheusAdapterEnabled returns false if the Prometheus Adapter component is not set, or the value of its Enabled field otherwise

func IsPrometheusEnabled added in v1.4.0

func IsPrometheusEnabled(kubeconfigPath string) bool

IsPrometheusEnabled returns true if the Prometheus component is not set and the Prometheus Operator is enabled, or the value of its Enabled field otherwise

func IsPrometheusNodeExporterEnabled added in v1.3.0

func IsPrometheusNodeExporterEnabled(kubeconfigPath string) bool

IsPrometheusNodeExporterEnabled returns false if the Prometheus Node Exporter component is not set, or the value of its Enabled field otherwise

func IsPrometheusOperatorEnabled added in v1.3.0

func IsPrometheusOperatorEnabled(kubeconfigPath string) bool

IsPrometheusOperatorEnabled returns false if the Prometheus Operator component is not set, or the value of its Enabled field otherwise

func IsPrometheusPushgatewayEnabled added in v1.3.0

func IsPrometheusPushgatewayEnabled(kubeconfigPath string) bool

IsPrometheusPushgatewayEnabled returns false if the Prometheus Pushgateway component is not set, or the value of its Enabled field otherwise

func IsRancherBackupEnabled added in v1.4.0

func IsRancherBackupEnabled(kubeconfigPath string) bool

IsRancherBackupEnabled returns false if the Rancher Backup component is not set, or the value of its Enabled field otherwise

func IsRancherEnabled added in v1.6.0

func IsRancherEnabled(kubeconfigPath string) bool

IsRancherEnabled returns false if the Rancher component is not set, or the value of its Enabled field otherwise

func IsVeleroEnabled added in v1.4.0

func IsVeleroEnabled(kubeconfigPath string) bool

IsVeleroEnabled returns false if the Velero component is not set, or the value of its Enabled field otherwise

func IsVerrazzanoManaged added in v1.5.0

func IsVerrazzanoManaged(labels map[string]string) bool

func IsVerrazzanoMinVersion added in v1.1.0

func IsVerrazzanoMinVersion(minVersion string, kubeconfigPath string) (bool, error)

IsVerrazzanoMinVersion returns true if the installed Verrazzano version >= minVersion

func IsWebLogicOperatorEnabled added in v1.1.0

func IsWebLogicOperatorEnabled(kubeconfigPath string) bool

IsWebLogicOperatorEnabled returns true if the WKO operator component is not set, or the value of its Enabled field otherwise

func JTq

func JTq(jtext string, path ...string) interface{}

JTq queries JSON text with a JSON path

func JaegerSpanRecordFoundInOpenSearch added in v1.4.0

func JaegerSpanRecordFoundInOpenSearch(kubeconfigPath string, after time.Time, serviceName string) bool

JaegerSpanRecordFoundInOpenSearch checks if jaeger span records are found in OpenSearch storage

func Jq

func Jq(node interface{}, path ...string) interface{}

Jq queries JSON nodes with a JSON path

func ListApplicationIndices added in v1.3.0

func ListApplicationIndices() []string

func ListCRDs added in v1.4.0

ListCRDs returns the list of CRDs in a cluster

func ListClusterRoleBindings added in v0.14.0

func ListClusterRoleBindings() (*rbacv1.ClusterRoleBindingList, error)

ListClusterRoleBindings returns the list of cluster role bindings for the cluster

func ListCronJobNamesMatchingLabels added in v1.4.0

func ListCronJobNamesMatchingLabels(kubeconfigPath, namespace string, matchLabels map[string]string) ([]string, error)

ListCronJobNamesMatchingLabels returns the list of cronjobs in a given namespace matching the given labels 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 ListDeploymentsMatchingLabelsInCluster added in v1.4.0

func ListDeploymentsMatchingLabelsInCluster(kubeconfigPath, namespace string, matchLabels map[string]string) (*appsv1.DeploymentList, error)

ListDeploymentsMatchingLabelsInCluster returns the list of deployments in a given namespace matching the given labels for the cluster

func ListIndexPatterns added in v1.3.0

func ListIndexPatterns(kubeconfigPath string) []string

ListIndexPatterns gets the configured index patterns in OpenSearch Dashboards

func ListIngresses

func ListIngresses(namespace string) (*networkingv1.IngressList, error)

ListIngresses lists ingresses in namespace

func ListJaegerTracesWithTags added in v1.4.0

func ListJaegerTracesWithTags(kubeconfigPath string, start time.Time, serviceName string, tags map[string]string) []string

ListJaegerTracesWithTags lists all trace ids for a given service with the given tags

func ListNamespaces

func ListNamespaces(opts metav1.ListOptions) (*corev1.NamespaceList, error)

ListNamespaces returns a namespace list for the given list options

func ListNodes

func ListNodes() (*corev1.NodeList, error)

ListNodes returns the list of nodes for the cluster

func ListPods

func ListPods(namespace string, opts metav1.ListOptions) (*corev1.PodList, error)

ListPods returns a pod list for the given namespace and list options

func ListPodsInCluster added in v0.14.0

func ListPodsInCluster(namespace string, clientset *kubernetes.Clientset) (*corev1.PodList, error)

ListPodsInCluster returns the list of pods in a given namespace for the cluster

func ListPodsWithLabelsInCluster added in v1.4.0

func ListPodsWithLabelsInCluster(namespace, labels string, clientset *kubernetes.Clientset) (*corev1.PodList, error)

ListPodsWithLabelsInCluster returns the list of pods in a given namespace that matches a specific label 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 ListServicesInJaeger added in v1.4.0

func ListServicesInJaeger(kubeconfigPath string) []string

ListServicesInJaeger lists the services whose traces are available in Jaeger

func ListStatefulSets added in v1.4.0

func ListStatefulSets(namespace string) (*appsv1.StatefulSetList, error)

ListStatefulSets returns the list of StatefulSets in a given namespace for the cluster

func ListSystemIndices added in v1.3.0

func ListSystemIndices() []string

func Log

func Log(level LogLevel, message string)

Log prints out a log message in a standard format and filters out messages based on the global log level

func LogIndexFound

func LogIndexFound(indexName string) bool

LogIndexFound confirms a named index can be found in Opensearch in the cluster specified in the environment

func LogIndexFoundInCluster added in v0.14.0

func LogIndexFoundInCluster(indexName, kubeconfigPath string) bool

LogIndexFoundInCluster confirms a named index can be found in Opensearch on the given cluster

func LogIndexPatternFound added in v1.3.0

func LogIndexPatternFound(indexName string) bool

LogIndexPatternFound confirms a named index pattern can be found in OpenSearch Dashboards in the cluster specified in the environment

func LogIndexPatternFoundInCluster added in v1.3.0

func LogIndexPatternFoundInCluster(indexName, kubeconfigPath string) bool

LogIndexFoundInCluster confirms a named index pattern can be found in OpenSearch Dashboards on the given cluster

func LogRecordFound

func LogRecordFound(indexName string, after time.Time, fields map[string]string) bool

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 MinVersionSpec added in v1.1.0

func MinVersionSpec(description string, minVersion string, specFunc interface{})

MinVersionSpec Executes the specified test spec/func when the Verrazzano version meets the minimum specified version

func NoLog added in v0.15.0

func NoLog(index string, match []Match, mustNot []Match) bool

NoLog returns true if no matched log record can be found in the index.

func NodeIsSchedulable added in v1.5.0

func NodeIsSchedulable(node corev1.Node) bool

NodeIsSchedulable returns false if a node has the control-plane/master taint and is unschedulable, true otherwise

func PodsNotRunning

func PodsNotRunning(namespace string, namePrefixes []string) (bool, error)

PodsNotRunning returns true if all pods in namePrefixes are not running

func PodsRunning

func PodsRunning(namespace string, namePrefixes []string) (bool, error)

PodsRunning is identical to PodsRunningInCluster, except that it uses the cluster specified in the environment

func PodsRunningInCluster added in v0.14.0

func PodsRunningInCluster(namespace string, namePrefixes []string, kubeconfigPath string) (bool, error)

PodsRunningInCluster checks if all the pods identified by namePrefixes are ready and running in the given cluster

func PodsRunningInClusterWithClient added in v1.6.1

func PodsRunningInClusterWithClient(namespace string, namePrefixes []string, client *kubernetes.Clientset) (bool, error)

PodsRunningInClusterWithClient 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 RemoveNamespaceFinalizers added in v1.1.1

func RemoveNamespaceFinalizers(namespace *corev1.Namespace) error

func RetrieveArgoCDPassword added in v1.6.4

func RetrieveArgoCDPassword(namespace, name string) (string, error)

This function retrieves the ArgoCD password to log into rancher, based on the provided name and namespace of a secret that holds this information

func ScrapeTargets added in v1.3.0

func ScrapeTargets() ([]interface{}, error)

ScrapeTargets queries Prometheus API /api/v1/targets to list scrape targets

func ScrapeTargetsFromExec added in v1.6.0

func ScrapeTargetsFromExec() ([]interface{}, error)

func ScrapeTargetsHealthy added in v1.5.0

func ScrapeTargetsHealthy(scrapePools []string) (bool, error)

ScrapeTargetsHealthy validates the health of the scrape targets for the given scrapePools

func ScrapeTargetsHealthyFromExec added in v1.6.0

func ScrapeTargetsHealthyFromExec(scrapePools []string) (bool, error)

ScrapeTargetsHealthyFromExec validates the health of the scrape targets for the given scrapePools by execing into the prometheus pod

func SearchLog added in v0.14.0

func SearchLog(index string, query OpensearchQuery) map[string]interface{}

SearchLog search recent log records for the index with matching filters.

func SecretsCreated

func SecretsCreated(namespace string, names ...string) bool

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 SlicesContainSameStrings

func SlicesContainSameStrings(strings1, strings2 []string) bool

SlicesContainSameStrings compares two slices and returns true if they contain the same strings in any order

func SlicesContainSubsetSubstring added in v1.3.0

func SlicesContainSubsetSubstring(strings1, strings2 []string) bool

SlicesContainSubsetSubstring returns true if the strings in the first slice are substrings of any string in the second slice

func SpecificPodsPodsNotRunningInClusterWithClient added in v1.6.1

func SpecificPodsPodsNotRunningInClusterWithClient(namespace string, clientset *kubernetes.Clientset, namePrefixes []string) (bool, error)

SpecificPodsPodsNotRunningInClusterWithClient returns true if all pods in namePrefixes are not running

func SpecificPodsRunning added in v1.4.0

func SpecificPodsRunning(namespace, labels string) (bool, error)

SpecificPodsRunning is identical to SpecificPodsRunningCluster, except that it uses the cluster specified in the environment

func SpecificPodsRunningInCluster added in v1.4.0

func SpecificPodsRunningInCluster(namespace, labels string, kubeconfigPath string) (bool, error)

SpecificPodsRunningInCluster checks if all the pods identified by labels and are ready and running in the given cluster

func SpecificPodsRunningInClusterWithClient added in v1.6.1

func SpecificPodsRunningInClusterWithClient(namespace, labels string, client *kubernetes.Clientset) (bool, error)

SpecificPodsRunningInClusterWithClient checks if all the pods identified by labels and are ready and running in the given cluster

func TestGrafanaTestDashboard added in v1.5.0

func TestGrafanaTestDashboard(testDashboard DashboardMetadata, pollingInterval time.Duration, timeout time.Duration)

func TestOpenSearchGrafanaDashBoard added in v1.5.0

func TestOpenSearchGrafanaDashBoard(pollingInterval time.Duration, timeout time.Duration)

func TestOpenSearchPlugins added in v1.5.0

func TestOpenSearchPlugins(pollingInterval time.Duration, waitTimeout time.Duration)

func TestSearchGrafanaDashboard added in v1.5.0

func TestSearchGrafanaDashboard(pollingInterval time.Duration, timeout time.Duration)

func TestSystemHealthGrafanaDashboard added in v1.5.0

func TestSystemHealthGrafanaDashboard(pollingInterval time.Duration, timeout time.Duration)

func UndeployHelloHelidonApplication added in v1.2.0

func UndeployHelloHelidonApplication(namespace string, customComponent string, customAppConfig string)

UndeployHelloHelidonApplication undeploys the Hello Helidon example application.

func UndeploySpringBootApplication added in v1.2.0

func UndeploySpringBootApplication(namespace string)

UndeploySpringBootApplication undeploys the Springboot example application.

func UninstallOpenSearchOperator added in v1.6.0

func UninstallOpenSearchOperator() error

UninstallOpenSearchOperator delete the CM so that the dev-controller can uninstall opensearch-operator helm

func UpdateConfigMap added in v1.3.0

func UpdateConfigMap(configMap *corev1.ConfigMap) error

UpdateConfigMap updates the config map

func UpdateSecret added in v1.3.1

func UpdateSecret(secret *corev1.Secret) error

UpdateSecret updates the given secret

func UseExternalOpensearch added in v1.5.0

func UseExternalOpensearch() bool

func ValidateApplicationTracesInCluster added in v1.4.0

func ValidateApplicationTracesInCluster(kubeconfigPath string, start time.Time, appServiceName, clusterName string) func() (bool, error)

ValidateApplicationTracesInCluster returns a function that validates if application traces can be successfully queried from Jaeger

func ValidateApplicationTracesInOS added in v1.4.0

func ValidateApplicationTracesInOS(start time.Time, appServiceName string) func() bool

ValidateApplicationTracesInOS returns a function that validates if application traces are stored successfully in OS backend storage

func ValidateDeploymentContainerImage added in v1.6.7

func ValidateDeploymentContainerImage(namespace, deploymentName, containerName, version string) (bool, error)

func ValidateEsIndexCleanerCronJobFunc added in v1.4.0

func ValidateEsIndexCleanerCronJobFunc() func() (bool, error)

ValidateEsIndexCleanerCronJobFunc returns a function that validates if cron job for periodically cleaning the OS indices are created.

func ValidateJaegerAgentMetricFunc added in v1.4.0

func ValidateJaegerAgentMetricFunc(metricsTest MetricsTest) func() bool

ValidateJaegerAgentMetricFunc returns a function that validates if metrics of Jaeger agent is scraped by prometheus.

func ValidateJaegerCollectorMetricFunc added in v1.4.0

func ValidateJaegerCollectorMetricFunc(metricsTest MetricsTest) func() bool

ValidateJaegerCollectorMetricFunc returns a function that validates if metrics of Jaeger collector is scraped by prometheus.

func ValidateJaegerOperatorMetricFunc added in v1.4.0

func ValidateJaegerOperatorMetricFunc(metricsTest MetricsTest) func() bool

ValidateJaegerOperatorMetricFunc returns a function that validates if metrics of Jaeger operator is scraped by prometheus.

func ValidateJaegerQueryMetricFunc added in v1.4.0

func ValidateJaegerQueryMetricFunc(metricsTest MetricsTest) func() bool

ValidateJaegerQueryMetricFunc returns a function that validates if metrics of Jaeger query is scraped by prometheus.

func ValidateOpensearchHits added in v1.5.0

func ValidateOpensearchHits(searchResults map[string]interface{}, hitValidator OpensearchHitValidator, exceptions []*regexp.Regexp) bool

ValidateOpensearchHits invokes the HitValidator on every hit in the searchResults. The first invalid hit found will return in false being returned. Otherwise true will be returned.

func ValidateSystemTracesFuncInCluster added in v1.4.0

func ValidateSystemTracesFuncInCluster(kubeconfigPath string, start time.Time, clusterName string) func() (bool, error)

ValidateSystemTracesFuncInCluster returns a function that validates if system traces for the given cluster can be successfully queried from Jaeger

func ValidateSystemTracesInOSFunc added in v1.4.0

func ValidateSystemTracesInOSFunc(start time.Time) func() bool

ValidateSystemTracesInOSFunc returns a function that validates if system traces are stored successfully in OS backend storage

func VerifyArgoCDAccess added in v1.5.0

func VerifyArgoCDAccess(log *zap.SugaredLogger) error

VerifyArgoCDAccess verifies that Argocd is accessible.

func VerifyArgoCDApplicationAccess added in v1.5.0

func VerifyArgoCDApplicationAccess(log *zap.SugaredLogger) error

func VerifyGrafanaComponent added in v1.4.0

func VerifyGrafanaComponent(log *zap.SugaredLogger, api *APIEndpoint, sysVmiHTTPClient *retryablehttp.Client, vmiCredentials *UsernamePassword) bool

func VerifyKeycloakAccess added in v1.4.0

func VerifyKeycloakAccess(log *zap.SugaredLogger) error

VerifyKeycloakAccess verifies access to Keycloak

func VerifyOpenSearchComponent added in v1.4.0

func VerifyOpenSearchComponent(log *zap.SugaredLogger, api *APIEndpoint, sysVmiHTTPClient *retryablehttp.Client, vmiCredentials *UsernamePassword) bool

func VerifyOpenSearchDashboardsComponent added in v1.4.0

func VerifyOpenSearchDashboardsComponent(log *zap.SugaredLogger, api *APIEndpoint, sysVmiHTTPClient *retryablehttp.Client, vmiCredentials *UsernamePassword) bool

func VerifyOpenSearchPlugins added in v1.5.0

func VerifyOpenSearchPlugins() error

VerifyOpenSearchPlugins checks that the OpenSearch plugins are installed

func VerifyPrometheusComponent added in v1.4.0

func VerifyPrometheusComponent(log *zap.SugaredLogger, api *APIEndpoint, sysVmiHTTPClient *retryablehttp.Client, vmiCredentials *UsernamePassword) bool

func VerifyRancherAccess added in v1.4.0

func VerifyRancherAccess(log *zap.SugaredLogger) error

VerifyRancherAccess verifies that Rancher is accessible.

func VerifyRancherKeycloakAuthConfig added in v1.4.0

func VerifyRancherKeycloakAuthConfig(log *zap.SugaredLogger) error

VerifyRancherKeycloakAuthConfig verifies that Rancher/Keycloak AuthConfig is correctly populated

func VerifySystemVMIComponent added in v1.4.0

func VerifySystemVMIComponent(log *zap.SugaredLogger, api *APIEndpoint, sysVmiHTTPClient *retryablehttp.Client, vmiCredentials *UsernamePassword, ingressName, expectedURLPrefix string) bool

func VzReadyV1beta1 added in v1.6.3

func VzReadyV1beta1() (bool, error)

func WaitForISMPolicyUpdate added in v1.3.0

func WaitForISMPolicyUpdate(pollingInterval time.Duration, timeout time.Duration)

WaitForISMPolicyUpdate waits for the VMO reconcile to complete and the ISM policies are created

func WaitForVZCondition added in v1.3.0

func WaitForVZCondition(conditionType v1beta1.ConditionType, pollingInterval, timeout time.Duration)

WaitForVZCondition waits till the VZ CR reaches the given condition

Types

type APIEndpoint

type APIEndpoint struct {
	AccessToken string `json:"access_token"`
	APIURL      string
	HTTPClient  *retryablehttp.Client
}

APIEndpoint contains information needed to access an API

func EventuallyGetAPIEndpoint added in v1.4.0

func EventuallyGetAPIEndpoint(kubeconfigPath string) *APIEndpoint

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) GetIngress

func (api *APIEndpoint) GetIngress(namespace, name string) (*networkingv1.Ingress, error)

GetIngress fetches ingress from api

func (*APIEndpoint) GetOpensearchURL added in v1.5.0

func (api *APIEndpoint) GetOpensearchURL() (string, error)

GetOpensearchURL fetches OpenSearch endpoint URL

func (*APIEndpoint) GetVerrazzanoIngressURL added in v1.3.0

func (api *APIEndpoint) GetVerrazzanoIngressURL() (string, error)

GetVerrazzanoIngressURL fetches Verrazzano-Ingress endpoint URL

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 Action added in v1.3.0

type Action struct {
	Rollover struct {
		MinIndexAge string `json:"min_index_age"`
	} `json:"rollover,omitempty"`
	Delete struct {
		MinIndexAge string `json:"min_index_age"`
	} `json:"delete,omitempty"`
}

Rollover or Delete action defined in ISM policy

type ConditionalCheckFunc added in v1.1.0

type ConditionalCheckFunc func() (bool, error)

ConditionalCheckFunc Test function for conditional specs

type DashboardMetadata added in v1.5.0

type DashboardMetadata struct {
	ID      int    `json:"id"`
	Slug    string `json:"slug"`
	Status  string `json:"status"`
	UID     string `json:"uid"`
	URL     string `json:"url"`
	Version int    `json:"version"`
}

type DataStream added in v1.3.0

type DataStream struct {
	Name           string `json:"name"`
	TimestampField struct {
		Name string `json:"name"`
	} `json:"timestamp_field"`
	Indices []struct {
		IndexName string `json:"index_name"`
		IndexUUID string `json:"index_uuid"`
	} `json:"indices"`
	Generation int    `json:"generation"`
	Status     string `json:"status"`
	Template   string `json:"template"`
}

DataStream details

func GetDataStream added in v1.3.0

func GetDataStream(dataStreamName string) (DataStream, error)

GetDataStream return the data stream object with the given

type HTTPResponse

type HTTPResponse struct {
	StatusCode int
	Header     http.Header
	Body       []byte
}

HTTPResponse represents an HTTP response including the read body

func CreateGrafanaDashboard added in v1.4.0

func CreateGrafanaDashboard(body string) (*HTTPResponse, error)

CreateGrafanaDashboard creates a grafana dashboard using the JSON string provided

func Delete

func Delete(url string, hostHeader string) (*HTTPResponse, error)

Delete executes an HTTP DELETE

func GetGrafanaDashboard added in v1.4.0

func GetGrafanaDashboard(uid string) (*HTTPResponse, error)

GetGrafanaDashboard returns the dashboard metadata for the given uid.

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 GetWebPageInCluster added in v1.1.0

func GetWebPageInCluster(url string, hostHeader string, kubeconfigPath string) (*HTTPResponse, error)

GetWebPageInCluster 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 PostOpensearch added in v1.5.0

func PostOpensearch(path string, body string) (*HTTPResponse, error)

PostOpensearch POST the request entity body to Opensearch API path The provided path is appended to the Opensearch base URL

func PostOpensearchDashboards added in v1.3.0

func PostOpensearchDashboards(path string, body string, additionalHeaders ...string) (*HTTPResponse, error)

PostOpensearchDashboards POST the request entity body to Opensearch API path The provided path is appended to the OpenSearchDashboards base URL

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 PutISMPolicy added in v1.5.3

func PutISMPolicy(policyData, policyName string) (*HTTPResponse, error)

func PutWithHostHeader

func PutWithHostHeader(url, contentType string, hostHeader string, body io.Reader) (*HTTPResponse, error)

PutWithHostHeader PUTs a request with a specified Host header

func PutWithHostHeaderInCluster added in v1.1.0

func PutWithHostHeaderInCluster(url, contentType string, hostHeader string, body io.Reader, kubeconfigPath string) (*HTTPResponse, error)

PutWithHostHeaderInCluster PUTs a request with a specified Host header

func SearchGrafanaDashboard added in v1.4.0

func SearchGrafanaDashboard(searchParams map[string]string) (*HTTPResponse, error)

SearchGrafanaDashboard returns the dashboard metadata for the given uid.

type ISMPolicy added in v1.3.0

type ISMPolicy struct {
	PolicyID        string      `json:"policy_id"`
	Description     string      `json:"description"`
	LastUpdatedTime int64       `json:"last_updated_time"`
	SchemaVersion   int         `json:"schema_version"`
	DefaultState    string      `json:"default_state"`
	States          []State     `json:"states"`
	IsmTemplate     IsmTemplate `json:"ism_template"`
}

ISMPolicy definition

func GetISMPolicy added in v1.3.0

func GetISMPolicy(policyName string) (ISMPolicy, error)

type IndexListData added in v1.3.0

type IndexListData struct {
	Health       string `json:"health"`
	Status       string `json:"status"`
	Index        string `json:"index"`
	UUID         string `json:"uuid"`
	Pri          string `json:"pri"`
	Rep          string `json:"rep"`
	DocsCount    string `json:"docsCount"`
	DocsDeleted  string `json:"docsDeleted"`
	StoreSize    string `json:"storeSize"`
	PriStoreSize string `json:"priStoreSize"`
}

IndexListData represents the row of /_cat/indices?format=json output

type IndexMetadata added in v1.3.0

type IndexMetadata struct {
	Mapping struct {
		TotalFields struct {
			Limit string `json:"limit"`
		} `json:"total_fields"`
	} `json:"mapping"`
	RefreshInterval    string `json:"refresh_interval"`
	Hidden             string `json:"hidden"`
	NumberOfShards     string `json:"number_of_shards"`
	AutoExpandReplicas string `json:"auto_expand_replicas"`
	ProvidedName       string `json:"provided_name"`
	CreationDate       string `json:"creation_date"`
	NumberOfReplicas   string `json:"number_of_replicas"`
	UUID               string `json:"uuid"`
	Version            struct {
		Created string `json:"created"`
	} `json:"version"`
}

IndexMetadata contains information about a particular

func GetApplicationIndices added in v1.3.0

func GetApplicationIndices() ([]IndexMetadata, error)

GetApplicationIndices returns the metadata of indices used by application indices

func GetBackingIndicesForDataStream added in v1.3.0

func GetBackingIndicesForDataStream(dataStreamName string) ([]IndexMetadata, error)

GetBackingIndicesForDataStream returns metadata of all backing indices for a given data stream

func GetIndexMetadata added in v1.3.0

func GetIndexMetadata(indexName string) (IndexMetadata, error)

GetIndexMetadata returns the metadata of the index

func GetIndexMetadataForDataStream added in v1.3.0

func GetIndexMetadataForDataStream(dataStreamName string) ([]IndexMetadata, error)

GetIndexMetadataForDataStream returns the metadata of all backing indices of a given datastream

func GetIndexMetadataList added in v1.3.0

func GetIndexMetadataList(indexNames []string) ([]IndexMetadata, error)

func GetSystemIndices added in v1.3.0

func GetSystemIndices() ([]IndexMetadata, error)

GetSystemIndices returns metadata of indices of all system indices

type IndexPattern added in v1.3.0

type IndexPattern struct {
	Name string
}

type IndexSettings added in v1.3.0

type IndexSettings struct {
	Settings struct {
		Index IndexMetadata `json:"index"`
	} `json:"settings"`
}

IndexSettings parent object containing the index metadata

type InlinePolicy added in v1.5.3

type InlinePolicy struct {
	ID             *string   `json:"_id,omitempty"`
	PrimaryTerm    *int      `json:"_primary_term,omitempty"`
	SequenceNumber *int      `json:"_seq_no,omitempty"`
	Status         *int      `json:"status,omitempty"`
	Policy         ISMPolicy `json:"policy"`
}

type IsmTemplate added in v1.3.0

type IsmTemplate []struct {
	IndexPatterns   []string `json:"index_patterns"`
	Priority        int      `json:"priority"`
	LastUpdatedTime int64    `json:"last_updated_time"`
}

IsmTemplate defined in ISM policy

type JaegerTraceData added in v1.4.0

type JaegerTraceData struct {
	TraceID string `json:"traceID"`
	Spans   []struct {
		TraceID       string `json:"traceID"`
		SpanID        string `json:"spanID"`
		Flags         int    `json:"flags"`
		OperationName string `json:"operationName"`
		References    []struct {
			RefType string `json:"refType"`
			TraceID string `json:"traceID"`
			SpanID  string `json:"spanID"`
		} `json:"references"`
		StartTime int64 `json:"startTime"`
		Duration  int   `json:"duration"`
		Tags      []struct {
			Key   string      `json:"key"`
			Type  string      `json:"type"`
			Value interface{} `json:"value"`
		} `json:"tags"`
		Logs []struct {
			Timestamp int64 `json:"timestamp"`
			Fields    []struct {
				Key   string `json:"key"`
				Type  string `json:"type"`
				Value string `json:"value"`
			} `json:"fields"`
		} `json:"logs"`
		ProcessID string      `json:"processID"`
		Warnings  interface{} `json:"warnings"`
	} `json:"spans"`
	Processes struct {
		P1 struct {
			ServiceName string `json:"serviceName"`
			Tags        []struct {
				Key   string `json:"key"`
				Type  string `json:"type"`
				Value string `json:"value"`
			} `json:"tags"`
		} `json:"p1"`
	} `json:"processes"`
	Warnings interface{} `json:"warnings"`
}

type JaegerTraceDataWrapper added in v1.4.0

type JaegerTraceDataWrapper struct {
	Data   []JaegerTraceData `json:"data"`
	Total  int               `json:"total"`
	Limit  int               `json:"limit"`
	Offset int               `json:"offset"`
	Errors interface{}       `json:"errors"`
}

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) GetToken added in v1.3.1

func (c *KeycloakRESTClient) GetToken(realm string, username string, password string, clientid string, log *zap.SugaredLogger) (string, error)

GetRealm gets a bearer token from a realm.

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": "..." }

func (*KeycloakRESTClient) VerifyUserExists added in v1.4.0

func (c *KeycloakRESTClient) VerifyUserExists(userRealm string, userID string) (bool, error)

VerifyUserExists verifies the user exists in Keycloak GET /auth/admin/realms/<realm>/users/<userID>

type ListOfTokenOutputFromRancher added in v1.6.4

type ListOfTokenOutputFromRancher struct {
	Data []struct {
		ClusterID string `json:"clusterId"`
		Name      string `json:"name"`
	} `json:"data"`
}

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 Match added in v0.14.0

type Match struct {
	Key   string
	Value string
}

Match describes a match_phrase in Opensearch Query

type MetricSource added in v1.6.0

type MetricSource interface {
	GetHost() string
	GetTargets() ([]interface{}, error)
	// contains filtered or unexported methods
}

MetricSource implements an interface to interact with metrics sources

type MetricsTest added in v1.6.0

type MetricsTest struct {
	Source        MetricSource
	DefaultLabels map[string]string
}

func NewMetricsTest added in v1.6.0

func NewMetricsTest(kubeconfigPath string, defaultLabels map[string]string, extraKubeconfigs ...string) (MetricsTest, error)

NewMetricsTest returns a metric test object with which to query metrics Parameters: kubeconfigs a list of kubeconfigs from all clusters kubeconfigPath this is the kubeconfigPath for the cluster we want to search metrics from defaultLabels the default labels will be added to the test metric when the query begins

func (MetricsTest) MetricsExist added in v1.6.0

func (m MetricsTest) MetricsExist(metricName string, labels map[string]string) bool

func (MetricsTest) QueryMetric added in v1.6.0

func (m MetricsTest) QueryMetric(metricName string, labels map[string]string) (string, error)

type NameGenerator added in v1.7.0

type NameGenerator struct {
	// contains filtered or unexported fields
}

func (NameGenerator) New added in v1.7.0

func (n NameGenerator) New(prefix string) string

type OSOperatorOverrides added in v1.6.0

type OSOperatorOverrides struct {
	EnvironmentName string
	DNSSuffix       string
	MasterReplicas  int
	DataReplicas    int
	IngestReplicas  int
}

OSOperatorOverrides are overrides to the opensearch-operator helm

type OpenSearchISMPolicyAddModifier added in v1.5.0

type OpenSearchISMPolicyAddModifier struct{}

func (OpenSearchISMPolicyAddModifier) ModifyCR added in v1.5.0

type OpenSearchISMPolicyRemoveModifier added in v1.5.0

type OpenSearchISMPolicyRemoveModifier struct{}

func (OpenSearchISMPolicyRemoveModifier) ModifyCR added in v1.5.0

type OpensearchHit added in v1.5.0

type OpensearchHit map[string]interface{}

OpensearchHit is the type used for a Opensearch hit returned in a search query result

type OpensearchHitValidator added in v1.5.0

type OpensearchHitValidator func(hit OpensearchHit) bool

OpensearchHitValidator is a function that validates a hit returned in a search query result

type OpensearchQuery added in v1.5.0

type OpensearchQuery struct {
	Filters []Match
	MustNot []Match
}

OpensearchQuery describes an Opensearch Query

type Payload added in v1.6.4

type Payload struct {
	ClusterID string `json:"clusterID"`
	TTL       int    `json:"ttl"`
}

type PolicyList added in v1.5.3

type PolicyList struct {
	Policies      []InlinePolicy `json:"policies"`
	TotalPolicies int            `json:"total_policies"`
}

type PrometheusSource added in v1.6.0

type PrometheusSource struct {
	// contains filtered or unexported fields
}

PrometheusSource provides a struct to interact with Prometheus metric source

func NewPrometheusSource added in v1.6.0

func NewPrometheusSource(kubeconfigPath string) (PrometheusSource, error)

func (PrometheusSource) GetHost added in v1.6.0

func (p PrometheusSource) GetHost() string

GetHost returns the host for the Prometheus ingress

func (PrometheusSource) GetTargets added in v1.6.0

func (p PrometheusSource) GetTargets() ([]interface{}, error)

GetTargets returns the Prometheus targets

type SearchResult added in v1.3.0

type SearchResult struct {
	Took     int  `json:"took"`
	TimedOut bool `json:"timed_out"`
	Shards   struct {
		Total      int `json:"total"`
		Successful int `json:"successful"`
		Skipped    int `json:"skipped"`
		Failed     int `json:"failed"`
	} `json:"_shards"`
	Hits struct {
		Total struct {
			Value    int    `json:"value"`
			Relation string `json:"relation"`
		} `json:"total"`
		MaxScore interface{}   `json:"max_score"`
		Hits     []interface{} `json:"hits"`
	} `json:"hits"`
}

SearchResult represents the result of an Opensearch search query

type State added in v1.3.0

type State struct {
	Name        string       `json:"name"`
	Actions     []Action     `json:"actions"`
	Transitions []Transition `json:"transitions"`
}

State defined in ISM policy

type ThanosSource added in v1.6.0

type ThanosSource struct {
	// contains filtered or unexported fields
}

ThanosSource provides a struct to interact with the Thanos metric source

func NewThanosSource added in v1.6.0

func NewThanosSource(kubeconfigPath string) (ThanosSource, error)

func (ThanosSource) GetHost added in v1.6.0

func (t ThanosSource) GetHost() string

GetHost returns the host for the Thanos ingress

func (ThanosSource) GetTargets added in v1.6.0

func (t ThanosSource) GetTargets() ([]interface{}, error)

GetTargets returns the Thanos store targets

type TokenPostResponse added in v1.6.4

type TokenPostResponse struct {
	Token   string `json:"token"`
	Created string `json:"created"`
}

type Transition added in v1.3.0

type Transition struct {
	StateName  string            `json:"state_name"`
	Conditions map[string]string `json:"conditions"`
}

Transition defined in ISM policy

type UsernamePassword

type UsernamePassword struct {
	Username string
	Password string
}

UsernamePassword - Username and Password credentials

func EventuallyGetSystemVMICredentials added in v1.4.0

func EventuallyGetSystemVMICredentials() *UsernamePassword

func GetSystemVMICredentials

func GetSystemVMICredentials() (*UsernamePassword, error)

GetSystemVMICredentials - Obtain VMI system credentials

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL