Skip to content

Commit

Permalink
fix doctor plugin schema (#1161)
Browse files Browse the repository at this point in the history
* fix doctor plugin schema

* fix lint

* make plugin server port configurable
  • Loading branch information
madebyrogal authored Jul 27, 2023
1 parent 09b63ff commit ea69b68
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/executor/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Only Slack integration is described, but described steps are the same for all co
cacheDir: "/tmp/plugins"
repositories:
botkube:
url: http://host.k3d.internal:3000/botkube.yaml
url: http://host.k3d.internal:3010/botkube.yaml
rbac:
create: true
Expand All @@ -71,7 +71,7 @@ Only Slack integration is described, but described steps are the same for all co
1. Start plugin server:
```bash
env PLUGIN_SERVER_HOST=http://host.k3d.internal go run test/helpers/plugin_server.go
env PLUGIN_SERVER_HOST=http://host.k3d.internal env PLUGIN_SERVER_PORT=3010 go run test/helpers/plugin_server.go
```
1. Install Botkube
Expand Down
2 changes: 1 addition & 1 deletion internal/executor/doctor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (d *Executor) Metadata(context.Context) (api.MetadataOutput, error) {
Description: "Doctor helps in finding the root cause of a k8s problem.",
JSONSchema: api.JSONSchema{
Value: heredoc.Doc(`{
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "doctor",
"description": "Doctor helps in finding the root cause of a k8s problem.",
"type": "object",
Expand Down
9 changes: 8 additions & 1 deletion test/helpers/plugin_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"log"
"os"
"path/filepath"
"strconv"

"github.com/kubeshop/botkube/test/fake"
)
Expand All @@ -13,16 +14,22 @@ func main() {
exitOnErr(err)

host := os.Getenv("PLUGIN_SERVER_HOST")
port := os.Getenv("PLUGIN_SERVER_PORT")
if host == "" {
host = "http://localhost"
}
if port == "" {
port = "3010"
}
portInt, err := strconv.Atoi(port)
exitOnErr(err)

binDir := filepath.Join(dir, "plugin-dist")
indexEndpoint, startServerFn := fake.NewPluginServer(fake.PluginConfig{
BinariesDirectory: binDir,
Server: fake.PluginServer{
Host: host,
Port: 3000,
Port: portInt,
},
})

Expand Down

0 comments on commit ea69b68

Please sign in to comment.