aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner2019-11-06 01:28:40 -0600
committerEfraim Flashner2019-11-06 01:28:40 -0600
commitcc0aef35c22a2970e7b4c22e8b487d7db72cf5df (patch)
treecd1b6cecca150de701f2d350a69cbca3148b516e
parentecb5e0a77272ae2087c15ac4d9a62694bd68b9c0 (diff)
downloadguix-bioinformatics-cc0aef35c22a2970e7b4c22e8b487d7db72cf5df.tar.gz
gn: Add kubernetes.
-rw-r--r--gn/packages/kubernetes.scm93
1 files changed, 93 insertions, 0 deletions
diff --git a/gn/packages/kubernetes.scm b/gn/packages/kubernetes.scm
new file mode 100644
index 0000000..1b83bd7
--- /dev/null
+++ b/gn/packages/kubernetes.scm
@@ -0,0 +1,93 @@
+(define-module (gn packages kubernetes)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix packages)
+ #:use-module (guix git-download)
+ #:use-module (guix build-system go)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages rsync)
+ )
+
+(define-public kubernetes
+ (package
+ (name "kubernetes")
+ (version "1.16.2")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/kubernetes/kubernetes.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1al6jvljscqg6j39rpm03sb33ns10pqz1j298bm3vispphbqx0j7"))))
+ (build-system go-build-system)
+ (arguments
+ `(#:import-path "k8s.io/kubernetes"
+ #:install-source? #f
+ #:tests? #f ; Skip tests for now.
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'make-files-writable
+ (lambda _
+ (for-each make-file-writable (find-files "."))
+ #t))
+ (add-before 'build 'prepare-build
+ (lambda _
+ (with-directory-excursion "src/k8s.io/kubernetes"
+ (substitute* '("build/root/Makefile"
+ "build/root/Makefile.generated_files"
+ "build/pause/Makefile")
+ (("/bin/bash") (which "bash"))))
+ #t))
+ (replace 'build
+ (lambda _
+ (with-directory-excursion "src/k8s.io/kubernetes"
+ ;; Cannot find go-bindata otherwise.
+ (setenv "PATH" (string-append (getcwd) "/_output/bin:"
+ (getenv "PATH")))
+ (invoke "make"))))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (with-directory-excursion "src/k8s.io/kubernetes"
+ ;; This saves more than 350MiB.
+ (delete-file "_output/local/go/bin/e2e.test")
+ (delete-file "_output/local/go/bin/e2e_node.test")
+ (for-each
+ (lambda (file)
+ (install-file file (string-append out "/bin")))
+ (find-files "_output/local/go/bin" ".*"))
+ ;(mkdir-p (string-append out "/share/bash-completion/completions"))
+ ;(call-with-output-file (string-append out "/share/bash-completion/completions/kubectl")
+ ; (lambda (port)
+ ; (format port (invoke "_output/local/go/bin/kubectl" "completion" "bash"))))
+ ;(mkdir-p (string-append out "/share/zsh/site-function"))
+ ;(call-with-output-file (string-append out "/share/zsh/site-functions/_kubectl")
+ ; (lambda (port)
+ ; (format port (invoke "_output/local/go/bin/kubectl" "completion" "zsh"))))
+ (install-file "LICENSE"
+ (string-append out "/share/doc/"
+ ,name "-" ,version)))
+ #t)))
+ (add-after 'install 'install-man-pages
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (mkdir-p (string-append out "/share/man/man1"))
+ (with-directory-excursion "src/k8s.io/kubernetes"
+ (for-each
+ (lambda (file)
+ (invoke "_output/local/go/bin/genman"
+ (string-append out "/share/man/man1") file))
+ '("kube-apiserver" "kube-controller-manager" "kube-proxy"
+ "kube-scheduler" "kubelet" "kubectl")))
+ #t))))))
+ (native-inputs
+ `(("which" ,which)))
+ (inputs
+ `(("rsync" ,rsync)))
+ (home-page "https://kubernetes.io/")
+ (synopsis "Production-Grade Container Scheduling and Management")
+ (description "Kubernetes is an open source system for managing containerized
+applications across multiple hosts. It provides basic mechanisms for
+deployment, maintenance, and scaling of applications.")
+ (license license:asl2.0)))