Skip to content

Commit 4956efb

Browse files
authored
Remove skaffoldLogs endpoint, consolidate into events endpoint (GoogleContainerTools#6296)
* remote skaffoldLogs endpoint, consolidate into events endpoint * update test
1 parent b4c2367 commit 4956efb

File tree

6 files changed

+150
-295
lines changed

6 files changed

+150
-295
lines changed

pkg/skaffold/event/v2/event.go

-19
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ type eventHandler struct {
7070
logLock sync.Mutex
7171
applicationLogs []proto.Event
7272
applicationLogsLock sync.Mutex
73-
skaffoldLogs []proto.Event
74-
skaffoldLogsLock sync.Mutex
7573
cfg Config
7674

7775
iteration int
@@ -80,7 +78,6 @@ type eventHandler struct {
8078
eventChan chan *proto.Event
8179
eventListeners []*listener
8280
applicationLogListeners []*listener
83-
skaffoldLogListeners []*listener
8481
}
8582

8683
type listener struct {
@@ -106,10 +103,6 @@ func ForEachApplicationLog(callback func(*proto.Event) error) error {
106103
return handler.forEachApplicationLog(callback)
107104
}
108105

109-
func ForEachSkaffoldLog(callback func(*proto.Event) error) error {
110-
return handler.forEachSkaffoldLog(callback)
111-
}
112-
113106
func Handle(event *proto.Event) error {
114107
if event != nil {
115108
handler.handle(event)
@@ -155,10 +148,6 @@ func (ev *eventHandler) logApplicationLog(event *proto.Event) {
155148
ev.log(event, &ev.applicationLogListeners, &ev.applicationLogs, &ev.applicationLogsLock)
156149
}
157150

158-
func (ev *eventHandler) logSkaffoldLog(event *proto.Event) {
159-
ev.log(event, &ev.skaffoldLogListeners, &ev.skaffoldLogs, &ev.skaffoldLogsLock)
160-
}
161-
162151
func (ev *eventHandler) forEach(listeners *[]*listener, log *[]proto.Event, lock sync.Locker, callback func(*proto.Event) error) error {
163152
listener := &listener{
164153
callback: callback,
@@ -191,10 +180,6 @@ func (ev *eventHandler) forEachApplicationLog(callback func(*proto.Event) error)
191180
return ev.forEach(&ev.applicationLogListeners, &ev.applicationLogs, &ev.applicationLogsLock, callback)
192181
}
193182

194-
func (ev *eventHandler) forEachSkaffoldLog(callback func(*proto.Event) error) error {
195-
return ev.forEach(&ev.skaffoldLogListeners, &ev.skaffoldLogs, &ev.skaffoldLogsLock, callback)
196-
}
197-
198183
func emptyState(cfg Config) proto.State {
199184
builds := map[string]string{}
200185
for _, p := range cfg.GetPipelines() {
@@ -316,7 +301,6 @@ func TaskInProgress(task constants.Phase, description string) {
316301
handler.iteration++
317302

318303
handler.applicationLogs = []proto.Event{}
319-
handler.skaffoldLogs = []proto.Event{}
320304
}
321305

322306
handler.handleTaskEvent(&proto.TaskEvent{
@@ -402,9 +386,6 @@ func (ev *eventHandler) handleExec(event *proto.Event) {
402386
case *proto.Event_ApplicationLogEvent:
403387
ev.logApplicationLog(event)
404388
return
405-
case *proto.Event_SkaffoldLogEvent:
406-
ev.logSkaffoldLog(event)
407-
return
408389
case *proto.Event_BuildSubtaskEvent:
409390
be := e.BuildSubtaskEvent
410391
if be.Step == Build {

pkg/skaffold/event/v2/logger_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ func TestHandleSkaffoldLogEvent(t *testing.T) {
4848
})
4949
}
5050
wait(t, func() bool {
51-
testHandler.skaffoldLogsLock.Lock()
52-
logLen := len(testHandler.skaffoldLogs)
53-
testHandler.skaffoldLogsLock.Unlock()
51+
testHandler.logLock.Lock()
52+
logLen := len(testHandler.eventLog)
53+
testHandler.logLock.Unlock()
5454
return logLen == len(messages)
5555
})
5656
}

pkg/skaffold/server/v2/endpoints.go

-4
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ func (s *Server) ApplicationLogs(_ *empty.Empty, stream proto.SkaffoldV2Service_
4646
return event.ForEachApplicationLog(stream.Send)
4747
}
4848

49-
func (s *Server) SkaffoldLogs(_ *empty.Empty, stream proto.SkaffoldV2Service_SkaffoldLogsServer) error {
50-
return event.ForEachSkaffoldLog(stream.Send)
51-
}
52-
5349
func (s *Server) Handle(ctx context.Context, e *proto.Event) (*empty.Empty, error) {
5450
return &empty.Empty{}, event.Handle(e)
5551
}

0 commit comments

Comments
 (0)