config

package
v0.0.0-...-009436c Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: Apache-2.0 Imports: 23 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"

	MCHUpdatedRequestName               = "mch-updated-request"
	MCOUpdatedRequestName               = "mco-updated-request"
	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"

	AlertmanagerAccessorSAName = "observability-alertmanager-accessor"
	/* #nosec */
	AlertmanagerAccessorSecretName = "observability-alertmanager-accessor"
	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"

	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"
)
View Source
const (
	DefaultImgRepository = "quay.io/open-cluster-management"
	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-2021-04-28-ee165b6"
	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"
	GrafanaDashboardLoaderKey  = "grafana_dashboard_loader"

	AlertManagerImgName           = "prometheus-alertmanager"
	AlertManagerImgKey            = "prometheus_alertmanager"
	ConfigmapReloaderImgRepo      = "quay.io/openshift"
	ConfigmapReloaderImgName      = "origin-configmap-reloader"
	ConfigmapReloaderImgTagSuffix = "4.8.0"
	ConfigmapReloaderKey          = "prometheus-config-reloader"

	OauthProxyImgRepo      = "quay.io/open-cluster-management"
	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 = "30d"
	RetentionResolution5m  = "180d"
	RetentionResolution1h  = "0d"
	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"
)
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 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 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 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 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"`

	// 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 compatiable configuration

type ObjectStorgeConf

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

ObjectStorgeConf is used to Unmarshal from bytes to do validation

Jump to

Keyboard shortcuts

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