# Loading custom module bundles with Operator

**URL:** <https://community.grafana.com/t/loading-custom-module-bundles-with-operator/98475>\
**Category:** Grafana k6\
**Created:** [July 19, 2022, 11:23pm UTC](https://community.grafana.com/t/loading-custom-module-bundles-with-operator/98475 "2022-07-19T23:23:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nema.darban](https://avatars.discourse-cdn.com/v4/letter/n/4bbf92/32.png) [@nema.darban](https://community.grafana.com/u/nema.darban)\
**Post date:** [July 19, 2022, 11:23pm UTC](https://community.grafana.com/t/loading-custom-module-bundles-with-operator/98475/1 "2022-07-19T23:23:13Z")

</div>

Hello,

I’m running K6 on one of our Kubernetes Clusters as the Operator model. My engineering team wants to create custom module bundles with Webpack and make them available for tests.

I can’t find any documentation on where the bundles can be mounted in the Operator (manager) container. Is this possible and if so how?

If possible, I was going to have my CI build their webpack and copy it into a new image where i would combine with the existing public image.

---

<div class="post-metadata">

**Author:** ![olhayevtushenko](https://avatars.discourse-cdn.com/v4/letter/o/bb73d2/32.png) [@olhayevtushenko](https://community.grafana.com/u/olhayevtushenko)\
**Post date:** [July 22, 2022, 8:37am UTC](https://community.grafana.com/t/loading-custom-module-bundles-with-operator/98475/4 "2022-07-22T08:37:57Z")

</div>

Hi @nema.darban  
Welcome to the forum 👋

You can mount a volume with whatever files you need to run the test as `volumeClaim`, see the docs [here](https://github.com/grafana/k6-operator/blob/main/README.md#volumeclaim).

Alternatively, you can build your own image and pass it as `runner` to your yaml and use `localFile` option, also described in the above README. But I’d say one should try to go with the volume if possible.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![nema.darban](https://avatars.discourse-cdn.com/v4/letter/n/4bbf92/32.png) [@nema.darban](https://community.grafana.com/u/nema.darban)\
**Post date:** [August 6, 2022, 12:19am UTC](https://community.grafana.com/t/loading-custom-module-bundles-with-operator/98475/5 "2022-08-06T00:19:10Z")

</div>

hi @olha

I feel like I’m making a rudimentary mistake then. I have a PVC that is bound to a Pod used by my CI/CD to build and copy the modules to the Volume.

On that Pod I’m mounting to the path `/k6-modules`. I’ve validated the files are there by exec’ing to the pod and checking the volume’s content.

_output of pod ls_

```auto
/ # ls k6-modules/v1/
httpd_test.js script_test.js test.main.js test.main.js.map
/ # 

```

_mount path for the pod used by ci/cd_

```auto
volumeMounts:
    - mountPath: "/k6-modules"
      name: k6-modules-directory

```

_error i get from my runner_

```auto
time="2022-08-06T00:16:19Z" level=error msg="The moduleSpecifier \"/test/v1/script_test.js\" couldn't be found on local disk. Make sure that you've specified the right path to the file. If you're running k6 using the Docker image make sure you have mounted the local directory (-v /local/path/:/inside/docker/path) containing your script and modules so that they're accessible by k6 from inside of the container, see https://k6.io/docs/using-k6/modules#using-local-modules-with-docker."

```

_This is my K6 config_

```yaml
# https://github.com/grafana/k6-operator/blob/main/README.md#parallelism
apiVersion: k6.io/v1alpha1
kind: K6
metadata:
  name: k6-apache-stress
  namespace: chaos
spec:
  parallelism: 10
  arguments: --out statsd
  script:
    volumeClaim:
      name: k6-modules
      file: v1/script_test.js
  runner:
    env:
      - name: K6_STATSD_ENABLE_TAGS
        value: "true"
      - name: K6_STATSD_ADDR
        value: datadog.datadog:8125

```

Is there anything else i can provide to help debug?

---

<div class="post-metadata">

**Author:** ![olhayevtushenko](https://avatars.discourse-cdn.com/v4/letter/o/bb73d2/32.png) [@olhayevtushenko](https://community.grafana.com/u/olhayevtushenko)\
**Post date:** [August 14, 2022, 6:48pm UTC](https://community.grafana.com/t/loading-custom-module-bundles-with-operator/98475/6 "2022-08-14T18:48:58Z")

</div>

Hi @nema.darban,

It seems like there might be an issue with the path. As you can see in the error message, k6-operator seeks the JS in `/test` folder, i.e. `/test/v1/script_test.js`. But it seems like your file is in `/k6-modules` instead. Is it possible to move it to `/test` ? This is hard-coded at the moment and cannot be changed.

I’ve created an issue to make it less dependent on hard-coded values [here](https://github.com/grafana/k6-operator/issues/143) but can’t promise when that particular improvement will happen.
