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

kubectl: init at v1.8.1 #30450

Closed
wants to merge 1 commit into from
Closed

Conversation

jamesthompson
Copy link

@jamesthompson jamesthompson commented Oct 15, 2017

Motivation for this change

kubectl is needed to administrate kubernetes clusters from the command line.

For google cloud users, it isn't installable through the google-cloud-sdk
derivation - this pulls the precompiled binary and installs it.

As far as I can tell there is no hosted tarball archive for this binary, hence
this binary install approach.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@@ -272,6 +272,7 @@
ivan-tkatchev = "Ivan Tkatchev <tkatchev@gmail.com>";
j-keck = "Jürgen Keck <jhyphenkeck@gmail.com>";
jagajaga = "Arseniy Seroka <ars.seroka@gmail.com>";
jthompson = "James Thompson <jamesthompsonoxford@gmail.com>";
Copy link
Member

Choose a reason for hiding this comment

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

Your handle here should be the same as your github username.

Copy link
Author

Choose a reason for hiding this comment

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

Changed @vyp - Thanks for the heads up.

@copumpkin
Copy link
Member

Trying to understand why you're packaging the prebuilt binary vs. building the code yourself. Can you elaborate on that?

As far as I can tell there is no hosted tarball archive for this binary, hence this binary install approach.

Do you mean that they don't host the source anywhere? https://github.com/kubernetes/kubernetes/tree/master/pkg/kubectl would probably work fine with a fetchFromGitHub subdirectory or the like. We also have a full k8s package from @offlinehacker and others that might also include kubectl.

kubectl is needed to administer kubernetes clusters from the command line.

For google cloud users, it isn't installable through the google-cloud-sdk
derivation - this pulls the precompiled binary and installs it.

As far as I can tell there is no hosted tarball archive for this binary, hence
this binary install approach.
@jamesthompson
Copy link
Author

jamesthompson commented Oct 16, 2017

@copumpkin I just wanted this tool, not the entire kubernetes install as I am simply administering a kubernetes cluster on google container engine.

This is my first nixpkgs PR. I thought seeing as there were a bunch of other basically pre-compiled tools in the nixpkgs set, that downloading this one (despite not being compressed) would also be fine. Happy to build the kubectl binary from the github-hosted source as well if that is the preferred means of building these kinds of derivations. But then, I'm not reallly au fait with the the intrinsic weirdness of golang builds.

@copumpkin
Copy link
Member

@jamesthompson we don't have any explicit rule against binary packages but generally prefer builds from source wherever possible.

On the necessity of this vs. the full k8s package, I'm wondering if we could just split the outputs from the main k8s package so folks like you wouldn't need to get the full thing, but we wouldn't be incurring additional maintenance by having two packages with essentially the same tool (but with separate version numbers needing to be bumped regularly, probably getting out of sync, etc.).

@offlinehacker @NeQuissimus any opinion on splitting kubectl into a separate output on the main k8s derivation?

longDescription = "The kubernetes command line tool. This package has the program: kubectl";
license = licenses.asl20;
homepage = "https://kubernetes.io/docs/user-guide/kubectl";
maintainers = with maintainers; [ jthompson ];
Copy link
Member

Choose a reason for hiding this comment

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

should be `jamesthompson'

@utdemir
Copy link
Member

utdemir commented Oct 16, 2017

I also only need kubectl and currently I'm using

pkgs.kubernetes.override { components = [ "cmd/kubectl" ]; })

and it works without problems.

It's slightly annoying that I have to compile and it takes a long time and lots of memory (I had to add a swapfile just to be able to compile this). But I think it'd be better if we just add this line to all-packages.nix and get binary caches from Hydra without depending on a prebuilt binary.

@fpletz
Copy link
Member

fpletz commented Oct 17, 2017

Could we maybe use another output in the kubernetes derivation to expose kubectl? Then we wouldn't have to rebuild so much go code.

@NeQuissimus
Copy link
Member

NeQuissimus commented Dec 18, 2017

Ping :) I'd love to see kubectl as a separate output that I can pull in without the rest of k8s... Any takers? :D

Although... Maybe we should keep kubectl separate altogether because it will be much easier to update. It seems the full k8s is complex to update, kubectl is a fairly simple binary...

I can't decide which I like better :D

@copumpkin
Copy link
Member

Is the protocol reasonably stable?

@NeQuissimus
Copy link
Member

Reasonably, yes...
It is possible to use a newer cluster with our kubectl derivation.

I have something similar to @utdemir that I use because I like to keep the versions in-sync:

    ((pkgs.kubernetes.override { components = [ "cmd/kubectl" ]; }).overrideAttrs (oldAttrs: {
      version = "1.9.0";
      name = "kubectl-1.9.0";
      src = fetchFromGitHub {
        owner = "kubernetes";
        repo = "kubernetes";
        rev = "v1.9.0";
        sha256 = "03383j5n66r5qv3y03g3v9vmvmzhpj3fzparsz1s22x1zzr4qg5a";
      };
    }))

@copumpkin
Copy link
Member

We could just throw that into top-level so that Hydra builds it, I suppose.

@kuznero
Copy link
Member

kuznero commented Jan 16, 2018

Somewhat related, on #33954 for upgrading kubernetes to 1.9.1 there are some problems with tests. Please help! Then it will be possible to produce another package specifically for kubectl :)

@nicknovitski
Copy link
Contributor

Oh, I hadn't seen this PR when I made #34126, but I did basically exactly what @NeQuissimus and @copumpkin said. 😅

@jamesthompson
Copy link
Author

I'm going to close this out - given #34126 solves the basic need of this PR.

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

Successfully merging this pull request may close these issues.

None yet

10 participants