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

rename manifest to payload in database #110

Merged
merged 1 commit into from
Jun 12, 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
6 changes: 3 additions & 3 deletions cmd/maestro/server/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ func decode(eventDataType types.CloudEventsDataType, evt *ce.Event) (*api.Resour
resource.Meta.DeletedAt.Time = deletionTimestamp
}

manifest, err := api.CloudEventToJSONMap(evt)
payload, err := api.CloudEventToJSONMap(evt)
if err != nil {
return nil, fmt.Errorf("failed to convert cloudevent to resource manifest: %v", err)
return nil, fmt.Errorf("failed to convert cloudevent to resource payload: %v", err)
}
resource.Manifest = manifest
resource.Payload = payload

switch eventDataType {
case workpayload.ManifestEventDataType:
Expand Down
2 changes: 1 addition & 1 deletion data/generated/openapi/openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pkg/api/presenters/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// ConvertResource converts a resource from the API to the openapi representation.
func ConvertResource(resource openapi.Resource) (*api.Resource, error) {
manifest, err := ConvertResourceManifest(resource.Manifest, resource.DeleteOption, resource.UpdateStrategy)
payload, err := ConvertResourceManifest(resource.Manifest, resource.DeleteOption, resource.UpdateStrategy)
if err != nil {
return nil, err
}
Expand All @@ -26,9 +26,9 @@ func ConvertResource(resource openapi.Resource) (*api.Resource, error) {
ConsumerName: util.NilToEmptyString(resource.ConsumerName),
Version: util.NilToEmptyInt32(resource.Version),
// Set the default source ID for RESTful API calls and do not allow modification
Source: constants.DefaultSourceID,
Type: api.ResourceTypeSingle,
Manifest: manifest,
Source: constants.DefaultSourceID,
Type: api.ResourceTypeSingle,
Payload: payload,
}, nil
}

Expand All @@ -39,7 +39,7 @@ func ConvertResourceManifest(manifest, deleteOption, updateStrategy map[string]i

// PresentResource converts a resource from the API to the openapi representation.
func PresentResource(resource *api.Resource) (*openapi.Resource, error) {
manifest, deleteOption, updateStrategy, err := api.DecodeManifest(resource.Manifest)
manifest, deleteOption, updateStrategy, err := api.DecodeManifest(resource.Payload)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -73,7 +73,7 @@ func PresentResource(resource *api.Resource) (*openapi.Resource, error) {

// PresentResourceBundle converts a resource from the API to the openapi representation.
func PresentResourceBundle(resource *api.Resource) (*openapi.ResourceBundle, error) {
manifestBundle, err := api.DecodeManifestBundle(resource.Manifest)
manifestBundle, err := api.DecodeManifestBundle(resource.Payload)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/resource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Resource struct {
Source string
ConsumerName string
Type ResourceType
Manifest datatypes.JSONMap
Payload datatypes.JSONMap
Status datatypes.JSONMap
// Name must be unique and not null, it can be treated as the resource external ID.
// The format of the name should be follow the RFC 1123 (same as the k8s namespace).
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/cloudevents/bundle_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ func (codec *BundleCodec) EventDataType() cetypes.CloudEventsDataType {
}

func (codec *BundleCodec) Encode(source string, eventType cetypes.CloudEventsType, res *api.Resource) (*cloudevents.Event, error) {
evt, err := api.JSONMAPToCloudEvent(res.Manifest)
evt, err := api.JSONMAPToCloudEvent(res.Payload)
if err != nil {
return nil, fmt.Errorf("failed to convert resource manifest to cloudevent: %v", err)
return nil, fmt.Errorf("failed to convert resource payload to cloudevent: %v", err)
}

evt.SetSource(source)
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/cloudevents/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ func (codec *Codec) EventDataType() cetypes.CloudEventsDataType {
}

func (codec *Codec) Encode(source string, eventType cetypes.CloudEventsType, res *api.Resource) (*cloudevents.Event, error) {
evt, err := api.JSONMAPToCloudEvent(res.Manifest)
evt, err := api.JSONMAPToCloudEvent(res.Payload)
if err != nil {
return nil, fmt.Errorf("failed to convert resource manifest to cloudevent: %v", err)
return nil, fmt.Errorf("failed to convert resource payload to cloudevent: %v", err)
}

evt.SetSource(source)
Expand Down
4 changes: 2 additions & 2 deletions pkg/db/migrations/202311151850_add_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func addResources() *gormigrate.Migration {
// "Single" resource type for RESTful API calls,
// "Bundle" resource type mainly for gRPC calls.
Type string `gorm:"index"`
// Manifest holds the resource manifest in CloudEvent format (JSON representation).
Manifest datatypes.JSON `gorm:"type:json"`
// Payload is CloudEvent payload with CloudEvent format (JSON representation).
Payload datatypes.JSON `gorm:"type:json"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI

I am seeing this

failed to create resource: maestro-9: Unable to create Resource: pq: column "payload" of relation "resources" does not exist

when I deploy the latest main against an existing deployment.
Ideally, this should've been a new migration file so that the column rename is applied. Renaming a column here, won't work for existing deployments as the migration id has already been applied.

// Status represents the resource status in CloudEvent format (JSON representation).
Status datatypes.JSON `gorm:"type:json"`
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/handlers/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ func (h resourceHandler) Patch(w http.ResponseWriter, r *http.Request) {
func() (interface{}, *errors.ServiceError) {
ctx := r.Context()
id := mux.Vars(r)["id"]
manifest, err := presenters.ConvertResourceManifest(patch.Manifest, patch.DeleteOption, patch.UpdateStrategy)
payload, err := presenters.ConvertResourceManifest(patch.Manifest, patch.DeleteOption, patch.UpdateStrategy)
if err != nil {
return nil, errors.GeneralError("failed to convert resource manifest: %s", err)
}
resource, serviceErr := h.resource.Update(ctx, &api.Resource{
Meta: api.Meta{ID: id},
Version: *patch.Version,
Type: api.ResourceTypeSingle,
Manifest: manifest,
Meta: api.Meta{ID: id},
Version: *patch.Version,
Type: api.ResourceTypeSingle,
Payload: payload,
})
if serviceErr != nil {
return nil, serviceErr
Expand Down
8 changes: 4 additions & 4 deletions pkg/services/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (s *sqlResourceService) Create(ctx context.Context, resource *api.Resource)
return nil, errors.Validation("the name in the resource is invalid, %v", err)
}
}
if err := ValidateManifest(resource.Type, resource.Manifest); err != nil {
if err := ValidateManifest(resource.Type, resource.Payload); err != nil {
return nil, errors.Validation("the manifest in the resource is invalid, %v", err)
}

Expand Down Expand Up @@ -113,17 +113,17 @@ func (s *sqlResourceService) Update(ctx context.Context, resource *api.Resource)
}

// New manifest is not changed, the update action is not needed.
if reflect.DeepEqual(resource.Manifest, found.Manifest) {
if reflect.DeepEqual(resource.Payload, found.Payload) {
return found, nil
}

if err := ValidateManifestUpdate(resource.Type, resource.Manifest, found.Manifest); err != nil {
if err := ValidateManifestUpdate(resource.Type, resource.Payload, found.Payload); err != nil {
return nil, errors.Validation("the new manifest in the resource is invalid, %v", err)
}

// Increase the current resource version and update its manifest.
found.Version = found.Version + 1
found.Manifest = resource.Manifest
found.Payload = resource.Payload

updated, err := s.resourceDao.Update(ctx, found)
if err != nil {
Expand Down
16 changes: 8 additions & 8 deletions pkg/services/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ func TestResourceFindByConsumerID(t *testing.T) {
const Breviceratops = "c4df9ff0-bfeb-5bc6-a0ab-4c9128d698b4"

resources := api.ResourceList{
&api.Resource{ConsumerName: Fukuisaurus, Type: api.ResourceTypeSingle, Manifest: newManifest(t, "{\"id\":\"75479c10-b537-4261-8058-ca2e36bac384\",\"time\":\"2024-03-07T03:29:03.194843266Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifests.spec.create_request\",\"source\":\"maestro\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"data\":{\"manifest\":{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"test\",\"namespace\":\"test\"}}}}")},
&api.Resource{ConsumerName: Fukuisaurus, Type: api.ResourceTypeBundle, Manifest: newManifest(t, "{\"id\":\"266a8cd2-2fab-4e89-9bf0-a56425ebcdf8\",\"time\":\"2024-02-05T17:31:05Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifestbundles.spec.create_request\",\"source\":\"grpc\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"resourceid\":\"c4df9ff0-bfeb-5bc6-a0ab-4c9128d698b4\",\"clustername\":\"b288a9da-8bfe-4c82-94cc-2b48e773fc46\",\"resourceversion\":1,\"data\":{\"manifests\":[{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"nginx\",\"namespace\":\"default\"}},{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"name\":\"nginx\",\"namespace\":\"default\"},\"spec\":{\"replicas\":1,\"selector\":{\"matchLabels\":{\"app\":\"nginx\"}},\"template\":{\"spec\":{\"containers\":[{\"name\":\"nginx\",\"image\":\"nginxinc/nginx-unprivileged\"}]},\"metadata\":{\"labels\":{\"app\":\"nginx\"}}}}}],\"deleteOption\":{\"propagationPolicy\":\"Foreground\"},\"manifestConfigs\":[{\"updateStrategy\":{\"type\":\"ServerSideApply\"},\"resourceIdentifier\":{\"name\":\"nginx\",\"group\":\"apps\",\"resource\":\"deployments\",\"namespace\":\"default\"}}]}}")},
&api.Resource{ConsumerName: Fukuisaurus, Type: api.ResourceTypeSingle, Manifest: newManifest(t, "{\"id\":\"75479c10-b537-4261-8058-ca2e36bac384\",\"time\":\"2024-03-07T03:29:03.194843266Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifests.spec.create_request\",\"source\":\"maestro\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"data\":{\"manifest\":{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"test\",\"namespace\":\"test\"}}}}")},
&api.Resource{ConsumerName: Seismosaurus, Type: api.ResourceTypeSingle, Manifest: newManifest(t, "{\"id\":\"75479c10-b537-4261-8058-ca2e36bac384\",\"time\":\"2024-03-07T03:29:03.194843266Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifests.spec.create_request\",\"source\":\"maestro\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"data\":{\"manifest\":{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"test\",\"namespace\":\"test\"}}}}")},
&api.Resource{ConsumerName: Seismosaurus, Type: api.ResourceTypeBundle, Manifest: newManifest(t, "{\"id\":\"266a8cd2-2fab-4e89-9bf0-a56425ebcdf8\",\"time\":\"2024-02-05T17:31:05Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifestbundles.spec.create_request\",\"source\":\"grpc\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"resourceid\":\"c4df9ff0-bfeb-5bc6-a0ab-4c9128d698b4\",\"clustername\":\"e3eb7db1-b124-4a4d-8bb6-cc779c01b402\",\"resourceversion\":1,\"data\":{\"manifests\":[{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"nginx\",\"namespace\":\"default\"}},{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"name\":\"nginx\",\"namespace\":\"default\"},\"spec\":{\"replicas\":1,\"selector\":{\"matchLabels\":{\"app\":\"nginx\"}},\"template\":{\"spec\":{\"containers\":[{\"name\":\"nginx\",\"image\":\"nginxinc/nginx-unprivileged\"}]},\"metadata\":{\"labels\":{\"app\":\"nginx\"}}}}}],\"deleteOption\":{\"propagationPolicy\":\"Foreground\"},\"manifestConfigs\":[{\"updateStrategy\":{\"type\":\"ServerSideApply\"},\"resourceIdentifier\":{\"name\":\"nginx\",\"group\":\"apps\",\"resource\":\"deployments\",\"namespace\":\"default\"}}]}}")},
&api.Resource{ConsumerName: Breviceratops, Type: api.ResourceTypeSingle, Manifest: newManifest(t, "{\"id\":\"75479c10-b537-4261-8058-ca2e36bac384\",\"time\":\"2024-03-07T03:29:03.194843266Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifests.spec.create_request\",\"source\":\"maestro\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"data\":{\"manifest\":{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"test\",\"namespace\":\"test\"}}}}")},
&api.Resource{ConsumerName: Breviceratops, Type: api.ResourceTypeBundle, Manifest: newManifest(t, "{\"id\":\"266a8cd2-2fab-4e89-9bf0-a56425ebcdf8\",\"time\":\"2024-02-05T17:31:05Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifestbundles.spec.create_request\",\"source\":\"grpc\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"resourceid\":\"c4df9ff0-bfeb-5bc6-a0ab-4c9128d698b4\",\"clustername\":\"c4df9ff0-bfeb-5bc6-a0ab-4c9128d698b4\",\"resourceversion\":1,\"data\":{\"manifests\":[{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"nginx\",\"namespace\":\"default\"}},{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"name\":\"nginx\",\"namespace\":\"default\"},\"spec\":{\"replicas\":1,\"selector\":{\"matchLabels\":{\"app\":\"nginx\"}},\"template\":{\"spec\":{\"containers\":[{\"name\":\"nginx\",\"image\":\"nginxinc/nginx-unprivileged\"}]},\"metadata\":{\"labels\":{\"app\":\"nginx\"}}}}}],\"deleteOption\":{\"propagationPolicy\":\"Foreground\"},\"manifestConfigs\":[{\"updateStrategy\":{\"type\":\"ServerSideApply\"},\"resourceIdentifier\":{\"name\":\"nginx\",\"group\":\"apps\",\"resource\":\"deployments\",\"namespace\":\"default\"}}]}}")},
&api.Resource{ConsumerName: Fukuisaurus, Type: api.ResourceTypeSingle, Payload: newPayload(t, "{\"id\":\"75479c10-b537-4261-8058-ca2e36bac384\",\"time\":\"2024-03-07T03:29:03.194843266Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifests.spec.create_request\",\"source\":\"maestro\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"data\":{\"manifest\":{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"test\",\"namespace\":\"test\"}}}}")},
&api.Resource{ConsumerName: Fukuisaurus, Type: api.ResourceTypeBundle, Payload: newPayload(t, "{\"id\":\"266a8cd2-2fab-4e89-9bf0-a56425ebcdf8\",\"time\":\"2024-02-05T17:31:05Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifestbundles.spec.create_request\",\"source\":\"grpc\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"resourceid\":\"c4df9ff0-bfeb-5bc6-a0ab-4c9128d698b4\",\"clustername\":\"b288a9da-8bfe-4c82-94cc-2b48e773fc46\",\"resourceversion\":1,\"data\":{\"manifests\":[{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"nginx\",\"namespace\":\"default\"}},{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"name\":\"nginx\",\"namespace\":\"default\"},\"spec\":{\"replicas\":1,\"selector\":{\"matchLabels\":{\"app\":\"nginx\"}},\"template\":{\"spec\":{\"containers\":[{\"name\":\"nginx\",\"image\":\"nginxinc/nginx-unprivileged\"}]},\"metadata\":{\"labels\":{\"app\":\"nginx\"}}}}}],\"deleteOption\":{\"propagationPolicy\":\"Foreground\"},\"manifestConfigs\":[{\"updateStrategy\":{\"type\":\"ServerSideApply\"},\"resourceIdentifier\":{\"name\":\"nginx\",\"group\":\"apps\",\"resource\":\"deployments\",\"namespace\":\"default\"}}]}}")},
&api.Resource{ConsumerName: Fukuisaurus, Type: api.ResourceTypeSingle, Payload: newPayload(t, "{\"id\":\"75479c10-b537-4261-8058-ca2e36bac384\",\"time\":\"2024-03-07T03:29:03.194843266Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifests.spec.create_request\",\"source\":\"maestro\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"data\":{\"manifest\":{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"test\",\"namespace\":\"test\"}}}}")},
&api.Resource{ConsumerName: Seismosaurus, Type: api.ResourceTypeSingle, Payload: newPayload(t, "{\"id\":\"75479c10-b537-4261-8058-ca2e36bac384\",\"time\":\"2024-03-07T03:29:03.194843266Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifests.spec.create_request\",\"source\":\"maestro\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"data\":{\"manifest\":{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"test\",\"namespace\":\"test\"}}}}")},
&api.Resource{ConsumerName: Seismosaurus, Type: api.ResourceTypeBundle, Payload: newPayload(t, "{\"id\":\"266a8cd2-2fab-4e89-9bf0-a56425ebcdf8\",\"time\":\"2024-02-05T17:31:05Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifestbundles.spec.create_request\",\"source\":\"grpc\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"resourceid\":\"c4df9ff0-bfeb-5bc6-a0ab-4c9128d698b4\",\"clustername\":\"e3eb7db1-b124-4a4d-8bb6-cc779c01b402\",\"resourceversion\":1,\"data\":{\"manifests\":[{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"nginx\",\"namespace\":\"default\"}},{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"name\":\"nginx\",\"namespace\":\"default\"},\"spec\":{\"replicas\":1,\"selector\":{\"matchLabels\":{\"app\":\"nginx\"}},\"template\":{\"spec\":{\"containers\":[{\"name\":\"nginx\",\"image\":\"nginxinc/nginx-unprivileged\"}]},\"metadata\":{\"labels\":{\"app\":\"nginx\"}}}}}],\"deleteOption\":{\"propagationPolicy\":\"Foreground\"},\"manifestConfigs\":[{\"updateStrategy\":{\"type\":\"ServerSideApply\"},\"resourceIdentifier\":{\"name\":\"nginx\",\"group\":\"apps\",\"resource\":\"deployments\",\"namespace\":\"default\"}}]}}")},
&api.Resource{ConsumerName: Breviceratops, Type: api.ResourceTypeSingle, Payload: newPayload(t, "{\"id\":\"75479c10-b537-4261-8058-ca2e36bac384\",\"time\":\"2024-03-07T03:29:03.194843266Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifests.spec.create_request\",\"source\":\"maestro\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"data\":{\"manifest\":{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"test\",\"namespace\":\"test\"}}}}")},
&api.Resource{ConsumerName: Breviceratops, Type: api.ResourceTypeBundle, Payload: newPayload(t, "{\"id\":\"266a8cd2-2fab-4e89-9bf0-a56425ebcdf8\",\"time\":\"2024-02-05T17:31:05Z\",\"type\":\"io.open-cluster-management.works.v1alpha1.manifestbundles.spec.create_request\",\"source\":\"grpc\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"resourceid\":\"c4df9ff0-bfeb-5bc6-a0ab-4c9128d698b4\",\"clustername\":\"c4df9ff0-bfeb-5bc6-a0ab-4c9128d698b4\",\"resourceversion\":1,\"data\":{\"manifests\":[{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"nginx\",\"namespace\":\"default\"}},{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"name\":\"nginx\",\"namespace\":\"default\"},\"spec\":{\"replicas\":1,\"selector\":{\"matchLabels\":{\"app\":\"nginx\"}},\"template\":{\"spec\":{\"containers\":[{\"name\":\"nginx\",\"image\":\"nginxinc/nginx-unprivileged\"}]},\"metadata\":{\"labels\":{\"app\":\"nginx\"}}}}}],\"deleteOption\":{\"propagationPolicy\":\"Foreground\"},\"manifestConfigs\":[{\"updateStrategy\":{\"type\":\"ServerSideApply\"},\"resourceIdentifier\":{\"name\":\"nginx\",\"group\":\"apps\",\"resource\":\"deployments\",\"namespace\":\"default\"}}]}}")},
}
for _, resource := range resources {
_, err := resourceService.Create(context.Background(), resource)
Expand All @@ -55,7 +55,7 @@ func TestCreateInvalidResource(t *testing.T) {
events := NewEventService(mocks.NewEventDao())
resourceService := NewResourceService(dbmocks.NewMockAdvisoryLockFactory(), resourceDAO, events)

resource := &api.Resource{ConsumerName: "invalidation", Manifest: newManifest(t, "{}")}
resource := &api.Resource{ConsumerName: "invalidation", Payload: newPayload(t, "{}")}

_, svcErr := resourceService.Create(context.Background(), resource)
gm.Expect(svcErr).ShouldNot(gm.BeNil())
Expand Down
Loading
Loading