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

do not provide kubectl #6

Closed
RafalSkolasinski opened this issue Jul 12, 2022 · 13 comments · Fixed by #7 or #8
Closed

do not provide kubectl #6

RafalSkolasinski opened this issue Jul 12, 2022 · 13 comments · Fixed by #7 or #8

Comments

@RafalSkolasinski
Copy link

This plugin seems to be also providing kubectl binary which conflicts with just regular kubectl plugin.
Could we please leave management of kubectl to the other plugin?

@virtualstaticvoid
Copy link
Owner

Okay, it appears kubebuilder bundles kubectl, so gets added when the archive gets extracted.

tar zxf "$tmp_download_file" --strip-components 1 || exit 1

I suppose the install script could delete kubectl.

@RafalSkolasinski
Copy link
Author

RafalSkolasinski commented Jul 12, 2022

That'd be great!

Just to make sure I am right, this is what I see in my kubectl shim

$ cat .asdf/shims/kubectl                                                                                                                                                                                                    (⎈ gke_seldon-managed-cloud_europe-west4-a_qa-cluster|default)
#!/usr/bin/env bash
# asdf-plugin: kubectl 1.20.10
# asdf-plugin: kubectl 1.21.1
# asdf-plugin: kubectl 1.22.11
# asdf-plugin: kubectl 1.22.6
# asdf-plugin: kubectl 1.23.5
# asdf-plugin: kubectl 1.24.2
# asdf-plugin: kubebuilder 2.3.0
# asdf-plugin: oc 4.8.2
# asdf-plugin: oc 4.9.19
exec /home/rskolasinski/.asdf/bin/private/asdf-exec "kubectl" "$@"

and quite a few times accidentally I ended up using older version of kubectl because what came from kubebuilder took priority

@virtualstaticvoid
Copy link
Owner

I'm wondering if a user doesn't have the kubectl plugin installed, what should happen in that case. This plugin isn't aware of any others which might be installed, so it might be tricky to figure out whether the kubectl binary should be deleted or not.

@RafalSkolasinski
Copy link
Author

Maybe it should then then fail on missing kubectl? I highly doubt anyone interested in kubebuillder to not have kubectl already.

@virtualstaticvoid
Copy link
Owner

It's coming back to me now :-) I made a change to the plugin when kubebuilder v3 was released.

kubectl isn't bundled anymore, since v3, so first make sure you have the most recent version of this plugin, and then have v3.x of kubebuilder installed.

@RafalSkolasinski
Copy link
Author

Ah, nice, okay, I will give it a shot ;-) ...

Though... I still may need to use older kubebuilder every now and then... Sometimes just need to use older tool for testing older code to look for source of regressions and whatnots...

@virtualstaticvoid
Copy link
Owner

virtualstaticvoid commented Jul 12, 2022

I highly doubt anyone interested in kubebuillder to not have kubectl already.

Yeah, I'm happy to remove kubectl binaries for version less than 3.x. I'll just add a warning message to the output.

@RafalSkolasinski
Copy link
Author

Cool, it works fine now :).
For some reason I had to first remove the 2.3.0 of kubebuilder and install it again for it to stop appearing in the shim.

@virtualstaticvoid
Copy link
Owner

For some reason I had to first remove the 2.3.0 of kubebuilder and install it again...

Yeah, it was previously installed using an older version of this plugin.

@RafalSkolasinski
Copy link
Author

RafalSkolasinski commented Aug 4, 2022

Okay.... so now I actually am worrying if this didn't break some other functionality 😅...
I see I was setting

set -x KUBEBUILDER_ASSETS (asdf where kubebuilder)"/bin"

and now ours test suite is failing

  Unexpected error:
      <*fmt.wrapError | 0xc0000a2780>: {
          msg: "unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec /home/rskolasinski/.asdf/installs/kubebuilder/2.3.0/bin/etcd: no such file or directory",
          err: <*fmt.wrapError | 0xc0000a2760>{
              msg: "failed to start the controlplane. retried 5 times: fork/exec /home/rskolasinski/.asdf/installs/kubebuilder/2.3.0/bin/etcd: no such file or directory",
              err: <*fs.PathError | 0xc00037a330>{
                  Op: "fork/exec",
                  Path: "/home/rskolasinski/.asdf/installs/kubebuilder/2.3.0/bin/etcd",
                  Err: <syscall.Errno>0x2,
              },
          },
      }
      unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec /home/rskolasinski/.asdf/installs/kubebuilder/2.3.0/bin/etcd: no such file or directory
  occurred

Is it possible to stop adding some tools to shims without removing the actual binaries?

@virtualstaticvoid
Copy link
Owner

virtualstaticvoid commented Aug 15, 2022

Is it possible to stop adding some tools to shims without removing the actual binaries?

It seems to be possible, by providing a bin/list-bin-paths script which returns the executable paths.

@virtualstaticvoid
Copy link
Owner

Hi @RafalSkolasinski

Can you confirm that the latest change #8 is working for you?

Thanks

@virtualstaticvoid
Copy link
Owner

BTW: Explicitly setting KUBEBUILDER_ASSETS isn't needed as a custom shim is provided which sets it.

https://github.com/virtualstaticvoid/asdf-kubebuilder/blob/master/shims/kubebuilder#L1-L4

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