cdk8s-plus-34 0.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/.jsii +101649 -0
  2. package/CODE_OF_CONDUCT.md +3 -0
  3. package/CONTRIBUTING.md +185 -0
  4. package/DCO +34 -0
  5. package/LICENSE +202 -0
  6. package/NOTICE +1 -0
  7. package/OWNERS.md +5 -0
  8. package/README.md +21 -33
  9. package/SECURITY.md +5 -0
  10. package/cdk8s.yaml +11 -0
  11. package/docs/java.md +150009 -0
  12. package/docs/plus/config-map.md +98 -0
  13. package/docs/plus/container.md +133 -0
  14. package/docs/plus/cronjob.md +67 -0
  15. package/docs/plus/deployment.md +232 -0
  16. package/docs/plus/horizontal-pod-autoscaler.md +226 -0
  17. package/docs/plus/ingress.md +68 -0
  18. package/docs/plus/job.md +48 -0
  19. package/docs/plus/namespace.md +58 -0
  20. package/docs/plus/network-policy.md +341 -0
  21. package/docs/plus/pod.md +455 -0
  22. package/docs/plus/pv.md +82 -0
  23. package/docs/plus/pvc.md +77 -0
  24. package/docs/plus/rbac.md +104 -0
  25. package/docs/plus/secret.md +32 -0
  26. package/docs/plus/service-account.md +35 -0
  27. package/docs/plus/service.md +41 -0
  28. package/docs/plus/volume.md +84 -0
  29. package/docs/python.md +161196 -0
  30. package/docs/typescript.md +139649 -0
  31. package/git-hooks/README.md +9 -0
  32. package/git-hooks/prepare-commit-msg +18 -0
  33. package/git-hooks/setup.sh +10 -0
  34. package/lib/_action.d.ts +26 -0
  35. package/lib/_action.js +39 -0
  36. package/lib/api-resource.d.ts +298 -0
  37. package/lib/api-resource.js +430 -0
  38. package/lib/base.d.ts +79 -0
  39. package/lib/base.js +92 -0
  40. package/lib/config-map.d.ts +126 -0
  41. package/lib/config-map.js +159 -0
  42. package/lib/container.d.ts +1057 -0
  43. package/lib/container.js +845 -0
  44. package/lib/cron-job.d.ts +138 -0
  45. package/lib/cron-job.js +103 -0
  46. package/lib/daemon-set.d.ts +45 -0
  47. package/lib/daemon-set.js +55 -0
  48. package/lib/deployment.d.ts +235 -0
  49. package/lib/deployment.js +216 -0
  50. package/lib/handler.d.ts +62 -0
  51. package/lib/handler.js +54 -0
  52. package/lib/horizontal-pod-autoscaler.d.ts +500 -0
  53. package/lib/horizontal-pod-autoscaler.js +569 -0
  54. package/lib/imports/k8s.d.ts +25809 -0
  55. package/lib/imports/k8s.js +19238 -0
  56. package/lib/index.d.ts +26 -0
  57. package/lib/index.js +44 -0
  58. package/lib/ingress.d.ts +230 -0
  59. package/lib/ingress.js +246 -0
  60. package/lib/job.d.ts +64 -0
  61. package/lib/job.js +54 -0
  62. package/lib/namespace.d.ts +128 -0
  63. package/lib/namespace.js +109 -0
  64. package/lib/network-policy.d.ts +311 -0
  65. package/lib/network-policy.js +344 -0
  66. package/lib/pod.d.ts +1097 -0
  67. package/lib/pod.js +1147 -0
  68. package/lib/probe.d.ts +181 -0
  69. package/lib/probe.js +88 -0
  70. package/lib/pv.d.ts +375 -0
  71. package/lib/pv.js +273 -0
  72. package/lib/pvc.d.ts +163 -0
  73. package/lib/pvc.js +154 -0
  74. package/lib/role-binding.d.ts +138 -0
  75. package/lib/role-binding.js +165 -0
  76. package/lib/role.d.ts +268 -0
  77. package/lib/role.js +401 -0
  78. package/lib/secret.d.ts +195 -0
  79. package/lib/secret.js +185 -0
  80. package/lib/service-account.d.ts +83 -0
  81. package/lib/service-account.js +105 -0
  82. package/lib/service.d.ts +289 -0
  83. package/lib/service.js +182 -0
  84. package/lib/stateful-set.d.ts +206 -0
  85. package/lib/stateful-set.js +244 -0
  86. package/lib/utils.d.ts +4 -0
  87. package/lib/utils.js +33 -0
  88. package/lib/volume.d.ts +577 -0
  89. package/lib/volume.js +377 -0
  90. package/lib/workload.d.ts +121 -0
  91. package/lib/workload.js +122 -0
  92. package/node_modules/balanced-match/.github/FUNDING.yml +2 -0
  93. package/node_modules/balanced-match/LICENSE.md +21 -0
  94. package/node_modules/balanced-match/README.md +97 -0
  95. package/node_modules/balanced-match/index.js +62 -0
  96. package/node_modules/balanced-match/package.json +48 -0
  97. package/node_modules/brace-expansion/.github/FUNDING.yml +2 -0
  98. package/node_modules/brace-expansion/LICENSE +21 -0
  99. package/node_modules/brace-expansion/README.md +135 -0
  100. package/node_modules/brace-expansion/index.js +202 -0
  101. package/node_modules/brace-expansion/package.json +49 -0
  102. package/node_modules/minimatch/LICENSE +15 -0
  103. package/node_modules/minimatch/README.md +491 -0
  104. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
  105. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
  106. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  107. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
  108. package/node_modules/minimatch/dist/commonjs/ast.d.ts +20 -0
  109. package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
  110. package/node_modules/minimatch/dist/commonjs/ast.js +747 -0
  111. package/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
  112. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
  113. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
  114. package/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
  115. package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
  116. package/node_modules/minimatch/dist/commonjs/escape.d.ts +12 -0
  117. package/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
  118. package/node_modules/minimatch/dist/commonjs/escape.js +22 -0
  119. package/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
  120. package/node_modules/minimatch/dist/commonjs/index.d.ts +98 -0
  121. package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
  122. package/node_modules/minimatch/dist/commonjs/index.js +1023 -0
  123. package/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
  124. package/node_modules/minimatch/dist/commonjs/package.json +3 -0
  125. package/node_modules/minimatch/dist/commonjs/unescape.d.ts +17 -0
  126. package/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
  127. package/node_modules/minimatch/dist/commonjs/unescape.js +24 -0
  128. package/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
  129. package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
  130. package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
  131. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  132. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
  133. package/node_modules/minimatch/dist/esm/ast.d.ts +20 -0
  134. package/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
  135. package/node_modules/minimatch/dist/esm/ast.js +743 -0
  136. package/node_modules/minimatch/dist/esm/ast.js.map +1 -0
  137. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
  138. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
  139. package/node_modules/minimatch/dist/esm/brace-expressions.js +148 -0
  140. package/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
  141. package/node_modules/minimatch/dist/esm/escape.d.ts +12 -0
  142. package/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
  143. package/node_modules/minimatch/dist/esm/escape.js +18 -0
  144. package/node_modules/minimatch/dist/esm/escape.js.map +1 -0
  145. package/node_modules/minimatch/dist/esm/index.d.ts +98 -0
  146. package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
  147. package/node_modules/minimatch/dist/esm/index.js +1007 -0
  148. package/node_modules/minimatch/dist/esm/index.js.map +1 -0
  149. package/node_modules/minimatch/dist/esm/package.json +3 -0
  150. package/node_modules/minimatch/dist/esm/unescape.d.ts +17 -0
  151. package/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
  152. package/node_modules/minimatch/dist/esm/unescape.js +20 -0
  153. package/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
  154. package/node_modules/minimatch/package.json +82 -0
  155. package/package.json +176 -6
  156. package/rotate.md +85 -0
@@ -0,0 +1,1057 @@
1
+ import { Size } from 'cdk8s';
2
+ import * as configmap from './config-map';
3
+ import * as handler from './handler';
4
+ import * as k8s from './imports/k8s';
5
+ import * as probe from './probe';
6
+ import * as secret from './secret';
7
+ import * as volume from './volume';
8
+ /**
9
+ * Capability - complete list of POSIX capabilities
10
+ */
11
+ export declare enum Capability {
12
+ /**
13
+ * ALL
14
+ */
15
+ ALL = "ALL",
16
+ /**
17
+ * CAP_AUDIT_CONTROL
18
+ */
19
+ AUDIT_CONTROL = "AUDIT_CONTROL",
20
+ /**
21
+ * CAP_AUDIT_READ
22
+ */
23
+ AUDIT_READ = "AUDIT_READ",
24
+ /**
25
+ * CAP_AUDIT_WRITE
26
+ */
27
+ AUDIT_WRITE = "AUDIT_WRITE",
28
+ /**
29
+ * CAP_BLOCK_SUSPEND
30
+ */
31
+ BLOCK_SUSPEND = "BLOCK_SUSPEND",
32
+ /**
33
+ * CAP_BPF
34
+ */
35
+ BPF = "BPF",
36
+ /**
37
+ * CAP_CHECKPOINT_RESTORE
38
+ */
39
+ CHECKPOINT_RESTORE = "CHECKPOINT_RESTORE",
40
+ /**
41
+ * CAP_CHOWN
42
+ */
43
+ CHOWN = "CHOWN",
44
+ /**
45
+ * CAP_DAC_OVERRIDE
46
+ */
47
+ DAC_OVERRIDE = "DAC_OVERRIDE",
48
+ /**
49
+ * CAP_DAC_READ_SEARCH
50
+ */
51
+ DAC_READ_SEARCH = "DAC_READ_SEARCH",
52
+ /**
53
+ * CAP_FOWNER
54
+ */
55
+ FOWNER = "FOWNER",
56
+ /**
57
+ * CAP_FSETID
58
+ */
59
+ FSETID = "FSETID",
60
+ /**
61
+ * CAP_IPC_LOCK
62
+ */
63
+ IPC_LOCK = "IPC_LOCK",
64
+ /**
65
+ * CAP_IPC_OWNER
66
+ */
67
+ IPC_OWNER = "IPC_OWNER",
68
+ /**
69
+ * CAP_KILL
70
+ */
71
+ KILL = "KILL",
72
+ /**
73
+ * CAP_LEASE
74
+ */
75
+ LEASE = "LEASE",
76
+ /**
77
+ * CAP_LINUX_IMMUTABLE
78
+ */
79
+ LINUX_IMMUTABLE = "LINUX_IMMUTABLE",
80
+ /**
81
+ * CAP_MAC_ADMIN
82
+ */
83
+ MAC_ADMIN = "MAC_ADMIN",
84
+ /**
85
+ * CAP_MAC_OVERRIDE
86
+ */
87
+ MAC_OVERRIDE = "MAC_OVERRIDE",
88
+ /**
89
+ * CAP_MKNOD
90
+ */
91
+ MKNOD = "MKNOD",
92
+ /**
93
+ * CAP_NET_ADMIN
94
+ */
95
+ NET_ADMIN = "NET_ADMIN",
96
+ /**
97
+ * CAP_NET_BIND_SERVICE
98
+ */
99
+ NET_BIND_SERVICE = "NET_BIND_SERVICE",
100
+ /**
101
+ * CAP_NET_BROADCAST
102
+ */
103
+ NET_BROADCAST = "NET_BROADCAST",
104
+ /**
105
+ * CAP_NET_RAW
106
+ */
107
+ NET_RAW = "NET_RAW",
108
+ /**
109
+ * CAP_PERFMON
110
+ */
111
+ PERFMON = "PERFMON",
112
+ /**
113
+ * CAP_SETGID
114
+ */
115
+ SETGID = "SETGID",
116
+ /**
117
+ * CAP_SETFCAP
118
+ */
119
+ SETFCAP = "SETFCAP",
120
+ /**
121
+ * CAP_SETPCAP
122
+ */
123
+ SETPCAP = "SETPCAP",
124
+ /**
125
+ * CAP_SETUID
126
+ */
127
+ SETUID = "SETUID",
128
+ /**
129
+ * CAP_SYS_ADMIN
130
+ */
131
+ SYS_ADMIN = "SYS_ADMIN",
132
+ /**
133
+ * CAP_SYS_BOOT
134
+ */
135
+ SYS_BOOT = "SYS_BOOT",
136
+ /**
137
+ * CAP_SYS_CHROOT
138
+ */
139
+ SYS_CHROOT = "SYS_CHROOT",
140
+ /**
141
+ * CAP_SYS_MODULE
142
+ */
143
+ SYS_MODULE = "SYS_MODULE",
144
+ /**
145
+ * CAP_SYS_NICE
146
+ */
147
+ SYS_NICE = "SYS_NICE",
148
+ /**
149
+ * CAP_SYS_PACCT
150
+ */
151
+ SYS_PACCT = "SYS_PACCT",
152
+ /**
153
+ * CAP_SYS_PTRACE
154
+ */
155
+ SYS_PTRACE = "SYS_PTRACE",
156
+ /**
157
+ * CAP_SYS_RAWIO
158
+ */
159
+ SYS_RAWIO = "SYS_RAWIO",
160
+ /**
161
+ * CAP_SYS_RESOURCE
162
+ */
163
+ SYS_RESOURCE = "SYS_RESOURCE",
164
+ /**
165
+ * CAP_SYS_TIME
166
+ */
167
+ SYS_TIME = "SYS_TIME",
168
+ /**
169
+ * CAP_SYS_TTY_CONFIG
170
+ */
171
+ SYS_TTY_CONFIG = "SYS_TTY_CONFIG",
172
+ /**
173
+ * CAP_SYSLOG
174
+ */
175
+ SYSLOG = "SYSLOG",
176
+ /**
177
+ * CAP_WAKE_ALARM
178
+ */
179
+ WAKE_ALARM = "WAKE_ALARM"
180
+ }
181
+ export declare enum SeccompProfileType {
182
+ /**
183
+ * A profile defined in a file on the node should be used
184
+ */
185
+ LOCALHOST = "Localhost",
186
+ /**
187
+ * The container runtime default profile should be used
188
+ */
189
+ RUNTIME_DEFAULT = "RuntimeDefault",
190
+ /**
191
+ * No profile should be applied
192
+ */
193
+ UNCONFINED = "Unconfined"
194
+ }
195
+ export interface SeccompProfile {
196
+ /**
197
+ * localhostProfile indicates a profile defined in a file on the node should be used.
198
+ * The profile must be preconfigured on the node to work. Must be a descending path,
199
+ * relative to the kubelet's configured seccomp profile location.
200
+ * Must only be set if type is "Localhost".
201
+ *
202
+ * @default - empty string
203
+ */
204
+ readonly localhostProfile?: string;
205
+ /**
206
+ * Indicates which kind of seccomp profile will be applied
207
+ */
208
+ readonly type: SeccompProfileType;
209
+ }
210
+ export interface ContainerSecutiryContextCapabilities {
211
+ /**
212
+ * Added capabilities
213
+ */
214
+ readonly add?: Capability[];
215
+ /**
216
+ * Removed capabilities
217
+ */
218
+ readonly drop?: Capability[];
219
+ }
220
+ /**
221
+ * Properties for `ContainerSecurityContext`
222
+ */
223
+ export interface ContainerSecurityContextProps {
224
+ /**
225
+ * The UID to run the entrypoint of the container process.
226
+ *
227
+ * @default - 25000. An arbitrary number bigger than 9999 is selected here.
228
+ * This is so that the container is blocked to access host files even if
229
+ * somehow it manages to get access to host file system.
230
+ */
231
+ readonly user?: number;
232
+ /**
233
+ * The GID to run the entrypoint of the container process.
234
+ *
235
+ * @default - 26000. An arbitrary number bigger than 9999 is selected here.
236
+ * This is so that the container is blocked to access host files even if
237
+ * somehow it manages to get access to host file system.
238
+ */
239
+ readonly group?: number;
240
+ /**
241
+ * Indicates that the container must run as a non-root user.
242
+ * If true, the Kubelet will validate the image at runtime to ensure that it does
243
+ * not run as UID 0 (root) and fail to start the container if it does.
244
+ *
245
+ * @default true
246
+ */
247
+ readonly ensureNonRoot?: boolean;
248
+ /**
249
+ * Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host.
250
+ *
251
+ * @default false
252
+ */
253
+ readonly privileged?: boolean;
254
+ /**
255
+ * Whether this container has a read-only root filesystem.
256
+ *
257
+ * @default true
258
+ */
259
+ readonly readOnlyRootFilesystem?: boolean;
260
+ /**
261
+ * Whether a process can gain more privileges than its parent process.
262
+ *
263
+ * @default false
264
+ */
265
+ readonly allowPrivilegeEscalation?: boolean;
266
+ /**
267
+ * POSIX capabilities for running containers
268
+ *
269
+ * @default none
270
+ */
271
+ readonly capabilities?: ContainerSecutiryContextCapabilities;
272
+ /**
273
+ * Container's seccomp profile settings. Only one profile source may be set
274
+ *
275
+ * @default none
276
+ */
277
+ readonly seccompProfile?: SeccompProfile;
278
+ }
279
+ /**
280
+ * Represents a network port in a single container.
281
+ */
282
+ export interface ContainerPort {
283
+ /**
284
+ * Number of port to expose on the pod's IP address. This must be a valid port number, 0 < x < 65536.
285
+ */
286
+ readonly number: number;
287
+ /**
288
+ * What host IP to bind the external port to.
289
+ *
290
+ * @default - 127.0.0.1.
291
+ */
292
+ readonly hostIp?: string;
293
+ /**
294
+ * Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536.
295
+ * Most containers do not need this.
296
+ *
297
+ * @default - auto generated by kubernetes and might change on restarts.
298
+ */
299
+ readonly hostPort?: number;
300
+ /**
301
+ * If specified, this must be an IANA_SVC_NAME and unique within the pod.
302
+ * Each named port in a pod must have a unique name.
303
+ * Name for the port that can be referred to by services.
304
+ *
305
+ * @default - port is not named.
306
+ */
307
+ readonly name?: string;
308
+ /**
309
+ * Protocol for port. Must be UDP, TCP, or SCTP. Defaults to "TCP".
310
+ *
311
+ * @default Protocol.TCP
312
+ */
313
+ readonly protocol?: Protocol;
314
+ }
315
+ /**
316
+ * Network protocols.
317
+ */
318
+ export declare enum Protocol {
319
+ /**
320
+ * TCP.
321
+ */
322
+ TCP = "TCP",
323
+ /**
324
+ * UDP.
325
+ */
326
+ UDP = "UDP",
327
+ /**
328
+ * SCTP.
329
+ */
330
+ SCTP = "SCTP"
331
+ }
332
+ /**
333
+ * Container security attributes and settings.
334
+ */
335
+ export declare class ContainerSecurityContext {
336
+ readonly ensureNonRoot: boolean;
337
+ readonly privileged: boolean;
338
+ readonly readOnlyRootFilesystem: boolean;
339
+ readonly user?: number;
340
+ readonly group?: number;
341
+ readonly allowPrivilegeEscalation?: boolean;
342
+ readonly capabilities?: ContainerSecutiryContextCapabilities;
343
+ readonly seccompProfile?: SeccompProfile;
344
+ constructor(props?: ContainerSecurityContextProps);
345
+ /**
346
+ * @internal
347
+ */
348
+ _toKube(): k8s.SecurityContext;
349
+ }
350
+ export declare enum EnvFieldPaths {
351
+ /**
352
+ * The name of the pod.
353
+ */
354
+ POD_NAME = "metadata.name",
355
+ /**
356
+ * The namespace of the pod.
357
+ */
358
+ POD_NAMESPACE = "metadata.namespace",
359
+ /**
360
+ * The uid of the pod.
361
+ */
362
+ POD_UID = "metadata.uid",
363
+ /**
364
+ * The labels of the pod.
365
+ */
366
+ POD_LABEL = "metadata.labels",
367
+ /**
368
+ * The annotations of the pod.
369
+ */
370
+ POD_ANNOTATION = "metadata.annotations",
371
+ /**
372
+ * The ipAddress of the pod.
373
+ */
374
+ POD_IP = "status.podIP",
375
+ /**
376
+ * The service account name of the pod.
377
+ */
378
+ SERVICE_ACCOUNT_NAME = "spec.serviceAccountName",
379
+ /**
380
+ * The name of the node.
381
+ */
382
+ NODE_NAME = "spec.nodeName",
383
+ /**
384
+ * The ipAddress of the node.
385
+ */
386
+ NODE_IP = "status.hostIP",
387
+ /**
388
+ * The ipAddresess of the pod.
389
+ */
390
+ POD_IPS = "status.podIPs"
391
+ }
392
+ export declare enum ResourceFieldPaths {
393
+ /**
394
+ * CPU limit of the container.
395
+ */
396
+ CPU_LIMIT = "limits.cpu",
397
+ /**
398
+ * Memory limit of the container.
399
+ */
400
+ MEMORY_LIMIT = "limits.memory",
401
+ /**
402
+ * CPU request of the container.
403
+ */
404
+ CPU_REQUEST = "requests.cpu",
405
+ /**
406
+ * Memory request of the container.
407
+ */
408
+ MEMORY_REQUEST = "requests.memory",
409
+ /**
410
+ * Ephemeral storage limit of the container.
411
+ */
412
+ STORAGE_LIMIT = "limits.ephemeral-storage",
413
+ /**
414
+ * Ephemeral storage request of the container.
415
+ */
416
+ STORAGE_REQUEST = "requests.ephemeral-storage"
417
+ }
418
+ /**
419
+ * Options to specify an envionment variable value from a ConfigMap key.
420
+ */
421
+ export interface EnvValueFromConfigMapOptions {
422
+ /**
423
+ * Specify whether the ConfigMap or its key must be defined.
424
+ *
425
+ * @default false
426
+ */
427
+ readonly optional?: boolean;
428
+ }
429
+ /**
430
+ * Options to specify an environment variable value from a Secret.
431
+ */
432
+ export interface EnvValueFromSecretOptions {
433
+ /**
434
+ * Specify whether the Secret or its key must be defined.
435
+ *
436
+ * @default false
437
+ */
438
+ readonly optional?: boolean;
439
+ }
440
+ /**
441
+ * Options to specify an environment variable value from the process environment.
442
+ */
443
+ export interface EnvValueFromProcessOptions {
444
+ /**
445
+ * Specify whether the key must exist in the environment.
446
+ * If this is set to true, and the key does not exist, an error will thrown.
447
+ *
448
+ * @default false
449
+ */
450
+ readonly required?: boolean;
451
+ }
452
+ /**
453
+ * Options to specify an environment variable value from a field reference.
454
+ */
455
+ export interface EnvValueFromFieldRefOptions {
456
+ /**
457
+ * Version of the schema the FieldPath is written in terms of.
458
+ */
459
+ readonly apiVersion?: string;
460
+ /**
461
+ * The key to select the pod label or annotation.
462
+ */
463
+ readonly key?: string;
464
+ }
465
+ /**
466
+ * Options to specify an environment variable value from a resource.
467
+ */
468
+ export interface EnvValueFromResourceOptions {
469
+ /**
470
+ * The container to select the value from.
471
+ */
472
+ readonly container?: Container;
473
+ /**
474
+ * The output format of the exposed resource.
475
+ */
476
+ readonly divisor?: string;
477
+ }
478
+ /**
479
+ * Utility class for creating reading env values from various sources.
480
+ */
481
+ export declare class EnvValue {
482
+ readonly value?: any | undefined;
483
+ readonly valueFrom?: any | undefined;
484
+ /**
485
+ * Create a value by reading a specific key inside a config map.
486
+ *
487
+ * @param configMap - The config map.
488
+ * @param key - The key to extract the value from.
489
+ * @param options - Additional options.
490
+ */
491
+ static fromConfigMap(configMap: configmap.IConfigMap, key: string, options?: EnvValueFromConfigMapOptions): EnvValue;
492
+ /**
493
+ * Defines an environment value from a secret JSON value.
494
+ *
495
+ * @param secretValue The secret value (secrent + key)
496
+ * @param options Additional options
497
+ */
498
+ static fromSecretValue(secretValue: secret.SecretValue, options?: EnvValueFromSecretOptions): EnvValue;
499
+ /**
500
+ * Create a value from the given argument.
501
+ *
502
+ * @param value - The value.
503
+ */
504
+ static fromValue(value: string): EnvValue;
505
+ /**
506
+ *
507
+ * Create a value from a field reference.
508
+ *
509
+ * @param fieldPath: The field reference.
510
+ * @param options: Additional options.
511
+ */
512
+ static fromFieldRef(fieldPath: EnvFieldPaths, options?: EnvValueFromFieldRefOptions): EnvValue;
513
+ /**
514
+ * Create a value from a resource.
515
+ *
516
+ * @param resource: Resource to select the value from.
517
+ * @param options: Additional options.
518
+ */
519
+ static fromResource(resource: ResourceFieldPaths, options?: EnvValueFromResourceOptions): EnvValue;
520
+ /**
521
+ * Create a value from a key in the current process environment.
522
+ *
523
+ * @param key - The key to read.
524
+ * @param options - Additional options.
525
+ */
526
+ static fromProcess(key: string, options?: EnvValueFromProcessOptions): EnvValue;
527
+ private constructor();
528
+ }
529
+ export declare enum ImagePullPolicy {
530
+ /**
531
+ * Every time the kubelet launches a container, the kubelet queries the container image registry
532
+ * to resolve the name to an image digest. If the kubelet has a container image with that exact
533
+ * digest cached locally, the kubelet uses its cached image; otherwise, the kubelet downloads
534
+ * (pulls) the image with the resolved digest, and uses that image to launch the container.
535
+ *
536
+ * Default is Always if ImagePullPolicy is omitted and either the image tag is :latest or
537
+ * the image tag is omitted.
538
+ */
539
+ ALWAYS = "Always",
540
+ /**
541
+ * The image is pulled only if it is not already present locally.
542
+ *
543
+ * Default is IfNotPresent if ImagePullPolicy is omitted and the image tag is present but
544
+ * not :latest
545
+ */
546
+ IF_NOT_PRESENT = "IfNotPresent",
547
+ /**
548
+ * The image is assumed to exist locally. No attempt is made to pull the image.
549
+ */
550
+ NEVER = "Never"
551
+ }
552
+ /**
553
+ * Container lifecycle properties.
554
+ */
555
+ export interface ContainerLifecycle {
556
+ /**
557
+ * This hook is executed immediately after a container is created. However,
558
+ * there is no guarantee that the hook will execute before the container ENTRYPOINT.
559
+ *
560
+ * @default - No post start handler.
561
+ */
562
+ readonly postStart?: handler.Handler;
563
+ /**
564
+ * This hook is called immediately before a container is terminated due to an API request or management
565
+ * event such as a liveness/startup probe failure, preemption, resource contention and others.
566
+ * A call to the PreStop hook fails if the container is already in a terminated or completed state
567
+ * and the hook must complete before the TERM signal to stop the container can be sent.
568
+ * The Pod's termination grace period countdown begins before the PreStop hook is executed,
569
+ * so regardless of the outcome of the handler, the container will eventually terminate
570
+ * within the Pod's termination grace period. No parameters are passed to the handler.
571
+ *
572
+ * @see https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination
573
+ *
574
+ * @default - No pre stop handler.
575
+ */
576
+ readonly preStop?: handler.Handler;
577
+ }
578
+ /**
579
+ * RestartPolicy defines the restart behavior of individual containers in a pod.
580
+ * This field may only be set for init containers, and the only allowed value is "Always".
581
+ * For non-init containers or when this field is not specified,
582
+ * the restart behavior is defined by the Pod's restart policy and the container type.
583
+ * Setting the RestartPolicy as "Always" for the init container will have the following effect:
584
+ * this init container will be continually restarted on exit until all regular containers have terminated.
585
+ * Once all regular containers have completed, all init containers with restartPolicy "Always" will be shut down.
586
+ * This lifecycle differs from normal init containers and is often referred to as a "sidecar" container.
587
+ *
588
+ * @see https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
589
+ */
590
+ export declare enum ContainerRestartPolicy {
591
+ /**
592
+ * If an init container is created with its restartPolicy set to Always,
593
+ * it will start and remain running during the entire life of the Pod.
594
+ * For regular containers, this is ignored by Kubernetes.
595
+ */
596
+ ALWAYS = "Always"
597
+ }
598
+ /**
599
+ * Properties for creating a container.
600
+ */
601
+ export interface ContainerProps extends ContainerOpts {
602
+ /**
603
+ * Docker image name.
604
+ */
605
+ readonly image: string;
606
+ }
607
+ /**
608
+ * Optional properties of a container.
609
+ */
610
+ export interface ContainerOpts {
611
+ /**
612
+ * Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.
613
+ *
614
+ * @default 'main'
615
+ */
616
+ readonly name?: string;
617
+ /**
618
+ * @deprecated - use `portNumber`.
619
+ */
620
+ readonly port?: number;
621
+ /**
622
+ * Number of port to expose on the pod's IP address. This must be a valid port number, 0 < x < 65536.
623
+ *
624
+ * This is a convinience property if all you need a single TCP numbered port.
625
+ * In case more advanced configuartion is required, use the `ports` property.
626
+ *
627
+ * This port is added to the list of ports mentioned in the `ports` property.
628
+ *
629
+ * @default - Only the ports mentiond in the `ports` property are exposed.
630
+ */
631
+ readonly portNumber?: number;
632
+ /**
633
+ * List of ports to expose from this container.
634
+ *
635
+ * @default - Only the port mentioned in the `portNumber` property is exposed.
636
+ */
637
+ readonly ports?: ContainerPort[];
638
+ /**
639
+ * Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment.
640
+ * If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME).
641
+ * Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated.
642
+ * More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
643
+ *
644
+ * @default - The docker image's ENTRYPOINT.
645
+ */
646
+ readonly command?: string[];
647
+ /**
648
+ * Arguments to the entrypoint. The docker image's CMD is used if `command` is
649
+ * not provided.
650
+ *
651
+ * Variable references $(VAR_NAME) are expanded using the container's
652
+ * environment. If a variable cannot be resolved, the reference in the input
653
+ * string will be unchanged. The $(VAR_NAME) syntax can be escaped with a
654
+ * double $$, ie: $$(VAR_NAME). Escaped references will never be expanded,
655
+ * regardless of whether the variable exists or not.
656
+ *
657
+ * Cannot be updated.
658
+ *
659
+ * @see https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
660
+ * @default []
661
+ */
662
+ readonly args?: string[];
663
+ /**
664
+ * Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.
665
+ *
666
+ * @default - The container runtime's default.
667
+ */
668
+ readonly workingDir?: string;
669
+ /**
670
+ * Environment variables to set in the container.
671
+ *
672
+ * @default - No environment variables.
673
+ */
674
+ readonly envVariables?: {
675
+ [name: string]: EnvValue;
676
+ };
677
+ /**
678
+ * List of sources to populate environment variables in the container.
679
+ * When a key exists in multiple sources, the value associated with
680
+ * the last source will take precedence. Values defined by the `envVariables` property
681
+ * with a duplicate key will take precedence.
682
+ *
683
+ * @default - No sources.
684
+ */
685
+ readonly envFrom?: EnvFrom[];
686
+ /**
687
+ * Pod volumes to mount into the container's filesystem. Cannot be updated.
688
+ */
689
+ readonly volumeMounts?: VolumeMount[];
690
+ /**
691
+ * Image pull policy for this container
692
+ * @default ImagePullPolicy.ALWAYS
693
+ */
694
+ readonly imagePullPolicy?: ImagePullPolicy;
695
+ /**
696
+ * Determines when the container is ready to serve traffic.
697
+ *
698
+ * @default - no readiness probe is defined
699
+ */
700
+ readonly readiness?: probe.Probe;
701
+ /**
702
+ * Periodic probe of container liveness. Container will be restarted if the probe fails.
703
+ *
704
+ * @default - no liveness probe is defined
705
+ */
706
+ readonly liveness?: probe.Probe;
707
+ /**
708
+ * StartupProbe indicates that the Pod has successfully initialized.
709
+ * If specified, no other probes are executed until this completes successfully
710
+ *
711
+ * @default - If a port is provided, then knocks on that port
712
+ * to determine when the container is ready for readiness and
713
+ * liveness probe checks.
714
+ * Otherwise, no startup probe is defined.
715
+ */
716
+ readonly startup?: probe.Probe;
717
+ /**
718
+ * Describes actions that the management system should take in response to container lifecycle events.
719
+ */
720
+ readonly lifecycle?: ContainerLifecycle;
721
+ /**
722
+ * Compute resources (CPU and memory requests and limits) required by the container
723
+ * @see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
724
+ *
725
+ * @default
726
+ * cpu:
727
+ * request: 1000 millis
728
+ * limit: 1500 millis
729
+ * memory:
730
+ * request: 512 mebibytes
731
+ * limit: 2048 mebibytes
732
+ */
733
+ readonly resources?: ContainerResources;
734
+ /**
735
+ * SecurityContext defines the security options the container should be run with.
736
+ * If set, the fields override equivalent fields of the pod's security context.
737
+ *
738
+ * @see https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
739
+ * @default
740
+ *
741
+ * ensureNonRoot: true
742
+ * privileged: false
743
+ * readOnlyRootFilesystem: true
744
+ * allowPrivilegeEscalation: false
745
+ * user: 25000
746
+ * group: 26000
747
+ */
748
+ readonly securityContext?: ContainerSecurityContextProps;
749
+ /**
750
+ * Kubelet will start init containers with restartPolicy=Always in the order with other init containers,
751
+ * but instead of waiting for its completion, it will wait for the container startup completion
752
+ * Currently, only accepted value is Always
753
+ * @see https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
754
+ * @default - no restart policy is defined and the pod restart policy is applied
755
+ */
756
+ readonly restartPolicy?: ContainerRestartPolicy;
757
+ }
758
+ /**
759
+ * A single application container that you want to run within a pod.
760
+ */
761
+ export declare class Container {
762
+ /**
763
+ * The port number that was configured for this container.
764
+ * If undefined, either the container doesn't expose a port, or its
765
+ * port configuration is stored in the `ports` field.
766
+ */
767
+ readonly portNumber?: number;
768
+ /**
769
+ * Volume mounts configured for this container.
770
+ */
771
+ readonly mounts: VolumeMount[];
772
+ /**
773
+ * Image pull policy for this container
774
+ */
775
+ readonly imagePullPolicy: ImagePullPolicy;
776
+ /**
777
+ * The container image.
778
+ */
779
+ readonly image: string;
780
+ /**
781
+ * The name of the container.
782
+ */
783
+ readonly name: string;
784
+ /**
785
+ * The working directory inside the container.
786
+ */
787
+ readonly workingDir?: string;
788
+ /**
789
+ * Compute resources (CPU and memory requests and limits) required by the container
790
+ * @see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
791
+ */
792
+ readonly resources?: ContainerResources;
793
+ /**
794
+ * The security context of the container.
795
+ */
796
+ readonly securityContext: ContainerSecurityContext;
797
+ /**
798
+ * The environment of the container.
799
+ */
800
+ readonly env: Env;
801
+ /**
802
+ * The restart policy of the container.
803
+ */
804
+ readonly restartPolicy?: ContainerRestartPolicy;
805
+ private readonly _command?;
806
+ private readonly _args?;
807
+ private readonly _ports;
808
+ private readonly _readiness?;
809
+ private readonly _liveness?;
810
+ private readonly _startup?;
811
+ private readonly _lifecycle?;
812
+ constructor(props: ContainerProps);
813
+ /**
814
+ * @deprecated - use `portNumber`.
815
+ */
816
+ get port(): number | undefined;
817
+ /**
818
+ * Ports exposed by this containers.
819
+ * Returns a copy, use `addPort` to modify.
820
+ */
821
+ get ports(): ContainerPort[];
822
+ /**
823
+ * Entrypoint array (the command to execute when the container starts).
824
+ * @returns a copy of the entrypoint array, cannot be modified
825
+ */
826
+ get command(): string[] | undefined;
827
+ /**
828
+ * Arguments to the entrypoint.
829
+ *
830
+ * @returns a copy of the arguments array, cannot be modified.
831
+ */
832
+ get args(): string[] | undefined;
833
+ /**
834
+ * Mount a volume to a specific path so that it is accessible by the container.
835
+ * Every pod that is configured to use this container will autmoatically have access to the volume.
836
+ *
837
+ * @param path - The desired path in the container.
838
+ * @param storage - The storage to mount.
839
+ */
840
+ mount(path: string, storage: volume.IStorage, options?: MountOptions): void;
841
+ /**
842
+ * Add a port to expose from this container.
843
+ */
844
+ addPort(port: ContainerPort): void;
845
+ /**
846
+ * @internal
847
+ */
848
+ _toKube(): k8s.Container;
849
+ }
850
+ /**
851
+ * Options for mounts.
852
+ */
853
+ export interface MountOptions {
854
+ /**
855
+ * Determines how mounts are propagated from the host to container and the
856
+ * other way around. When not set, MountPropagationNone is used.
857
+ *
858
+ * Mount propagation allows for sharing volumes mounted by a Container to
859
+ * other Containers in the same Pod, or even to other Pods on the same node.
860
+ *
861
+ * @default MountPropagation.NONE
862
+ */
863
+ readonly propagation?: MountPropagation;
864
+ /**
865
+ * Mounted read-only if true, read-write otherwise (false or unspecified).
866
+ * Defaults to false.
867
+ *
868
+ * @default false
869
+ */
870
+ readonly readOnly?: boolean;
871
+ /**
872
+ * Path within the volume from which the container's volume should be mounted.).
873
+ *
874
+ * @default "" the volume's root
875
+ */
876
+ readonly subPath?: string;
877
+ /**
878
+ * Expanded path within the volume from which the container's volume should be
879
+ * mounted. Behaves similarly to SubPath but environment variable references
880
+ * $(VAR_NAME) are expanded using the container's environment. Defaults to ""
881
+ * (volume's root).
882
+ *
883
+ * `subPathExpr` and `subPath` are mutually exclusive.
884
+ *
885
+ * @default "" volume's root.
886
+ */
887
+ readonly subPathExpr?: string;
888
+ }
889
+ /**
890
+ * Mount a volume from the pod to the container.
891
+ */
892
+ export interface VolumeMount extends MountOptions {
893
+ /**
894
+ * The volume to mount.
895
+ */
896
+ readonly volume: volume.Volume;
897
+ /**
898
+ * Path within the container at which the volume should be mounted. Must not
899
+ * contain ':'.
900
+ */
901
+ readonly path: string;
902
+ }
903
+ export declare enum MountPropagation {
904
+ /**
905
+ * This volume mount will not receive any subsequent mounts that are mounted
906
+ * to this volume or any of its subdirectories by the host. In similar
907
+ * fashion, no mounts created by the Container will be visible on the host.
908
+ *
909
+ * This is the default mode.
910
+ *
911
+ * This mode is equal to `private` mount propagation as described in the Linux
912
+ * kernel documentation
913
+ */
914
+ NONE = "None",
915
+ /**
916
+ * This volume mount will receive all subsequent mounts that are mounted to
917
+ * this volume or any of its subdirectories.
918
+ *
919
+ * In other words, if the host mounts anything inside the volume mount, the
920
+ * Container will see it mounted there.
921
+ *
922
+ * Similarly, if any Pod with Bidirectional mount propagation to the same
923
+ * volume mounts anything there, the Container with HostToContainer mount
924
+ * propagation will see it.
925
+ *
926
+ * This mode is equal to `rslave` mount propagation as described in the Linux
927
+ * kernel documentation
928
+ */
929
+ HOST_TO_CONTAINER = "HostToContainer",
930
+ /**
931
+ * This volume mount behaves the same the HostToContainer mount. In addition,
932
+ * all volume mounts created by the Container will be propagated back to the
933
+ * host and to all Containers of all Pods that use the same volume
934
+ *
935
+ * A typical use case for this mode is a Pod with a FlexVolume or CSI driver
936
+ * or a Pod that needs to mount something on the host using a hostPath volume.
937
+ *
938
+ * This mode is equal to `rshared` mount propagation as described in the Linux
939
+ * kernel documentation
940
+ *
941
+ * Caution: Bidirectional mount propagation can be dangerous. It can damage
942
+ * the host operating system and therefore it is allowed only in privileged
943
+ * Containers. Familiarity with Linux kernel behavior is strongly recommended.
944
+ * In addition, any volume mounts created by Containers in Pods must be
945
+ * destroyed (unmounted) by the Containers on termination.
946
+ *
947
+ */
948
+ BIDIRECTIONAL = "Bidirectional"
949
+ }
950
+ /**
951
+ * CPU and memory compute resources
952
+ */
953
+ export interface ContainerResources {
954
+ readonly cpu?: CpuResources;
955
+ readonly memory?: MemoryResources;
956
+ readonly ephemeralStorage?: EphemeralStorageResources;
957
+ }
958
+ /**
959
+ * CPU request and limit
960
+ */
961
+ export interface CpuResources {
962
+ readonly request?: Cpu;
963
+ readonly limit?: Cpu;
964
+ }
965
+ /**
966
+ * Represents the amount of CPU.
967
+ * The amount can be passed as millis or units.
968
+ */
969
+ export declare class Cpu {
970
+ static millis(amount: number): Cpu;
971
+ static units(amount: number): Cpu;
972
+ amount: string;
973
+ private constructor();
974
+ }
975
+ /**
976
+ * Memory request and limit
977
+ */
978
+ export interface MemoryResources {
979
+ readonly request?: Size;
980
+ readonly limit?: Size;
981
+ }
982
+ /**
983
+ * Emphemeral storage request and limit
984
+ */
985
+ export interface EphemeralStorageResources {
986
+ readonly request?: Size;
987
+ readonly limit?: Size;
988
+ }
989
+ /**
990
+ * A collection of env variables defined in other resources.
991
+ */
992
+ export declare class EnvFrom {
993
+ private readonly configMap?;
994
+ private readonly prefix?;
995
+ private readonly sec?;
996
+ constructor(configMap?: configmap.IConfigMap | undefined, prefix?: string | undefined, sec?: secret.ISecret | undefined);
997
+ /**
998
+ * @internal
999
+ */
1000
+ _toKube(): k8s.EnvFromSource;
1001
+ }
1002
+ export declare function extractContainerPorts(selector?: any): ContainerPort[];
1003
+ /**
1004
+ * Container environment variables.
1005
+ */
1006
+ export declare class Env {
1007
+ /**
1008
+ * Selects a ConfigMap to populate the environment variables with.
1009
+ * The contents of the target ConfigMap's Data field will represent
1010
+ * the key-value pairs as environment variables.
1011
+ */
1012
+ static fromConfigMap(configMap: configmap.IConfigMap, prefix?: string): EnvFrom;
1013
+ /**
1014
+ * Selects a Secret to populate the environment variables with.
1015
+ * The contents of the target Secret's Data field will represent
1016
+ * the key-value pairs as environment variables.
1017
+ */
1018
+ static fromSecret(secr: secret.ISecret): EnvFrom;
1019
+ private readonly _sources;
1020
+ private readonly _variables;
1021
+ constructor(sources: EnvFrom[], variables: {
1022
+ [name: string]: EnvValue;
1023
+ });
1024
+ /**
1025
+ * Add a single variable by name and value.
1026
+ * The variable value can come from various dynamic sources such a secrets of config maps.
1027
+ * Use `EnvValue.fromXXX` to select sources.
1028
+ */
1029
+ addVariable(name: string, value: EnvValue): void;
1030
+ /**
1031
+ * The environment variables for this container.
1032
+ * Returns a copy. To add environment variables use `container.env.addVariable()`.
1033
+ */
1034
+ get variables(): {
1035
+ [name: string]: EnvValue;
1036
+ };
1037
+ /**
1038
+ * Add a collection of variables by copying from another source.
1039
+ * Use `Env.fromXXX` functions to select sources.
1040
+ */
1041
+ copyFrom(from: EnvFrom): void;
1042
+ /**
1043
+ * The list of sources used to populate the container environment,
1044
+ * in addition to the `variables`.
1045
+ *
1046
+ * Returns a copy. To add a source use `container.env.copyFrom()`.
1047
+ */
1048
+ get sources(): EnvFrom[];
1049
+ private renderEnv;
1050
+ /**
1051
+ * @internal
1052
+ */
1053
+ _toKube(): {
1054
+ variables?: k8s.EnvVar[];
1055
+ from?: k8s.EnvFromSource[];
1056
+ };
1057
+ }