Repository: clouditor/clouditor
Pull request #562 (2022-03-07 16:01:02)

Fix make list of discoverers configurable
Delete provider configuration from discovery request, because it was implemented in discovery request and NewService()

codecov[bot]: # [Codecov](https://codecov.io/gh/clouditor/clouditor/pull/562?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor) Report
> Merging [#562](https://codecov.io/gh/clouditor/clouditor/pull/562?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor) (4de3d36) into [main](https://codecov.io/gh/clouditor/clouditor/commit/98fef9975b23f0ad723981b0c155de3d3a9b75fa?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor) (98fef99) will **decrease** coverage by `0.01%`.
> The diff coverage is `90.90%`.

[![Impacted file tree graph](https://codecov.io/gh/clouditor/clouditor/pull/562/graphs/tree.svg?width=650&height=150&src=pr&token=syrXsw5LTX&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor)](https://codecov.io/gh/clouditor/clouditor/pull/562?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor)

```diff
@@            Coverage Diff             @@
##             main     #562      +/-   ##
==========================================
- Coverage   81.70%   81.69%   -0.02%     
==========================================
  Files          50       50              
  Lines        4843     4839       -4     
==========================================
- Hits         3957     3953       -4     
  Misses        703      703              
  Partials      183      183              
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `81.69% <90.90%> (-0.02%)` | :arrow_down: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/clouditor/clouditor/pull/562?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor) | Coverage Δ | |
|---|---|---|
| [cmd/engine/engine.go](https://codecov.io/gh/clouditor/clouditor/pull/562/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-Y21kL2VuZ2luZS9lbmdpbmUuZ28=) | `79.68% <75.00%> (+0.21%)` | :arrow_up: |
| [cli/commands/service/discovery/discovery.go](https://codecov.io/gh/clouditor/clouditor/pull/562/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-Y2xpL2NvbW1hbmRzL3NlcnZpY2UvZGlzY292ZXJ5L2Rpc2NvdmVyeS5nbw==) | `82.53% <100.00%> (-0.80%)` | :arrow_down: |
| [service/discovery/discovery.go](https://codecov.io/gh/clouditor/clouditor/pull/562/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-c2VydmljZS9kaXNjb3ZlcnkvZGlzY292ZXJ5Lmdv) | `93.81% <100.00%> (-0.10%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/clouditor/clouditor/pull/562?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/clouditor/clouditor/pull/562?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor). Last update [98fef99...4de3d36](https://codecov.io/gh/clouditor/clouditor/pull/562?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor).


Patch:
diff --git a/api/discovery/discovery.pb.go b/api/discovery/discovery.pb.go
index 908785d7..346d8a03 100644
--- a/api/discovery/discovery.pb.go
+++ b/api/discovery/discovery.pb.go
@@ -52,9 +52,6 @@ type StartDiscoveryRequest struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
-
-	// A list of providers to be discovered
-	Providers []string `protobuf:"bytes,1,rep,name=providers,proto3" json:"providers,omitempty"`
 }
 
 func (x *StartDiscoveryRequest) Reset() {
@@ -89,13 +86,6 @@ func (*StartDiscoveryRequest) Descriptor() ([]byte, []int) {
 	return file_api_discovery_discovery_proto_rawDescGZIP(), []int{0}
 }
 
-func (x *StartDiscoveryRequest) GetProviders() []string {
-	if x != nil {
-		return x.Providers
-	}
-	return nil
-}
-
 type StartDiscoveryResponse struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -246,37 +236,35 @@ var file_api_discovery_discovery_proto_rawDesc = []byte{
 	0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f,
 	0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
 	0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74,
-	0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x35, 0x0a, 0x15, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44,
-	0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
-	0x1c, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03,
-	0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x22, 0x38, 0x0a,
-	0x16, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52,
-	0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x63, 0x63, 0x65,
-	0x73, 0x73, 0x66, 0x75, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x75, 0x63,
-	0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x22, 0x33, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79,
-	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x74, 0x65,
-	0x72, 0x65, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
-	0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x22, 0x45, 0x0a, 0x0d,
-	0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a,
-	0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,
-	0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
-	0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75,
-	0x6c, 0x74, 0x73, 0x32, 0xdb, 0x01, 0x0a, 0x09, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72,
-	0x79, 0x12, 0x6f, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x20, 0x2e, 0x63, 0x6c, 0x6f,
-	0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, 0x69, 0x73, 0x63,
-	0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x63,
+	0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44,
+	0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22,
+	0x38, 0x0a, 0x16, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72,
+	0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x63,
+	0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73,
+	0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x22, 0x33, 0x0a, 0x0c, 0x51, 0x75, 0x65,
+	0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x69, 0x6c,
+	0x74, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x0c, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x22, 0x45,
+	0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+	0x34, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
+	0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
+	0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x72, 0x65,
+	0x73, 0x75, 0x6c, 0x74, 0x73, 0x32, 0xdb, 0x01, 0x0a, 0x09, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76,
+	0x65, 0x72, 0x79, 0x12, 0x6f, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x20, 0x2e, 0x63,
 	0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, 0x69,
-	0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
-	0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x22, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, 0x73,
-	0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x3a, 0x01, 0x2a, 0x62,
-	0x01, 0x2a, 0x12, 0x5d, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x17, 0x2e, 0x63, 0x6c,
-	0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71,
-	0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72,
-	0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21,
-	0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x22, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, 0x73, 0x63,
-	0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x3a, 0x01, 0x2a, 0x62, 0x01,
-	0x2a, 0x42, 0x0f, 0x5a, 0x0d, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65,
-	0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21,
+	0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74,
+	0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+	0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x22, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x64,
+	0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x3a, 0x01,
+	0x2a, 0x62, 0x01, 0x2a, 0x12, 0x5d, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x17, 0x2e,
+	0x63, 0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52,
+	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74,
+	0x6f, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+	0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x22, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69,
+	0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x3a, 0x01, 0x2a,
+	0x62, 0x01, 0x2a, 0x42, 0x0f, 0x5a, 0x0d, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f,
+	0x76, 0x65, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
diff --git a/api/discovery/discovery.proto b/api/discovery/discovery.proto
index 0fafc05b..26374a90 100644
--- a/api/discovery/discovery.proto
+++ b/api/discovery/discovery.proto
@@ -56,8 +56,6 @@ service Discovery {
 }
 
 message StartDiscoveryRequest {
-  // A list of providers to be discovered
-  repeated string providers = 1;
 }
 
 message StartDiscoveryResponse { bool successful = 1; }
diff --git a/cli/commands/service/discovery/discovery.go b/cli/commands/service/discovery/discovery.go
index 7bd14b49..0e60dd3a 100644
--- a/cli/commands/service/discovery/discovery.go
+++ b/cli/commands/service/discovery/discovery.go
@@ -26,22 +26,15 @@
 package discovery
 
 import (
-	"context"
-	"fmt"
-	"github.com/spf13/viper"
-
 	"clouditor.io/clouditor/api/discovery"
 	"clouditor.io/clouditor/cli"
+	"context"
+	"fmt"
 	"github.com/spf13/cobra"
 )
 
-const (
-	DiscovererFlag = "discoverer"
-)
-
 // NewStartDiscoveryCommand returns a cobra command for the `start` subcommand
 func NewStartDiscoveryCommand() *cobra.Command {
-	var discoverer []string
 	cmd := &cobra.Command{
 		Use:   "start",
 		Short: "Starts the discovery",
@@ -60,15 +53,12 @@ func NewStartDiscoveryCommand() *cobra.Command {
 
 			client = discovery.NewDiscoveryClient(session)
 
-			res, err = client.Start(context.Background(), &discovery.StartDiscoveryRequest{Providers: discoverer})
+			res, err = client.Start(context.Background(), &discovery.StartDiscoveryRequest{})
 
 			return session.HandleResponse(res, err)
 		},
 	}
 
-	cmd.Flags().StringSliceVarP(&discoverer, DiscovererFlag, "d", []string{}, "Providers to discover, separated by comma")
-	_ = viper.BindPFlag(DiscovererFlag, cmd.Flags().Lookup(DiscovererFlag))
-
 	return cmd
 }
 
diff --git a/cmd/engine/engine.go b/cmd/engine/engine.go
index 90c496ab..abcb396d 100644
--- a/cmd/engine/engine.go
+++ b/cmd/engine/engine.go
@@ -48,7 +48,6 @@ import (
 	"clouditor.io/clouditor/api/discovery"
 	"clouditor.io/clouditor/api/evidence"
 	"clouditor.io/clouditor/api/orchestrator"
-	cli_discovery "clouditor.io/clouditor/cli/commands/service/discovery"
 	"clouditor.io/clouditor/logging/formatter"
 	"clouditor.io/clouditor/persistence"
 	"clouditor.io/clouditor/persistence/gorm"
@@ -84,6 +83,7 @@ const (
 	DBPortFlag                 = "db-port"
 	DBInMemoryFlag             = "db-in-memory"
 	CreateDefaultTarget        = "target-default-create"
+	ProviderFlag               = "provider"
 
 	DefaultAPIDefaultUser      = "clouditor"
 	DefaultAPIDefaultPassword  = "clouditor"
@@ -143,6 +143,7 @@ func init() {
 	engineCmd.Flags().Int16(DBPortFlag, DefaultDBPort, "Provides port for database")
 	engineCmd.Flags().Bool(DBInMemoryFlag, DefaultDBInMemory, "Uses an in-memory database which is not persisted at all")
 	engineCmd.Flags().Bool(CreateDefaultTarget, DefaultCreateDefaultTarget, "Creates a default target cloud service if it does not exist")
+	engineCmd.Flags().StringSliceVarP(&providers, ProviderFlag, "p", []string{}, "Providers to discover, separated by comma")
 
 	_ = viper.BindPFlag(APIDefaultUserFlag, engineCmd.Flags().Lookup(APIDefaultUserFlag))
 	_ = viper.BindPFlag(APIDefaultPasswordFlag, engineCmd.Flags().Lookup(APIDefaultPasswordFlag))
@@ -162,6 +163,7 @@ func init() {
 	_ = viper.BindPFlag(DBPortFlag, engineCmd.Flags().Lookup(DBPortFlag))
 	_ = viper.BindPFlag(DBInMemoryFlag, engineCmd.Flags().Lookup(DBInMemoryFlag))
 	_ = viper.BindPFlag(CreateDefaultTarget, engineCmd.Flags().Lookup(CreateDefaultTarget))
+	_ = viper.BindPFlag(ProviderFlag, engineCmd.Flags().Lookup(ProviderFlag))
 }
 
 func initConfig() {
@@ -199,10 +201,10 @@ func doCmd(_ *cobra.Command, _ []string) (err error) {
 	}
 
 	// If no CSPs for discovering is given, take all implemented discoverers
-	if viper.GetString(cli_discovery.DiscovererFlag) == "" {
+	if viper.GetString(ProviderFlag) == "" {
 		providers = []string{service_discovery.ProviderAWS, service_discovery.ProviderAzure, service_discovery.ProviderK8S}
 	} else {
-		providers = []string{viper.GetString(cli_discovery.DiscovererFlag)}
+		providers = []string{viper.GetString(ProviderFlag)}
 	}
 
 	authService = service_auth.NewService(
diff --git a/openapi/discovery/openapi.yaml b/openapi/discovery/openapi.yaml
index 1a9b9f0f..ac3426bc 100644
--- a/openapi/discovery/openapi.yaml
+++ b/openapi/discovery/openapi.yaml
@@ -70,12 +70,7 @@ components:
                     $ref: '#/components/schemas/ListValue'
         StartDiscoveryRequest:
             type: object
-            properties:
-                providers:
-                    type: array
-                    items:
-                        type: string
-                    description: A list of providers to be discovered
+            properties: {}
         StartDiscoveryResponse:
             type: object
             properties:
diff --git a/service/discovery/discovery.go b/service/discovery/discovery.go
index 1f8899a3..d2cb3259 100644
--- a/service/discovery/discovery.go
+++ b/service/discovery/discovery.go
@@ -111,6 +111,11 @@ func WithInternalAuthorizer(address string, username string, password string, op
 
 // WithProviders is an option to set providers for discovering
 func WithProviders(providersList []string) ServiceOption {
+	if len(providersList) == 0 {
+		newError := errors.New("no providers given")
+		log.Error(newError)
+	}
+
 	return func(s *Service) {
 		s.providers = providersList
 	}
@@ -170,21 +175,12 @@ func (s *Service) initAssessmentStream(additionalOpts ...grpc.DialOption) error
 }
 
 // Start starts discovery
-func (s *Service) Start(_ context.Context, req *discovery.StartDiscoveryRequest) (resp *discovery.StartDiscoveryResponse, err error) {
+func (s *Service) Start(_ context.Context, _ *discovery.StartDiscoveryRequest) (resp *discovery.StartDiscoveryResponse, err error) {
 	resp = &discovery.StartDiscoveryResponse{Successful: true}
 
 	log.Infof("Starting discovery...")
 	s.scheduler.TagsUnique()
 
-	// Set providers
-	if req == nil || req.Providers == nil || len(req.Providers) == 0 {
-		newError := errors.New("no providers for discovering given")
-		log.Errorf("%s", newError)
-		return nil, status.Errorf(codes.InvalidArgument, "%s", newError)
-	} else {
-		s.providers = req.Providers
-	}
-
 	// Establish connection to assessment component
 	if s.assessmentStream == nil {
 		err = s.initAssessmentStream()


Test patch:
diff --git a/service/discovery/discovery_test.go b/service/discovery/discovery_test.go
index d28a59ba..d0cdb9b9 100644
--- a/service/discovery/discovery_test.go
+++ b/service/discovery/discovery_test.go
@@ -252,9 +252,8 @@ func TestStart(t *testing.T) {
 	tests := []struct {
 		name           string
 		fields         fields
-		req       *discovery.StartDiscoveryRequest
-		providers []string
-		wantResp  *discovery.StartDiscoveryResponse
+		providers      []string
+		wantResp       *discovery.StartDiscoveryResponse
 		wantErr        bool
 		wantErrMessage string
 	}{
@@ -271,7 +270,6 @@ func TestStart(t *testing.T) {
 					},
 				},
 			},
-			req:            &discovery.StartDiscoveryRequest{Providers: []string{ProviderAzure}},
 			providers:      []string{ProviderAzure},
 			wantResp:       &discovery.StartDiscoveryResponse{Successful: true},
 			wantErr:        false,
@@ -295,7 +293,6 @@ func TestStart(t *testing.T) {
 					},
 				},
 			},
-			req:            &discovery.StartDiscoveryRequest{Providers: []string{ProviderAzure}},
 			providers:      []string{ProviderAzure},
 			wantResp:       nil,
 			wantErr:        true,
@@ -314,7 +311,6 @@ func TestStart(t *testing.T) {
 					},
 				},
 			},
-			req:            &discovery.StartDiscoveryRequest{Providers: []string{ProviderK8S}},
 			providers:      []string{ProviderK8S},
 			wantResp:       nil,
 			wantErr:        true,
@@ -325,7 +321,6 @@ func TestStart(t *testing.T) {
 			fields: fields{
 				hasRPCConnection: false,
 			},
-			req:            &discovery.StartDiscoveryRequest{Providers: []string{"aws", "azure", "k8s"}},
 			providers:      []string{"aws", "azure", "k8s"},
 			wantResp:       nil,
 			wantErr:        true,
@@ -344,7 +339,6 @@ func TestStart(t *testing.T) {
 					},
 				},
 			},
-			req:            &discovery.StartDiscoveryRequest{Providers: []string{"aws", "k8s"}},
 			providers:      []string{"aws", "k8s"},
 			wantResp:       nil,
 			wantErr:        true,
@@ -355,18 +349,16 @@ func TestStart(t *testing.T) {
 			fields: fields{
 				hasRPCConnection: true,
 			},
-			req:            &discovery.StartDiscoveryRequest{Providers: []string{}},
-			providers:      nil,
-			wantResp:       nil,
-			wantErr:        true,
-			wantErrMessage: "no providers for discovering given",
+			providers:      []string{},
+			wantResp:       &discovery.StartDiscoveryResponse{Successful: true},
+			wantErr:        false,
+			wantErrMessage: "",
 		},
 		{
 			name: "Request with wrong provider name",
 			fields: fields{
 				hasRPCConnection: true,
 			},
-			req:            &discovery.StartDiscoveryRequest{Providers: []string{"falseProvider"}},
 			providers:      []string{"falseProvider"},
 			wantResp:       nil,
 			wantErr:        true,
@@ -376,7 +368,7 @@ func TestStart(t *testing.T) {
 
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			s := NewService()
+			s := NewService(WithProviders(tt.providers))
 			if tt.fields.hasRPCConnection {
 				assert.NoError(t, s.initAssessmentStream(grpc.WithContextDialer(bufConnDialer)))
 			}
@@ -387,7 +379,7 @@ func TestStart(t *testing.T) {
 				}
 			}
 
-			resp, err := s.Start(context.TODO(), tt.req)
+			resp, err := s.Start(context.TODO(), nil)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("Got Start() error = %v, wantErr %v", err, tt.wantErr)
 				return
@@ -395,9 +387,6 @@ func TestStart(t *testing.T) {
 				assert.Equal(t, tt.wantResp, resp)
 			}
 
-			if tt.req != nil {
-				assert.Equal(t, tt.providers, s.providers)
-			}
 			if err != nil {
 				assert.Contains(t, err.Error(), tt.wantErrMessage)
 			}