Fix generate command for read-only root filesystem setting
The readonly_root_filesystem setting was not included in the resulting CRD when running faas-cli generate. Signed-off-by: Han Verstraete (OpenFaaS Ltd) <han@openfaas.com>
This commit is contained in:
committed by
Alex Ellis
parent
b88dc1905f
commit
0451db85fa
@@ -203,15 +203,16 @@ func generateCRDYAML(services stack.Services, format schema.BuildFormat, apiVers
|
|||||||
imageName := schema.BuildImageName(format, function.Image, version, branch)
|
imageName := schema.BuildImageName(format, function.Image, version, branch)
|
||||||
|
|
||||||
spec := openfaasv1.Spec{
|
spec := openfaasv1.Spec{
|
||||||
Name: name,
|
Name: name,
|
||||||
Image: imageName,
|
Image: imageName,
|
||||||
Environment: allEnvironment,
|
Environment: allEnvironment,
|
||||||
Labels: function.Labels,
|
Labels: function.Labels,
|
||||||
Annotations: function.Annotations,
|
Annotations: function.Annotations,
|
||||||
Limits: function.Limits,
|
Limits: function.Limits,
|
||||||
Requests: function.Requests,
|
Requests: function.Requests,
|
||||||
Constraints: function.Constraints,
|
Constraints: function.Constraints,
|
||||||
Secrets: function.Secrets,
|
Secrets: function.Secrets,
|
||||||
|
ReadOnlyRootFilesystem: function.ReadOnlyRootFilesystem,
|
||||||
}
|
}
|
||||||
|
|
||||||
crd := openfaasv1.CRD{
|
crd := openfaasv1.CRD{
|
||||||
|
|||||||
@@ -202,6 +202,35 @@ spec:
|
|||||||
Branch: "",
|
Branch: "",
|
||||||
Version: "",
|
Version: "",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "Read-only root filesystem",
|
||||||
|
Input: `
|
||||||
|
provider:
|
||||||
|
name: openfaas
|
||||||
|
gateway: http://127.0.0.1:8080
|
||||||
|
functions:
|
||||||
|
url-ping:
|
||||||
|
lang: python
|
||||||
|
handler: ./sample/url-ping
|
||||||
|
image: alexellis/faas-url-ping:0.2
|
||||||
|
readonly_root_filesystem: true`,
|
||||||
|
Output: []string{`---
|
||||||
|
apiVersion: openfaas.com/v1
|
||||||
|
kind: Function
|
||||||
|
metadata:
|
||||||
|
name: url-ping
|
||||||
|
namespace: openfaas-fn
|
||||||
|
spec:
|
||||||
|
name: url-ping
|
||||||
|
image: alexellis/faas-url-ping:0.2
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
`},
|
||||||
|
Format: schema.DefaultFormat,
|
||||||
|
APIVersion: "openfaas.com/v1",
|
||||||
|
Namespace: "openfaas-fn",
|
||||||
|
Branch: "",
|
||||||
|
Version: "",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_generateCRDYAML(t *testing.T) {
|
func Test_generateCRDYAML(t *testing.T) {
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ type Spec struct {
|
|||||||
|
|
||||||
//Secrets list of secrets to be made available to function
|
//Secrets list of secrets to be made available to function
|
||||||
Secrets []string `yaml:"secrets,omitempty"`
|
Secrets []string `yaml:"secrets,omitempty"`
|
||||||
|
|
||||||
|
ReadOnlyRootFilesystem bool `yaml:"readOnlyRootFilesystem,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//CRD root level YAML definition for the object
|
//CRD root level YAML definition for the object
|
||||||
|
|||||||
Reference in New Issue
Block a user