nmstate / kubernetes-nmstate

Declarative node network configuration driven through Kubernetes API.
GNU General Public License v2.0
181 stars 89 forks source link

e2e: Use metrics container when executing commands #1238

Open mkowalski opened 5 months ago

mkowalski commented 5 months ago

This PR adds explicit -c nmstate-metrics to the command invocations that use kubectl.sh exec [...]. This should not change the current behaviour as by default we execture them in this container, however it's been noticed that the following stderr is produced

stderr: Defaulted container "nmstate-metrics" out of: nmstate-metrics, kube-rbac-proxy

so for being explict, we are defining where to execute the command.

Release note:

NONE
kubevirt-bot commented 5 months ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please ask for approval from mkowalski. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/nmstate/kubernetes-nmstate/blob/main/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
kubevirt-bot commented 5 months ago

@mkowalski: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-nmstate-e2e-operator-k8s e8e0bfecde7a571bd5777cabb120ad6841008a3d link true /test pull-kubernetes-nmstate-e2e-operator-k8s
pull-kubernetes-nmstate-e2e-handler-k8s-future e8e0bfecde7a571bd5777cabb120ad6841008a3d link false /test pull-kubernetes-nmstate-e2e-handler-k8s-future
pull-kubernetes-nmstate-e2e-handler-k8s e8e0bfecde7a571bd5777cabb120ad6841008a3d link true /test pull-kubernetes-nmstate-e2e-handler-k8s
Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
qinqon commented 5 months ago

@mkowalski looks like this is failing

ccurred failed [FAILED] Unexpected error:
    <*errors.errorString | 0x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0is2598icKmD7jcUoqRCWDFhzKUbXlHug87X3RkwWzfCsrZAtuiyNEu1hkhTJ7IvRSyUAg :8089 https://127.0.0.1:8443/metrics : selecting podman as container runtime
    Defaulted container "nmstate-metrics" out of: nmstate-metrics, kube-rbac-proxy
    time="2024-05-06T12:54:23Z" level=error msg="exec failed: unable to start container process: exec: \"-c\": executable file not found in $PATH"
    command terminated with exit code 255
     exit status 255
    {
mkowalski commented 5 months ago

/hold

Maybe we will not even need that. Error makes sense, I composed the command wrongly

 ./cluster/kubectl.shexec -n nmstate nmstate-metrics-68b4d6d87c-px6rg -- -c nmstate-metrics curl -s -k
qinqon commented 5 months ago

/hold

Maybe we will not even need that. Error makes sense, I composed the command wrongly

 ./cluster/kubectl.shexec -n nmstate nmstate-metrics-68b4d6d87c-px6rg -- -c nmstate-metrics curl -s -k

Well this is not extra important since the default container is in the first one the list but it's true that the warning is bothering.

mkowalski commented 5 months ago

It was purely for cosmetic reasons because when I parse output as a human I like to see empty stderr. I will try fixing this in a low-effort way and if I find that it's too hacky change, I will drop it