Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Group, Version, Kind in Update proxy_store.go #270

Merged
merged 9 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/stores/partition/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package partition

import (
"context"
"errors"
"fmt"
"os"
"reflect"
Expand Down Expand Up @@ -389,7 +390,7 @@ func ToAPIEvent(apiOp *types.APIRequest, schema *types.APISchema, event watch.Ev

if event.Type == watch.Error {
status, _ := event.Object.(*metav1.Status)
apiEvent.Error = fmt.Errorf(status.Message)
apiEvent.Error = errors.New(status.Message)
return apiEvent
}

Expand Down
10 changes: 7 additions & 3 deletions pkg/stores/proxy/proxy_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ import (
)

const (
watchTimeoutEnv = "CATTLE_WATCH_TIMEOUT_SECONDS"
errNamespaceRequired = "metadata.namespace is required"
watchTimeoutEnv = "CATTLE_WATCH_TIMEOUT_SECONDS"
errNamespaceRequired = "metadata.namespace is required"
errResourceVersionRequired = "metadata.resourceVersion is required for update"
)

var (
Expand Down Expand Up @@ -515,9 +516,12 @@ func (s *Store) Update(apiOp *types.APIRequest, schema *types.APISchema, params

resourceVersion := input.String("metadata", "resourceVersion")
if resourceVersion == "" {
return nil, nil, fmt.Errorf("metadata.resourceVersion is required for update")
return nil, nil, errors.New(errResourceVersionRequired)
}

gvk := attributes.GVK(schema)
input["apiVersion"], input["kind"] = gvk.ToAPIVersionAndKind()
gehrkefc marked this conversation as resolved.
Show resolved Hide resolved

opts := metav1.UpdateOptions{}
if err := decodeParams(apiOp, &opts); err != nil {
return nil, nil, err
Expand Down
Loading
Loading