diff --git a/pkg/daprrp/processors/pubsubbrokers/processor.go b/pkg/daprrp/processors/pubsubbrokers/processor.go index 597246d2c8b..6d45cd0193e 100644 --- a/pkg/daprrp/processors/pubsubbrokers/processor.go +++ b/pkg/daprrp/processors/pubsubbrokers/processor.go @@ -62,9 +62,15 @@ func (p *Processor) Process(ctx context.Context, resource *datamodel.DaprPubSubB // If the resource is being provisioned manually then *we* are responsible for creating the Dapr Component. // Let's do this now. - applicationID, err := resources.ParseResource(resource.Properties.Application) - if err != nil && resource.Properties.Application != "" { - return err // This should already be validated by this point. + // DaprPubSubBroker resources may or may not be application scoped. + // Some Dapr Components can be specific to a single application, they would be application scoped and have + // resource.Properties.Application populated, while others could be shared across multiple applications. + var applicationID resources.ID + if resource.Properties.Application != "" { + applicationID, err = resources.ParseResource(resource.Properties.Application) + if err != nil { + return err // This should already be validated by this point. + } } component, err := dapr.ConstructDaprGeneric( @@ -113,9 +119,16 @@ func (p *Processor) Delete(ctx context.Context, resource *datamodel.DaprPubSubBr return nil } - applicationID, err := resources.ParseResource(resource.Properties.Application) - if err != nil && resource.Properties.Application != "" { - return err // This should already be validated by this point. + // DaprPubSubBroker resources may or may not be application scoped. + // Some Dapr Components can be specific to a single application, they would be application scoped and have + // resource.Properties.Application populated, while others could be shared across multiple applications. + var err error + var applicationID resources.ID + if resource.Properties.Application != "" { + applicationID, err = resources.ParseResource(resource.Properties.Application) + if err != nil { + return err + } } component := unstructured.Unstructured{ diff --git a/pkg/daprrp/processors/secretstores/processor.go b/pkg/daprrp/processors/secretstores/processor.go index a8ab999816d..6903df2ce15 100644 --- a/pkg/daprrp/processors/secretstores/processor.go +++ b/pkg/daprrp/processors/secretstores/processor.go @@ -59,9 +59,15 @@ func (p *Processor) Process(ctx context.Context, resource *datamodel.DaprSecretS // If the resource is being provisioned manually then *we* are responsible for creating the Dapr Component. // Let's do this now. - applicationID, err := resources.ParseResource(resource.Properties.Application) - if err != nil && resource.Properties.Application != "" { - return err // This should already be validated by this point. + // DaprSecretStore resources may or may not be application scoped. + // Some Dapr Components can be specific to a single application, they would be application scoped and have + // resource.Properties.Application populated, while others could be shared across multiple applications. + var applicationID resources.ID + if resource.Properties.Application != "" { + applicationID, err = resources.ParseResource(resource.Properties.Application) + if err != nil { + return err // This should already be validated by this point. + } } component, err := dapr.ConstructDaprGeneric( @@ -110,9 +116,16 @@ func (p *Processor) Delete(ctx context.Context, resource *datamodel.DaprSecretSt return nil } - applicationID, err := resources.ParseResource(resource.Properties.Application) - if err != nil && resource.Properties.Application != "" { - return err // This should already be validated by this point. + // DaprSecretStore resources may or may not be application scoped. + // Some Dapr Components can be specific to a single application, they would be application scoped and have + // resource.Properties.Application populated, while others could be shared across multiple applications. + var err error + var applicationID resources.ID + if resource.Properties.Application != "" { + applicationID, err = resources.ParseResource(resource.Properties.Application) + if err != nil { + return err + } } component := unstructured.Unstructured{ diff --git a/pkg/daprrp/processors/statestores/processor.go b/pkg/daprrp/processors/statestores/processor.go index 03fdaf391fe..374bd7032e1 100644 --- a/pkg/daprrp/processors/statestores/processor.go +++ b/pkg/daprrp/processors/statestores/processor.go @@ -62,9 +62,15 @@ func (p *Processor) Process(ctx context.Context, resource *datamodel.DaprStateSt // If the resource is being provisioned manually then *we* are responsible for creating the Dapr Component. // Let's do this now. - applicationID, err := resources.ParseResource(resource.Properties.Application) - if err != nil && resource.Properties.Application != "" { - return err // This should already be validated by this point. + // DaprStateStore resources may or may not be application scoped. + // Some Dapr Components can be specific to a single application, they would be application scoped and have + // resource.Properties.Application populated, while others could be shared across multiple applications. + var applicationID resources.ID + if resource.Properties.Application != "" { + applicationID, err = resources.ParseResource(resource.Properties.Application) + if err != nil { + return err // This should already be validated by this point. + } } component, err := dapr.ConstructDaprGeneric( @@ -113,9 +119,16 @@ func (p *Processor) Delete(ctx context.Context, resource *datamodel.DaprStateSto return nil } - applicationID, err := resources.ParseResource(resource.Properties.Application) - if err != nil && resource.Properties.Application != "" { - return err // This should already be validated by this point. + // DaprStateStore resources may or may not be application scoped. + // Some Dapr Components can be specific to a single application, they would be application scoped and have + // resource.Properties.Application populated, while others could be shared across multiple applications. + var err error + var applicationID resources.ID + if resource.Properties.Application != "" { + applicationID, err = resources.ParseResource(resource.Properties.Application) + if err != nil { + return err + } } component := unstructured.Unstructured{