Skip to content

Commit

Permalink
feat(service): fix opa service uri malformatting
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Becker <sebastian.becker@de.bosch.com>
  • Loading branch information
sbckr committed Nov 21, 2024
1 parent ca4daf8 commit bbfaf27
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/ephemeral/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ephemeral:
minScale: 1
programIdentifier: "ephemeral-generic"
opa:
endpoint: "http://opa.carbynestack.io"
endpoint: "http://opa.default.svc.cluster.local:8081/"
policyPackage: "carbynestack.def"
amphora:
host: "amphora"
Expand Down
2 changes: 1 addition & 1 deletion pkg/discovery/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ func NewGame(ctx context.Context, id string, bus mb.MessageBus, stateTimeout tim
fsm.WhenIn(WaitTCPCheck).GotEvent(TCPCheckSuccess).Stay(),
fsm.WhenIn(WaitTCPCheck).GotEvent(TCPCheckSuccessAll).GoTo(Playing).WithTimeout(computationTimeout),
fsm.WhenIn(WaitTCPCheck).GotEvent(TCPCheckFailure).GoTo(GameError),
fsm.WhenIn(WaitTCPCheck).GotEvent(GameFinishedWithError).GoTo(GameError),
fsm.WhenIn(Playing).GotEvent(GameFinishedWithSuccess).Stay(),
fsm.WhenIn(Playing).GotEvent(GameFinishedWithError).GoTo(GameError),
fsm.WhenIn(Playing).GotEvent(GameSuccess).GoTo(GameDone),
fsm.WhenIn(Playing).GotEvent(GameError).GoTo(GameError),
fsm.WhenInAnyState().GotEvent(GameFinishedWithError).GoTo(GameError),
fsm.WhenInAnyState().GotEvent(StateTimeoutError).GoTo(GameError),
fsm.WhenInAnyState().GotEvent(GameDone).GoTo(GameDone),
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/ephemeral/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ func NewPlayer(ctx context.Context, bus mb.MessageBus, stateTimeout time.Duratio
fsm.WhenIn(Init).GotEvent(Register).GoTo(Registering),
fsm.WhenIn(Registering).GotEvent(PlayersReady).GoTo(Playing).WithTimeout(computationTimeout),
fsm.WhenIn(Playing).GotEvent(PlayerFinishedWithSuccess).GoTo(PlayerFinishedWithSuccess),
fsm.WhenIn(Playing).GotEvent(PlayerFinishedWithError).GoTo(PlayerFinishedWithError),
fsm.WhenIn(Playing).GotEvent(PlayingError).GoTo(PlayerFinishedWithError),
fsm.WhenInAnyState().GotEvent(GameError).GoTo(PlayerFinishedWithError),
fsm.WhenInAnyState().GotEvent(PlayingError).GoTo(PlayerFinishedWithError),
fsm.WhenInAnyState().GotEvent(PlayerDone).GoTo(PlayerDone),
fsm.WhenInAnyState().GotEvent(StateTimeoutError).GoTo(PlayerFinishedWithError),
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/opa/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (c *Client) makeOpaRequest(action string, data interface{}, v interface{})
req, err := http.NewRequest(
"POST",
fmt.Sprintf("%s/v1/data/%s/%s",
c.URL.String(),
strings.Trim(c.URL.String(), "/"),
strings.ReplaceAll(c.PolicyPackage, ".", "/"),
action),
bytes.NewBuffer(payload))
Expand Down

0 comments on commit bbfaf27

Please sign in to comment.