Documentation
¶
Index ¶
- Constants
- func Apply(url string, kubeconfig string, ctx string, yamlB []byte) error
- func CheckAdvRetentionConfig(opt TestOptions) (bool, error)
- func CheckAllOBADisabled(opt TestOptions) error
- func CheckAllOBAsDeleted(opt TestOptions) error
- func CheckAllOBAsEnabled(opt TestOptions) error
- func CheckAllPodNodeSelector(opt TestOptions, nodeSelector map[string]interface{}) error
- func CheckAllPodsAffinity(opt TestOptions) error
- func CheckDaemonSetsInNamespace(client kubernetes.Interface, ns string)
- func CheckDeploymentPodReady(opt TestOptions, deployName string) error
- func CheckDeploymentsInNamespace(client kubernetes.Interface, ns string)
- func CheckMCOAddonResources(opt TestOptions) error
- func CheckMCOComponents(opt TestOptions) error
- func CheckMCOConversion(opt TestOptions, v1beta1tov1beta2GoldenPath string) error
- func CheckManagedClusterAddonsStatus(opt TestOptions, namespace, status string) error
- func CheckOBAComponents(opt TestOptions) error
- func CheckOBADeleted(opt TestOptions, namespace string) error
- func CheckOBAStatus(opt TestOptions, namespace, status string) error
- func CheckPodsInNamespace(client kubernetes.Interface, ns string, forcePodNamesLog []string, ...)
- func CheckStatefulSetPodReady(opt TestOptions, stsName string) error
- func CheckStatefulSetsInNamespace(client kubernetes.Interface, ns string)
- func CheckStorageResize(opt TestOptions, stsName string, expectedCapacity string) error
- func CleanExportResources(opt TestOptions) error
- func ContainDashboard(opt TestOptions, title string) (error, bool)
- func CreateCRB(opt TestOptions, isHub bool, crb *rbacv1.ClusterRoleBinding) error
- func CreateMCONamespace(opt TestOptions) error
- func CreateMCOTestingRBAC(opt TestOptions) error
- func CreateObjSecret(opt TestOptions) error
- func CreatePullSecret(opt TestOptions, mcoNs string) error
- func CreateSA(opt TestOptions, isHub bool, namespace string, sa *v1.ServiceAccount) error
- func DeleteCRB(opt TestOptions, isHub bool, name string) error
- func DeleteCertSecret(opt TestOptions) error
- func DeleteConfigMap(opt TestOptions, isHub bool, name string, namespace string) error
- func DeleteDeployment(opt TestOptions, isHub bool, name string, namespace string) error
- func DeleteMCOInstance(opt TestOptions, name string) error
- func DeleteMCOTestingRBAC(opt TestOptions) error
- func DeleteSA(opt TestOptions, isHub bool, namespace string, name string) error
- func FetchBearerToken(opt TestOptions) (string, error)
- func GetAllMCOPods(opt TestOptions) ([]corev1.Pod, error)
- func GetCRB(opt TestOptions, isHub bool, name string) (error, *rbacv1.ClusterRoleBinding)
- func GetConfigMap(opt TestOptions, isHub bool, name string, namespace string) (error, *corev1.ConfigMap)
- func GetDefaultMetricList(opt TestOptions) ([]string, []string)
- func GetDeployment(opt TestOptions, isHub bool, name string, namespace string) (*appv1.Deployment, error)
- func GetDeploymentWithLabel(opt TestOptions, isHub bool, label string, namespace string) (*appv1.DeploymentList, error)
- func GetGrafanaURL(opt TestOptions) string
- func GetKubeClientDynamic(opt TestOptions, isHub bool) dynamic.Interface
- func GetMCOAddonSpecResources(opt TestOptions) (map[string]interface{}, error)
- func GetManagedClusterName(opt TestOptions) string
- func GetNamespace(opt TestOptions, isHub bool, namespace string) (error, *v1.Namespace)
- func GetPodList(opt TestOptions, isHub bool, namespace string, labelSelector string) (error, *v1.PodList)
- func GetPodLogs(opt TestOptions, isHub bool, namespace, podName, containerName string, ...) (string, error)
- func GetPullSecret(opt TestOptions) (string, error)
- func GetRouterCA(cli kubernetes.Interface) ([]byte, error)
- func GetSAWithLabel(opt TestOptions, isHub bool, label string, namespace string) (*v1.ServiceAccountList, error)
- func GetStatefulSet(opt TestOptions, isHub bool, name string, namespace string) (*appv1.StatefulSet, error)
- func GetStatefulSetWithLabel(opt TestOptions, isHub bool, label string, namespace string) (*appv1.StatefulSetList, error)
- func HaveCRDs(c Cluster, kubeconfig string, expectedCRDs []string) error
- func IntegrityChecking(opt TestOptions) error
- func ListKSManagedClusterNames(opt TestOptions) ([]string, error)
- func ListManagedClusters(opt TestOptions) ([]string, error)
- func ListOCPManagedClusterIDs(opt TestOptions, minVersionStr string) ([]string, error)
- func LoadConfig(url, kubeconfig, ctx string) (*rest.Config, error)
- func LogDeploymentStatus(deployment appsv1.Deployment)
- func LogFailingTestStandardDebugInfo(opt TestOptions)
- func LogObjectEvents(client kubernetes.Interface, ns string, kind string, name string)
- func LogPodLogs(client kubernetes.Interface, ns string, pod corev1.Pod)
- func LogPodStatus(podList corev1.Pod)
- func ModifyMCOAddonSpecInterval(opt TestOptions, interval int64) error
- func ModifyMCOAddonSpecMetrics(opt TestOptions, enable bool) error
- func ModifyMCOCR(opt TestOptions) error
- func NewKubeClient(url, kubeconfig, ctx string) kubernetes.Interface
- func NewKubeClientAPIExtension(url, kubeconfig, ctx string) apiextensionsclientset.Interface
- func NewKubeClientDynamic(url, kubeconfig, ctx string) dynamic.Interface
- func NewMCOAddonGVR() schema.GroupVersionResource
- func NewMCOClusterManagementAddonsGVR() schema.GroupVersionResource
- func NewMCOGVRV1BETA1() schema.GroupVersionResource
- func NewMCOGVRV1BETA2() schema.GroupVersionResource
- func NewMCOMObservatoriumGVR() schema.GroupVersionResource
- func NewMCOManagedClusterAddonsGVR() schema.GroupVersionResource
- func NewOCMManagedClustersGVR() schema.GroupVersionResource
- func NewOCMManifestworksGVR() schema.GroupVersionResource
- func NewOCMMultiClusterHubGVR() schema.GroupVersionResource
- func PrintObject(ctx context.Context, client dynamic.Interface, gvr schema.GroupVersionResource, ...)
- func RevertMCOCRModification(opt TestOptions) error
- func StatusContainsTypeEqualTo(u *unstructured.Unstructured, typeString string) bool
- func UninstallMCO(opt TestOptions) error
- func UpdateCRB(opt TestOptions, isHub bool, name string, crb *rbacv1.ClusterRoleBinding) (error, *rbacv1.ClusterRoleBinding)
- func UpdateDeployment(opt TestOptions, isHub bool, name string, namespace string, ...) (*appv1.Deployment, error)
- func UpdateDeploymentReplicas(opt TestOptions, deployName, crProperty string, ...) error
- func UpdateObservabilityFromManagedCluster(opt TestOptions, enableObservability bool) error
- func UpdateSA(opt TestOptions, isHub bool, namespace string, sa *v1.ServiceAccount) (error, *v1.ServiceAccount)
- type APIKeys
- type AWSAPIKey
- type AzureAPIKey
- type CloudConnection
- type Cluster
- type CollectRule
- type CollectRuleGroup
- type CollectRuleSelector
- type DynamicMetrics
- type GCPAPIKey
- type GrafanaResponse
- type MetricsAllowlist
- type RecordingRule
- type Registry
- type TestOptions
- type TestOptionsContainer
Constants ¶
const ( ServerCACerts = "observability-server-ca-certs" ClientCACerts = "observability-client-ca-certs" ServerCerts = "observability-server-certs" GrafanaCerts = "observability-grafana-certs" )
const ( MCO_CR_NAME = "observability" MCO_COMPONENT_LABEL = "observability.open-cluster-management.io/name=" + MCO_CR_NAME OBSERVATORIUM_COMPONENT_LABEL = "app.kubernetes.io/part-of=observatorium" MCO_NAMESPACE = "open-cluster-management-observability" MCO_ADDON_NAMESPACE = "open-cluster-management-addon-observability" MCO_PULL_SECRET_NAME = "multiclusterhub-operator-pull-secret" OBJ_SECRET_NAME = "thanos-object-storage" // #nosec G101 -- Not a hardcoded credential. MCO_GROUP = "observability.open-cluster-management.io" OCM_WORK_GROUP = "work.open-cluster-management.io" OCM_CLUSTER_GROUP = "cluster.open-cluster-management.io" OCM_ADDON_GROUP = "addon.open-cluster-management.io" )
const ( ManagedClusterAddOnDisabledMessage = "enableMetrics is set to False" OBMAddonEnabledMessage = "Cluster metrics sent successfully" ManagedClusterAddOnEnabledMessage = "observability-controller add-on is available" )
const (
RouterCertsSecretName = "router-certs-default"
)
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply a multi resources file to the cluster described by the url, kubeconfig and ctx. url of the cluster kubeconfig which contains the ctx ctx, the ctx to use yamlB, a byte array containing the resources file
func CheckAdvRetentionConfig ¶
func CheckAdvRetentionConfig(opt TestOptions) (bool, error)
func CheckAllOBADisabled ¶
func CheckAllOBADisabled(opt TestOptions) error
func CheckAllOBAsDeleted ¶
func CheckAllOBAsDeleted(opt TestOptions) error
func CheckAllOBAsEnabled ¶
func CheckAllOBAsEnabled(opt TestOptions) error
func CheckAllPodNodeSelector ¶
func CheckAllPodNodeSelector(opt TestOptions, nodeSelector map[string]interface{}) error
func CheckAllPodsAffinity ¶
func CheckAllPodsAffinity(opt TestOptions) error
func CheckDaemonSetsInNamespace ¶
func CheckDaemonSetsInNamespace(client kubernetes.Interface, ns string)
func CheckDeploymentPodReady ¶
func CheckDeploymentPodReady(opt TestOptions, deployName string) error
func CheckDeploymentsInNamespace ¶
func CheckDeploymentsInNamespace(client kubernetes.Interface, ns string)
func CheckMCOAddonResources ¶
func CheckMCOAddonResources(opt TestOptions) error
func CheckMCOComponents ¶
func CheckMCOComponents(opt TestOptions) error
func CheckMCOConversion ¶
func CheckMCOConversion(opt TestOptions, v1beta1tov1beta2GoldenPath string) error
func CheckManagedClusterAddonsStatus ¶
func CheckManagedClusterAddonsStatus(opt TestOptions, namespace, status string) error
func CheckOBAComponents ¶
func CheckOBAComponents(opt TestOptions) error
func CheckOBADeleted ¶
func CheckOBADeleted(opt TestOptions, namespace string) error
func CheckOBAStatus ¶
func CheckOBAStatus(opt TestOptions, namespace, status string) error
func CheckPodsInNamespace ¶
func CheckPodsInNamespace(client kubernetes.Interface, ns string, forcePodNamesLog []string, podLabels map[string]string)
CheckPodsInNamespace lists pods in a namespace and logs debug info (status, events, logs) for pods not running.
func CheckStatefulSetPodReady ¶
func CheckStatefulSetPodReady(opt TestOptions, stsName string) error
func CheckStatefulSetsInNamespace ¶
func CheckStatefulSetsInNamespace(client kubernetes.Interface, ns string)
func CheckStorageResize ¶
func CheckStorageResize(opt TestOptions, stsName string, expectedCapacity string) error
func CleanExportResources ¶
func CleanExportResources(opt TestOptions) error
func ContainDashboard ¶
func ContainDashboard(opt TestOptions, title string) (error, bool)
func CreateCRB ¶
func CreateCRB(opt TestOptions, isHub bool, crb *rbacv1.ClusterRoleBinding) error
func CreateMCONamespace ¶
func CreateMCONamespace(opt TestOptions) error
func CreateMCOTestingRBAC ¶
func CreateMCOTestingRBAC(opt TestOptions) error
func CreateObjSecret ¶
func CreateObjSecret(opt TestOptions) error
func CreatePullSecret ¶
func CreatePullSecret(opt TestOptions, mcoNs string) error
func CreateSA ¶
func CreateSA(opt TestOptions, isHub bool, namespace string, sa *v1.ServiceAccount) error
func DeleteCertSecret ¶
func DeleteCertSecret(opt TestOptions) error
func DeleteConfigMap ¶
func DeleteConfigMap(opt TestOptions, isHub bool, name string, namespace string) error
func DeleteDeployment ¶
func DeleteDeployment(opt TestOptions, isHub bool, name string, namespace string) error
func DeleteMCOInstance ¶
func DeleteMCOInstance(opt TestOptions, name string) error
func DeleteMCOTestingRBAC ¶
func DeleteMCOTestingRBAC(opt TestOptions) error
func FetchBearerToken ¶
func FetchBearerToken(opt TestOptions) (string, error)
func GetAllMCOPods ¶
func GetAllMCOPods(opt TestOptions) ([]corev1.Pod, error)
func GetCRB ¶
func GetCRB(opt TestOptions, isHub bool, name string) (error, *rbacv1.ClusterRoleBinding)
func GetConfigMap ¶
func GetDefaultMetricList ¶
func GetDefaultMetricList(opt TestOptions) ([]string, []string)
func GetDeployment ¶
func GetDeployment(opt TestOptions, isHub bool, name string, namespace string) (*appv1.Deployment, error)
func GetDeploymentWithLabel ¶
func GetDeploymentWithLabel(opt TestOptions, isHub bool, label string, namespace string) (*appv1.DeploymentList, error)
func GetGrafanaURL ¶
func GetGrafanaURL(opt TestOptions) string
func GetKubeClientDynamic ¶
func GetKubeClientDynamic(opt TestOptions, isHub bool) dynamic.Interface
func GetMCOAddonSpecResources ¶
func GetMCOAddonSpecResources(opt TestOptions) (map[string]interface{}, error)
func GetManagedClusterName ¶
func GetManagedClusterName(opt TestOptions) string
func GetNamespace ¶
func GetPodList ¶
func GetPodLogs ¶
func GetPullSecret ¶
func GetPullSecret(opt TestOptions) (string, error)
GetPullSecret checks the secret from MCH CR and return the secret name
func GetRouterCA ¶
func GetRouterCA(cli kubernetes.Interface) ([]byte, error)
func GetSAWithLabel ¶
func GetSAWithLabel(opt TestOptions, isHub bool, label string, namespace string) (*v1.ServiceAccountList, error)
func GetStatefulSet ¶
func GetStatefulSet(opt TestOptions, isHub bool, name string, namespace string) (*appv1.StatefulSet, error)
func GetStatefulSetWithLabel ¶
func GetStatefulSetWithLabel(opt TestOptions, isHub bool, label string, namespace string) (*appv1.StatefulSetList, error)
func IntegrityChecking ¶
func IntegrityChecking(opt TestOptions) error
IntegrityChecking checks to ensure all required conditions are met when completing the specs
func ListKSManagedClusterNames ¶
func ListKSManagedClusterNames(opt TestOptions) ([]string, error)
func ListManagedClusters ¶
func ListManagedClusters(opt TestOptions) ([]string, error)
func ListOCPManagedClusterIDs ¶
func ListOCPManagedClusterIDs(opt TestOptions, minVersionStr string) ([]string, error)
func LogDeploymentStatus ¶
func LogDeploymentStatus(deployment appsv1.Deployment)
func LogFailingTestStandardDebugInfo ¶
func LogFailingTestStandardDebugInfo(opt TestOptions)
LogFailingTestStandardDebugInfo logs standard debug info for failing tests. It scans workloads and pods from hub and managed clusters observability namespaces. It also prints MCO and OBA objects. If a workload or pod is not running, it prints the resource spec, status, events and logs if appropriate.
func LogObjectEvents ¶
func LogObjectEvents(client kubernetes.Interface, ns string, kind string, name string)
func LogPodLogs ¶
func LogPodLogs(client kubernetes.Interface, ns string, pod corev1.Pod)
func LogPodStatus ¶
func ModifyMCOAddonSpecInterval ¶
func ModifyMCOAddonSpecInterval(opt TestOptions, interval int64) error
func ModifyMCOAddonSpecMetrics ¶
func ModifyMCOAddonSpecMetrics(opt TestOptions, enable bool) error
func ModifyMCOCR ¶
func ModifyMCOCR(opt TestOptions) error
ModifyMCOCR modifies the MCO CR for reconciling. modify multiple parameter to save running time
func NewKubeClient ¶
func NewKubeClient(url, kubeconfig, ctx string) kubernetes.Interface
func NewKubeClientAPIExtension ¶
func NewKubeClientAPIExtension(url, kubeconfig, ctx string) apiextensionsclientset.Interface
func NewKubeClientDynamic ¶
func NewMCOAddonGVR ¶
func NewMCOAddonGVR() schema.GroupVersionResource
func NewMCOClusterManagementAddonsGVR ¶
func NewMCOClusterManagementAddonsGVR() schema.GroupVersionResource
func NewMCOGVRV1BETA1 ¶
func NewMCOGVRV1BETA1() schema.GroupVersionResource
func NewMCOGVRV1BETA2 ¶
func NewMCOGVRV1BETA2() schema.GroupVersionResource
func NewMCOMObservatoriumGVR ¶
func NewMCOMObservatoriumGVR() schema.GroupVersionResource
func NewMCOManagedClusterAddonsGVR ¶
func NewMCOManagedClusterAddonsGVR() schema.GroupVersionResource
func NewOCMManagedClustersGVR ¶
func NewOCMManagedClustersGVR() schema.GroupVersionResource
func NewOCMManifestworksGVR ¶
func NewOCMManifestworksGVR() schema.GroupVersionResource
func NewOCMMultiClusterHubGVR ¶
func NewOCMMultiClusterHubGVR() schema.GroupVersionResource
func PrintObject ¶
func RevertMCOCRModification ¶
func RevertMCOCRModification(opt TestOptions) error
RevertMCOCRModification revert the previous changes
func StatusContainsTypeEqualTo ¶
func StatusContainsTypeEqualTo(u *unstructured.Unstructured, typeString string) bool
StatusContainsTypeEqualTo check if u contains a condition type with value typeString
func UninstallMCO ¶
func UninstallMCO(opt TestOptions) error
func UpdateCRB ¶
func UpdateCRB(opt TestOptions, isHub bool, name string, crb *rbacv1.ClusterRoleBinding) (error, *rbacv1.ClusterRoleBinding)
func UpdateDeployment ¶
func UpdateDeployment( opt TestOptions, isHub bool, name string, namespace string, dep *appv1.Deployment) (*appv1.Deployment, error)
func UpdateDeploymentReplicas ¶
func UpdateDeploymentReplicas( opt TestOptions, deployName, crProperty string, desiredReplicas, expectedReplicas int32, ) error
func UpdateObservabilityFromManagedCluster ¶
func UpdateObservabilityFromManagedCluster(opt TestOptions, enableObservability bool) error
func UpdateSA ¶
func UpdateSA(opt TestOptions, isHub bool, namespace string, sa *v1.ServiceAccount) (error, *v1.ServiceAccount)
Types ¶
type APIKeys ¶
type APIKeys struct { AWS AWSAPIKey `yaml:"aws,omitempty"` GCP GCPAPIKey `yaml:"gcp,omitempty"` Azure AzureAPIKey `yaml:"azure,omitempty"` }
type AzureAPIKey ¶
type AzureAPIKey struct { BaseDnsDomain string `yaml:"baseDnsDomain"` BaseDomainRGN string `yaml:"azureBaseDomainRGN"` Region string `yaml:"region"` SubscriptionID string `yaml:"subscriptionID"` TenantID string `yaml:"tenantID"` ClientID string `yaml:"clientID"` ClientSecret string `yaml:"clientSecret"` }
type CloudConnection ¶
type CloudConnection struct { PullSecret string `yaml:"pullSecret"` SSHPrivateKey string `yaml:"sshPrivatekey"` SSHPublicKey string `yaml:"sshPublickey"` Keys APIKeys `yaml:"apiKeys,omitempty"` OCPRelease string `yaml:"ocpRelease,omitempty"` }
CloudConnection struct for bits having to do with Connections
type Cluster ¶
type Cluster struct { Name string `yaml:"name,omitempty"` Namespace string `yaml:"namespace,omitempty"` Tags map[string]bool `yaml:"tags,omitempty"` BaseDomain string `yaml:"baseDomain"` User string `yaml:"user,omitempty"` Password string `yaml:"password,omitempty"` KubeContext string `yaml:"kubecontext,omitempty"` ClusterServerURL string `yaml:"clusterServerURL,omitempty"` GrafanaURL string `yaml:"grafanaURL,omitempty"` GrafanaHost string `yaml:"grafanaHost,omitempty"` KubeConfig string `yaml:"kubeconfig,omitempty"` }
Define the shape of clusters that may be added under management
type CollectRule ¶
type CollectRuleGroup ¶
type CollectRuleGroup struct { Name string `yaml:"group"` Annotations map[string]string `yaml:"annotations"` Selector CollectRuleSelector `yaml:"selector"` CollectRuleList []CollectRule `yaml:"rules"` }
CollectRuleGroup structure contains information of a group of collect rules used for dnamically collecting metrics.
type CollectRuleSelector ¶
type CollectRuleSelector struct {
MatchExpression []metav1.LabelSelectorRequirement `yaml:"matchExpressions"`
}
type DynamicMetrics ¶
type GrafanaResponse ¶
type GrafanaResponse struct { Status string `json:"status"` Data struct { ResultType string `json:"resultType"` Result []struct { Metric map[string]string `json:"metric"` Value []interface{} `json:"value"` // Use interface{} because value can be mixed types } `json:"result"` } `json:"data"` }
func QueryGrafana ¶
func QueryGrafana(opt TestOptions, query string) (*GrafanaResponse, error)
func (GrafanaResponse) ContainsLabelsSet ¶
func (r GrafanaResponse) ContainsLabelsSet(labels map[string]string) bool
func (GrafanaResponse) String ¶
func (r GrafanaResponse) String() string
type MetricsAllowlist ¶
type MetricsAllowlist struct { NameList []string `yaml:"names"` MatchList []string `yaml:"matches"` RenameMap map[string]string `yaml:"renames"` RuleList []RecordingRule `yaml:"rules"` //deprecated RecordingRuleList []RecordingRule `yaml:"recording_rules"` CollectRuleGroupList []CollectRuleGroup `yaml:"collect_rules"` }
type RecordingRule ¶
type Registry ¶
type Registry struct { // example: quay.io/stolostron Server string `yaml:"server"` User string `yaml:"user"` Password string `yaml:"password"` }
Define the image registry
type TestOptions ¶
type TestOptions struct { HubCluster Cluster `yaml:"hub"` ManagedClusters []Cluster `yaml:"clusters"` ImageRegistry Registry `yaml:"imageRegistry,omitempty"` KubeConfig string `yaml:"kubeconfig,omitempty"` Connection CloudConnection `yaml:"cloudConnection,omitempty"` Headless string `yaml:"headless,omitempty"` OwnerPrefix string `yaml:"ownerPrefix,omitempty"` }
Define options available for Tests to consume
type TestOptionsContainer ¶
type TestOptionsContainer struct {
Options TestOptions `yaml:"options"`
}
Source Files
¶
- client.go
- kube_debug.go
- mco_cert_secret.go
- mco_clusterrolebinding.go
- mco_configmaps.go
- mco_dashboard.go
- mco_deploy.go
- mco_deployments.go
- mco_export.go
- mco_grafana.go
- mco_managedcluster.go
- mco_metric.go
- mco_namespace.go
- mco_oba.go
- mco_pods.go
- mco_router_ca.go
- mco_sa.go
- mco_statefulset.go
- options.go
- utils.go