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

bug, deep coupling: virtctl.sh expects virtctl binary to be present in a certain folder #1277

Open
dhiller opened this issue Sep 20, 2024 · 6 comments

Comments

@dhiller
Copy link
Contributor

dhiller commented Sep 20, 2024

Issue
When working on moving kubevirtci into it's own folder we noticed that kubevirtci expects the virtctl binary from k/kubevirt to be present in the system at a certain hard coded path 1 .

This is a deep coupling from one project to another which forces users of virtctl.sh to "somehow" provide said binary. This is likely a leftover of the move of kubevirtci to it's own repository.

See #94 (review)

Short-term
Short term it should be band-aided firstly by deprecating the virtctl.sh binary by issuing a WARN to stderr. This should give users time to move to other ways of calling the virtctl binary.

Also repos that show such calls 3, namely

  • kubevirt/containerized-data-importer
  • kubevirt/common-instancetypes
  • kubevirt/community
  • kubevirt/machine-remediation (likely one of the repos ready to archive - last change was 4 years ago)
  • kubevirt/user-guide

should be updated to use the proper script from kubevirt/kubevirt (if necessary).

Search queries:

Long-term
Long term virtctl.sh should be removed. It will be replaced by a script inside k/kubevirt below the hack folder with this PR: kubevirt/kubevirt#12872

Workaround
An easy workaround would be installing it as a krew plugin and then using kubectl virt 2

/kind bug
/kind tracker

dhiller added a commit to dhiller/kubevirt that referenced this issue Sep 20, 2024
KubeVirtCI project has a circular dependency on the virtctl binary [1]
- it expects the binary to be present at a certain path.

Thus we create our own version of virtctl.sh in the hack folder.

We then replace all calls to `virtctl.sh` with the new location.

[1]: kubevirt/kubevirtci#1277

Signed-off-by: Daniel Hiller <[email protected]>
dhiller added a commit to dhiller/kubevirt that referenced this issue Sep 20, 2024
KubeVirtCI project has a circular dependency on the virtctl binary [1]
- it expects the binary to be present at a certain path.

Thus we create our own version of virtctl.sh in the hack folder.

We then replace all calls to `virtctl.sh` with the new location.

[1]: kubevirt/kubevirtci#1277

Signed-off-by: Daniel Hiller <[email protected]>
dhiller added a commit to dhiller/kubevirt that referenced this issue Sep 20, 2024
KubeVirtCI project has a circular dependency on the virtctl binary [1]
- it expects the binary to be present at a certain path.

Thus we create our own version of virtctl.sh in the hack folder.

We then replace all calls to `virtctl.sh` with the new location.

[1]: kubevirt/kubevirtci#1277

Signed-off-by: Daniel Hiller <[email protected]>
dhiller added a commit to dhiller/kubevirtci that referenced this issue Sep 20, 2024
We want to remove virtctl.sh in the long run [1], for now we are issuing
a deprecation warning.

[1]: kubevirt#1277

Signed-off-by: Daniel Hiller <[email protected]>
dhiller added a commit to dhiller/kubevirtci that referenced this issue Sep 20, 2024
We want to remove virtctl.sh in the long run [1], for now we are issuing
a deprecation warning.

[1]: kubevirt#1277

Signed-off-by: Daniel Hiller <[email protected]>
kubevirt-bot pushed a commit that referenced this issue Sep 24, 2024
* virtctl.sh: add deprecation warning

We want to remove virtctl.sh in the long run [1], for now we are issuing
a deprecation warning.

[1]: #1277

Signed-off-by: Daniel Hiller <[email protected]>

* virtctl.sh: add fallback to parent directory

Since there might be usages outside kubevirt that source kubevirtci
cluster-up folder from kubevirt main repo, we add a fallback that uses
the parent directory.

Signed-off-by: Daniel Hiller <[email protected]>

---------

Signed-off-by: Daniel Hiller <[email protected]>
dhiller added a commit to dhiller/kubevirt that referenced this issue Sep 25, 2024
KubeVirtCI project has a circular dependency on the virtctl binary [1]
- it expects the binary to be present at a certain path.

Thus we create our own version of virtctl.sh in the hack folder.

We then replace all calls to `virtctl.sh` with the new location.

[1]: kubevirt/kubevirtci#1277

Signed-off-by: Daniel Hiller <[email protected]>
dhiller added a commit to dhiller/kubevirt that referenced this issue Sep 25, 2024
KubeVirtCI project has a circular dependency on the virtctl binary [1]
- it expects the binary to be present at a certain path.

Thus we create our own version of virtctl.sh in the hack folder.

We then replace all calls to `virtctl.sh` with the new location.

[1]: kubevirt/kubevirtci#1277

Signed-off-by: Daniel Hiller <[email protected]>
dhiller added a commit to dhiller/kubevirt that referenced this issue Sep 26, 2024
KubeVirtCI project has a circular dependency on the virtctl binary [1]
- it expects the binary to be present at a certain path.

Thus we create our own version of virtctl.sh in the hack folder.

We then replace all calls to `virtctl.sh` with the new location.

[1]: kubevirt/kubevirtci#1277

Signed-off-by: Daniel Hiller <[email protected]>
@andreabolognani
Copy link

@dhiller I just hit the deprecation message during development:

$ ./cluster-up/kubectl.sh apply -f examples/vmi-nocloud.yaml && ./cluster-up/virtctl.sh console vmi-nocloud
virtualmachineinstance.kubevirt.io/vmi-nocloud created
WARNING: usage of './cluster-up/virtctl.sh' is deprecated!
         see: https://github.com/kubevirt/kubevirtci/issues/1277
Successfully connected to vmi-nocloud console. The escape sequence is ^]
...

Even after reading the issue description, it's unclear to me what the recommended replacement for my usage of virtctl.sh would be. Can you please clarify? Thanks!

@dhiller
Copy link
Contributor Author

dhiller commented Oct 7, 2024

@dhiller I just hit the deprecation message during development:

$ ./cluster-up/kubectl.sh apply -f examples/vmi-nocloud.yaml && ./cluster-up/virtctl.sh console vmi-nocloud
virtualmachineinstance.kubevirt.io/vmi-nocloud created
WARNING: usage of './cluster-up/virtctl.sh' is deprecated!
         see: https://github.com/kubevirt/kubevirtci/issues/1277
Successfully connected to vmi-nocloud console. The escape sequence is ^]
...

Even after reading the issue description, it's unclear to me what the recommended replacement for my usage of virtctl.sh would be. Can you please clarify? Thanks!

Hey @andreabolognani thanks for pointing this out! I figure this has happened while you were working on k/kubevirt, right?

Actually this will be addressed with this PR: kubevirt/kubevirt#12872

There I am replacing the kubevirtci virtctl.sh with a version that is inside k/kubevirt. Will that work for you or do we need to keep the virtctl.sh in a way?

@dhiller
Copy link
Contributor Author

dhiller commented Oct 7, 2024

@andreabolognani I've addressed this in the issue comment - hope that makes it clear now.

@andreabolognani
Copy link

I figure this has happened while you were working on k/kubevirt, right?

Correct.

There I am replacing the kubevirtci virtctl.sh with a version that is inside k/kubevirt. Will that work for you or do we need to keep the virtctl.sh in a way?

So IIUC instead of calling ./cluster-up/virtctl.sh I will have to call ./hack/virtctl.sh? I'll have to adapt my muscle memory, but other than that it suits me just fine.

Hopefully kubectl.sh will also live next to virtctl.sh in the same folder? It would be annoying if that were no longer the case.

@dhiller
Copy link
Contributor Author

dhiller commented Oct 7, 2024

I figure this has happened while you were working on k/kubevirt, right?

Correct.

There I am replacing the kubevirtci virtctl.sh with a version that is inside k/kubevirt. Will that work for you or do we need to keep the virtctl.sh in a way?

So IIUC instead of calling ./cluster-up/virtctl.sh I will have to call ./hack/virtctl.sh? I'll have to adapt my muscle memory, but other than that it suits me just fine.

Hopefully kubectl.sh will also live next to virtctl.sh in the same folder? It would be annoying if that were no longer the case.

I understand where you are coming from - we could just add a wrapper hack/kubectl.sh that calls kubevirtci/cluster-up/kubectl.sh. Or you'd define an alias? WDYT?

@andreabolognani
Copy link

I think a wrapper would be a good way to go about it.

Bonus points if ./cluster-up/kubeconfig.sh doesn't need to get a wrapper in hack/, which means that I will be able to type just ./h<TAB>/ku<TAB> to get the correct result. For comparison, right now I need to type ./cl<TAB>/kubect<TAB> so the number of keystrokes saved would be quite significant!

By the way, and this is only tangentially related: it used to be the case, a few years back, that you could run kubectl.sh without having kubectl installed on your machine, since the binary would be pulled from the running cluster. At some point that broke, so I resigned myself to installing kubectl on my machine despite not needing it outside of KubeVirt development. If at all feasible, going back to the previous status quo would be very appreciated. Maybe that's already the case and I simply haven't noticed? One can dream :)

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

No branches or pull requests

3 participants