Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

track podman events in kube play #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

vyasgun
Copy link
Owner

@vyasgun vyasgun commented May 24, 2023

Does this PR introduce a user-facing change?


@vyasgun vyasgun force-pushed the pr/kube-play-progress branch 3 times, most recently from 6220ce5 to 58e21d4 Compare May 25, 2023 06:28
Copy link

@lkingland lkingland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review is just some minor notes I made as I was reading through.

"github.com/containers/podman/v4/pkg/domain/entities"
v1apps "github.com/containers/podman/v4/pkg/k8s.io/api/apps/v1"
v1 "github.com/containers/podman/v4/pkg/k8s.io/api/core/v1"
metav1 "github.com/containers/podman/v4/pkg/k8s.io/apimachinery/pkg/apis/meta/v1"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor stylistic question: I wonder if it would make sense to match the naming convention of the already-imported v1apps and name this one v1meta?

Comment on lines 35 to 43
"io"
"net/http"
"os"
"path/filepath"
"sigs.k8s.io/yaml"
"strconv"
"strings"
"sync"
"time"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may want to ensure your IDE is running goimports along with gofmt on save. Builtin imports I believe are automatically moved to the top imports block.

@@ -446,6 +446,7 @@ func teardown(body io.Reader, options entities.PlayKubeDownOptions) error {
}

func kubeplay(body io.Reader) error {
//go abi.PrintProgress(registry.GetContext(), registry.ContainerEngine(), os.Stdout)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the --quiet flag is false by default. Perhaps it would be nice to update that flag to silence this progress as well?

@@ -46,6 +50,8 @@ const sdNotifyAnnotation = "io.containers.sdnotify"
// default network created/used by kube
const kubeDefaultNetwork = "podman-default-kube-network"

var eventFiltersCh = make(chan string)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would guess that the events channel should be a member of ContainerEngine

@@ -181,6 +245,13 @@ func (ic *ContainerEngine) PlayKube(ctx context.Context, body io.Reader, options
}
}()

if eventFilters, err := getEventFilters(documentList); err != nil {
return nil, err
} else {
Copy link

@lkingland lkingland May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stylistic note: the else statement is probably unnecessary

for {

select {
case <-ctx.Done():

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be able to be a single select statement with multiple cases and no default case. Whichever channel returns first, that one's block executes, then the select statement exits and the loop repeats. The break statement would then just be a continue I believe

go abi.PrintProgress(ctx, &containerEngine, w)

_, err = containerEngine.PlayKube(ctx, r.Body, options)
cancel()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be best as a defer cancel()

@vyasgun vyasgun force-pushed the pr/kube-play-progress branch 6 times, most recently from de1d910 to b45b6bf Compare May 31, 2023 13:51
@vyasgun vyasgun force-pushed the pr/kube-play-progress branch from b45b6bf to 41d05b9 Compare May 31, 2023 14:10
Copy link

A friendly reminder that this PR had no activity for 30 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants