Skip to content

Commit d6e73fc

Browse files
committed
Rename krill to device simulator
1 parent 446e214 commit d6e73fc

File tree

130 files changed

+358
-351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+358
-351
lines changed

.github/workflows/callout_build.yml renamed to .github/workflows/device_simulator_build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
name: callout_build
1+
name: device-simulator_build
22

33
on:
44
workflow_dispatch:
55
push:
66
tags:
7-
- 'v*.*.*-callout'
7+
- 'v*.*.*-device-simulator'
88

99
jobs:
1010
call-docker-build:
1111
uses: ./.github/workflows/docker_build.yml
1212
with:
13-
registry: makocr.azurecr.io/callout
14-
file: samples/callout/Dockerfile
13+
registry: makocr.azurecr.io/device-simulator
14+
file: samples/device-simulator/Dockerfile
1515
context: .
1616
secrets:
1717
azureCredentials: ${{ secrets.AZURE_CREDENTIALS }}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: krill_test
1+
name: device-simulator_test
22

33
on:
44
workflow_dispatch:
55
push:
66
paths:
7-
- samples/callout/**
7+
- samples/device-simulator/**
88

99
jobs:
1010
call-mage-test:
1111
uses: ./.github/workflows/mage_tests.yml
1212
with:
13-
workdir: samples/callout/
13+
workdir: samples/device-simulator/

.github/workflows/krill_build.yml renamed to .github/workflows/http_grpc_callout_build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
name: krill_build
1+
name: http_grpc_callout_build
22

33
on:
44
workflow_dispatch:
55
push:
66
tags:
7-
- 'v*.*.*-krill'
7+
- 'v*.*.*-http-grpc-callout'
88

99
jobs:
1010
call-docker-build:
1111
uses: ./.github/workflows/docker_build.yml
1212
with:
13-
registry: makocr.azurecr.io/krill
14-
file: samples/krill/Dockerfile
13+
registry: makocr.azurecr.io/http-grpc-callout
14+
file: samples/http-grpc-callout/Dockerfile
1515
context: .
1616
secrets:
1717
azureCredentials: ${{ secrets.AZURE_CREDENTIALS }}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: krill_test
1+
name: http_grpc_callout_test
22

33
on:
44
workflow_dispatch:
55
push:
66
paths:
7-
- samples/krill/**
7+
- samples/http-grpc-callout/**
88

99
jobs:
1010
call-mage-test:
1111
uses: ./.github/workflows/mage_tests.yml
1212
with:
13-
workdir: samples/krill/
13+
workdir: samples/http-grpc-callout/

samples/krill/.gitignore renamed to samples/device-simulator/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ bin
44
dns.yaml
55
/src/**/config.json
66
/bin
7-
/krill
87
/listen
98
/mqtt
109
/manager
File renamed without changes.

samples/krill/Dockerfile renamed to samples/device-simulator/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21-cbl-mariner2.0 AS build
44

55
COPY ./lib /workdir/lib
66

7-
COPY ./samples/krill /workdir/samples/krill
7+
COPY ./samples/device-simulator /workdir/samples/device-simulator
88

9-
WORKDIR /workdir/samples/krill
9+
WORKDIR /workdir/samples/device-simulator
1010

1111
RUN go mod download
1212

1313
RUN go install github.com/magefile/mage@latest
1414

1515
RUN mage ci
1616

17-
RUN go build -o ./bin/krill ./cmd/krill
17+
RUN go build -o ./bin/device-simulator ./cmd
1818

1919
EXPOSE 2112
2020

21-
CMD [ "/bin/krill" ]
21+
CMD [ "/bin/device-simulator" ]

samples/krill/README.md renamed to samples/device-simulator/README.md

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
1-
# Krill
1+
# Device Simulator
22

33
```
4-
⠀⠀⠀⠀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣤⣤⣀⠀⠀⠀⠀⠀⠀
5-
⠀⠀⢀⣀⡙⠻⢶⣶⣦⣴⣶⣶⣶⠾⠛⠛⠋⠉⠉⠉⠉⠙⠃⠀⠀⠀⠀⠀
6-
⠀⠀⠀⠉⠉⠙⠛⠛⠋⠉⠉⠡⣤⣴⣶⣶⣾⣿⣿⣿⣛⣩⣤⡤⠖⠀⠀⠀
7-
⠀⠀⠀⠀⠀⠀⢠⣴⣾⠂⣴⣦⠈⣿⣿⣿⣿⣿⣿⠿⠛⣋⠁⠀⠀⠀⠀⠀
8-
⠀⠀⢀⣼⣿⣶⣄⡉⠻⣧⣌⣁⣴⣿⣿⣿⣿⣿⣿⡿⠛⠁⠀⠀⠀⠀⠀⠀
9-
⠀⠀⣾⣿⣿⣿⣿⣿⣦⡈⢻⣿⣿⣿⣿⡿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀
10-
⠀⡀⢻⣿⣿⣿⣿⣿⣿⣿⡄⠙⠛⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
11-
⢠⣷⣄⡉⠻⢿⣿⣿⣿⠏⠠⢶⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
12-
⢸⣿⣿⣿⣶⣤⣈⠙⠁⠰⣦⣀⠉⠻⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
13-
⠘⢿⣿⣿⣿⣿⣿⡇⠠⣦⣄⠉⠳⣤⠈⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
14-
⠀⢠⣌⣉⡉⠉⣉⡁⠀⠀⠙⠗⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
15-
⠀⠀⠹⢿⣿⣿⣿⣿⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
16-
⠀⠀⠀⠀⠙⠻⣿⣿⠟⢀⣤⡀⠀⠀⠀⠀⠀⠀⣀⣀⣠⣤⣤⣤⠀⠀⠀⠀
17-
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠿⠿⡿⠂⣀⣠⣤⣤⣤⣀⣉⣉⠉⠉⠀⠀⠀⠀
18-
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠙⠛⠛⠛⠛⠋⠉⠉⠁
4+
____ _ _____ _ _ _
5+
| \ ___ _ _|_|___ ___ | __|_|_____ _ _| |___| |_ ___ ___
6+
| | | -_| | | | _| -_| |__ | | | | | | .'| _| . | _|
7+
|____/|___|\_/|_|___|___| |_____|_|_|_|_|___|_|__,|_| |___|_|
198
```
209

21-
Krill is a highly configurable MQTT asset simulator.
10+
Device Simulator is a highly configurable MQTT asset simulator.
2211

2312
## Usage
2413

25-
### Krill as K8s Pod
14+
### Device Simulator as K8s Pod
2615

27-
`kubectl run krill --image=azbluefin.azurecr.io/krill:latest --stdin < config.yml`
16+
```sh
17+
# From the root of the device-simulator directory.
18+
docker build ../.. -f Dockerfile -t <yourcrhere>.azurecr.io/device-simulator:latest
2819

29-
Krill runs as a pod within the desired cluster using the kubectl run command. The configuration of choice is provided via stdin of the krill process within the pod, provided in the command above using `--stdin < config.yml`. Alternative names for a configuration file may be used -- the command simply uses stdin piping to provide krill with an appropriate configuration.
20+
# Or if running from the root of the explore-iot-operations repository.
21+
# docker build . -f ./samples/device-simulator/Dockerfile -t <yourcrhere>.azurecr.io/device-simulator:latest
22+
23+
# Push or load your newly built image into your cluster, depending on the k8s setup.
24+
# docker push <yourcrhere>.azurecr.io/device-simulator:latest # Using AKS + Connected ACR
25+
# minikube load <yourcrhere>.azurecr.io/device-simulator:latest # Using minikube
26+
# docker save <yourcrhere>.azurecr.io/device-simulator:latest | k3s ctr images import - # Using K3s
27+
28+
kubectl run device-simulator --image=<yourcrhere>.azurecr.io/device-simulator:latest --stdin < config.yml
29+
```
30+
31+
Device simulator runs as a pod within the desired cluster using the kubectl run command. The configuration of choice is provided via stdin of the simulator process within the pod, provided in the command above using `--stdin < config.yml`. Alternative names for a configuration file may be used -- the command simply uses stdin piping to provide simulator with an appropriate configuration.
3032

3133
See the example YAML configuration below, with comments describing the various configurable fields.
3234

@@ -91,6 +93,31 @@ simulation:
9193

9294
```
9395

96+
### Device Simulator on the Command Line
97+
98+
#### Method 1
99+
100+
```sh
101+
# With Golang installed, the device simulator can be run from the cmd folder.
102+
cd ./cmd
103+
go run . < config.yml
104+
# Or by reading in a file instead of stdin:
105+
# go run . --stdin=false --config=config.yml
106+
```
107+
108+
#### Method 2
109+
110+
```sh
111+
# With Golang installed, build a binary of the device simulator.
112+
go build -o ./bin/device-simulator ./cmd
113+
./device-simulator < config.yml
114+
115+
# Or by reading in a file instead of stdin:
116+
# ./device-simulator --stdin=false --config=config.yml
117+
```
118+
119+
## Configuring a Simulation
120+
94121
### Configuring Payload Formats
95122

96123
There are currently five supported types of payload formats:
@@ -178,7 +205,7 @@ Example Equations:
178205

179206
## Metrics
180207

181-
Prometheus metrics are provided by the krill simulator at the port specified in the metrics field of the configuration. The available metrics are:
208+
Prometheus metrics are provided by the simulator at the port specified in the metrics field of the configuration. The available metrics are:
182209

183-
1. `krill_entity_gauge` - shows the count of each system entity.
184-
1. `krill_<siteName>_asset_publish_counter` - records the number of messages published, labeled by asset identifier.
210+
1. `device_simulator_entity_gauge` - shows the count of each system entity.
211+
1. `device_simulator_<siteName>_asset_publish_counter` - records the number of messages published, labeled by asset identifier.

samples/krill/cmd/krill/main.go renamed to samples/device-simulator/cmd/main.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ import (
1414

1515
"github.com/explore-iot-ops/lib/env"
1616
"github.com/explore-iot-ops/lib/logger"
17-
"github.com/explore-iot-ops/samples/krill/components/broker"
18-
"github.com/explore-iot-ops/samples/krill/components/client"
19-
"github.com/explore-iot-ops/samples/krill/components/edge"
20-
"github.com/explore-iot-ops/samples/krill/components/formatter"
21-
"github.com/explore-iot-ops/samples/krill/components/limiter"
22-
"github.com/explore-iot-ops/samples/krill/components/node"
23-
"github.com/explore-iot-ops/samples/krill/components/observer"
24-
"github.com/explore-iot-ops/samples/krill/components/outlet"
25-
"github.com/explore-iot-ops/samples/krill/components/provider"
26-
"github.com/explore-iot-ops/samples/krill/components/publisher"
27-
"github.com/explore-iot-ops/samples/krill/components/registry"
28-
"github.com/explore-iot-ops/samples/krill/components/renderer"
29-
"github.com/explore-iot-ops/samples/krill/components/site"
30-
"github.com/explore-iot-ops/samples/krill/components/subscriber"
31-
"github.com/explore-iot-ops/samples/krill/components/topic"
32-
"github.com/explore-iot-ops/samples/krill/components/tracer"
33-
"github.com/explore-iot-ops/samples/krill/lib/exporter"
34-
"github.com/explore-iot-ops/samples/krill/lib/krill"
17+
"github.com/explore-iot-ops/samples/device-simulator/components/broker"
18+
"github.com/explore-iot-ops/samples/device-simulator/components/client"
19+
"github.com/explore-iot-ops/samples/device-simulator/components/edge"
20+
"github.com/explore-iot-ops/samples/device-simulator/components/formatter"
21+
"github.com/explore-iot-ops/samples/device-simulator/components/limiter"
22+
"github.com/explore-iot-ops/samples/device-simulator/components/node"
23+
"github.com/explore-iot-ops/samples/device-simulator/components/observer"
24+
"github.com/explore-iot-ops/samples/device-simulator/components/outlet"
25+
"github.com/explore-iot-ops/samples/device-simulator/components/provider"
26+
"github.com/explore-iot-ops/samples/device-simulator/components/publisher"
27+
"github.com/explore-iot-ops/samples/device-simulator/components/registry"
28+
"github.com/explore-iot-ops/samples/device-simulator/components/renderer"
29+
"github.com/explore-iot-ops/samples/device-simulator/components/site"
30+
"github.com/explore-iot-ops/samples/device-simulator/components/subscriber"
31+
"github.com/explore-iot-ops/samples/device-simulator/components/topic"
32+
"github.com/explore-iot-ops/samples/device-simulator/components/tracer"
33+
"github.com/explore-iot-ops/samples/device-simulator/lib/exporter"
34+
"github.com/explore-iot-ops/samples/device-simulator/lib/external"
3535
"gopkg.in/yaml.v3"
3636

3737
"github.com/prometheus/client_golang/prometheus"
@@ -48,7 +48,7 @@ func main() {
4848

4949
func run() error {
5050

51-
fmt.Print(krill.Krill)
51+
fmt.Print(external.Logo)
5252

5353
ctx := context.Background()
5454

@@ -70,8 +70,8 @@ func run() error {
7070
unmarshal = json.Unmarshal
7171
}
7272

73-
configReader := env.New[krill.Configuration](
74-
func(cr *env.ConfigurationReader[krill.Configuration]) {
73+
configReader := env.New[external.Configuration](
74+
func(cr *env.ConfigurationReader[external.Configuration]) {
7575
cr.Unmarshal = unmarshal
7676
if *flags["stdin"].(*bool) {
7777
cr.ReadFile = func(_ string) ([]byte, error) {
@@ -189,7 +189,7 @@ func run() error {
189189
topicService := topic.NewService(topicStore, registryStore)
190190
tracerService := tracer.NewService(tracerStore, registryStore)
191191

192-
builder := krill.New(
192+
builder := external.New(
193193
brokerService,
194194
clientService,
195195
edgeService,
@@ -208,7 +208,7 @@ func run() error {
208208
tracerService,
209209
)
210210

211-
lg.Printf("parsing krill configuration")
211+
lg.Printf("parsing external configuration")
212212

213213
err = builder.Parse(configuration.Simulation)
214214
if err != nil {

samples/krill/components/broker/broker.go renamed to samples/device-simulator/components/broker/broker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package broker
77
import (
88
"fmt"
99

10-
"github.com/explore-iot-ops/samples/krill/components/registry"
10+
"github.com/explore-iot-ops/samples/device-simulator/components/registry"
1111
)
1212

1313
type Source interface {

samples/krill/components/broker/service.go renamed to samples/device-simulator/components/broker/service.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
package broker
55

66
import (
7-
"github.com/explore-iot-ops/samples/krill/components/observer"
8-
"github.com/explore-iot-ops/samples/krill/components/registry"
9-
"github.com/explore-iot-ops/samples/krill/lib/component"
7+
"github.com/explore-iot-ops/samples/device-simulator/components/observer"
8+
"github.com/explore-iot-ops/samples/device-simulator/components/registry"
9+
"github.com/explore-iot-ops/samples/device-simulator/lib/component"
1010
)
1111

1212
type Store component.Store[Source, component.ID]

samples/krill/components/broker/service_test.go renamed to samples/device-simulator/components/broker/service_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ package broker
66
import (
77
"testing"
88

9-
"github.com/explore-iot-ops/samples/krill/components/observer"
10-
"github.com/explore-iot-ops/samples/krill/components/registry"
11-
"github.com/explore-iot-ops/samples/krill/lib/component"
9+
"github.com/explore-iot-ops/samples/device-simulator/components/observer"
10+
"github.com/explore-iot-ops/samples/device-simulator/components/registry"
11+
"github.com/explore-iot-ops/samples/device-simulator/lib/component"
1212
"github.com/stretchr/testify/require"
1313
)
1414

samples/krill/components/client/client.go renamed to samples/device-simulator/components/client/client.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"time"
1313

1414
"github.com/explore-iot-ops/lib/logger"
15-
"github.com/explore-iot-ops/samples/krill/components/registry"
16-
"github.com/explore-iot-ops/samples/krill/components/site"
15+
"github.com/explore-iot-ops/samples/device-simulator/components/registry"
16+
"github.com/explore-iot-ops/samples/device-simulator/components/site"
1717

1818
mqtt "github.com/eclipse/paho.mqtt.golang"
1919
)
@@ -28,10 +28,7 @@ type PublisherSubscriber interface {
2828
GetName() string
2929
}
3030

31-
// Publisher is an interface whose implementation should include the observable functionality (see registry // Copyright (c) Microsoft Corporation.
32-
// Licensed under the MIT License.
33-
34-
package),
31+
// Publisher is an interface whose implementation should include the observable functionality (see registry package),
3532
// as well as the ability to publish a message on a given topic.
3633
type Publisher interface {
3734
Publish(topic string, qos byte, messagesRetained bool, data []byte) error

samples/krill/components/client/client_test.go renamed to samples/device-simulator/components/client/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010

1111
mqttv5 "github.com/eclipse/paho.golang/paho"
1212
mqtt "github.com/eclipse/paho.mqtt.golang"
13-
"github.com/explore-iot-ops/samples/krill/components/site"
14-
"github.com/explore-iot-ops/samples/krill/lib/errors"
13+
"github.com/explore-iot-ops/samples/device-simulator/components/site"
14+
"github.com/explore-iot-ops/samples/device-simulator/lib/errors"
1515
"github.com/stretchr/testify/require"
1616
)
1717

samples/krill/components/client/errors.go renamed to samples/device-simulator/components/client/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package client
66
import (
77
"fmt"
88

9-
"github.com/explore-iot-ops/samples/krill/lib/errors"
9+
"github.com/explore-iot-ops/samples/device-simulator/lib/errors"
1010
)
1111

1212
type BrokerConnectionError struct {

samples/krill/components/client/service.go renamed to samples/device-simulator/components/client/service.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import (
77
"context"
88

99
"github.com/explore-iot-ops/lib/logger"
10-
"github.com/explore-iot-ops/samples/krill/components/broker"
11-
"github.com/explore-iot-ops/samples/krill/components/observer"
12-
"github.com/explore-iot-ops/samples/krill/components/registry"
13-
"github.com/explore-iot-ops/samples/krill/components/site"
14-
"github.com/explore-iot-ops/samples/krill/lib/component"
15-
"github.com/explore-iot-ops/samples/krill/lib/dialer"
10+
"github.com/explore-iot-ops/samples/device-simulator/components/broker"
11+
"github.com/explore-iot-ops/samples/device-simulator/components/observer"
12+
"github.com/explore-iot-ops/samples/device-simulator/components/registry"
13+
"github.com/explore-iot-ops/samples/device-simulator/components/site"
14+
"github.com/explore-iot-ops/samples/device-simulator/lib/component"
15+
"github.com/explore-iot-ops/samples/device-simulator/lib/dialer"
1616

1717
mqttv5 "github.com/eclipse/paho.golang/paho"
1818
mqttv3 "github.com/eclipse/paho.mqtt.golang"

0 commit comments

Comments
 (0)