Documentation ¶
Index ¶
- Constants
- func ApplyDefaultSettings(opts *Options) error
- func ApplyGatewayDefaultOptions(opts *Options) error
- func ApplyTLSSettings(opts *Options, profile *openshiftconfigv1.TLSSecurityProfile) error
- func BuildAll(opts Options) ([]client.Object, error)
- func BuildCompactor(opts Options) ([]client.Object, error)
- func BuildDistributor(opts Options) ([]client.Object, error)
- func BuildGateway(opts Options) ([]client.Object, error)
- func BuildIndexGateway(opts Options) ([]client.Object, error)
- func BuildIngester(opts Options) ([]client.Object, error)
- func BuildLokiGossipRingService(stackName string) *corev1.Service
- func BuildPrometheusRule(opts Options) ([]client.Object, error)
- func BuildQuerier(opts Options) ([]client.Object, error)
- func BuildQueryFrontend(opts Options) ([]client.Object, error)
- func BuildRuler(opts Options) ([]client.Object, error)
- func BuildServiceAccount(opts Options) client.Object
- func BuildServiceMonitors(opts Options) []client.Object
- func CompactorName(stackName string) string
- func ComponentLabels(component, stackName string) labels.Set
- func ConfigOptions(opt Options) config.Options
- func ConfigureOptionsForMode(cfg *config.Options, opt Options) error
- func DefaultLokiStackSpec(size lokiv1.LokiStackSizeType) *lokiv1.LokiStackSpec
- func DistributorName(stackName string) string
- func GatewayName(stackName string) string
- func GossipLabels() map[string]string
- func IndexGatewayName(stackName string) string
- func IngesterName(stackName string) string
- func LokiConfigMap(opt Options) (*corev1.ConfigMap, string, error)
- func MutateFuncFor(existing, desired client.Object, depAnnotations map[string]string) controllerutil.MutateFn
- func NewCompactorGRPCService(opts Options) *corev1.Service
- func NewCompactorHTTPService(opts Options) *corev1.Service
- func NewCompactorServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
- func NewCompactorStatefulSet(opts Options) *appsv1.StatefulSet
- func NewDistributorDeployment(opts Options) *appsv1.Deployment
- func NewDistributorGRPCService(opts Options) *corev1.Service
- func NewDistributorHTTPService(opts Options) *corev1.Service
- func NewDistributorServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
- func NewGatewayDeployment(opts Options, sha1C string) *appsv1.Deployment
- func NewGatewayHTTPService(opts Options) *corev1.Service
- func NewGatewayIngress(opts Options) (*networkingv1.Ingress, error)
- func NewGatewayPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget
- func NewGatewayServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
- func NewIndexGatewayGRPCService(opts Options) *corev1.Service
- func NewIndexGatewayHTTPService(opts Options) *corev1.Service
- func NewIndexGatewayPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget
- func NewIndexGatewayServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
- func NewIndexGatewayStatefulSet(opts Options) *appsv1.StatefulSet
- func NewIngesterGRPCService(opts Options) *corev1.Service
- func NewIngesterHTTPService(opts Options) *corev1.Service
- func NewIngesterServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
- func NewIngesterStatefulSet(opts Options) *appsv1.StatefulSet
- func NewPrometheusRule(opts Options) (*monitoringv1.PrometheusRule, error)
- func NewQuerierDeployment(opts Options) *appsv1.Deployment
- func NewQuerierGRPCService(opts Options) *corev1.Service
- func NewQuerierHTTPService(opts Options) *corev1.Service
- func NewQuerierPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget
- func NewQuerierServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
- func NewQueryFrontendDeployment(opts Options) *appsv1.Deployment
- func NewQueryFrontendGRPCService(opts Options) *corev1.Service
- func NewQueryFrontendHTTPService(opts Options) *corev1.Service
- func NewQueryFrontendPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget
- func NewQueryFrontendServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
- func NewRulerGRPCService(opts Options) *corev1.Service
- func NewRulerHTTPService(opts Options) *corev1.Service
- func NewRulerPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget
- func NewRulerServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
- func NewRulerStatefulSet(opts Options) *appsv1.StatefulSet
- func NewServiceAccount(opts Options) client.Object
- func NewServiceAccountTokenSecret(opts Options) client.Object
- func PrometheusRuleName(stackName string) string
- func QuerierName(stackName string) string
- func QueryFrontendName(stackName string) string
- func RulerName(stackName string) string
- func RulesConfigMapName(stackName string) string
- func RulesConfigMapShards(opts *Options) ([]*corev1.ConfigMap, error)
- func RulesStorageVolumeName() string
- func TenantCAPath(tennantName, key string) string
- type GatewayTimeoutConfig
- type MTLSSecret
- type OIDCSecret
- type Options
- type RuleName
- type Ruler
- type RulerSecret
- type ShardedConfigMap
- type TLSProfileSpec
- type TenantConfig
- type TenantOIDCSpec
- type TenantOPASpec
- type TenantOpenShiftSpec
- type TenantSecrets
- type Tenants
- type TimeoutConfig
Constants ¶
const ( // EnvRelatedImageLoki is the environment variable to fetch the Loki image pullspec. EnvRelatedImageLoki = "RELATED_IMAGE_LOKI" // EnvRelatedImageGateway is the environment variable to fetch the Gateway image pullspec. EnvRelatedImageGateway = "RELATED_IMAGE_GATEWAY" // DefaultContainerImage declares the default fallback for loki image. DefaultContainerImage = "docker.io/grafana/loki:3.2.1" // DefaultLokiStackGatewayImage declares the default image for lokiStack-gateway. DefaultLokiStackGatewayImage = "quay.io/observatorium/api:latest" // PrometheusCAFile declares the path for prometheus CA file for service monitors. PrometheusCAFile string = "/etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt" // BearerTokenFile declares the path for bearer token file for service monitors. BearerTokenFile string = "/var/run/secrets/kubernetes.io/serviceaccount/token" // AnnotationCertRotationRequiredAt stores the point in time the last cert rotation happened AnnotationCertRotationRequiredAt string = "loki.grafana.com/certRotationRequiredAt" // AnnotationLokiConfigHash stores the last SHA1 hash of the loki configuration AnnotationLokiConfigHash string = "loki.grafana.com/config-hash" // AnnotationLokiObjectStoreHash stores the last SHA1 hash of the loki object storage credetials. AnnotationLokiObjectStoreHash string = "loki.grafana.com/object-store-hash" // AnnotationLokiTokenCCOAuthHash stores the SHA1 hash of the secret generated by the Cloud Credential Operator. AnnotationLokiTokenCCOAuthHash string = "loki.grafana.com/token-cco-auth-hash" // LabelCompactorComponent is the label value for the compactor component LabelCompactorComponent string = "compactor" // LabelDistributorComponent is the label value for the distributor component LabelDistributorComponent string = "distributor" // LabelIngesterComponent is the label value for the ingester component LabelIngesterComponent string = "ingester" // LabelQuerierComponent is the label value for the querier component LabelQuerierComponent string = "querier" // LabelQueryFrontendComponent is the label value for the query frontend component LabelQueryFrontendComponent string = "query-frontend" // LabelIndexGatewayComponent is the label value for the lokiStack-index-gateway component LabelIndexGatewayComponent string = "index-gateway" // LabelRulerComponent is the label value for the lokiStack-ruler component LabelRulerComponent string = "ruler" // LabelGatewayComponent is the label value for the lokiStack-gateway component LabelGatewayComponent string = "lokistack-gateway" )
const MaxConfigMapDataSizeBytes = (1 * 1024 * 1024) - 50_000
MaxConfigMapDataSizeBytes is the maximum data size in bytes that a single ConfigMap may contain. This is lower than 1MB in order to reserve space for metadata
Variables ¶
This section is empty.
Functions ¶
func ApplyDefaultSettings ¶
ApplyDefaultSettings manipulates the options to conform to build specifications
func ApplyGatewayDefaultOptions ¶
ApplyGatewayDefaultOptions applies defaults on the LokiStackSpec depending on selected tenant mode. Currently nothing is applied for modes static and dynamic. For modes openshift-logging and openshift-network the tenant spec is filled with defaults for authentication and authorization.
func ApplyTLSSettings ¶
func ApplyTLSSettings(opts *Options, profile *openshiftconfigv1.TLSSecurityProfile) error
ApplyTLSSettings manipulates the options to conform to the TLS profile specifications
func BuildCompactor ¶
BuildCompactor builds the k8s objects required to run Loki Compactor.
func BuildDistributor ¶
BuildDistributor returns a list of k8s objects for Loki Distributor
func BuildGateway ¶
BuildGateway returns a list of k8s objects for Loki Stack Gateway
func BuildIndexGateway ¶
BuildIndexGateway returns a list of k8s objects for Loki IndexGateway
func BuildIngester ¶
BuildIngester builds the k8s objects required to run Loki Ingester
func BuildLokiGossipRingService ¶
BuildLokiGossipRingService creates a k8s service for the gossip/memberlist members of the cluster
func BuildPrometheusRule ¶
BuildPrometheusRule returns a list of k8s objects for Loki PrometheusRule
func BuildQuerier ¶
BuildQuerier returns a list of k8s objects for Loki Querier
func BuildQueryFrontend ¶
BuildQueryFrontend returns a list of k8s objects for Loki QueryFrontend
func BuildRuler ¶
BuildRuler returns a list of k8s objects for Loki Stack Ruler
func BuildServiceAccount ¶ added in v0.6.0
BuildServiceAccount returns a k8s object for the LokiStack serviceaccount.
func BuildServiceMonitors ¶
BuildServiceMonitors builds the service monitors
func CompactorName ¶
CompactorName is the name of the compactor statefulset
func ComponentLabels ¶
ComponentLabels is a list of all commonLabels including the app.kubernetes.io/component:<component> label
func ConfigOptions ¶
ConfigOptions converts Options to config.Options
func ConfigureOptionsForMode ¶
ConfigureOptionsForMode applies configuration depending on the mode type.
func DefaultLokiStackSpec ¶
func DefaultLokiStackSpec(size lokiv1.LokiStackSizeType) *lokiv1.LokiStackSpec
DefaultLokiStackSpec returns the default configuration for a LokiStack of the specified size
func DistributorName ¶
DistributorName is the name of the distributor deployment
func GatewayName ¶
GatewayName is the name of the lokiStack-gateway statefulset
func GossipLabels ¶
GossipLabels is the list of labels that should be assigned to components using the gossip ring
func IndexGatewayName ¶
IndexGatewayName is the name of the index-gateway statefulset
func IngesterName ¶
IngesterName is the name of the compactor statefulset
func LokiConfigMap ¶
LokiConfigMap creates the single configmap containing the loki configuration for the whole cluster
func MutateFuncFor ¶
func MutateFuncFor(existing, desired client.Object, depAnnotations map[string]string) controllerutil.MutateFn
MutateFuncFor returns a mutate function based on the existing resource's concrete type. It currently supports the following types and will return an error for other types:
- ConfigMap
- Secret
- Service
- ServiceAccount
- ClusterRole
- ClusterRoleBinding
- Role
- RoleBinding
- Deployment
- StatefulSet
- ServiceMonitor
- Ingress
- Route
- PrometheusRule
- PodDisruptionBudget
func NewCompactorGRPCService ¶
NewCompactorGRPCService creates a k8s service for the compactor GRPC endpoint
func NewCompactorHTTPService ¶
NewCompactorHTTPService creates a k8s service for the ingester HTTP endpoint
func NewCompactorServiceMonitor ¶
func NewCompactorServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
NewCompactorServiceMonitor creates a k8s service monitor for the compactor component
func NewCompactorStatefulSet ¶
func NewCompactorStatefulSet(opts Options) *appsv1.StatefulSet
NewCompactorStatefulSet creates a statefulset object for a compactor.
func NewDistributorDeployment ¶
func NewDistributorDeployment(opts Options) *appsv1.Deployment
NewDistributorDeployment creates a deployment object for a distributor
func NewDistributorGRPCService ¶
NewDistributorGRPCService creates a k8s service for the distributor GRPC endpoint
func NewDistributorHTTPService ¶
NewDistributorHTTPService creates a k8s service for the distributor HTTP endpoint
func NewDistributorServiceMonitor ¶
func NewDistributorServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
NewDistributorServiceMonitor creates a k8s service monitor for the distributor component
func NewGatewayDeployment ¶
func NewGatewayDeployment(opts Options, sha1C string) *appsv1.Deployment
NewGatewayDeployment creates a deployment object for a lokiStack-gateway
func NewGatewayHTTPService ¶
NewGatewayHTTPService creates a k8s service for the lokistack-gateway HTTP endpoint
func NewGatewayIngress ¶
func NewGatewayIngress(opts Options) (*networkingv1.Ingress, error)
NewGatewayIngress creates a k8s Ingress object for accessing the lokistack-gateway from public.
func NewGatewayPodDisruptionBudget ¶
func NewGatewayPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget
NewGatewayPodDisruptionBudget returns a PodDisruptionBudget for the LokiStack Gateway pods.
func NewGatewayServiceMonitor ¶
func NewGatewayServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
NewGatewayServiceMonitor creates a k8s service monitor for the lokistack-gateway component
func NewIndexGatewayGRPCService ¶
NewIndexGatewayGRPCService creates a k8s service for the index-gateway GRPC endpoint
func NewIndexGatewayHTTPService ¶
NewIndexGatewayHTTPService creates a k8s service for the index-gateway HTTP endpoint
func NewIndexGatewayPodDisruptionBudget ¶
func NewIndexGatewayPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget
NewIndexGatewayPodDisruptionBudget returns a PodDisruptionBudget for the LokiStack index-gateway pods.
func NewIndexGatewayServiceMonitor ¶
func NewIndexGatewayServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
NewIndexGatewayServiceMonitor creates a k8s service monitor for the index-gateway component
func NewIndexGatewayStatefulSet ¶
func NewIndexGatewayStatefulSet(opts Options) *appsv1.StatefulSet
NewIndexGatewayStatefulSet creates a statefulset object for an index-gateway
func NewIngesterGRPCService ¶
NewIngesterGRPCService creates a k8s service for the ingester GRPC endpoint
func NewIngesterHTTPService ¶
NewIngesterHTTPService creates a k8s service for the ingester HTTP endpoint
func NewIngesterServiceMonitor ¶
func NewIngesterServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
NewIngesterServiceMonitor creates a k8s service monitor for the ingester component
func NewIngesterStatefulSet ¶
func NewIngesterStatefulSet(opts Options) *appsv1.StatefulSet
NewIngesterStatefulSet creates a deployment object for an ingester
func NewPrometheusRule ¶
func NewPrometheusRule(opts Options) (*monitoringv1.PrometheusRule, error)
NewPrometheusRule creates a prometheus rule
func NewQuerierDeployment ¶
func NewQuerierDeployment(opts Options) *appsv1.Deployment
NewQuerierDeployment creates a deployment object for a querier
func NewQuerierGRPCService ¶
NewQuerierGRPCService creates a k8s service for the querier GRPC endpoint
func NewQuerierHTTPService ¶
NewQuerierHTTPService creates a k8s service for the querier HTTP endpoint
func NewQuerierPodDisruptionBudget ¶
func NewQuerierPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget
NewQuerierPodDisruptionBudget returns a PodDisruptionBudget for the LokiStack querier pods.
func NewQuerierServiceMonitor ¶
func NewQuerierServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
NewQuerierServiceMonitor creates a k8s service monitor for the querier component
func NewQueryFrontendDeployment ¶
func NewQueryFrontendDeployment(opts Options) *appsv1.Deployment
NewQueryFrontendDeployment creates a deployment object for a query-frontend
func NewQueryFrontendGRPCService ¶
NewQueryFrontendGRPCService creates a k8s service for the query-frontend GRPC endpoint
func NewQueryFrontendHTTPService ¶
NewQueryFrontendHTTPService creates a k8s service for the query-frontend HTTP endpoint
func NewQueryFrontendPodDisruptionBudget ¶
func NewQueryFrontendPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget
NewQueryFrontendPodDisruptionBudget returns a PodDisruptionBudget for the LokiStack query-frontend pods.
func NewQueryFrontendServiceMonitor ¶
func NewQueryFrontendServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
NewQueryFrontendServiceMonitor creates a k8s service monitor for the query-frontend component
func NewRulerGRPCService ¶
NewRulerGRPCService creates a k8s service for the ruler GRPC endpoint
func NewRulerHTTPService ¶
NewRulerHTTPService creates a k8s service for the ruler HTTP endpoint
func NewRulerPodDisruptionBudget ¶
func NewRulerPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget
NewRulerPodDisruptionBudget returns a PodDisruptionBudget for the LokiStack ruler pods.
func NewRulerServiceMonitor ¶
func NewRulerServiceMonitor(opts Options) *monitoringv1.ServiceMonitor
NewRulerServiceMonitor creates a k8s service monitor for the ruler component
func NewRulerStatefulSet ¶
func NewRulerStatefulSet(opts Options) *appsv1.StatefulSet
NewRulerStatefulSet creates a StatefulSet object for a ruler
func NewServiceAccount ¶
NewServiceAccount returns a k8s object for the LokiStack Gateway serviceaccount.
func NewServiceAccountTokenSecret ¶
NewServiceAccountTokenSecret returns a k8s object for the LokiStack Gateway secret. This secret represents the ServiceAccountToken.
func PrometheusRuleName ¶
PrometheusRuleName is the name of the loki-prometheus-rule
func QuerierName ¶
QuerierName is the name of the querier deployment
func QueryFrontendName ¶
QueryFrontendName is the name of the query-frontend statefulset
func RulesConfigMapName ¶
RulesConfigMapName is the name of the alerting/recording rules configmap
func RulesConfigMapShards ¶
RulesConfigMapShards returns a ConfigMap resource that contains all loki alerting and recording rules as YAML data. If the size of the data is more than 1MB, the ConfigMap will be split into multiple shards, and this function will return the list of shards
func RulesStorageVolumeName ¶
func RulesStorageVolumeName() string
RulesStorageVolumeName is the name of the rules volume
func TenantCAPath ¶
Types ¶
type GatewayTimeoutConfig ¶
type GatewayTimeoutConfig struct { ReadTimeout time.Duration WriteTimeout time.Duration UpstreamWriteTimeout time.Duration }
GatewayTimeoutConfig contains the http server configuration options for all Loki components.
type MTLSSecret ¶
type MTLSSecret struct {
CAPath string
}
type OIDCSecret ¶
type Options ¶
type Options struct { Name string Namespace string Image string GatewayImage string GatewayBaseDomain string ConfigSHA1 string CertRotationRequiredAt string Gates configv1.FeatureGates Stack lokiv1.LokiStackSpec ResourceRequirements internal.ComponentResources AlertingRules []lokiv1.AlertingRule RecordingRules []lokiv1.RecordingRule RulesConfigMapNames []string Ruler Ruler ObjectStorage storage.Options OpenShiftOptions openshift.Options Timeouts TimeoutConfig Tenants Tenants TLSProfile TLSProfileSpec }
Options is a set of configuration values to use when building manifests such as resource sizes, etc. Most of this should be provided - either directly or indirectly - by the user.
func (Options) TLSCipherSuites ¶
TLSCipherSuites transforms TLSProfileSpec.Ciphers from a slice to a string of elements joined with a comma.
type Ruler ¶
type Ruler struct { Spec *lokiv1.RulerConfigSpec Secret *RulerSecret }
Ruler configuration for manifests generation.
type RulerSecret ¶
type RulerSecret struct { // Username for basic authentication only. Username string // Password for basic authentication only. Password string // BearerToken contains the token used for bearer authentication. BearerToken string }
RulerSecret defines the ruler secret for remote write client auth
type ShardedConfigMap ¶
type ShardedConfigMap struct {
// contains filtered or unexported fields
}
ShardedConfigMap is the configmap data that is sharded across multiple configmaps in case MaxConfigMapDataSizeBytes is exceeded
func NewShardedConfigMap ¶
func NewShardedConfigMap(template *corev1.ConfigMap, namePrefix string) *ShardedConfigMap
NewShardedConfigMap takes a corev1.ConfigMap as template and a name prefix and returns a new ShardedConfigMap.
type TLSProfileSpec ¶
type TLSProfileSpec struct { // Ciphers is used to specify the cipher algorithms that are negotiated // during the TLS handshake. Ciphers []string // MinTLSVersion is used to specify the minimal version of the TLS protocol // that is negotiated during the TLS handshake. MinTLSVersion string }
TLSProfileSpec is the desired behavior of a TLSProfileType.
type TenantConfig ¶
type TenantConfig struct { OIDC *TenantOIDCSpec OPA *TenantOPASpec OpenShift *TenantOpenShiftSpec RuleFiles []string }
TenantConfig for tenant authorizationconfig
type TenantOIDCSpec ¶
type TenantOIDCSpec struct{}
TenantOIDCSpec stub config for OIDC configuration options (e.g. used in static or dynamic mode)
type TenantOPASpec ¶
type TenantOPASpec struct{}
TenantOPASpec stub config for OPA configuration options (e.g. used in dynamic mode)
type TenantOpenShiftSpec ¶
type TenantOpenShiftSpec struct {
CookieSecret string
}
TenantOpenShiftSpec config for OpenShift authentication options (e.g. used in openshift-logging mode)
type TenantSecrets ¶
type TenantSecrets struct { TenantName string OIDCSecret *OIDCSecret MTLSSecret *MTLSSecret }
TenantSecrets for tenant's authentication.
type Tenants ¶
type Tenants struct { Secrets []*TenantSecrets Configs map[string]TenantConfig }
Tenants contains the configuration per tenant and secrets for authn/authz. Secrets are required only for modes static and dynamic to reconcile the OIDC provider. Configs are required only for all modes to reconcile rules and gateway configuration.
type TimeoutConfig ¶
type TimeoutConfig struct { Loki config.HTTPTimeoutConfig Gateway GatewayTimeoutConfig }
TimeoutConfig contains the server configuration options for all Loki components
func NewTimeoutConfig ¶
func NewTimeoutConfig(s *lokiv1.LimitsSpec) (TimeoutConfig, error)
NewTimeoutConfig creates a TimeoutConfig from the QueryTimeout values in the spec's limits.
Source Files ¶
- build.go
- compactor.go
- config.go
- config_otlp.go
- distributor.go
- gateway.go
- gateway_tenants.go
- indexgateway.go
- ingester.go
- memberlist.go
- mutate.go
- node_placement.go
- options.go
- prometheus_rule.go
- proxy_env.go
- querier.go
- query-frontend.go
- ruler.go
- rules_config.go
- securitycontext.go
- service.go
- service_monitor.go
- serviceaccount.go
- shard_rules_configmap.go
- var.go