Get plugin config from data field

This commit is contained in:
Donny Xia
2020-11-19 13:11:47 -08:00
parent a6833bc4c0
commit 2f4c35347e
3 changed files with 47 additions and 32 deletions

View File

@@ -81,15 +81,15 @@ functionConfig:
kind: FulfillmentCenter
metadata:
name: staging
metadata:
annotations:
config.kubernetes.io/function: |
container:
image: gcr.io/example/foo:v1.0.0
namespace: foo
fieldSpecs:
- path: metadata/namespace
create: true
annotations:
config.kubernetes.io/function: |
container:
image: gcr.io/example/foo:v1.0.0
data:
namespace: foo
fieldSpecs:
- path: metadata/namespace
create: true
items:
- apiVersion: apps/v1
kind: foobar
@@ -108,7 +108,9 @@ func runKrmFunction(t *testing.T, input []byte, dir string) []byte {
cmd.Stderr = eb
cmd.Dir = dir
err := cmd.Run()
assert.NoErrorf(t, err, "Stdout:\n%s\nStderr:\n%s\n", ob.String(), eb.String())
if !assert.NoErrorf(t, err, "Stdout:\n%s\nStderr:\n%s\n", ob.String(), eb.String()) {
t.FailNow()
}
return ob.Bytes()
}
@@ -135,15 +137,15 @@ functionConfig:
kind: FulfillmentCenter
metadata:
name: staging
metadata:
annotations:
config.kubernetes.io/function: |
container:
image: gcr.io/example/foo:v1.0.0
namespace: foo
fieldSpecs:
- path: metadata/namespace
create: true
annotations:
config.kubernetes.io/function: |
container:
image: gcr.io/example/foo:v1.0.0
data:
namespace: foo
fieldSpecs:
- path: metadata/namespace
create: true
`, string(output))
}
@@ -194,11 +196,13 @@ functionConfig:
kind: FulfillmentCenter
metadata:
name: staging
annotations:
config.kubernetes.io/function: |
container:
image: gcr.io/example/foo:v1.0.0
data:
metadata:
annotations:
config.kubernetes.io/function: |
container:
image: gcr.io/example/foo:v1.0.0
name: staging
items: []
`)
}
@@ -225,10 +229,12 @@ functionConfig:
kind: FulfillmentCenter
metadata:
name: staging
annotations:
config.kubernetes.io/function: |
container:
image: gcr.io/example/foo:v1.0.0
data:
metadata:
annotations:
config.kubernetes.io/function: |
container:
image: gcr.io/example/foo:v1.0.0
name: staging
`, string(output))
}