| 73 | } |
| 74 | |
| 75 | func NewQuerierWithConfigFile(name string, store RingStore, address, configFile string, flags map[string]string, image string) *CortexService { |
| 76 | if configFile != "" { |
| 77 | flags["-config.file"] = filepath.Join(e2e.ContainerSharedDir, configFile) |
| 78 | } |
| 79 | |
| 80 | // Configure the ingesters ring backend and the store-gateway ring backend. |
| 81 | ringBackendFlags := map[string]string{ |
| 82 | "-ring.store": string(store), |
| 83 | "-store-gateway.sharding-ring.store": string(store), |
| 84 | } |
| 85 | |
| 86 | switch store { |
| 87 | case RingStoreConsul: |
| 88 | ringBackendFlags["-consul.hostname"] = address |
| 89 | ringBackendFlags["-store-gateway.sharding-ring.consul.hostname"] = address |
| 90 | case RingStoreEtcd: |
| 91 | ringBackendFlags["-etcd.endpoints"] = address |
| 92 | ringBackendFlags["-store-gateway.sharding-ring.etcd.endpoints"] = address |
| 93 | } |
| 94 | |
| 95 | // For backward compatibility |
| 96 | flags = e2e.MergeFlagsWithoutRemovingEmpty(ringBackendFlags, flags) |
| 97 | |
| 98 | if image == "" { |
| 99 | image = GetDefaultImage() |
| 100 | } |
| 101 | |
| 102 | return NewCortexService( |
| 103 | name, |
| 104 | image, |
| 105 | e2e.NewCommandWithoutEntrypoint("cortex", e2e.BuildArgs(e2e.MergeFlags(map[string]string{ |
| 106 | "-target": "querier", |
| 107 | "-log.level": "warn", |
| 108 | "-distributor.replication-factor": "1", |
| 109 | // Query-frontend worker. |
| 110 | "-querier.frontend-client.backoff-min-period": "100ms", |
| 111 | "-querier.frontend-client.backoff-max-period": "100ms", |
| 112 | "-querier.frontend-client.backoff-retries": "1", |
| 113 | "-querier.worker-parallelism": "1", |
| 114 | // Quickly detect query-frontend and query-scheduler when running it. |
| 115 | "-querier.dns-lookup-period": "1s", |
| 116 | // Store-gateway ring backend. |
| 117 | "-store-gateway.sharding-enabled": "true", |
| 118 | "-store-gateway.sharding-ring.replication-factor": "1", |
| 119 | }, flags))...), |
| 120 | e2e.NewHTTPReadinessProbe(httpPort, "/ready", 200, 299), |
| 121 | httpPort, |
| 122 | grpcPort, |
| 123 | ) |
| 124 | } |
| 125 | |
| 126 | func NewStoreGateway(name string, store RingStore, address string, flags map[string]string, image string) *CortexService { |
| 127 | return NewStoreGatewayWithConfigFile(name, store, address, "", flags, image) |