mirror of
https://github.com/rancher/steve.git
synced 2025-09-16 15:29:04 +00:00
added values overwrite check
This commit is contained in:
@@ -432,7 +432,15 @@ func (s *Store) Create(apiOp *types.APIRequest, schema *types.APISchema, params
|
|||||||
}
|
}
|
||||||
|
|
||||||
gvk := attributes.GVK(schema)
|
gvk := attributes.GVK(schema)
|
||||||
input["apiVersion"], input["kind"] = gvk.ToAPIVersionAndKind()
|
apiVersion, kind := gvk.ToAPIVersionAndKind()
|
||||||
|
|
||||||
|
if value, found := input["apiVersion"]; !found || value == "" {
|
||||||
|
input["apiVersion"] = apiVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
if value, found := input["kind"]; !found || value == "" {
|
||||||
|
input["kind"] = kind
|
||||||
|
}
|
||||||
|
|
||||||
buffer := WarningBuffer{}
|
buffer := WarningBuffer{}
|
||||||
k8sClient, err := metricsStore.Wrap(s.clientGetter.TableClient(apiOp, schema, ns, &buffer))
|
k8sClient, err := metricsStore.Wrap(s.clientGetter.TableClient(apiOp, schema, ns, &buffer))
|
||||||
@@ -506,7 +514,15 @@ func (s *Store) Update(apiOp *types.APIRequest, schema *types.APISchema, params
|
|||||||
}
|
}
|
||||||
|
|
||||||
gvk := attributes.GVK(schema)
|
gvk := attributes.GVK(schema)
|
||||||
input["apiVersion"], input["kind"] = gvk.ToAPIVersionAndKind()
|
apiVersion, kind := gvk.ToAPIVersionAndKind()
|
||||||
|
|
||||||
|
if value, found := input["apiVersion"]; !found || value == "" {
|
||||||
|
input["apiVersion"] = apiVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
if value, found := input["kind"]; !found || value == "" {
|
||||||
|
input["kind"] = kind
|
||||||
|
}
|
||||||
|
|
||||||
opts := metav1.UpdateOptions{}
|
opts := metav1.UpdateOptions{}
|
||||||
if err := decodeParams(apiOp, &opts); err != nil {
|
if err := decodeParams(apiOp, &opts); err != nil {
|
||||||
|
Reference in New Issue
Block a user