Skip to content

Commit

Permalink
feat: add wait for ready runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
phillebaba committed Jun 18, 2024
1 parent b2d5cd4 commit df95cf2
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion kubernetes/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package kubernetes
import (
"context"

"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/discovery"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/rest"
Expand Down Expand Up @@ -37,7 +38,20 @@ func WatcherForConfig(cfg *rest.Config) (watcher.StatusWatcher, error) {
return sw, nil
}

// WaitForReady waits for all of the resources to reach a ready state.
// WaitForReady waits for all of the runtime objects to reach a ready state.

Check warning on line 41 in kubernetes/wait.go

View workflow job for this annotation

GitHub Actions / lint

comment on exported function WaitForReadyRuntime should be of the form "WaitForReadyRuntime ..."
func WaitForReadyRuntime(ctx context.Context, sw watcher.StatusWatcher, robjs []runtime.Object) error {
objs := []object.ObjMetadata{}
for _, robj := range robjs {
obj, err := object.RuntimeToObjMeta(robj)
if err != nil {
return err
}
objs = append(objs, obj)
}
return WaitForReady(ctx, sw, objs)
}

// WaitForReady waits for all of the objects to reach a ready state.
func WaitForReady(ctx context.Context, sw watcher.StatusWatcher, objs []object.ObjMetadata) error {
cancelCtx, cancel := context.WithCancel(ctx)
defer cancel()
Expand Down

0 comments on commit df95cf2

Please sign in to comment.