1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-30 03:15:05 +00:00

fix assign to nil map

This commit is contained in:
Shuting Zhao 2020-04-01 12:41:37 -07:00
parent 77d9634604
commit 05d5d91afd

View file

@ -127,6 +127,7 @@ func addingDefaultFieldsToSchema(schemaRaw []byte) []byte {
_ = json.Unmarshal(schemaRaw, &schema)
if schema.Properties["apiVersion"] == nil {
schema.Properties = make(map[string]interface{})
apiVersionDefRaw := `{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources","type":"string"}`
apiVersionDef := make(map[string]interface{})
_ = json.Unmarshal([]byte(apiVersionDefRaw), &apiVersionDef)