Generate network config

This commit is contained in:
Phani Teja Marupaka
2020-03-19 16:41:04 -07:00
parent ce2e685619
commit 9a9bdee605
2 changed files with 10 additions and 2 deletions

View File

@@ -89,6 +89,14 @@ func (r *RunFnRunner) getFunctions(c *cobra.Command, args, dataItems []string) (
if err != nil {
return nil, err
}
if r.Network {
err = fn.PipeE(
yaml.LookupCreate(yaml.MappingNode, "container", "network"),
yaml.SetField("required", yaml.NewScalarRNode("true")))
if err != nil {
return nil, err
}
}
// create the function config
rc, err := yaml.Parse(`

View File

@@ -101,7 +101,7 @@ metadata:
name: function-input
annotations:
config.kubernetes.io/function: |
container: {image: 'foo:bar'}
container: {image: 'foo:bar', network: {required: true}}
data: {}
kind: ConfigMap
apiVersion: v1
@@ -118,7 +118,7 @@ metadata:
name: function-input
annotations:
config.kubernetes.io/function: |
container: {image: 'foo:bar'}
container: {image: 'foo:bar', network: {required: true}}
data: {}
kind: ConfigMap
apiVersion: v1