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

Declarative function storage mounts are ignored #3141

Closed
ashlineldridge opened this issue Oct 24, 2020 · 5 comments
Closed

Declarative function storage mounts are ignored #3141

ashlineldridge opened this issue Oct 24, 2020 · 5 comments
Labels
area/kyaml issues for kyaml kind/feature Categorizes issue or PR as related to a new feature. triage/unresolved Indicates an issue that can not or will not be resolved.

Comments

@ashlineldridge
Copy link

Describe the bug

When storage mounts are specified to a declarative function definition they are ignored. It looks like this code has been written to cater for command line --mount arguments, which get stored in the RunFns.StorageMounts slice, but declarative mounts which are stored in spec.Container.Network.StorageMounts are ignored.

Files that can reproduce the issue

In a new directory create the following files:

# kpt.yaml

apiVersion: kpt.example.com/v1alpha1
kind: FunctionConfig
metadata:
  name: example-function
  annotations:
    config.kubernetes.io/function: |
      container:
        image: example:latest
        mounts:
        - type: bind
          src: .
          dst: /src
spec: {}
# Dockerfile

FROM bash:latest
CMD ls /src >&2

First, build the function image:

docker build -t example:latest .

Then, run the Kpt function:

> kpt fn run .

ls: /src: No such file or directory
error: exit status 1

But if a command line mount is specified the function executes successfully:

> kpt fn run --mount type=bind,src="$(pwd)",dst=/src .

Dockerfile
kpt.yaml

Expected Output

It should be possible to configure storage mounts for kyaml functions declaratively.

@ashlineldridge
Copy link
Author

Happy to submit a PR.

@Shell32-Natsu Shell32-Natsu added area/kyaml issues for kyaml kind/feature Categorizes issue or PR as related to a new feature. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 26, 2020
@Shell32-Natsu
Copy link
Contributor

That's intended.In most of the cases the KRM function config file author is different from the user. It makes no sense to add a path in user's system when the author is creating a function config. So we have decided to make the mount purely imperative.

@Shell32-Natsu Shell32-Natsu added triage/unresolved Indicates an issue that can not or will not be resolved. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 26, 2020
@Shell32-Natsu
Copy link
Contributor

We haven't updated all documentation about this. Sorry for any confusion.

@ashlineldridge
Copy link
Author

@Shell32-Natsu But what about the use case for functions being applied during kpt sync? Kptfiles allow you to declaratively specify functions that get applied during a sync operation (here).

IME, package consumer often wants to be able to define a pipeline of transformations and validations that get applied to pulled packages and that's what sync + declarative functions allow. Making certain properties of KRM functions imperative-only feels like it goes against the direction of the recent declarative setters proposal.

@Shell32-Natsu
Copy link
Contributor

Please open an issue in kpt repo and we can discuss there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kyaml issues for kyaml kind/feature Categorizes issue or PR as related to a new feature. triage/unresolved Indicates an issue that can not or will not be resolved.
Projects
None yet
Development

No branches or pull requests

2 participants