github.com/smartcontractkit/chainlink-testing-framework/libs@v0.0.0-20240227141906-ec710b4eb1a3/k8s/presets/presets.go (about) 1 package presets 2 3 import ( 4 "github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/environment" 5 "github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/pkg/cdk8s/blockscout" 6 "github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/pkg/helm/chainlink" 7 "github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/pkg/helm/ethereum" 8 "github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/pkg/helm/mockserver" 9 mockservercfg "github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/pkg/helm/mockserver-cfg" 10 "github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/pkg/helm/reorg" 11 ) 12 13 var BaseToml = `[Log] 14 Level = "debug" 15 JSONConsole = true 16 [Log.File] 17 MaxSize = "0b" 18 [WebServer] 19 AllowOrigins = "*" 20 HTTPPort = 6688 21 SecureCookies = false 22 SessionTimeout = "999h0m0s" 23 [WebServer.RateLimit] 24 Authenticated = 2000 25 Unauthenticated = 100 26 [WebServer.TLS] 27 HTTPSPort = 0 28 [Database] 29 MaxIdleConns = 20 30 MaxOpenConns = 40 31 MigrateOnStartup = true 32 [OCR2] 33 Enabled = true 34 [P2P] 35 [P2P.V2] 36 ListenAddresses = ["0.0.0.0:6690"]` 37 38 func OnlyRemoteRunner(config *environment.Config) *environment.Environment { 39 return environment.New(config) 40 } 41 42 // EVMOneNode local development Chainlink deployment 43 func EVMOneNode(config *environment.Config) (*environment.Environment, error) { 44 45 c := chainlink.New(0, map[string]any{ 46 "replicas": 1, 47 "toml": BaseToml, 48 }) 49 50 return environment.New(config). 51 AddHelm(mockservercfg.New(nil)). 52 AddHelm(mockserver.New(nil)). 53 AddHelm(ethereum.New(nil)). 54 AddHelm(c), nil 55 } 56 57 // EVMMinimalLocalBS local development Chainlink deployment, 58 // 1 bootstrap + 4 oracles (minimal requirements for OCR) + Blockscout 59 func EVMMinimalLocalBS(config *environment.Config) (*environment.Environment, error) { 60 c := chainlink.New(0, map[string]any{ 61 "replicas": 5, 62 "toml": BaseToml, 63 }) 64 return environment.New(config). 65 AddChart(blockscout.New(&blockscout.Props{})). 66 AddHelm(mockservercfg.New(nil)). 67 AddHelm(mockserver.New(nil)). 68 AddHelm(ethereum.New(nil)). 69 AddHelm(c), nil 70 } 71 72 // EVMMinimalLocal local development Chainlink deployment, 73 // 1 bootstrap + 4 oracles (minimal requirements for OCR) 74 func EVMMinimalLocal(config *environment.Config) *environment.Environment { 75 return environment.New(config). 76 AddHelm(mockservercfg.New(nil)). 77 AddHelm(mockserver.New(nil)). 78 AddHelm(ethereum.New(nil)). 79 AddHelm(chainlink.New(0, map[string]interface{}{ 80 "replicas": 5, 81 "toml": BaseToml, 82 })) 83 } 84 85 // EVMMinimalLocal local development Chainlink deployment, 86 // 1 bootstrap + 4 oracles (minimal requirements for OCR) 87 func EVMMultipleNodesWithDiffDBVersion(config *environment.Config) *environment.Environment { 88 return environment.New(config). 89 AddHelm(mockservercfg.New(nil)). 90 AddHelm(mockserver.New(nil)). 91 AddHelm(ethereum.New(nil)). 92 AddHelm(chainlink.New(0, map[string]interface{}{ 93 "toml": BaseToml, 94 "nodes": []map[string]any{ 95 { 96 "name": "node-1", 97 "db": map[string]any{ 98 "image": map[string]any{ 99 "image": "postgres", 100 "version": "13.12", 101 }, 102 }, 103 }, 104 { 105 "name": "node-2", 106 "db": map[string]any{ 107 "image": map[string]any{ 108 "image": "postgres", 109 "version": "14.9", 110 }, 111 }, 112 }, 113 { 114 "name": "node-3", 115 "db": map[string]any{ 116 "image": map[string]any{ 117 "image": "postgres", 118 "version": "15.4", 119 }, 120 }, 121 }, 122 }, 123 })) 124 } 125 126 // EVMReorg deployment for two Ethereum networks re-org test 127 func EVMReorg(config *environment.Config) (*environment.Environment, error) { 128 var clToml = `[[EVM]] 129 ChainID = '1337' 130 FinalityDepth = 200 131 132 [[EVM.Nodes]] 133 Name = 'geth' 134 WSURL = 'ws://geth-ethereum-geth:8546' 135 HTTPURL = 'http://geth-ethereum-geth:8544' 136 137 [EVM.HeadTracker] 138 HistoryDepth = 400 139 [OCR2] 140 Enabled = true 141 [P2P] 142 [P2P.V2] 143 ListenAddresses = ["0.0.0.0:6690"]` 144 c := chainlink.New(0, map[string]interface{}{ 145 "replicas": 5, 146 "toml": clToml, 147 }) 148 149 return environment.New(config). 150 AddHelm(mockservercfg.New(nil)). 151 AddHelm(mockserver.New(nil)). 152 AddHelm(reorg.New(&reorg.Props{ 153 NetworkName: "geth", 154 NetworkType: "geth-reorg", 155 Values: map[string]interface{}{ 156 "geth": map[string]interface{}{ 157 "genesis": map[string]interface{}{ 158 "networkId": "1337", 159 }, 160 }, 161 }, 162 })). 163 AddHelm(reorg.New(&reorg.Props{ 164 NetworkName: "geth-2", 165 NetworkType: "geth-reorg", 166 Values: map[string]interface{}{ 167 "geth": map[string]interface{}{ 168 "genesis": map[string]interface{}{ 169 "networkId": "2337", 170 }, 171 }, 172 }, 173 })). 174 AddHelm(c), nil 175 } 176 177 // EVMSoak deployment for a long running soak tests 178 func EVMSoak(config *environment.Config) *environment.Environment { 179 return environment.New(config). 180 AddHelm(mockservercfg.New(nil)). 181 AddHelm(mockserver.New(nil)). 182 AddHelm(ethereum.New(ðereum.Props{ 183 Simulated: true, 184 Values: map[string]interface{}{ 185 "resources": map[string]interface{}{ 186 "requests": map[string]interface{}{ 187 "cpu": "1000m", 188 "memory": "2048Mi", 189 }, 190 "limits": map[string]interface{}{ 191 "cpu": "1000m", 192 "memory": "2048Mi", 193 }, 194 }, 195 }, 196 })). 197 AddHelm(chainlink.New(0, map[string]interface{}{ 198 "replicas": 5, 199 "toml": BaseToml, 200 "db": map[string]interface{}{ 201 "stateful": true, 202 "capacity": "1Gi", 203 "resources": map[string]interface{}{ 204 "requests": map[string]interface{}{ 205 "cpu": "250m", 206 "memory": "256Mi", 207 }, 208 "limits": map[string]interface{}{ 209 "cpu": "250m", 210 "memory": "256Mi", 211 }, 212 }, 213 }, 214 "chainlink": map[string]interface{}{ 215 "resources": map[string]interface{}{ 216 "requests": map[string]interface{}{ 217 "cpu": "1000m", 218 "memory": "2048Mi", 219 }, 220 "limits": map[string]interface{}{ 221 "cpu": "1000m", 222 "memory": "2048Mi", 223 }, 224 }, 225 }, 226 })) 227 }