itzg / minecraft-server-charts

MIT License
279 stars 144 forks source link

feat: Add container lifecycle to the main Minecraft container #158

Closed allanger closed 1 year ago

allanger commented 1 year ago

It might be useful when a user wants to install plugins using initContainers, but those plugins require running some commands in order to be configured.

For example, I'm installing plugins in an emptyDir volume, so they are reinstalled on each pod restart. But since configs are stored in the same dir, I can't just edit them there, because they exist on that emptyDir volume as well. So the idea of this PR is to let users do something like:

  spec:
    containers:
      name: minecraft-minecraft
      lifecycle:
        postStart:
          exec:
            command:
            - bash
            - -c
            - for i in {1..100}; do mc-health && break || sleep 20; done && mc-send-to-console
              say hello world
allanger commented 1 year ago

Thanks! Please also bump the minor version of the chart. When the PR validation runs it'll check for that.

Ouch, I'm sorry for some dumb mistakes 🙃 I hope now it looks better

As I see, you're using Squash Merge, so I've created a lot of commits. If you'd better see them rebased and squashed into one, I will do

itzg commented 1 year ago

No problem at all! And no need to squash them since like you said, I'll use a squash merge anyway.