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

Adding the active kubecontext to minikube profile list command #17735

Merged
merged 2 commits into from
Mar 28, 2024

Conversation

Skalador
Copy link
Contributor

@Skalador Skalador commented Dec 5, 2023

The minikube profile list does not show the active kubecontext as pointed out in #16604. The active kubecontext was added to the profiles as ActiveKubeContext similar to the Active property of the existing implementation. This allows older version, which rely on the json field Active, to still work and additionally obtain the information about ActiveKubeContext. The table representation for the minikube profile list command was updated as well. Active minikube profiles are highlighted in the Profile column. The Active column was replaced with an Active Kubecontext column.

Table representation before PR:

minikube profile list
|-----------|-----------|---------|--------------|------|---------|---------|-------|--------------------|
|  Profile  | VM Driver | Runtime |      IP      | Port | Version | Status  | Nodes | Active             |
|-----------|-----------|---------|--------------|------|---------|---------|-------|--------------------|
| minikube  | docker    | docker  | 192.168.49.2 | 8443 | v1.28.4 | Running |     1 |                    |
| minikube2 | docker    | docker  | 192.168.58.2 | 8443 | v1.28.4 | Running |     1 | *                  |
|-----------|-----------|---------|--------------|------|---------|---------|-------|--------------------|

Table representation after PR:

minikube profile list -o table
|-----------|-----------|---------|--------------|------|---------|---------|-------|--------------------|
|  Profile  | VM Driver | Runtime |      IP      | Port | Version | Status  | Nodes | Active Kubecontext |
|-----------|-----------|---------|--------------|------|---------|---------|-------|--------------------|
| *minikube | docker    | docker  | 192.168.49.2 | 8443 | v1.28.4 | Running |     1 |                    |
| minikube2 | docker    | docker  | 192.168.58.2 | 8443 | v1.28.4 | Running |     1 | *                  |
|-----------|-----------|---------|--------------|------|---------|---------|-------|--------------------|

JSON representation before PR:

minikube profile list -o json | jq
{
  "invalid": [],
  "valid": [
    {
      "Name": "minikube",
      "Status": "Running",
...output omitted...
      "Active": true
    },
    {
      "Name": "minikube2",
      "Status": "Running",
...output omitted...
      "Active": false
    }
  ]
}

JSON representation after PR:

minikube profile list -o json | jq
{
  "invalid": [],
  "valid": [
    {
      "Name": "minikube",
      "Status": "Running",
...output omitted...
      "Active": true,
      "ActiveKubeContext": false
    },
    {
      "Name": "minikube2",
      "Status": "Running",
...output omitted...
      "Active": false,
      "ActiveKubeContext": true
    }
  ]
}

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 5, 2023
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 5, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @Skalador. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 5, 2023
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

this PR would make it more clear thank you for quick contribution, lets do the changes in the comment

@@ -154,7 +154,7 @@ func profileStatus(p *config.Profile, api libmachine.API) string {

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for this PR, I think for sake of more clarity what active minikube profile is, in addition to "ActiveKubeContext" Column
we should have "Active miniikube" column,
by the way one idea for a follow up PR,
we could Later get rid of some of the column by default such as "Port" or K8S version, and make it available only in a --detailed or --long format

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, thanks for your fast answer!
Do I understand you correctly, that you want the table output to change from:

minikube profile list -o table
|-----------|-----------|---------|--------------|------|---------|---------|-------|--------------------|
|  Profile  | VM Driver | Runtime |      IP      | Port | Version | Status  | Nodes | Active Kubecontext |
|-----------|-----------|---------|--------------|------|---------|---------|-------|--------------------|
| *minikube | docker    | docker  | 192.168.49.2 | 8443 | v1.28.4 | Running |     1 |                    |
| minikube2 | docker    | docker  | 192.168.58.2 | 8443 | v1.28.4 | Running |     1 | *                  |
|-----------|-----------|---------|--------------|------|---------|---------|-------|--------------------|

to

minikube profile list -o table
|-----------|-----------|---------|--------------|------|---------|---------|-------|--------------------|-------------------|
|  Profile  | VM Driver | Runtime |      IP      | Port | Version | Status  | Nodes | Active Profile     | Active Kubecontext|
|-----------|-----------|---------|--------------|------|---------|---------|-------|--------------------|-------------------|
| minikube  | docker    | docker  | 192.168.49.2 | 8443 | v1.28.4 | Running |     1 |  *                 |                   |
| minikube2 | docker    | docker  | 192.168.58.2 | 8443 | v1.28.4 | Running |     1 |                    | *                 |
|-----------|-----------|---------|--------------|------|---------|---------|-------|--------------------|-------------------|

The JSON output shall be the same due to compatibility reasons, correct?
When this PR is merged, I can create an issue (or PR) addressing the follow up issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @medyagh, I have updated this PR with my above comment.

minikube profile list -o table
|-----------|-----------|---------|--------------|------|---------|---------|-------|----------------|--------------------|
|  Profile  | VM Driver | Runtime |      IP      | Port | Version | Status  | Nodes | Active Profile | Active Kubecontext |
|-----------|-----------|---------|--------------|------|---------|---------|-------|----------------|--------------------|
| minikube  | docker    | docker  | 192.168.49.2 | 8443 | v1.28.4 | Running |     1 | *              |                    |
| minikube2 | docker    | docker  | 192.168.58.2 | 8443 | v1.28.4 | Running |     1 |                | *                  |
|-----------|-----------|---------|--------------|------|---------|---------|-------|----------------|--------------------|

The JSON output is the same as before due to compatibility reasons. I thought about adding ActiveProfile, which has the same data as Active with a deprecation note. The deprecation note shall point out, that Active will be removed in a future release and ActiveProfile shall be used instead.

minikube profile list -o json | jq | grep -i active
      "Active": true,
      "ActiveKubeContext": false
      "Active": false,
      "ActiveKubeContext": true

Please let me know, what you think.

Copy link
Member

@spowelljr spowelljr left a comment

Choose a reason for hiding this comment

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

You have formatting issues, can you run gofmt -w -s . and then upload the changes

@Skalador
Copy link
Contributor Author

You have formatting issues, can you run gofmt -w -s . and then upload the changes

Hi @spowelljr, thanks for pointing this out. I have fixed it alongside the request from @medyagh .

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 7, 2024
@Shubham82
Copy link

@Skalador could you please resolve the merge conflicts

The minikube profile list does not show the active kubecontext. The active kubecontext was added to the profiles as ActiveKubeContext similar to the Active property of the existing implementation. This allows older version, which rely on the json field Active, to still work and additionally obtain the information about ActiveKubeContext. The table representation for the minikube profile list command was updated as well. Active minikube profiles are highlighted in the Profile column. The Active column was replaced with an Active Kubecontext column.
Updated the command line output of minikube profile list -o table to have two columns, i.e. Active Profile and Active Kubecontext. This makes the output more intuitive. Formatting issues are fixed as well.
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 27, 2024
@spowelljr
Copy link
Member

/ok-to-test

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

thank you for this PR and addressing the review comments

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 27, 2024
@medyagh
Copy link
Member

medyagh commented Mar 27, 2024

as a follow up PR we could rename VM driver to driver
and also move the "port" column to a detailed view

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 17735) |
+----------------+----------+---------------------+
| minikube start | 52.2s    | 52.2s               |
| enable ingress | 25.6s    | 25.5s               |
+----------------+----------+---------------------+

Times for minikube start: 51.5s 56.0s 48.8s 51.7s 53.2s
Times for minikube (PR 17735) start: 51.4s 54.2s 52.8s 49.5s 53.1s

Times for minikube ingress: 26.6s 28.1s 23.0s 27.0s 23.5s
Times for minikube (PR 17735) ingress: 26.5s 24.0s 24.0s 25.5s 27.6s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 17735) |
+----------------+----------+---------------------+
| minikube start | 23.0s    | 22.2s               |
| enable ingress | 21.3s    | 21.5s               |
+----------------+----------+---------------------+

Times for minikube start: 22.0s 24.9s 21.4s 21.9s 24.8s
Times for minikube (PR 17735) start: 21.2s 22.2s 24.3s 20.9s 22.3s

Times for minikube ingress: 22.3s 20.8s 21.3s 21.3s 20.8s
Times for minikube (PR 17735) ingress: 22.3s 21.3s 21.8s 21.3s 20.8s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 17735) |
+----------------+----------+---------------------+
| minikube start | 21.8s    | 20.6s               |
| enable ingress | 31.6s    | 29.4s               |
+----------------+----------+---------------------+

Times for minikube ingress: 31.8s 31.8s 31.8s 30.8s 31.8s
Times for minikube (PR 17735) ingress: 31.8s 31.3s 31.8s 19.3s 32.8s

Times for minikube start: 20.0s 23.5s 22.8s 20.1s 22.5s
Times for minikube (PR 17735) start: 20.3s 19.5s 20.4s 20.1s 22.6s

@minikube-pr-bot
Copy link

These are the flake rates of all failed tests.

Environment Failed Tests Flake Rate (%)
KVM_Linux TestDownloadOnly/v1.30.0-beta.0/json-events (gopogh) 0.00 (chart)
KVM_Linux TestPreload (gopogh) 0.00 (chart)
none_Linux TestAddons/parallel/Registry (gopogh) 0.00 (chart)
KVM_Linux_containerd TestAddons/parallel/CloudSpanner (gopogh) 1.16 (chart)
Docker_Linux_containerd_arm64 TestStartStop/group/old-k8s-version/serial/SecondStart (gopogh) 47.70 (chart)

To see the flake rates of all tests by environment, click here.

@Shubham82
Copy link

@Skalador could you please resolve these failed test cases?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: medyagh, Skalador, spowelljr

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@spowelljr spowelljr merged commit c5dd90e into kubernetes:master Mar 28, 2024
26 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants