wiremock / helm-charts

Helm Chart for Wiremock deployment on Kubernetes
https://wiremock.github.io/helm-charts/
Apache License 2.0
19 stars 32 forks source link

Read only file system error #4

Closed daviddelucca closed 3 years ago

daviddelucca commented 3 years ago

Hey mates! What's up?

Great job on helm chart and I'll be really glad if you could give me a hand :)

The deploy is extremely smooth but when I have tried to register StubMapping using Wiremock client (wiremock.register(StubMapping.buildFrom("json string"))) from other application pointing to K8s cluter, I have faced an exception:

java.lang.RuntimeException: java.io.FileNotFoundException: /home/wiremock/storage/mappings/0-d1c5c208-6953-45aa-a77d-63b106532cd9.json (Read-only file system)
    at com.github.tomakehurst.wiremock.common.AbstractFileSource.writeTextFileAndTranslateExceptions(AbstractFileSource.java:172)
    at com.github.tomakehurst.wiremock.common.AbstractFileSource.writeTextFile(AbstractFileSource.java:104)
    at com.github.tomakehurst.wiremock.standalone.JsonFileMappingsSource.save(JsonFileMappingsSource.java:66)
    at com.github.tomakehurst.wiremock.core.WireMockApp.addStubMapping(WireMockApp.java:245)
    at com.github.tomakehurst.wiremock.admin.tasks.CreateStubMappingTask.execute(CreateStubMappingTask.java:33)
    at com.github.tomakehurst.wiremock.http.AdminRequestHandler.handleRequest(AdminRequestHandler.java:88)
    at com.github.tomakehurst.wiremock.http.AbstractRequestHandler.handle(AbstractRequestHandler.java:67)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet.service(WireMockHandlerDispatchingServlet.java:120)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

I believe that it's happening because K8s read only file system. What's the best way to convert it to writable disk?

edit: folders are being created as root owner:

~ ᐅ kubectl exec -it wiremock-d895bcbb5-gxvkn -n devsecops -- ls -la /home/wiremock/storage
total 0
drwxr-xr-x 4 root     root     37 Sep 25 16:28 .
drwxr-xr-x 1 wiremock wiremock 21 Sep 25 16:28 ..
drwxrwxrwx 3 root     root     82 Sep 25 16:28 __files
drwxrwxrwx 3 root     root     81 Sep 25 16:28 mappings
gitkent commented 3 years ago

@daviddelucca Thanks for raising this. I have created a PR for this but before I merge, can you please test out this branch: feature/read-write-fs?

I have tried to created some file seems to be working:

wiremock@release-name-wiremock-7979854859-hlzmq:~$ touch storage/__files/test
wiremock@release-name-wiremock-7979854859-hlzmq:~$ touch storage/mappings/test

Let me know how it goes.

Cheers