kotal icon indicating copy to clipboard operation
kotal copied to clipboard

Use subpath instead of initContianer copy shell script

Open J1a-wei opened this issue 2 years ago • 1 comments

Hi, I'm little curious about initContainer logic (e.g. lotus).

Can I use subPath mount config toml file Instead of initContainer?

apiVersion: apps/v1
kind: StatefulSet
spec:
  template:
    spec:
      containers:
      - args:
        - lotus
        - daemon
        env:
        - name: LOTUS_PATH
          value: /home/filecoin/kotal-data
        - name: GOLOG_LOG_LEVEL
          value: info
        imagePullPolicy: IfNotPresent
        name: node
        volumeMounts:
        - mountPath: /home/filecoin/kotal-data
          name: data
        - mountPath: /home/filecoin/kotal-data/config.toml
          name: config
          subPath: config.toml
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: filecoin-mainnet-ckeil8ouci5s
      - configMap:
          defaultMode: 420
          name: filecoin-mainnet-ckeil8ouci5s
        name: config

I tested it , it works well.

J1a-wei avatar Jun 01 '22 08:06 J1a-wei

hi @skrbug,

We're always using initContainers for any setup or config initialization, and using container(s) for the node itself. One container one process, and we avoid && at all costs. For debugging purposes, it will be easy to spot that it's initialization issue if you spot Init:Error or Init:CrashLoopBackOff.

Your enhancement is interesting, because lotus node reads config from data dir, can you raise a PR that we can review. Thank you 🙏

mFarghaly avatar Jun 03 '22 10:06 mFarghaly

@mFarghaly #14 Sure.I would love to raise pr. Recently a little busy, I forgot to reply. IMO It's clearer and faster use volume subpath. PTAL

J1a-wei avatar Jun 11 '22 14:06 J1a-wei