vendir icon indicating copy to clipboard operation
vendir copied to clipboard

Ability to set file mode for inline files.

Open GrahamDumpleton opened this issue 4 years ago • 2 comments

Describe the problem/challenge you have

I want to be able to do:

apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
- path: packages/example
  contents:
  - path: .
    inline:
      paths:
        script.sh: |
          #!/bin/bash
          date

where script.sh needs to have execute file mode permissions when created.

At the moment it is always created with only rw- permissions.

Describe the solution you'd like

Like how in Kubernetes when mounting config maps it is possible to specify a defaultMode with a umask, would like something similar.

apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
- path: packages/example
  contents:
  - path: .
    inline:
      paths:
        script.sh: |
          #!/bin/bash
          date
      defaultMode: 0755

Anything else you would like to add:

It is a bit annoying that this can't be specified on a per file basis, but a default mode for all paths is better than nothing. One can always segregate files that need to be executable under different array item under contents.


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible" 👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help work on this issue.

GrahamDumpleton avatar Apr 13 '22 06:04 GrahamDumpleton

Thanks @GrahamDumpleton!

joe-kimmel-vmw avatar Apr 13 '22 16:04 joe-kimmel-vmw

Adding this here and not as a separate issue as falls under same umbrella, but this ability to set file mode also needs to apply to files introduced from secrets or config maps using inline.pathsFrom.

apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
- path: packages/example
  contents:
  - path: .
    inline:
      pathsFrom:
        secretRef:
          name: my-scripts
      defaultMode: 0755

GrahamDumpleton avatar Apr 16 '22 22:04 GrahamDumpleton