Skip to content

Commit 70a6339

Browse files
authored
feat(core): add pods details to firehose output (#103)
1 parent 0cacc40 commit 70a6339

18 files changed

+422
-97
lines changed

core/core.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ package core
44
//go:generate mockery --name=ModuleService -r --case underscore --with-expecter --structname ModuleService --filename=module_service.go --output=./mocks
55

66
import (
7-
"context"
7+
context "context"
8+
"encoding/json"
89
"time"
910

1011
"go.uber.org/zap"
@@ -26,7 +27,8 @@ type Service struct {
2627
type ModuleService interface {
2728
PlanAction(ctx context.Context, res module.ExpandedResource, act module.ActionRequest) (*module.Plan, error)
2829
SyncState(ctx context.Context, res module.ExpandedResource) (*resource.State, error)
29-
StreamLogs(ctx context.Context, spec module.ExpandedResource, filter map[string]string) (<-chan module.LogChunk, error)
30+
StreamLogs(ctx context.Context, res module.ExpandedResource, filter map[string]string) (<-chan module.LogChunk, error)
31+
GetOutput(ctx context.Context, res module.ExpandedResource) (json.RawMessage, error)
3032
}
3133

3234
type AsyncWorker interface {

core/mocks/driver.go

+50-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/mocks/loggable_module.go

+59-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/mocks/module_service.go

+58-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/module/driver.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ type Driver interface {
2626
// Sync can return state in resource.StatusDeleted to indicate resource
2727
// should be removed from the Entropy storage.
2828
Sync(ctx context.Context, res ExpandedResource) (*resource.State, error)
29+
30+
// Output returns the current external state of the resource
31+
// Output should not have any side effects on any external resource
32+
Output(ctx context.Context, res ExpandedResource) (json.RawMessage, error)
2933
}
3034

3135
// Plan represents the changes to be staged and later synced by module.
@@ -38,7 +42,7 @@ type Plan struct {
3842
type Loggable interface {
3943
Driver
4044

41-
Log(ctx context.Context, spec ExpandedResource, filter map[string]string) (<-chan LogChunk, error)
45+
Log(ctx context.Context, res ExpandedResource, filter map[string]string) (<-chan LogChunk, error)
4246
}
4347

4448
// ExpandedResource represents the context for Plan() or Sync() invocations.

core/module/module.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ func (desc Descriptor) validateDependencies(dependencies map[string]ResolvedDepe
7979
return nil
8080
}
8181

82-
func (desc Descriptor) validateActionReq(spec ExpandedResource, req ActionRequest) error {
83-
kind := spec.Resource.Kind
82+
func (desc Descriptor) validateActionReq(res ExpandedResource, req ActionRequest) error {
83+
kind := res.Resource.Kind
8484

8585
actDesc := desc.findAction(req.Name)
8686
if actDesc == nil {

0 commit comments

Comments
 (0)