gateway

command module
v0.1.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Gateway

The Gateway enables broadcasting a single message to the different microservices running in the cluster.

The gateway works as a tree: there is the root and the different leafs. The leafs “attach” to the root using a set of attributes, while the root provides an API.

When broadcasting a message, the message must contain the attributes to whom it should be broadcast. The root will broadcast the message to all the leafs that registered with those attributes.

Building gateway

To build the gateway run: go build .

Configuration

Load config file using the CONFIG environment variable

export CONFIG=path/to/clusterData.json

example/clusterData.json
{
   "gatewayWebsocketURL": "127.0.0.1:8001",
   "gatewayRestURL": "127.0.0.1:8002",
   "kubevulnURL": "127.0.0.1:8081",
   "kubescapeURL": "127.0.0.1:8080",
   "eventReceiverRestURL": "https://report.armo.cloud",
   "eventReceiverWebsocketURL": "wss://report.armo.cloud",
   "rootGatewayURL": "wss://ens.euprod1.cyberarmorsoft.com/v1/waitfornotification",
   "accountID": "*********************",
   "clusterName": "******" 
  } 

API Documentation

As mentioned before, the Gateway exposes an HTTP API. You can learn more about the API using one of the provided interactive OpenAPI UIs:

  • SwaggerUI, available at /openapi/v2/swaggerui
  • RapiDoc, available at /openapi/v2/rapi
  • Redoc, available at /openapi/v2/docs

Supported environment variables

  • WEBSOCKET_PORT: websocket port (default 8001)
  • HTTP_PORT: restAPI port (default 8002)

For more details on environment variables, check out pkg/environmentvariables.go.

VS code configuration samples

You can use the sample file below to setup your VS code environment for building and debugging purposes.

.vscode/launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program":  "${workspaceRoot}",
                 "env": {
                     "NAMESPACE": "armo-system",
                     "CONFIG": "${workspaceRoot}/.vscode/clusterData.json",
            },
            "args": [
                "-alsologtostderr", "-v=4", "2>&1"
            ]
        }
    ]
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package classification Kubescape Gateway
Package classification Kubescape Gateway
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址