Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to pipe env/properties files content to a configmap #1394

Closed
wombat opened this issue Mar 6, 2020 · 1 comment · Fixed by #1484
Closed

Add the ability to pipe env/properties files content to a configmap #1394

wombat opened this issue Mar 6, 2020 · 1 comment · Fixed by #1484

Comments

@wombat
Copy link

wombat commented Mar 6, 2020

What would you like to be added:
Right now a file from a Pipe is always written as a file to a ConfigMap and e.g. its an env file, I can't mount the variables as env vars inside another container. Adding a flag or separate PipeEnv task would make sense to me.

Why is this needed:
One of my pipe tasks creates a .env file which I have to mount as env vars into another container in another task. Right now I am mounting the ConfigMap from the pipe into an intermediary kubectl container which creates a new ConfigMap containing the env vars as separate variables.
kubectl wise the current behaviours is like kubectl create configmap xyz --from-file vs kubectl create configmap xyz --from-env-file

zen-dog added a commit that referenced this issue Apr 27, 2020
Summary:
When creating `ConfigMap`s or `Secret`s k8s allows for taking an env-file using the `--from-env-file` option. Env-files contain a list of environment variables.

These syntax rules apply:
 - Each line in an env file has to be in VAR=VAL format.
 - Lines beginning with # (i.e. comments) are ignored.
 - Blank lines are ignored.
 - There is no special handling of quotation marks (i.e. they will be part of the ConfigMap value))

 New pipe-task `fnvFile` field can be used instead of `file` to signal that the pipe-file should be treated as an env-file:

 ```yaml
spec:
  pipe:
    - envFile: /tmp/foo.env
      kind: ConfigMap
      key: foo
```

Note, that **either** `file` or `envFile` can be used but not both.

For more information on env-files see [k8s documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#create-configmaps-from-files)

Fixes: #1394
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
@zen-dog
Copy link
Contributor

zen-dog commented Apr 28, 2020

@wombat the PR #1484 implementing the requested feature is in review now. Feel free to take a look 😉

zen-dog pushed a commit that referenced this issue Apr 29, 2020
Summary:
When creating `ConfigMap`s or `Secret`s k8s allows for taking an env-file using the `--from-env-file` option. Env-files contain a list of environment variables.

These syntax rules apply:
 - Each line in an env file has to be in VAR=VAL format.
 - Lines beginning with # (i.e. comments) are ignored.
 - Blank lines are ignored.
 - There is no special handling of quotation marks (i.e. they will be part of the ConfigMap value))

 New pipe-task `fnvFile` field can be used instead of `file` to signal that the pipe-file should be treated as an env-file:

 ```yaml
spec:
  pipe:
    - envFile: /tmp/foo.env
      kind: ConfigMap
      key: foo
```

Note, that **either** `file` or `envFile` can be used but not both.

For more information on env-files see [k8s documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#create-configmaps-from-files)

Fixes: #1394
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants