config

package
v0.0.0-...-7ed3670 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
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"
)
View Source
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"
)
View Source
const (
	ResourceTypeConfigMap = "ConfigMap"
	ResourceTypeSecret    = "Secret"
)
View Source
const (
	HubEndpointOperatorName    = "endpoint-observability-operator"
	HubMetricsCollectorName    = "metrics-collector-deployment"
	HubUwlMetricsCollectorName = "uwl-metrics-collector-deployment"
	HubUwlMetricsCollectorNs   = "openshift-user-workload-monitoring"
	HubEndpointSaName          = "endpoint-observability-operator-sa"
)
View Source
const (
	MCORsName = "multiclusterobservabilities"
)

Variables

Functions

func CheckIsIBMCloud

func CheckIsIBMCloud(c client.Client) (bool, error)

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

func CheckObjStorageConf(data []byte) (bool, error)

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

func GetAlertmanagerCA(client client.Client) (string, error)

GetAlertmanagerCA is used to get the CA of Alertmanager.

func GetAlertmanagerEndpoint

func GetAlertmanagerEndpoint(client client.Client, namespace string) (string, error)

GetAlertmanagerEndpoint is used to get the URL for alertmanager.

func GetAlertmanagerRouterCA

func GetAlertmanagerRouterCA(client client.Client) (string, error)

GetAlertmanagerRouterCA is used to get the CA of openshift Route.

func GetCertDuration

func GetCertDuration() time.Duration

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 GetImageManifests

func GetImageManifests() map[string]string

GetImageManifests...

func GetKubeAPIServerAddress

func GetKubeAPIServerAddress(client client.Client) (string, error)

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

func GetMulticloudConsoleHost(client client.Client, isStandalone bool) (string, error)

GetMulticloudConsoleHost is used to get the URL for multicloud-console route.

func GetObsAPIHost

func GetObsAPIHost(client client.Client, namespace string) (string, error)

GetObsAPIHost is used to get the URL for observartium api gateway.

func GetObsAPISvc

func GetObsAPISvc(instanceName string) string

GetObsAPISvc returns observatorium api service.

func GetOperandName

func GetOperandName(name string) string

func GetOperandNamePrefix

func GetOperandNamePrefix() string

func GetReplicas

func GetReplicas(component string, advanced *observabilityv1beta2.AdvancedConfig) *int32

func GetRouteHost

func GetRouteHost(client client.Client, name string, namespace string) (string, error)

func GetTenantUID

func GetTenantUID() string

GetTenantUID returns tenant uid.

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

func IsPaused(annotations map[string]string) bool

IsPaused returns true if the multiclusterobservability instance is labeled as paused, and false otherwise.

func IsValidAzureConf

func IsValidAzureConf(data []byte) (bool, error)

IsValidAzureConf is used to validate azure configuration.

func IsValidGCSConf

func IsValidGCSConf(data []byte) (bool, error)

IsValidGCSConf is used to validate GCS configuration.

func IsValidS3Conf

func IsValidS3Conf(data []byte) (bool, error)

IsValidS3Conf is used to validate s3 configuration.

func ReadImageManifestConfigMap

func ReadImageManifestConfigMap(c client.Client, version string) (bool, error)

ReadImageManifestConfigMap reads configmap with the label ocm-configmap-type=image-manifest.

func ReplaceImage

func ReplaceImage(annotations map[string]string, imageRepo, componentName string) (bool, string)

ReplaceImage is used to replace the image with specified annotation or imagemanifest configmap.

func SetAlertingDisabled

func SetAlertingDisabled(status bool)

Set AnnotationMCOAlerting.

func SetCertDuration

func SetCertDuration(annotations map[string]string)

func SetCustomRuleConfigMap

func SetCustomRuleConfigMap(hasConfigMap bool)

SetCustomRuleConfigMap set true if there is custom rule configmap.

func SetImageManifests

func SetImageManifests(images map[string]string)

SetImageManifests sets imageManifests.

func SetMonitoringCRName

func SetMonitoringCRName(crName string)

SetMonitoringCRName sets the cr name.

func SetOperandNames

func SetOperandNames(c client.Client) error

func WithoutResourcesRequests

func WithoutResourcesRequests(annotations map[string]string) bool

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

type ObjectStorgeConf struct {
	Type   string `yaml:"type"`
	Config Config `yaml:"config"`
}

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.

Jump to

Keyboard shortcuts

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