github.com/kotalco/kotal@v0.3.0/clients/ethereum2/lighthouse_validator_client.go (about)

     1  package ethereum2
     2  
     3  import (
     4  	"strings"
     5  
     6  	ethereum2v1alpha1 "github.com/kotalco/kotal/apis/ethereum2/v1alpha1"
     7  	"github.com/kotalco/kotal/controllers/shared"
     8  	corev1 "k8s.io/api/core/v1"
     9  )
    10  
    11  // LighthouseValidatorClient is SigmaPrime Ethereum 2.0 validator client
    12  // https://github.com/sigp/lighthouse
    13  type LighthouseValidatorClient struct {
    14  	validator *ethereum2v1alpha1.Validator
    15  }
    16  
    17  // HomeDir returns container home directory
    18  func (t *LighthouseValidatorClient) HomeDir() string {
    19  	return LighthouseHomeDir
    20  }
    21  
    22  // Command returns environment variables for the client
    23  func (t *LighthouseValidatorClient) Env() []corev1.EnvVar {
    24  	return nil
    25  }
    26  
    27  // Args returns command line arguments required for client
    28  func (t *LighthouseValidatorClient) Args() (args []string) {
    29  
    30  	validator := t.validator
    31  
    32  	args = append(args, LighthouseDataDir, shared.PathData(t.HomeDir()))
    33  
    34  	args = append(args, LighthouseDebugLevel, string(t.validator.Spec.Logging))
    35  
    36  	args = append(args, LighthouseNetwork, validator.Spec.Network)
    37  
    38  	args = append(args, LighthouseFeeRecipient, string(validator.Spec.FeeRecipient))
    39  
    40  	if len(validator.Spec.BeaconEndpoints) != 0 {
    41  		args = append(args, LighthouseBeaconNodeEndpoints, strings.Join(validator.Spec.BeaconEndpoints, ","))
    42  	}
    43  
    44  	if validator.Spec.Graffiti != "" {
    45  		args = append(args, LighthouseGraffiti, validator.Spec.Graffiti)
    46  	}
    47  
    48  	return
    49  }
    50  
    51  // Command returns command for running the client
    52  func (t *LighthouseValidatorClient) Command() (command []string) {
    53  	command = []string{"lighthouse", "vc"}
    54  	return
    55  }