Commit Graph

101 Commits

Author SHA1 Message Date
Donny Xia
4f760a0850 make result public in function filter 2021-05-06 09:45:11 -07:00
Jeremy
9989b5fc84 Add check of UpdateExpectedFromActual before skipping test
Signed-off-by: Jeremy <jeremyrrickard@gmail.com>
2021-04-12 13:12:53 -06:00
Katrina Verey
5c4b5b1bf0 Improvements to kyaml fn framework
This commit creates a new version of the alpha configuration functions framework. Goals include:
- Make it easy to build multi-version APIs with the framework (not previously facilitated at all).
- Simplify the framework's APIs where redundant configuration options exist (leaving the most powerful, replacing others with helpers to maintain usability they provided).
- Make the Framework's APIs more consistent (e.g. between the various template types, usage of kio.Filter, field names)
- Decouple responsibilities (e.g. command creation, resource list processing, generation of templating functions).
- Make the framework even more powerfully pluggable (e.g. any kio.Filter can be a selector, and the selector the framework provides is itself a filter built from reusable abstractions).
- Improve documentation.
- Make container patches merge fields (notably list fields like `env`) correctly.
2021-03-03 08:27:19 -08:00
monopole
2e6ef91a7c Update generated files under kyaml.
sed -i 's|version: v0.17.0|version: v0.19.8|' kyaml/yaml/internal/k8sgen/k8scopy.yaml
rm kyaml/yaml/internal/k8sgen/pkg/labels/zz_generated.deepcopy.go
(cd kyaml; make generate)
2021-02-28 10:10:52 -08:00
Phillip Wittrock
61dcb3f548 Fork starlib/util for serialization libs.
Prevents pulling in excessive transitive deps.

See: https://github.com/kubernetes/kubernetes/pull/98946
2021-02-24 11:17:08 -08:00
Phillip Wittrock
f7d13ade35 fn framework support for legacy kustomize plugin io 2021-02-17 09:19:02 -08:00
Phillip Wittrock
2db4121c6a Support fnframework to write expected testdata based on observed results 2021-02-11 09:48:50 -08:00
monopole
bbccee0219 Fix message in generated code. 2021-02-09 07:34:32 -08:00
Katrina Verey
4f184e8ce3 Add validation hook to template command execution 2021-01-20 15:53:46 -08:00
Katrina Verey
2e0d6d42bf Improve framework usability without cobra 2021-01-20 15:53:10 -08:00
Phillip Wittrock
736f110f04 Fn framework template and process options
- Refactor framework code to be simpler
- Add TemplatesFn feature
- Add PreProcessFilters feature
- Add PostProcessFilters features
- Add TemplatesFromDir
- Add PatchTemplatesFromDir
- Add PatchContainerTemplatesFromDir
2020-11-30 08:23:34 -08:00
Phillip Wittrock
f2706dce68 Improved fn framework support for patching
- Generate patches with a func
- Generate patches for containers
2020-11-24 12:02:55 -08:00
Phillip Wittrock
82b2d83ede fn/framework support for reading from stdin in standalone
- speficy '-' to read from stdin when running standalone
2020-11-21 09:17:26 -08:00
Phillip Wittrock
be5db09db1 Function framework support for patching containers 2020-11-19 10:01:12 -08:00
Phillip Wittrock
8c4841c28f Support for framework.Selector substitutions 2020-11-17 08:52:34 -08:00
Phillip Wittrock
02e7589323 Function framework testutil support for functions which refer to local files
Some functions may read local files using relative paths.  Update the test
framework to `cd` into the directory containing the config.yaml before
running the function.
2020-11-16 16:35:07 -08:00
Phillip Wittrock
02b14d919b fn framework -- add support for patch templates 2020-11-16 14:01:08 -08:00
Phillip Wittrock
bd0a699ff6 Refactor fn/framework tests to use a common library. 2020-11-16 14:00:55 -08:00
Phillip Wittrock
8b9d8a266d Support standalone mode for framework functions 2020-11-12 11:54:58 -08:00
Phani Teja Marupaka
e9ff26bb1b Make recurse logic public 2020-10-19 12:26:15 -07:00
Donny Xia
acdfd9a920 remove error from NewContainer 2020-09-24 11:37:49 -07:00
Donny Xia
52016b22dd test without system call 2020-09-24 11:37:48 -07:00
Donny Xia
11049fa0bb add as-current-user for fn run 2020-09-24 11:37:48 -07:00
Donny Xia
f6c06b58ef Change network to a boolean 2020-09-16 16:20:50 -07:00
Donny Xia
c202be0338 Remove redundant env field 2020-08-26 12:49:42 -07:00
Donny Xia
46194b3385 code review 2020-08-25 12:15:37 -07:00
Donny Xia
904a9dea08 explicitly specify envs to be exported in function 2020-08-25 12:14:46 -07:00
Donny Xia
893c99da1c code review 2020-08-24 16:27:55 -07:00
Donny Xia
fa15242719 refactor network name in kyaml container 2020-08-24 11:40:57 -07:00
Donny Xia
451c5c32c9 code review 2020-08-21 12:05:11 -07:00
Donny Xia
d03cf061e8 Update kyaml to specify user for function 2020-08-20 15:24:59 -07:00
jregan
31c59bd7f2 Drop all calls to IsEmpty. 2020-08-09 10:47:06 -07:00
Donny Xia
8cd7c13fad fix linter issue 2020-08-05 12:04:46 -07:00
Donny Xia
8cdc97a0dd code review 2020-08-05 11:56:19 -07:00
Donny Xia
2f7241f4c3 code review 2020-08-04 17:11:18 -07:00
Donny Xia
c99bc47c8d fix test on macos 2020-08-04 11:01:06 -07:00
Donny Xia
60422c8090 Ignore TMPDIR when run container 2020-08-04 10:48:59 -07:00
Alexey Odinokov
ba3e09849a Made mountString params more similar to docker params
see [1]
kept support for the previous field names similarly to
docker behavior.

[1]
https://docs.docker.com/storage/bind-mounts/#use-a-read-only-bind-mount
2020-07-13 17:21:37 +00:00
Alexey Odinokov
63f9f79fc0 Fixed incorrect docker mount arguments generation
The previous implementation combined --mount and -v notation
of argument [1] adding :ro to make the read-only mount point.
E.g. the command [2] called docker with the following
params: [3]. As a result instead of the read-only
folder /tmp/source, the read-write folder /tmp/source/:ro/'
is created.

This PR:
1. substitutes ':ro' with correct ',readonly'.
2. changes 'src=' and 'dst=' with 'source=' and 'target=' as
   it is stated in the documentation [1]
3. introduces the ability to EXPLICITLY create a mountpoint
   with read-write access. To do so it's necessary to add
   ',rw=true' to the --mount argument
4. corrects UTs adds some additional coverage for added
   functionality

[1]
https://docs.docker.com/storage/bind-mounts/#use-a-read-only-bind-mount

[2]
kustomize fn run ./d --mount type=bind,src=$(pwd)/test/,dst=/tmp/source/

[3]
--mount type=bind,src=/home/ubuntu/kpt-functions-catalog/functions/ts/test/,dst=/tmp/source/:ro
2020-07-11 17:03:44 +00:00
Phillip Wittrock
28c919912a Fix cmd/config windows issues 2020-05-21 16:53:24 -07:00
Phillip Wittrock
f17cec0b3f Address kyaml windows compatibility issues 2020-05-19 15:44:30 -07:00
Phillip Wittrock
6ae53cb732 Support publishing starlark functions from urls 2020-05-13 11:36:49 -07:00
Phillip Wittrock
5907c9e141 Copy comments from function inputs to function outputs. 2020-05-12 15:07:43 -07:00
Phillip Wittrock
5bae01fa68 UX improvements to kyaml/fn/framework 2020-05-07 22:03:12 -07:00
Phillip Wittrock
dab0f3cf22 Add documentation and simplify framework 2020-05-07 12:51:02 -07:00
Phillip Wittrock
95f0a44fc0 Enable exec functions (Alpha) 2020-05-06 08:59:54 -07:00
Phillip Wittrock
174b2ed62e Refactor starlark runtime ontop of runtimeutil 2020-05-06 08:16:14 -07:00
Phillip Wittrock
594c48d19a Refactor container function runtime into its own package 2020-05-06 08:16:14 -07:00
Phillip Wittrock
096ad8c95c Exec function implementation 2020-05-06 08:16:14 -07:00
Phillip Wittrock
fd70213ca2 Create shared functions filter library 2020-05-06 08:16:14 -07:00