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

     1  package schema_registry
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"strconv"
     7  
     8  	"github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/config"
     9  	"github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/environment"
    10  	"github.com/smartcontractkit/chainlink-testing-framework/libs/utils/projectpath"
    11  )
    12  
    13  type Props struct {
    14  }
    15  
    16  type Chart struct {
    17  	Name    string
    18  	Path    string
    19  	Version string
    20  	Props   *Props
    21  	Values  *map[string]interface{}
    22  }
    23  
    24  func (m Chart) IsDeploymentNeeded() bool {
    25  	return true
    26  }
    27  
    28  func (m Chart) GetName() string {
    29  	return m.Name
    30  }
    31  
    32  func (m Chart) GetPath() string {
    33  	return m.Path
    34  }
    35  
    36  func (m Chart) GetVersion() string {
    37  	return m.Version
    38  }
    39  
    40  func (m Chart) GetProps() interface{} {
    41  	return m.Props
    42  }
    43  
    44  func (m Chart) GetValues() *map[string]interface{} {
    45  	return m.Values
    46  }
    47  
    48  func (m Chart) ExportData(e *environment.Environment) error {
    49  	return nil
    50  }
    51  
    52  func defaultProps() map[string]interface{} {
    53  	return map[string]interface{}{}
    54  }
    55  
    56  func New(props map[string]interface{}) environment.ConnectedChart {
    57  	return NewVersioned("", props)
    58  }
    59  
    60  // NewVersioned enables choosing a specific helm chart version
    61  func NewVersioned(helmVersion string, props map[string]interface{}) environment.ConnectedChart {
    62  	dp := defaultProps()
    63  	config.MustMerge(&dp, props)
    64  	chartPath := "chainlink-qa/schema-registry"
    65  	if b, err := strconv.ParseBool(os.Getenv(config.EnvVarLocalCharts)); err == nil && b {
    66  		chartPath = fmt.Sprintf("%s/schema-registry", projectpath.ChartsRoot)
    67  	}
    68  	return Chart{
    69  		Name:    "cp-schema-registry",
    70  		Path:    chartPath,
    71  		Values:  &dp,
    72  		Version: helmVersion,
    73  	}
    74  }