summaryrefslogtreecommitdiff
path: root/gnu/packages/kubernetes.scm
blob: 41e02a6070b302a70ce8c3e144be451118292402 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2026 Arthur Rodrigues <arthurhdrodrigues@proton.me>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages kubernetes)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix build-system go)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module (guix packages)
  #:use-module (gnu packages golang-build)
  #:use-module (gnu packages golang-check)
  #:use-module (gnu packages golang-web)
  #:use-module (gnu packages golang-xyz)
  #:use-module (gnu packages prometheus))


;;;
;;; Libraries:
;;;

(define-public go-go-etcd-io-etcd-client-v3
  (package
    (name "go-go-etcd-io-etcd-client-v3")
    (version "3.6.7")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/etcd-io/etcd")
             (commit (go-version->git-ref version #:subdir "client"))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0d9rjyl5h0xm9isgr8b2fz8528wk3pds71rjl8g08fgsmsa5kicb"))
       (modules '((guix build utils)
                  (ice-9 ftw)
                  (srfi srfi-26)))
       (snippet #~(begin
                    (define (delete-all-but directory . preserve)
                      (with-directory-excursion directory
                        (let* ((pred (negate (cut member <>
                                                  (cons* "." ".." preserve))))
                               (items (scandir "." pred)))
                          (for-each (cut delete-file-recursively <>) items))))
                    ;; Replace symlinks to tests with file contents
                    (for-each
                     (lambda (f)
                       (delete-file (string-append "client/v3/" f))
                       (copy-file (string-append
                                   "tests/integration/clientv3/examples/" f)
                                  (string-append "client/v3/" f)))
                     (list "example_auth_test.go"
                           "example_cluster_test.go"
                           "example_kv_test.go"
                           "example_lease_test.go"
                           "example_maintenance_test.go"
                           "example_metrics_test.go"
                           "example_test.go"
                           "example_watch_test.go"))
                    (for-each
                     (lambda (f)
                       (delete-file
                        (string-append "client/v3/concurrency/" f))
                       (copy-file
                        (string-append "tests/integration/clientv3/concurrency/" f)
                        (string-append "client/v3/concurrency/" f)))
                     (list "example_election_test.go"
                           "example_mutex_test.go"
                           "example_stm_test.go"))
                    ;; Copy sertificates for tests.
                    (mkdir-p "client/v3/tests/fixtures")
                    (substitute* "client/v3/yaml/config_test.go"
                      (("\\.\\./\\.\\./\\.\\./") "../"))
                    (for-each
                     (lambda (f)
                       (copy-file
                        (string-append "tests/fixtures/" f)
                        (string-append "client/v3/tests/fixtures/" f)))
                     (list "server.crt"
                           "server.key.insecure"
                           "ca.crt"))
                    ;; Keep source related to expected import-path.
                    (delete-all-but "." "client")
                    (delete-file-recursively "client/pkg")))))
    (build-system go-build-system)
    (arguments
     (list
      ;; TODO: Tests a shaky and fail a lot, check how run unittests.
      #:tests? #f 
      #:import-path "go.etcd.io/etcd/client/v3"
      #:unpack-path "go.etcd.io/etcd"))
    (native-inputs
     (list go-github-com-grpc-ecosystem-go-grpc-middleware-providers-prometheus
           go-github-com-prometheus-client-golang
           go-github-com-stretchr-testify
           go-go-etcd-io-etcd-client-pkg-v3
           go-go-uber-org-zap
           go-google-golang-org-grpc))
    (propagated-inputs
     (list go-github-com-coreos-go-semver
           go-github-com-dustin-go-humanize
           go-github-com-grpc-ecosystem-go-grpc-middleware-v2
           go-go-etcd-io-etcd-api-v3
           go-sigs-k8s-io-yaml))
    (home-page "https://github.com/etcd-io/etcd")
    (synopsis "Golang client for ETCD")
    (description
     "This package implements the official Go client for etcd.")
    (license license:asl2.0)))

(define-public go-go-etcd-io-etcd-pkg-v3
  (package
    (name "go-go-etcd-io-etcd-pkg-v3")
    (version "3.6.7")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://github.com/etcd-io/etcd")
              (commit (go-version->git-ref version
                                           #:subdir "pkg"))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0d9rjyl5h0xm9isgr8b2fz8528wk3pds71rjl8g08fgsmsa5kicb"))
       (modules '((guix build utils)
                  (ice-9 ftw)
                  (srfi srfi-26)))
       (snippet #~(begin
                    (define (delete-all-but directory . preserve)
                      (with-directory-excursion directory
                        (let* ((pred (negate (cut member <>
                                                  (cons* "." ".." preserve))))
                               (items (scandir "." pred)))
                          (for-each (cut delete-file-recursively <>) items))))
                    (delete-all-but "." "pkg")
                    (rename-file "pkg" "pkg.tmp")
                    (mkdir-p "pkg/v3")
                    (rename-file "pkg.tmp" "pkg/v3")))))
    (build-system go-build-system)
    (arguments
     (list
      #:skip-build? #t
      #:tests? #f       ;TODO: Tests hang, select some subset
      #:import-path "go.etcd.io/etcd/pkg/v3"
      #:unpack-path "go.etcd.io/etcd"))
    (native-inputs
     (list go-github-com-spf13-cobra
           go-github-com-spf13-pflag
           go-github-com-stretchr-testify))
    (propagated-inputs
     (list go-github-com-creack-pty
           go-github-com-dustin-go-humanize
           go-go-etcd-io-etcd-client-pkg-v3
           go-go-uber-org-zap
           go-google-golang-org-grpc))
    (home-page "https://github.com/etcd-io/etcd")
    (synopsis "Utility packages for etcd")
    (description
     "This package is a collection of utility packages used by etcd without
being specific to etcd itself.")
    (license license:asl2.0)))

(define-public go-k8s-io-component-base
  (package
    (name "go-k8s-io-component-base")
    (version "0.34.1")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://github.com/kubernetes/component-base")
              (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "090ghb66zh4mln9fvp89vfq0g4pysm5y4lrp5n6801491mngyndm"))))
    (build-system go-build-system)
    (arguments
     (list
      #:test-flags
      #~(list "-skip" "Tracing")
      #:import-path "k8s.io/component-base"))
    (native-inputs
     (list go-github-com-stretchr-testify))
    (propagated-inputs
     (list go-github-com-blang-semver-v4
           go-github-com-go-logr-logr
           go-github-com-go-logr-zapr
           go-github-com-google-go-cmp
           go-github-com-moby-term
           go-github-com-prometheus-client-golang
           go-github-com-prometheus-client-model
           go-github-com-prometheus-common
           go-github-com-prometheus-procfs
           go-github-com-spf13-cobra
           go-github-com-spf13-pflag
           go-go-opentelemetry-io-contrib-instrumentation-net-http-otelhttp
           go-go-opentelemetry-io-otel
           go-go-opentelemetry-io-otel-exporters-otlp-otlptrace
           go-go-opentelemetry-io-otel-exporters-otlp-otlptrace-otlptracegrpc
           go-go-opentelemetry-io-otel-sdk
           go-go-opentelemetry-io-otel-trace
           go-go-uber-org-zap
           go-go-yaml-in-yaml-v2
           go-golang-org-x-sys
           go-golang-org-x-text
           go-k8s-io-apimachinery
           go-k8s-io-client-go
           go-k8s-io-klog-v2
           go-k8s-io-utils
           go-sigs-k8s-io-json))
    (home-page "https://github.com/kubernetes/component-base")
    (synopsis "Kubernetes core components Golang source code")
    (description
     "This package contains shared code for Kubernetes core components.")
    (license license:asl2.0)))

(define-public go-sigs-k8s-io-apiserver-network-proxy-konnectivity-client
  (package
    (name "go-sigs-k8s-io-apiserver-network-proxy-konnectivity-client")
    (version "0.34.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://github.com/kubernetes-sigs/apiserver-network-proxy")
              (commit (go-version->git-ref version
                                           #:subdir "konnectivity-client"))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1kh92blfpmrmklxqg5j0p07yz534gjzhm44xj8bh5pad3y5zw5m0"))))
    (build-system go-build-system)
    (arguments
     (list
      #:skip-build? #t
      #:import-path "sigs.k8s.io/apiserver-network-proxy/konnectivity-client"
      #:unpack-path "sigs.k8s.io/apiserver-network-proxy"))
    (native-inputs
     (list go-go-uber-org-goleak))
    (propagated-inputs
     (list go-github-com-prometheus-client-golang
           go-google-golang-org-grpc
           go-google-golang-org-protobuf
           go-k8s-io-klog-v2))
    (home-page "https://sigs.k8s.io/apiserver-network-proxy")
    (synopsis "Network proxy for Kubernetes API server")
    (description
     "This package provides a network proxy for the Kubernetes API server.")
    (license license:asl2.0)))


;;;
;;; Executables:
;;;

;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above in alphabetic order:
;;; guix import --insert=gnu/packages/python-xyz.scm pypi <package-name>.
;;;