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

     1  package metricspersisting
     2  
     3  import (
     4  	toolsetslatest "github.com/caos/orbos/internal/operator/boom/api/latest"
     5  	"github.com/caos/orbos/internal/operator/boom/application/applications/metriccollection"
     6  	"github.com/caos/orbos/internal/operator/boom/application/applications/metricspersisting/info"
     7  	"github.com/caos/orbos/internal/operator/boom/name"
     8  	"github.com/caos/orbos/mntr"
     9  )
    10  
    11  type Prometheus struct {
    12  	monitor mntr.Monitor
    13  	orb     string
    14  }
    15  
    16  func New(monitor mntr.Monitor, orb string) *Prometheus {
    17  	return &Prometheus{
    18  		monitor: monitor,
    19  		orb:     orb,
    20  	}
    21  }
    22  
    23  func (p *Prometheus) GetName() name.Application {
    24  	return info.GetName()
    25  }
    26  
    27  func (p *Prometheus) Deploy(toolsetCRDSpec *toolsetslatest.ToolsetSpec) bool {
    28  	//not possible to deploy when prometheus operator is not deployed
    29  
    30  	po := metriccollection.New(p.monitor)
    31  	if !po.Deploy(toolsetCRDSpec) {
    32  		return false
    33  	}
    34  
    35  	return toolsetCRDSpec.MetricCollection != nil && toolsetCRDSpec.MetricCollection.Deploy
    36  }
    37  
    38  func (p *Prometheus) GetNamespace() string {
    39  	return info.GetNamespace()
    40  }