github.com/kotalco/kotal@v0.3.0/clients/ethereum2/teku_beacon_node.go (about) 1 package ethereum2 2 3 import ( 4 "fmt" 5 "strings" 6 7 ethereum2v1alpha1 "github.com/kotalco/kotal/apis/ethereum2/v1alpha1" 8 "github.com/kotalco/kotal/controllers/shared" 9 corev1 "k8s.io/api/core/v1" 10 ) 11 12 // TekuBeaconNode is ConsenSys Pegasys Ethereum 2.0 client 13 // https://github.com/Consensys/teku/ 14 type TekuBeaconNode struct { 15 node *ethereum2v1alpha1.BeaconNode 16 } 17 18 // HomeDir returns container home directory 19 func (t *TekuBeaconNode) HomeDir() string { 20 return TekuHomeDir 21 } 22 23 // Args returns command line arguments required for client 24 func (t *TekuBeaconNode) Args() (args []string) { 25 26 node := t.node 27 28 args = append(args, TekuDataPath, shared.PathData(t.HomeDir())) 29 30 args = append(args, TekuNetwork, node.Spec.Network) 31 32 args = append(args, TekuLogging, strings.ToUpper(string(node.Spec.Logging))) 33 34 args = append(args, TekuExecutionEngineEndpoint, node.Spec.ExecutionEngineEndpoint) 35 36 args = append(args, TekuFeeRecipient, string(node.Spec.FeeRecipient)) 37 38 jwtSecretPath := fmt.Sprintf("%s/jwt.secret", shared.PathSecrets(t.HomeDir())) 39 args = append(args, TekuJwtSecretFile, jwtSecretPath) 40 41 if node.Spec.REST { 42 args = append(args, TekuRestEnabled) 43 args = append(args, TekuRESTAPICorsOrigins, strings.Join(node.Spec.CORSDomains, ",")) 44 args = append(args, TekuRESTAPIHostAllowlist, strings.Join(node.Spec.Hosts, ",")) 45 args = append(args, TekuRestPort, fmt.Sprintf("%d", node.Spec.RESTPort)) 46 args = append(args, TekuRestHost, shared.Host(node.Spec.REST)) 47 } 48 49 if node.Spec.CheckpointSyncURL != "" { 50 args = append(args, TekuInitialState, node.Spec.CheckpointSyncURL) 51 } 52 53 args = append(args, TekuP2PPort, fmt.Sprintf("%d", node.Spec.P2PPort)) 54 55 return 56 } 57 58 // Command returns command for running the client 59 func (t *TekuBeaconNode) Command() (command []string) { 60 return 61 } 62 63 // Command returns environment variables for running the client 64 func (t *TekuBeaconNode) Env() []corev1.EnvVar { 65 return nil 66 }