Skip to content

Commit

Permalink
Merge pull request #24 from kubescape/create
Browse files Browse the repository at this point in the history
fix create func for in-cluster adapter
  • Loading branch information
matthyx authored Dec 14, 2023
2 parents 9ff3dbc + 498fed4 commit 1dde7d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions adapters/incluster/v1/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ func (c *Client) patchObject(ctx context.Context, id domain.KindName, checksum s
return object, c.PutObject(ctx, id, modified)
}

func (c *Client) PutObject(_ context.Context, _ domain.KindName, object []byte) error {
func (c *Client) PutObject(_ context.Context, id domain.KindName, object []byte) error {
var obj unstructured.Unstructured
err := obj.UnmarshalJSON(object)
if err != nil {
return fmt.Errorf("unmarshal object: %w", err)
}
_, err = c.client.Resource(c.res).Namespace("").Create(context.Background(), &obj, metav1.CreateOptions{})
_, err = c.client.Resource(c.res).Namespace(id.Namespace).Create(context.Background(), &obj, metav1.CreateOptions{})
if err != nil {
return fmt.Errorf("create resource: %w", err)
}
Expand Down

0 comments on commit 1dde7d3

Please sign in to comment.