1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-09 03:09:50 +00:00

chaging it replace apiVersion and kind from input to schema

This commit is contained in:
gehrkefc
2024-09-12 14:23:53 -03:00
parent cc1b580a18
commit e20157f2d9
4 changed files with 12 additions and 254 deletions

View File

@@ -529,15 +529,7 @@ func (s *Store) Create(apiOp *types.APIRequest, schema *types.APISchema, params
}
gvk := attributes.GVK(schema)
apiVersion, kind := gvk.ToAPIVersionAndKind()
if value, found := input["apiVersion"]; !found || value == "" {
input["apiVersion"] = apiVersion
}
if value, found := input["kind"]; !found || value == "" {
input["kind"] = kind
}
input["apiVersion"], input["kind"] = gvk.ToAPIVersionAndKind()
buffer := WarningBuffer{}
k8sClient, err := metricsStore.Wrap(s.clientGetter.TableClient(apiOp, schema, namespace, &buffer))
@@ -611,15 +603,7 @@ func (s *Store) Update(apiOp *types.APIRequest, schema *types.APISchema, params
}
gvk := attributes.GVK(schema)
apiVersion, kind := gvk.ToAPIVersionAndKind()
if value, found := input["apiVersion"]; !found || value == "" {
input["apiVersion"] = apiVersion
}
if value, found := input["kind"]; !found || value == "" {
input["kind"] = kind
}
input["apiVersion"], input["kind"] = gvk.ToAPIVersionAndKind()
opts := metav1.UpdateOptions{}
if err := decodeParams(apiOp, &opts); err != nil {