github.com/smartcontractkit/chainlink-testing-framework/libs@v0.0.0-20240227141906-ec710b4eb1a3/k8s/pkg/helm/grafana/grafana.go (about)

     1  package grafana
     2  
     3  import (
     4  	"github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/config"
     5  	"github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/environment"
     6  )
     7  
     8  type Props struct {
     9  }
    10  
    11  type Chart struct {
    12  	Name    string
    13  	Path    string
    14  	Version string
    15  	Props   *Props
    16  	Values  *map[string]interface{}
    17  }
    18  
    19  func (m Chart) IsDeploymentNeeded() bool {
    20  	return true
    21  }
    22  
    23  func (m Chart) GetName() string {
    24  	return m.Name
    25  }
    26  
    27  func (m Chart) GetPath() string {
    28  	return m.Path
    29  }
    30  
    31  func (m Chart) GetVersion() string {
    32  	return m.Version
    33  }
    34  
    35  func (m Chart) GetProps() interface{} {
    36  	return m.Props
    37  }
    38  
    39  func (m Chart) GetValues() *map[string]interface{} {
    40  	return m.Values
    41  }
    42  
    43  func (m Chart) ExportData(e *environment.Environment) error {
    44  	return nil
    45  }
    46  
    47  func defaultProps() map[string]interface{} {
    48  	return map[string]interface{}{
    49  		"resources": map[string]interface{}{
    50  			"limits": map[string]interface{}{
    51  				"memory": "1000Mi",
    52  				"cpu":    "1.5",
    53  			},
    54  			"requests": map[string]interface{}{
    55  				"memory": "500Mi",
    56  				"cpu":    "1.0",
    57  			},
    58  		},
    59  		"rbac": map[string]interface{}{
    60  			"create": "false",
    61  		},
    62  		"testFramework": map[string]interface{}{
    63  			"enabled": false,
    64  		},
    65  	}
    66  }
    67  
    68  func New(props map[string]interface{}) environment.ConnectedChart {
    69  	return NewVersioned("", props)
    70  }
    71  
    72  // NewVersioned enables choosing a specific helm chart version
    73  func NewVersioned(helmVersion string, props map[string]interface{}) environment.ConnectedChart {
    74  	dp := defaultProps()
    75  	config.MustMerge(&dp, props)
    76  	return Chart{
    77  		Name:    "grafana",
    78  		Path:    "grafana/grafana",
    79  		Values:  &dp,
    80  		Version: helmVersion,
    81  	}
    82  }