mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 18:10:59 +00:00
Include json files for fn source
This commit is contained in:
@@ -71,7 +71,7 @@ func (r *SourceRunner) runE(c *cobra.Command, args []string) error {
|
||||
|
||||
var inputs []kio.Reader
|
||||
for _, a := range args {
|
||||
inputs = append(inputs, kio.LocalPackageReader{PackagePath: a})
|
||||
inputs = append(inputs, kio.LocalPackageReader{PackagePath: a, IncludeJSON: true})
|
||||
}
|
||||
if len(inputs) == 0 {
|
||||
inputs = []kio.Reader{&kio.ByteReader{Reader: c.InOrStdin()}}
|
||||
|
||||
@@ -21,25 +21,37 @@ func TestSourceCommand(t *testing.T) {
|
||||
}
|
||||
defer os.RemoveAll(d)
|
||||
|
||||
err = ioutil.WriteFile(filepath.Join(d, "f1.yaml"), []byte(`
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx2
|
||||
name: foo
|
||||
annotations:
|
||||
app: nginx2
|
||||
spec:
|
||||
replicas: 1
|
||||
err = ioutil.WriteFile(filepath.Join(d, "f1.json"), []byte(`
|
||||
{
|
||||
"kind": "Deployment",
|
||||
"metadata": {
|
||||
"labels": {
|
||||
"app": "nginx2"
|
||||
},
|
||||
"name": "foo",
|
||||
"annotations": {
|
||||
"app": "nginx2"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"replicas": 1
|
||||
}
|
||||
}
|
||||
---
|
||||
kind: Service
|
||||
metadata:
|
||||
name: foo
|
||||
annotations:
|
||||
app: nginx
|
||||
spec:
|
||||
selector:
|
||||
app: nginx
|
||||
{
|
||||
"kind": "Service",
|
||||
"metadata": {
|
||||
"name": "foo",
|
||||
"annotations": {
|
||||
"app": "nginx"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"selector": {
|
||||
"app": "nginx"
|
||||
}
|
||||
}
|
||||
}
|
||||
`), 0600)
|
||||
if !assert.NoError(t, err) {
|
||||
return
|
||||
@@ -86,22 +98,22 @@ kind: ResourceList
|
||||
items:
|
||||
- kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx2
|
||||
name: foo
|
||||
annotations:
|
||||
app: nginx2
|
||||
config.kubernetes.io/index: '0'
|
||||
config.kubernetes.io/path: 'f1.yaml'
|
||||
config.kubernetes.io/path: 'f1.json'
|
||||
labels:
|
||||
app: nginx2
|
||||
name: foo
|
||||
spec:
|
||||
replicas: 1
|
||||
- kind: Service
|
||||
metadata:
|
||||
name: foo
|
||||
annotations:
|
||||
app: nginx
|
||||
config.kubernetes.io/index: '1'
|
||||
config.kubernetes.io/path: 'f1.yaml'
|
||||
config.kubernetes.io/path: 'f1.json'
|
||||
name: foo
|
||||
spec:
|
||||
selector:
|
||||
app: nginx
|
||||
|
||||
Reference in New Issue
Block a user