Add openAPIV3Schema validation to CRD
validate limits and requests
validate function name as Kubernetes deployment name
validate secrets and constraints as string array
@@ -8,9 +8,59 @@ metadata:
spec:
group: openfaas.com
version: v1alpha2
+ versions:
+ - name: v1alpha2
+ served: true
+ storage: true
names:
- kind: Function
plural: functions
+ singular: function
+ kind: Function
+ shortNames:
+ - fn
scope: Namespaced
+ validation:
+ openAPIV3Schema:
+ properties:
+ spec:
+ required:
+ - name
+ - image
+ properties:
+ name:
+ type: string
+ pattern: "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
+ image:
+ type: string
+ limits:
+ properties:
+ cpu:
+ type: string
+ pattern: "^[0-9]+(m)"
+ memory:
+ type: string
+ pattern: "^[0-9]+(Mi|Gi)"
+ requests:
+ properties:
+ cpu:
+ type: string
+ pattern: "^[0-9]+(m)"
+ memory:
+ type: string
+ pattern: "^[0-9]+(Mi|Gi)"
+ secrets:
+ type: array
+ items:
+ type: string
+ constraints:
+ type: array
+ items:
+ type: string
+ environment:
+ type: object
+ labels:
+ type: object
+ annotations:
+ type: object
{{- end }}
{{- end }}
