Documentation ¶
Index ¶
- Constants
- Variables
- func CheckIsIBMCloud(c client.Client) (bool, error)
- func CheckObjStorageConf(data []byte) (bool, error)
- func CleanUpOperandNames()
- func GetAlertmanagerCA(client client.Client) (string, error)
- func GetAlertmanagerEndpoint(client client.Client, namespace string) (string, error)
- func GetAlertmanagerRouterCA(client client.Client) (string, error)
- func GetCertDuration() time.Duration
- func GetClusterID(ocpClient ocpClientSet.Interface) (string, error)
- func GetClusterNameLabelKey() string
- func GetCrLabelKey() string
- func GetDefaultCRName() string
- func GetDefaultNamespace() string
- func GetDefaultTenantName() string
- func GetImageManifestConfigMapName() string
- func GetImageManifests() map[string]string
- func GetImagePullPolicy(mco observabilityv1beta2.MultiClusterObservabilitySpec) corev1.PullPolicy
- func GetImagePullSecret(mco observabilityv1beta2.MultiClusterObservabilitySpec) string
- func GetKubeAPIServerAddress(client client.Client) (string, error)
- func GetMCONamespace() string
- func GetMonitoringCRName() string
- func GetMulticloudConsoleHost(client client.Client, isStandalone bool) (string, error)
- func GetOBAResources(oba *mcoshared.ObservabilityAddonSpec) *corev1.ResourceRequirements
- func GetObsAPIHost(client client.Client, namespace string) (string, error)
- func GetObsAPISvc(instanceName string) string
- func GetOperandName(name string) string
- func GetOperandNamePrefix() string
- func GetReplicas(component string, advanced *observabilityv1beta2.AdvancedConfig) *int32
- func GetResources(component string, advanced *observabilityv1beta2.AdvancedConfig) corev1.ResourceRequirements
- func GetRouteHost(client client.Client, name string, namespace string) (string, error)
- func GetTenantUID() string
- func GetValidatingWebhookConfigurationForMCO() *admissionregistrationv1.ValidatingWebhookConfiguration
- func HasCustomRuleConfigMap() bool
- func IsAlertingDisabled() bool
- func IsAlertingDisabledInSpec(mco *observabilityv1beta2.MultiClusterObservability) bool
- func IsPaused(annotations map[string]string) bool
- func IsValidAzureConf(data []byte) (bool, error)
- func IsValidGCSConf(data []byte) (bool, error)
- func IsValidS3Conf(data []byte) (bool, error)
- func ReadImageManifestConfigMap(c client.Client, version string) (bool, error)
- func ReplaceImage(annotations map[string]string, imageRepo, componentName string) (bool, string)
- func SetAlertingDisabled(status bool)
- func SetCertDuration(annotations map[string]string)
- func SetCustomRuleConfigMap(hasConfigMap bool)
- func SetImageManifests(images map[string]string)
- func SetMonitoringCRName(crName string)
- func SetOperandNames(c client.Client) error
- func WithoutResourcesRequests(annotations map[string]string) bool
- type Config
- type HTTPConfig
- type ObjectStorgeConf
- type TLSConfig
Constants ¶
const ( OpenshiftIngressOperatorNamespace = "openshift-ingress-operator" OpenshiftIngressNamespace = "openshift-ingress" OpenshiftIngressOperatorCRName = "default" OpenshiftIngressDefaultCertName = "router-certs-default" OpenshiftIngressRouteCAName = "router-ca" AnnotationKeyImageRepository = "mco-imageRepository" AnnotationKeyImageTagSuffix = "mco-imageTagSuffix" AnnotationMCOPause = "mco-pause" AnnotationMCOWithoutResourcesRequests = "mco-thanos-without-resources-requests" AnnotationCertDuration = "mco-cert-duration" AnnotationDisableMCOAlerting = "mco-disable-alerting" MCHUpdatedRequestName = "mch-updated-request" MCOUpdatedRequestName = "mco-updated-request" ClusterManagementAddOnUpdateName = "clustermgmtaddon-updated-request" AddonDeploymentConfigUpdateName = "addondc-updated-request" MulticloudConsoleRouteName = "multicloud-console" ImageManifestConfigMapNamePrefix = "mch-image-manifest-" OCMManifestConfigMapTypeLabelKey = "ocm-configmap-type" OCMManifestConfigMapTypeLabelValue = "image-manifest" OCMManifestConfigMapVersionLabelKey = "ocm-release-version" ComponentVersion = "COMPONENT_VERSION" ServerCACerts = "observability-server-ca-certs" ClientCACerts = "observability-client-ca-certs" ServerCerts = "observability-server-certs" ServerCertCN = "observability-server-certificate" GrafanaCerts = "observability-grafana-certs" GrafanaCN = "grafana" ManagedClusterOU = "acm" GrafanaRouteName = "grafana" GrafanaServiceName = "grafana" GrafanaOauthClientName = "grafana-proxy-client" // #nosec G101 -- Not a hardcoded credential. GrafanaOauthClientSecret = "grafana-proxy-client" // #nosec G101 -- Not a hardcoded credential. AlertmanagerAccessorSAName = "observability-alertmanager-accessor" AlertmanagerAccessorSecretName = "observability-alertmanager-accessor" // #nosec G101 -- Not a hardcoded credential. AlertmanagerServiceName = "alertmanager" AlertmanagerRouteName = "alertmanager" AlertmanagerRouteBYOCAName = "alertmanager-byo-ca" AlertmanagerRouteBYOCERTName = "alertmanager-byo-cert" AlertRuleDefaultConfigMapName = "thanos-ruler-default-rules" AlertRuleDefaultFileKey = "default_rules.yaml" AlertRuleCustomConfigMapName = "thanos-ruler-custom-rules" AlertRuleCustomFileKey = "custom_rules.yaml" AlertmanagerURL = "http://alertmanager:9093" AlertmanagerConfigName = "alertmanager-config" AlertmanagersDefaultConfigMapName = "thanos-ruler-config" AlertmanagersDefaultConfigFileKey = "config.yaml" AlertmanagersDefaultCaBundleMountPath = "/etc/thanos/configmaps/alertmanager-ca-bundle" AlertmanagersDefaultCaBundleName = "alertmanager-ca-bundle" AlertmanagersDefaultCaBundleKey = "service-ca.crt" AllowlistCustomConfigMapName = "observability-metrics-custom-allowlist" ManagedClusterLabelAllowListConfigMapName = "observability-managed-cluster-label-allowlist" ProxyServiceName = "rbac-query-proxy" ProxyRouteName = "rbac-query-proxy" ProxyRouteBYOCAName = "proxy-byo-ca" ProxyRouteBYOCERTName = "proxy-byo-cert" ValidatingWebhookConfigurationName = "multicluster-observability-operator" WebhookServiceName = "multicluster-observability-webhook-service" BackupLabelName = "cluster.open-cluster-management.io/backup" BackupLabelValue = "" OpenShiftClusterMonitoringlabel = "openshift.io/cluster-monitoring" )
const ( DefaultImgRepository = "quay.io/stolostron" DefaultImgTagSuffix = "2.4.0-SNAPSHOT-2021-09-23-07-02-14" ObservatoriumImgRepo = "quay.io/observatorium" ObservatoriumAPIImgName = "observatorium" ObservatoriumOperatorImgName = "observatorium-operator" ObservatoriumOperatorImgKey = "observatorium_operator" ThanosReceiveControllerImgName = "thanos-receive-controller" // ThanosReceiveControllerKey is used to get from mch-image-manifest.xxx configmap. ThanosReceiveControllerKey = "thanos_receive_controller" ThanosReceiveControllerImgTag = "master-2022-04-01-b58820f" ThanosImgName = "thanos" MemcachedImgRepo = "quay.io/ocm-observability" MemcachedImgName = "memcached" MemcachedImgTag = "1.6.3-alpine" MemcachedExporterImgRepo = "quay.io/prometheus" MemcachedExporterImgName = "memcached-exporter" MemcachedExporterKey = "memcached_exporter" MemcachedExporterImgTag = "v0.9.0" GrafanaImgKey = "grafana" GrafanaDashboardLoaderName = "grafana-dashboard-loader" // #nosec G101 -- Not a hardcoded credential. GrafanaDashboardLoaderKey = "grafana_dashboard_loader" // #nosec G101 -- Not a hardcoded credential. GrafanaCustomDashboardLabel = "grafana-custom-dashboard" AlertManagerImgName = "prometheus-alertmanager" AlertManagerImgKey = "prometheus_alertmanager" ConfigmapReloaderImgRepo = "quay.io/openshift" ConfigmapReloaderImgName = "origin-configmap-reloader" ConfigmapReloaderImgTagSuffix = "4.8.0" ConfigmapReloaderKey = "configmap_reloader" KubeRBACProxyKey = "kube_rbac_proxy" KubeRBACProxyImgName = "kube-rbac-proxy" OauthProxyImgRepo = "quay.io/stolostron" OauthProxyImgName = "origin-oauth-proxy" OauthProxyImgTagSuffix = "2.0.12-SNAPSHOT-2021-06-11-19-40-10" OauthProxyKey = "oauth_proxy" EndpointControllerImgName = "endpoint-monitoring-operator" EndpointControllerKey = "endpoint_monitoring_operator" RBACQueryProxyImgName = "rbac-query-proxy" RBACQueryProxyKey = "rbac_query_proxy" RBACQueryProxyCPURequets = "20m" RBACQueryProxyMemoryRequets = "100Mi" GrafanaCPURequets = "4m" GrafanaMemoryRequets = "100Mi" GrafanaCPULimits = "500m" GrafanaMemoryLimits = "1Gi" AlertmanagerCPURequets = "4m" AlertmanagerMemoryRequets = "200Mi" ObservatoriumAPICPURequets = "20m" ObservatoriumAPIMemoryRequets = "128Mi" ThanosQueryFrontendCPURequets = "100m" ThanosQueryFrontendMemoryRequets = "256Mi" MemcachedExporterCPURequets = "5m" MemcachedExporterMemoryRequets = "50Mi" ThanosQueryCPURequets = "300m" ThanosQueryMemoryRequets = "1Gi" ThanosCompactCPURequets = "100m" ThanosCompactMemoryRequets = "512Mi" ObservatoriumReceiveControllerCPURequets = "4m" ObservatoriumReceiveControllerMemoryRequets = "32Mi" ThanosReceiveCPURequets = "300m" ThanosReceiveMemoryRequets = "512Mi" ThanosRuleCPURequets = "50m" ThanosRuleMemoryRequets = "512Mi" ThanosRuleReloaderCPURequets = "4m" ThanosRuleReloaderMemoryRequets = "25Mi" ThanosCachedCPURequets = "45m" ThanosCachedMemoryRequets = "128Mi" ThanosCachedExporterCPURequets = "5m" ThanosCachedExporterMemoryRequets = "50Mi" ThanosStoreCPURequets = "100m" ThanosStoreMemoryRequets = "1Gi" MetricsCollectorCPURequets = "10m" MetricsCollectorMemoryRequets = "100Mi" MetricsCollectorCPULimits = "" MetricsCollectorMemoryLimits = "" ObservatoriumAPI = "observatorium-api" ThanosCompact = "thanos-compact" ThanosQuery = "thanos-query" ThanosQueryFrontend = "thanos-query-frontend" ThanosQueryFrontendMemcached = "thanos-query-frontend-memcached" ThanosRule = "thanos-rule" ThanosReceive = "thanos-receive-default" ThanosStoreMemcached = "thanos-store-memcached" ThanosStoreShard = "thanos-store-shard" MemcachedExporter = "memcached-exporter" Grafana = "grafana" RBACQueryProxy = "rbac-query-proxy" Alertmanager = "alertmanager" ThanosReceiveController = "thanos-receive-controller" ObservatoriumOperator = "observatorium-operator" MetricsCollector = "metrics-collector" Observatorium = "observatorium" RetentionResolutionRaw = "365d" RetentionResolution5m = "365d" RetentionResolution1h = "365d" RetentionInLocal = "24h" DeleteDelay = "48h" BlockDuration = "2h" DefaultImagePullPolicy = "IfNotPresent" DefaultImagePullSecret = "multiclusterhub-operator-pull-secret" ResourceLimits = "limits" ResourceRequests = "requests" )
const ( IngressControllerCRD = "ingresscontrollers.operator.openshift.io" MCHCrdName = "multiclusterhubs.operator.open-cluster-management.io" MCOCrdName = "multiclusterobservabilities.observability.open-cluster-management.io" StorageVersionMigrationCrdName = "storageversionmigrations.migration.k8s.io" MCGHCrdName = "multiclusterglobalhubs.operator.open-cluster-management.io" )
const ( ResourceTypeConfigMap = "ConfigMap" ResourceTypeSecret = "Secret" )
const ( HubEndpointOperatorName = "endpoint-observability-operator" HubMetricsCollectorName = "metrics-collector-deployment" HubUwlMetricsCollectorName = "uwl-metrics-collector-deployment" HubUwlMetricsCollectorNs = "openshift-user-workload-monitoring" HubEndpointSaName = "endpoint-observability-operator-sa" )
const (
MCORsName = "multiclusterobservabilities"
)
Variables ¶
var ( Replicas1 int32 = 1 Replicas2 int32 = 2 Replicas3 int32 = 3 Replicas = map[string]*int32{ ObservatoriumAPI: &Replicas2, ThanosQuery: &Replicas2, ThanosQueryFrontend: &Replicas2, Grafana: &Replicas2, RBACQueryProxy: &Replicas2, ThanosRule: &Replicas3, ThanosReceive: &Replicas3, ThanosStoreShard: &Replicas3, ThanosStoreMemcached: &Replicas3, ThanosQueryFrontendMemcached: &Replicas3, Alertmanager: &Replicas3, } MemoryLimitMB = int32(1024) ConnectionLimit = int32(1024) MaxItemSize = "1m" BackupResourceMap = map[string]string{ AllowlistCustomConfigMapName: ResourceTypeConfigMap, AlertRuleCustomConfigMapName: ResourceTypeConfigMap, ManagedClusterLabelAllowListConfigMapName: ResourceTypeConfigMap, AlertmanagerConfigName: ResourceTypeSecret, AlertmanagerRouteBYOCAName: ResourceTypeSecret, AlertmanagerRouteBYOCERTName: ResourceTypeSecret, ProxyRouteBYOCAName: ResourceTypeSecret, ProxyRouteBYOCERTName: ResourceTypeSecret, DefaultImagePullSecret: ResourceTypeSecret, } )
Functions ¶
func CheckIsIBMCloud ¶
checkIsIBMCloud detects if the current cloud vendor is ibm or not we know we are on OCP already, so if it's also ibm cloud, it's roks.
func CheckObjStorageConf ¶
CheckObjStorageConf is used to check/valid the object storage configurations.
func CleanUpOperandNames ¶
func CleanUpOperandNames()
CleanUpOperandNames delete all the operand name items. Should be called when the MCO CR is deleted.
func GetAlertmanagerCA ¶
GetAlertmanagerCA is used to get the CA of Alertmanager.
func GetAlertmanagerEndpoint ¶
GetAlertmanagerEndpoint is used to get the URL for alertmanager.
func GetAlertmanagerRouterCA ¶
GetAlertmanagerRouterCA is used to get the CA of openshift Route.
func GetCertDuration ¶
func GetClusterID ¶
func GetClusterID(ocpClient ocpClientSet.Interface) (string, error)
GetClusterID is used to get the cluster uid.
func GetClusterNameLabelKey ¶
func GetClusterNameLabelKey() string
GetClusterNameLabelKey returns the key for the injected label.
func GetCrLabelKey ¶
func GetCrLabelKey() string
GetCrLabelKey returns the key for the CR label injected into the resources created by the operator.
func GetDefaultCRName ¶
func GetDefaultCRName() string
GetDefaultCRName is used to get default CR name.
func GetDefaultNamespace ¶
func GetDefaultNamespace() string
func GetDefaultTenantName ¶
func GetDefaultTenantName() string
GetDefaultTenantName returns the default tenant name.
func GetImageManifestConfigMapName ¶
func GetImageManifestConfigMapName() string
func GetImagePullPolicy ¶
func GetImagePullPolicy(mco observabilityv1beta2.MultiClusterObservabilitySpec) corev1.PullPolicy
func GetImagePullSecret ¶
func GetImagePullSecret(mco observabilityv1beta2.MultiClusterObservabilitySpec) string
func GetKubeAPIServerAddress ¶
GetKubeAPIServerAddress is used to get the api server url.
func GetMCONamespace ¶
func GetMCONamespace() string
func GetMonitoringCRName ¶
func GetMonitoringCRName() string
GetMonitoringCRName returns monitoring cr name.
func GetMulticloudConsoleHost ¶
GetMulticloudConsoleHost is used to get the URL for multicloud-console route.
func GetOBAResources ¶
func GetOBAResources(oba *mcoshared.ObservabilityAddonSpec) *corev1.ResourceRequirements
func GetObsAPIHost ¶
GetObsAPIHost is used to get the URL for observartium api gateway.
func GetObsAPISvc ¶
GetObsAPISvc returns observatorium api service.
func GetOperandName ¶
func GetOperandNamePrefix ¶
func GetOperandNamePrefix() string
func GetReplicas ¶
func GetReplicas(component string, advanced *observabilityv1beta2.AdvancedConfig) *int32
func GetResources ¶
func GetResources(component string, advanced *observabilityv1beta2.AdvancedConfig) corev1.ResourceRequirements
func GetRouteHost ¶
func GetValidatingWebhookConfigurationForMCO ¶
func GetValidatingWebhookConfigurationForMCO() *admissionregistrationv1.ValidatingWebhookConfiguration
GetValidatingWebhookConfigurationForMCO return the ValidatingWebhookConfiguration for the MCO validaing webhook.
func HasCustomRuleConfigMap ¶
func HasCustomRuleConfigMap() bool
HasCustomRuleConfigMap returns true if there is custom rule configmap.
func IsAlertingDisabled ¶
func IsAlertingDisabled() bool
func IsAlertingDisabledInSpec ¶
func IsAlertingDisabledInSpec(mco *observabilityv1beta2.MultiClusterObservability) bool
Get AnnotationMCOAlerting.
func IsPaused ¶
IsPaused returns true if the multiclusterobservability instance is labeled as paused, and false otherwise.
func IsValidAzureConf ¶
IsValidAzureConf is used to validate azure configuration.
func IsValidGCSConf ¶
IsValidGCSConf is used to validate GCS configuration.
func IsValidS3Conf ¶
IsValidS3Conf is used to validate s3 configuration.
func ReadImageManifestConfigMap ¶
ReadImageManifestConfigMap reads configmap with the label ocm-configmap-type=image-manifest.
func ReplaceImage ¶
ReplaceImage is used to replace the image with specified annotation or imagemanifest configmap.
func SetCertDuration ¶
func SetCustomRuleConfigMap ¶
func SetCustomRuleConfigMap(hasConfigMap bool)
SetCustomRuleConfigMap set true if there is custom rule configmap.
func SetImageManifests ¶
SetImageManifests sets imageManifests.
func SetMonitoringCRName ¶
func SetMonitoringCRName(crName string)
SetMonitoringCRName sets the cr name.
func SetOperandNames ¶
func WithoutResourcesRequests ¶
WithoutResourcesRequests returns true if the multiclusterobservability instance has annotation: mco-thanos-without-resources-requests: "true" This is just for test purpose: the KinD cluster does not have enough resources for the requests. We won't expose this annotation to the customer.
Types ¶
type Config ¶
type Config struct { // s3 configuration Bucket string `yaml:"bucket"` Endpoint string `yaml:"endpoint"` Insecure bool `yaml:"insecure"` AccessKey string `yaml:"access_key"` SecretKey string `yaml:"secret_key"` HTTPConfig HTTPConfig `yaml:"http_config"` // azure configuration // Bucket string `yaml:"bucket"` StorageAccount string `yaml:"storage_account"` StorageAccountKey string `yaml:"storage_account_key"` Container string `yaml:"container"` MaxRetries int32 `yaml:"max_retries"` // gcs configuration // Endpoint string `yaml:"endpoint"` ServiceAccount string `yaml:"service_account"` }
Config is for s3/azure/gcs compatible configuration.
type HTTPConfig ¶
type HTTPConfig struct { IdleConnTimeout model.Duration `yaml:"idle_conn_timeout"` ResponseHeaderTimeout model.Duration `yaml:"response_header_timeout"` InsecureSkipVerify bool `yaml:"insecure_skip_verify"` TLSHandshakeTimeout model.Duration `yaml:"tls_handshake_timeout"` ExpectContinueTimeout model.Duration `yaml:"expect_continue_timeout"` MaxIdleConns int `yaml:"max_idle_conns"` MaxIdleConnsPerHost int `yaml:"max_idle_conns_per_host"` MaxConnsPerHost int `yaml:"max_conns_per_host"` // Allow upstream callers to inject a round tripper Transport http.RoundTripper `yaml:"-"` TLSConfig TLSConfig `yaml:"tls_config"` }
HTTPConfig stores the http.Transport configuration for the s3 minio client.
type ObjectStorgeConf ¶
ObjectStorgeConf is used to Unmarshal from bytes to do validation.
type TLSConfig ¶
type TLSConfig struct { // The CA cert to use for the targets. CAFile string `yaml:"ca_file"` // The client cert file for the targets. CertFile string `yaml:"cert_file"` // The client key file for the targets. KeyFile string `yaml:"key_file"` // Used to verify the hostname for the targets. ServerName string `yaml:"server_name"` // Disable target certificate validation. InsecureSkipVerify bool `yaml:"insecure_skip_verify"` }
TLSConfig configures the options for TLS connections.