@@ -25,11 +25,13 @@ import (
2525 "context"
2626 "errors"
2727 "io"
28- k8serrors "k8s.io/apimachinery/pkg/api/errors"
2928 "log"
3029 "text/template"
3130 "time"
3231
32+ k8serrors "k8s.io/apimachinery/pkg/api/errors"
33+ "k8s.io/utils/pointer"
34+
3335 "github.com/onsi/gomega"
3436 batchv1 "k8s.io/api/batch/v1"
3537 corev1 "k8s.io/api/core/v1"
6567 name: {{ .Name }}
6668 # This configuration will load ~1GB per data loader.
6769 args:
68- - --keys=1000000
70+ - --keys={{ .Keys }}
6971 - --batch-size=50
7072 - --value-size=1000
7173 env:
8587 value: /var/dynamic/fdb/primary/lib
8688 - name: FDB_NETWORK_OPTION_TRACE_LOG_GROUP
8789 value: {{ .Name }}
90+ - name: FDB_NETWORK_OPTION_TRACE_ENABLE
91+ value: "/tmp/fdb-trace-logs"
8892 - name: FDB_NETWORK_OPTION_EXTERNAL_CLIENT_DIRECTORY
8993 value: /var/dynamic/fdb/libs
9094 - name: PYTHONUNBUFFERED
97101 - name: fdb-certs
98102 mountPath: /tmp/fdb-certs
99103 readOnly: true
104+ - name: fdb-logs
105+ mountPath: /tmp/fdb-trace-logs
100106 resources:
101107 requests:
102108 cpu: "1"
@@ -161,11 +167,13 @@ spec:
161167 path: fdb.cluster
162168 - name: fdb-libs
163169 emptyDir: {}
170+ - name: fdb-logs
171+ emptyDir: {}
164172 - name: fdb-certs
165173 secret:
166174 secretName: {{ .SecretName }}`
167175
168- // For now we only load 2GB into the cluster, we can increase this later if we want.
176+ // For now, we only load 2GB into the cluster, we can increase this later if we want.
169177 dataLoaderJobUnifiedImage = `apiVersion: batch/v1
170178kind: Job
171179metadata:
@@ -185,7 +193,7 @@ spec:
185193 name: {{ .Name }}
186194 # This configuration will load ~1GB per data loader.
187195 args:
188- - --keys=1000000
196+ - --keys={{ .Keys }}
189197 - --batch-size=50
190198 - --value-size=1000
191199 env:
@@ -201,6 +209,8 @@ spec:
201209 # Consider remove this option once 6.3 is no longer being used.
202210 - name: FDB_NETWORK_OPTION_IGNORE_EXTERNAL_CLIENT_FAILURES
203211 value: ""
212+ - name: FDB_NETWORK_OPTION_TRACE_ENABLE
213+ value: "/tmp/fdb-trace-logs"
204214 - name: LD_LIBRARY_PATH
205215 value: /var/dynamic/fdb
206216 - name: FDB_NETWORK_OPTION_TRACE_LOG_GROUP
@@ -217,6 +227,8 @@ spec:
217227 - name: fdb-certs
218228 mountPath: /tmp/fdb-certs
219229 readOnly: true
230+ - name: fdb-logs
231+ mountPath: /tmp/fdb-trace-logs
220232 resources:
221233 requests:
222234 cpu: "1"
@@ -278,12 +290,14 @@ spec:
278290 path: fdb.cluster
279291 - name: fdb-libs
280292 emptyDir: {}
293+ - name: fdb-logs
294+ emptyDir: {}
281295 - name: fdb-certs
282296 secret:
283297 secretName: {{ .SecretName }}`
284298)
285299
286- // dataLoaderConfig represents the configuration of the Dataloader Job.
300+ // dataLoaderConfig represents the configuration of the data-loader Job.
287301type dataLoaderConfig struct {
288302 // Name of the data loader Job.
289303 Name string
@@ -298,27 +312,31 @@ type dataLoaderConfig struct {
298312 // SecretName represents the Kubernetes secret that contains the certificates for communicating with the FoundationDB
299313 // cluster.
300314 SecretName string
315+ // Keys defines how many keys should be written by the data loader.
316+ Keys int
301317}
302318
303- func (factory * Factory ) getDataLoaderConfig (cluster * FdbCluster ) * dataLoaderConfig {
319+ func (factory * Factory ) getDataLoaderConfig (cluster * FdbCluster , keys * int ) * dataLoaderConfig {
320+ log .Println ("keys:" , keys , "deref:" , pointer .IntDeref (keys , 1000000 ))
304321 return & dataLoaderConfig {
305322 Name : dataLoaderName ,
306323 Image : factory .GetDataLoaderImage (),
307324 Namespace : cluster .Namespace (),
308325 SidecarVersions : factory .GetSidecarConfigs (),
309326 ClusterName : cluster .Name (),
310327 SecretName : factory .GetSecretName (),
328+ Keys : pointer .IntDeref (keys , 1000000 ),
311329 }
312330}
313331
314332// CreateDataLoaderIfAbsent will create the data loader for the provided cluster and load some random data into the cluster.
315333func (factory * Factory ) CreateDataLoaderIfAbsent (cluster * FdbCluster ) {
316- factory .CreateDataLoaderIfAbsentWithWait (cluster , true )
334+ factory .CreateDataLoaderIfAbsentWithWait (cluster , nil , true )
317335}
318336
319337// CreateDataLoaderIfAbsentWithWait will create the data loader for the provided cluster and load some random data into the cluster.
320338// If wait is true, the method will wait until the data loader has finished.
321- func (factory * Factory ) CreateDataLoaderIfAbsentWithWait (cluster * FdbCluster , wait bool ) {
339+ func (factory * Factory ) CreateDataLoaderIfAbsentWithWait (cluster * FdbCluster , keys * int , wait bool ) {
322340 if ! factory .options .enableDataLoading {
323341 return
324342 }
@@ -330,7 +348,8 @@ func (factory *Factory) CreateDataLoaderIfAbsentWithWait(cluster *FdbCluster, wa
330348 t , err := template .New ("dataLoaderJob" ).Parse (dataLoaderJobTemplate )
331349 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
332350 buf := bytes.Buffer {}
333- gomega .Expect (t .Execute (& buf , factory .getDataLoaderConfig (cluster ))).NotTo (gomega .HaveOccurred ())
351+ log .Println ("keys:" , keys )
352+ gomega .Expect (t .Execute (& buf , factory .getDataLoaderConfig (cluster , keys ))).NotTo (gomega .HaveOccurred ())
334353 decoder := yamlutil .NewYAMLOrJSONDecoder (& buf , 100000 )
335354 for {
336355 var rawObj runtime.RawExtension
0 commit comments