github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/boom/api/latest/metricspersisting.go (about)

     1  package latest
     2  
     3  import (
     4  	"github.com/caos/orbos/internal/operator/boom/api/latest/storage"
     5  	"github.com/caos/orbos/pkg/kubernetes/k8s"
     6  )
     7  
     8  type MetricsPersisting struct {
     9  	//Flag if tool should be deployed
    10  	//@default: false
    11  	Deploy bool `json:"deploy" yaml:"deploy"`
    12  	//Spec to define which metrics should get scraped
    13  	//@default: nil
    14  	Metrics *Metrics `json:"metrics,omitempty" yaml:"metrics,omitempty"`
    15  	//Spec to define how the persistence should be handled
    16  	//@default: nil
    17  	Storage *storage.Spec `json:"storage,omitempty" yaml:"storage,omitempty"`
    18  	//Configuration to write to remote prometheus
    19  	RemoteWrite *RemoteWrite `json:"remoteWrite,omitempty" yaml:"remoteWrite,omitempty"`
    20  	//Static labels added to metrics
    21  	ExternalLabels map[string]string `json:"externalLabels,omitempty" yaml:"externalLabels,omitempty"`
    22  	//NodeSelector for statefulset
    23  	NodeSelector map[string]string `json:"nodeSelector,omitempty" yaml:"nodeSelector,omitempty"`
    24  	//Tolerations to run prometheus on nodes
    25  	Tolerations k8s.Tolerations `json:"tolerations,omitempty" yaml:"tolerations,omitempty"`
    26  	//Resource requirements
    27  	Resources *k8s.Resources `json:"resources,omitempty" yaml:"resources,omitempty"`
    28  	//Overwrite used image
    29  	OverwriteImage string `json:"overwriteImage,omitempty" yaml:"overwriteImage,omitempty"`
    30  	//Overwrite used image version
    31  	OverwriteVersion string `json:"overwriteVersion,omitempty" yaml:"overwriteVersion,omitempty"`
    32  }
    33  
    34  // Metrics: When the metrics spec is nil all metrics will get scraped.
    35  type Metrics struct {
    36  	//Bool if metrics should get scraped from ambassador
    37  	Ambassador bool `json:"ambassador"`
    38  	//Bool if metrics should get scraped from argo-cd
    39  	Argocd bool `json:"argocd"`
    40  	//Bool if metrics should get scraped from kube-state-metrics
    41  	KubeStateMetrics bool `json:"kube-state-metrics" yaml:"kube-state-metrics"`
    42  	//Bool if metrics should get scraped from prometheus
    43  	Prometheus bool `json:"prometheus" yaml:"prometheus"`
    44  	//Bool if metrics should get scraped from prometheus-node-exporter
    45  	PrometheusNodeExporter bool `json:"prometheus-node-exporter" yaml:"prometheus-node-exporter"`
    46  	//Bool if metrics should get scraped from prometheus-systemd-exporter
    47  	PrometheusSystemdExporter bool `json:"prometheus-systemd-exporter" yaml:"prometheus-systemd-exporter"`
    48  	//Bool if metrics should get scraped from kube-api-server
    49  	APIServer bool `json:"api-server" yaml:"api-server"`
    50  	//Bool if metrics should get scraped from prometheus-operator
    51  	PrometheusOperator bool `json:"prometheus-operator" yaml:"prometheus-operator"`
    52  	//Bool if metrics should get scraped from logging-operator
    53  	LoggingOperator bool `json:"logging-operator" yaml:"logging-operator"`
    54  	//Bool if metrics should get scraped from loki
    55  	Loki bool `json:"loki"`
    56  	//Bool if metrics should get scraped from BOOM
    57  	Boom bool `json:"boom" yaml:"boom"`
    58  	//Bool if metrics should get scraped from ORBITER
    59  	Orbiter bool `json:"orbiter" yaml:"orbiter"`
    60  	//Bool if metrics should get scraped from ZITADEL
    61  	Zitadel bool `json:"zitadel" yaml:"zitadel"`
    62  	//Bool if metrics should get scraped from database
    63  	Database bool `json:"database" yaml:"database"`
    64  	//Bool if metrics should get scraped from networking
    65  	Networking bool `json:"networking" yaml:"networking"`
    66  }
    67  
    68  type RemoteWrite struct {
    69  	//URL of the endpoint of the remote prometheus
    70  	URL string `json:"url" yaml:"url"`
    71  	//Basic-auth-configuration to push metrics to remote prometheus
    72  	BasicAuth *BasicAuth `json:"basicAuth,omitempty" yaml:"basicAuth,omitempty"`
    73  	//RelabelConfigs for remote write
    74  	RelabelConfigs []*RelabelConfig `json:"relabelConfigs,omitempty" yaml:"relabelConfigs,omitempty"`
    75  }
    76  type RelabelConfig struct {
    77  	//The source labels select values from existing labels. Their content is concatenated using the configured separator and matched against the configured regular expression for the replace, keep, and drop actions.
    78  	SourceLabels []string `json:"sourceLabels,omitempty" yaml:"sourceLabels,omitempty"`
    79  	//Separator placed between concatenated source label values. default is ';'.
    80  	Separator string `json:"separator,omitempty" yaml:"separator,omitempty"`
    81  	//Label to which the resulting value is written in a replace action. It is mandatory for replace actions. Regex capture groups are available.
    82  	TargetLabel string `json:"targetLabel,omitempty" yaml:"targetLabel,omitempty"`
    83  	//Regular expression against which the extracted value is matched. Default is '(.*)'
    84  	Regex string `json:"regex,omitempty" yaml:"regex,omitempty"`
    85  	//Modulus to take of the hash of the source label values.
    86  	Modulus string `json:"modulus,omitempty" yaml:"modulus,omitempty"`
    87  	//Replacement value against which a regex replace is performed if the regular expression matches. Regex capture groups are available. Default is '$1'
    88  	Replacement string `json:"replacement,omitempty" yaml:"replacement,omitempty"`
    89  	//Action to perform based on regex matching. Default is 'replace'
    90  	Action string `json:"action,omitempty" yaml:"action,omitempty"`
    91  }
    92  type BasicAuth struct {
    93  	//Username to push metrics to remote prometheus
    94  	Username *SecretKeySelector `json:"username" yaml:"username"`
    95  	//Password to push metrics to remote prometheus
    96  	Password *SecretKeySelector `json:"password" yaml:"password"`
    97  }
    98  type SecretKeySelector struct {
    99  	//Name of the existing secret
   100  	Name string `json:"name" yaml:"name"`
   101  	//Name of the key with the value in the existing secret
   102  	Key string `json:"key" yaml:"key"`
   103  }