Skip to content

Commit

Permalink
Add comments for PodRunner (#5424)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepikaDixit authored and tdmanv committed Apr 17, 2019
1 parent a03bafa commit ac72e67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/kube/pod_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@ import (
"k8s.io/client-go/kubernetes"
)

// PodRunner specifies Kubernetes Client and PodOptions needed for creating Pod
type PodRunner struct {
cli kubernetes.Interface
podOptions *PodOptions
}

// NewPodRunner returns a new PodRunner given Kubernetes Client and PodOptions
func NewPodRunner(cli kubernetes.Interface, options *PodOptions) *PodRunner {
return &PodRunner{
cli: cli,
podOptions: options,
}
}

// Run will create a new Pod based on PodRunner contents and execute the given function
func (p *PodRunner) Run(ctx context.Context, fn func(context.Context, *v1.Pod) (map[string]interface{}, error)) (map[string]interface{}, error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
Expand Down

0 comments on commit ac72e67

Please sign in to comment.