-
Notifications
You must be signed in to change notification settings - Fork 1
/
cron_job.tf
3078 lines (2259 loc) · 195 KB
/
cron_job.tf
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
resource "kubernetes_cron_job" "instance" {
depends_on = [null_resource.module_depends_on]
for_each = local.cron_job.applications
dynamic "metadata" { # Nesting Mode: list Min Items : 1 Max Items : 1
for_each = contains(keys(each.value), "metadata") ? {item = each.value["metadata"]} : {}
content {
annotations = lookup(metadata.value, "annotations", null)
# Type: ['map', 'string'] Optional
# An unstructured key value map stored with the cronjob that may be used to store arbitrary metadata. More info: http://kubernetes.io/docs/user-guide/annotations
generate_name = lookup(metadata.value, "generateName", null)
# Type: string Optional
# Prefix, used by the server, to generate a unique name ONLY IF the `name` field has not been provided. This value will also be combined with a unique suffix. Read more: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#idempotency
labels = lookup(metadata.value, "labels", null)
# Type: ['map', 'string'] Optional
# Map of string keys and values that can be used to organize and categorize (scope and select) the cronjob. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels
name = lookup(metadata.value, "name", null)
# Type: string Optional Computed
# Name of the cronjob, must be unique. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names
namespace = var.namespace != "" ? var.namespace : lookup(metadata.value, "namespace", null)
# Type: string Optional
# Namespace defines the space within which name of the cronjob must be unique.
}
}
dynamic "spec" { # Nesting Mode: list Min Items : 1 Max Items : 1
for_each = contains(keys(each.value), "spec") ? {item = each.value["spec"]} : {}
content {
concurrency_policy = lookup(spec.value, "concurrencyPolicy", null)
# Type: string Optional
# Specifies how to treat concurrent executions of a Job. Defaults to Allow.
failed_jobs_history_limit = lookup(spec.value, "failedJobsHistoryLimit", null)
# Type: number Optional
# The number of failed finished jobs to retain. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.
schedule = lookup(spec.value, "schedule", null)
# Type: string Required
# Cron format string, e.g. 0 * * * * or @hourly, as schedule time of its jobs to be created and executed.
starting_deadline_seconds = lookup(spec.value, "startingDeadlineSeconds", null)
# Type: number Optional
# Optional deadline in seconds for starting the job if it misses scheduled time for any reason. Missed jobs executions will be counted as failed ones.
successful_jobs_history_limit = lookup(spec.value, "successfulJobsHistoryLimit", null)
# Type: number Optional
# The number of successful finished jobs to retain. Defaults to 3.
suspend = lookup(spec.value, "suspend", null)
# Type: bool Optional
# This flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults to false.
dynamic "job_template" { # Nesting Mode: list Min Items : 1 Max Items : 1
for_each = contains(keys(spec.value), "jobTemplate") ? {item = spec.value["jobTemplate"]} : {}
content {
dynamic "metadata" { # Nesting Mode: list Min Items : 1 Max Items : 1
for_each = contains(keys(job_template.value), "metadata") ? {item = job_template.value["metadata"]} : {}
content {
annotations = lookup(metadata.value, "annotations", null)
# Type: ['map', 'string'] Optional
# An unstructured key value map stored with the jobTemplateSpec that may be used to store arbitrary metadata. More info: http://kubernetes.io/docs/user-guide/annotations
generate_name = lookup(metadata.value, "generateName", null)
# Type: string Optional
# Prefix, used by the server, to generate a unique name ONLY IF the `name` field has not been provided. This value will also be combined with a unique suffix. Read more: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#idempotency
labels = lookup(metadata.value, "labels", null)
# Type: ['map', 'string'] Optional
# Map of string keys and values that can be used to organize and categorize (scope and select) the jobTemplateSpec. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels
name = lookup(metadata.value, "name", null)
# Type: string Optional Computed
# Name of the jobTemplateSpec, must be unique. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names
}
}
dynamic "spec" { # Nesting Mode: list Min Items : 1 Max Items : 1
for_each = contains(keys(job_template.value), "spec") ? {item = job_template.value["spec"]} : {}
content {
active_deadline_seconds = lookup(spec.value, "activeDeadlineSeconds", null)
# Type: number Optional
# Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. Value must be a positive integer.
backoff_limit = lookup(spec.value, "backoffLimit", null)
# Type: number Optional
# Specifies the number of retries before marking this job failed. Defaults to 6
completions = lookup(spec.value, "completions", null)
# Type: number Optional
# Specifies the desired number of successfully finished pods the job should be run with. Setting to nil means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value. Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
manual_selector = lookup(spec.value, "manualSelector", null)
# Type: bool Optional
# Controls generation of pod labels and pod selectors. Leave unset unless you are certain what you are doing. When false or unset, the system pick labels unique to this job and appends those labels to the pod template. When true, the user is responsyble for picking unique labels and specifying the selector. Failure to pick a unique label may cause this and other jobs to not function correctly. More info: https://git.k8s.io/community/contributors/design-proposals/selector-generation.md
parallelism = lookup(spec.value, "parallelism", null)
# Type: number Optional
# Specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
ttl_seconds_after_finished = lookup(spec.value, "ttlSecondsAfterFinished", null)
# Type: number Optional
# ttlSecondsAfterFinished limits the lifetime of a Job that has finished execution (either Complete or Failed). If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted. When the Job is being deleted, its lifecycle guarantees (e.g. finalizers) will be honored. If this field is unset, the Job won't be automatically deleted. If this field is set to zero, the Job becomes eligible to be deleted immediately after it finishes.
dynamic "selector" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(spec.value), "selector") ? {item = spec.value["selector"]} : {}
content {
match_labels = lookup(selector.value, "matchLabels", null)
# Type: ['map', 'string'] Optional
# A map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of `match_expressions`, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
dynamic "match_expressions" { # Nesting Mode: list
for_each = lookup(selector.value, "matchExpressions", {})
content {
key = lookup(match_expressions.value, "key", null)
# Type: string Optional
# The label key that the selector applies to.
operator = lookup(match_expressions.value, "operator", null)
# Type: string Optional
# A key's relationship to a set of values. Valid operators ard `In`, `NotIn`, `Exists` and `DoesNotExist`.
values = lookup(match_expressions.value, "values", null)
# Type: ['set', 'string'] Optional
# An array of string values. If the operator is `In` or `NotIn`, the values array must be non-empty. If the operator is `Exists` or `DoesNotExist`, the values array must be empty. This array is replaced during a strategic merge patch.
}
}
}
}
dynamic "template" { # Nesting Mode: list Min Items : 1 Max Items : 1
for_each = contains(keys(spec.value), "template") ? {item = spec.value["template"]} : {}
content {
dynamic "metadata" { # Nesting Mode: list Min Items : 1 Max Items : 1
for_each = contains(keys(template.value), "metadata") ? {item = template.value["metadata"]} : {}
content {
annotations = lookup(metadata.value, "annotations", null)
# Type: ['map', 'string'] Optional
# An unstructured key value map stored with the job that may be used to store arbitrary metadata. More info: http://kubernetes.io/docs/user-guide/annotations
generate_name = lookup(metadata.value, "generateName", null)
# Type: string Optional
# Prefix, used by the server, to generate a unique name ONLY IF the `name` field has not been provided. This value will also be combined with a unique suffix. Read more: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#idempotency
labels = lookup(metadata.value, "labels", null)
# Type: ['map', 'string'] Optional
# Map of string keys and values that can be used to organize and categorize (scope and select) the job. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels
name = lookup(metadata.value, "name", null)
# Type: string Optional Computed
# Name of the job, must be unique. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names
}
}
dynamic "spec" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(template.value), "spec") ? {item = template.value["spec"]} : {}
content {
active_deadline_seconds = lookup(spec.value, "activeDeadlineSeconds", null)
# Type: number Optional
# Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. Value must be a positive integer.
automount_service_account_token = lookup(spec.value, "automountServiceAccountToken", null)
# Type: bool Optional
# AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.
dns_policy = lookup(spec.value, "dnsPolicy", null)
# Type: string Optional
# Set DNS policy for containers within the pod. Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'. Optional: Defaults to 'ClusterFirst', see [Kubernetes reference](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy).
enable_service_links = lookup(spec.value, "enableServiceLinks", null)
# Type: bool Optional
# Enables generating environment variables for service discovery. Optional: Defaults to true.
host_ipc = lookup(spec.value, "hostIPC", null)
# Type: bool Optional
# Use the host's ipc namespace. Optional: Defaults to false.
host_network = lookup(spec.value, "hostNetwork", null)
# Type: bool Optional
# Host networking requested for this pod. Use the host's network namespace. If this option is set, the ports that will be used must be specified.
host_pid = lookup(spec.value, "hostPid", null)
# Type: bool Optional
# Use the host's pid namespace.
hostname = lookup(spec.value, "hostname", null)
# Type: string Optional Computed
# Specifies the hostname of the Pod If not specified, the pod's hostname will be set to a system-defined value.
node_name = lookup(spec.value, "nodeName", null)
# Type: string Optional Computed
# NodeName is a request to schedule this pod onto a specific node. If it is non-empty, the scheduler simply schedules this pod onto that node, assuming that it fits resource requirements.
node_selector = lookup(spec.value, "nodeSelector", null)
# Type: ['map', 'string'] Optional
# NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: http://kubernetes.io/docs/user-guide/node-selection.
priority_class_name = lookup(spec.value, "priorityClassName", null)
# Type: string Optional
# If specified, indicates the pod's priority. "system-node-critical" and "system-cluster-critical" are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default.
restart_policy = lookup(spec.value, "restartPolicy", null)
# Type: string Optional
# Restart policy for all containers within the pod. One of Always, OnFailure, Never. More info: http://kubernetes.io/docs/user-guide/pod-states#restartpolicy.
service_account_name = lookup(spec.value, "serviceAccountName", null)
# Type: string Optional Computed
# ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info: http://releases.k8s.io/HEAD/docs/design/service_accounts.md.
share_process_namespace = lookup(spec.value, "shareProcessNamespace", null)
# Type: bool Optional
# Share a single process namespace between all of the containers in a pod. When this is set containers will be able to view and signal processes from other containers in the same pod, and the first process in each container will not be assigned PID 1. HostPID and ShareProcessNamespace cannot both be set. Optional: Defaults to false.
subdomain = lookup(spec.value, "subdomain", null)
# Type: string Optional
# If specified, the fully qualified Pod hostname will be "...svc.". If not specified, the pod will not have a domainname at all..
termination_grace_period_seconds = lookup(spec.value, "terminationGracePeriodSeconds", null)
# Type: number Optional
# Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process.
dynamic "affinity" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(spec.value), "affinity") ? {item = spec.value["affinity"]} : {}
content {
dynamic "node_affinity" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(affinity.value), "nodeAffinity") ? {item = affinity.value["nodeAffinity"]} : {}
content {
dynamic "preferred_during_scheduling_ignored_during_execution" { # Nesting Mode: list
for_each = lookup(node_affinity.value, "preferredDuringSchedulingIgnoredDuringExecution", {})
content {
weight = lookup(preferred_during_scheduling_ignored_during_execution.value, "weight", null)
# Type: number Required
# weight is in the range 1-100
dynamic "preference" { # Nesting Mode: list Min Items : 1 Max Items : 1
for_each = contains(keys(preferred_during_scheduling_ignored_during_execution.value), "preference") ? {item = preferred_during_scheduling_ignored_during_execution.value["preference"]} : {}
content {
dynamic "match_expressions" { # Nesting Mode: list
for_each = lookup(preference.value, "matchExpressions", {})
content {
key = lookup(match_expressions.value, "key", null)
# Type: string Optional
# The label key that the selector applies to.
operator = lookup(match_expressions.value, "operator", null)
# Type: string Optional
# Operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
values = lookup(match_expressions.value, "values", null)
# Type: ['set', 'string'] Optional
# Values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.
}
}
}
}
}
}
dynamic "required_during_scheduling_ignored_during_execution" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(node_affinity.value), "requiredDuringSchedulingIgnoredDuringExecution") ? {item = node_affinity.value["requiredDuringSchedulingIgnoredDuringExecution"]} : {}
content {
dynamic "node_selector_term" { # Nesting Mode: list
for_each = lookup(required_during_scheduling_ignored_during_execution.value, "nodeSelectorTerms", {})
content {
dynamic "match_expressions" { # Nesting Mode: list
for_each = lookup(node_selector_term.value, "matchExpressions", {})
content {
key = lookup(match_expressions.value, "key", null)
# Type: string Optional
# The label key that the selector applies to.
operator = lookup(match_expressions.value, "operator", null)
# Type: string Optional
# Operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
values = lookup(match_expressions.value, "values", null)
# Type: ['set', 'string'] Optional
# Values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.
}
}
}
}
}
}
}
}
dynamic "pod_affinity" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(affinity.value), "podAffinity") ? {item = affinity.value["podAffinity"]} : {}
content {
dynamic "preferred_during_scheduling_ignored_during_execution" { # Nesting Mode: list
for_each = lookup(pod_affinity.value, "preferredDuringSchedulingIgnoredDuringExecution", {})
content {
weight = lookup(preferred_during_scheduling_ignored_during_execution.value, "weight", null)
# Type: number Required
# weight associated with matching the corresponding podAffinityTerm, in the range 1-100
dynamic "pod_affinity_term" { # Nesting Mode: list Min Items : 1 Max Items : 1
for_each = contains(keys(preferred_during_scheduling_ignored_during_execution.value), "podAffinityTerm") ? {item = preferred_during_scheduling_ignored_during_execution.value["podAffinityTerm"]} : {}
content {
namespaces = lookup(pod_affinity_term.value, "namespaces", null)
# Type: ['set', 'string'] Optional
# namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means 'this pod's namespace'
topology_key = lookup(pod_affinity_term.value, "topologyKey", null)
# Type: string Optional
# empty topology key is interpreted by the scheduler as 'all topologies'
dynamic "label_selector" { # Nesting Mode: list
for_each = contains(keys(pod_affinity_term.value), "labelSelector") ? {item = pod_affinity_term.value["labelSelector"]} : {}
content {
match_labels = lookup(label_selector.value, "matchLabels", null)
# Type: ['map', 'string'] Optional
# A map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of `match_expressions`, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
dynamic "match_expressions" { # Nesting Mode: list
for_each = lookup(label_selector.value, "matchExpressions", {})
content {
key = lookup(match_expressions.value, "key", null)
# Type: string Optional
# The label key that the selector applies to.
operator = lookup(match_expressions.value, "operator", null)
# Type: string Optional
# A key's relationship to a set of values. Valid operators ard `In`, `NotIn`, `Exists` and `DoesNotExist`.
values = lookup(match_expressions.value, "values", null)
# Type: ['set', 'string'] Optional
# An array of string values. If the operator is `In` or `NotIn`, the values array must be non-empty. If the operator is `Exists` or `DoesNotExist`, the values array must be empty. This array is replaced during a strategic merge patch.
}
}
}
}
}
}
}
}
dynamic "required_during_scheduling_ignored_during_execution" { # Nesting Mode: list
for_each = lookup(pod_affinity.value, "requiredDuringSchedulingIgnoredDuringExecution", {})
content {
namespaces = lookup(required_during_scheduling_ignored_during_execution.value, "namespaces", null)
# Type: ['set', 'string'] Optional
# namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means 'this pod's namespace'
topology_key = lookup(required_during_scheduling_ignored_during_execution.value, "topologyKey", null)
# Type: string Optional
# empty topology key is interpreted by the scheduler as 'all topologies'
dynamic "label_selector" { # Nesting Mode: list
for_each = contains(keys(required_during_scheduling_ignored_during_execution.value), "labelSelector") ? {item = required_during_scheduling_ignored_during_execution.value["labelSelector"]} : {}
content {
match_labels = lookup(label_selector.value, "matchLabels", null)
# Type: ['map', 'string'] Optional
# A map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of `match_expressions`, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
dynamic "match_expressions" { # Nesting Mode: list
for_each = lookup(label_selector.value, "matchExpressions", {})
content {
key = lookup(match_expressions.value, "key", null)
# Type: string Optional
# The label key that the selector applies to.
operator = lookup(match_expressions.value, "operator", null)
# Type: string Optional
# A key's relationship to a set of values. Valid operators ard `In`, `NotIn`, `Exists` and `DoesNotExist`.
values = lookup(match_expressions.value, "values", null)
# Type: ['set', 'string'] Optional
# An array of string values. If the operator is `In` or `NotIn`, the values array must be non-empty. If the operator is `Exists` or `DoesNotExist`, the values array must be empty. This array is replaced during a strategic merge patch.
}
}
}
}
}
}
}
}
dynamic "pod_anti_affinity" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(affinity.value), "podAntiAffinity") ? {item = affinity.value["podAntiAffinity"]} : {}
content {
dynamic "preferred_during_scheduling_ignored_during_execution" { # Nesting Mode: list
for_each = lookup(pod_anti_affinity.value, "preferredDuringSchedulingIgnoredDuringExecution", {})
content {
weight = lookup(preferred_during_scheduling_ignored_during_execution.value, "weight", null)
# Type: number Required
# weight associated with matching the corresponding podAffinityTerm, in the range 1-100
dynamic "pod_affinity_term" { # Nesting Mode: list Min Items : 1 Max Items : 1
for_each = contains(keys(preferred_during_scheduling_ignored_during_execution.value), "podAffinityTerm") ? {item = preferred_during_scheduling_ignored_during_execution.value["podAffinityTerm"]} : {}
content {
namespaces = lookup(pod_affinity_term.value, "namespaces", null)
# Type: ['set', 'string'] Optional
# namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means 'this pod's namespace'
topology_key = lookup(pod_affinity_term.value, "topologyKey", null)
# Type: string Optional
# empty topology key is interpreted by the scheduler as 'all topologies'
dynamic "label_selector" { # Nesting Mode: list
for_each = contains(keys(pod_affinity_term.value), "labelSelector") ? {item = pod_affinity_term.value["labelSelector"]} : {}
content {
match_labels = lookup(label_selector.value, "matchLabels", null)
# Type: ['map', 'string'] Optional
# A map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of `match_expressions`, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
dynamic "match_expressions" { # Nesting Mode: list
for_each = lookup(label_selector.value, "matchExpressions", {})
content {
key = lookup(match_expressions.value, "key", null)
# Type: string Optional
# The label key that the selector applies to.
operator = lookup(match_expressions.value, "operator", null)
# Type: string Optional
# A key's relationship to a set of values. Valid operators ard `In`, `NotIn`, `Exists` and `DoesNotExist`.
values = lookup(match_expressions.value, "values", null)
# Type: ['set', 'string'] Optional
# An array of string values. If the operator is `In` or `NotIn`, the values array must be non-empty. If the operator is `Exists` or `DoesNotExist`, the values array must be empty. This array is replaced during a strategic merge patch.
}
}
}
}
}
}
}
}
dynamic "required_during_scheduling_ignored_during_execution" { # Nesting Mode: list
for_each = lookup(pod_anti_affinity.value, "requiredDuringSchedulingIgnoredDuringExecution", {})
content {
namespaces = lookup(required_during_scheduling_ignored_during_execution.value, "namespaces", null)
# Type: ['set', 'string'] Optional
# namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means 'this pod's namespace'
topology_key = lookup(required_during_scheduling_ignored_during_execution.value, "topologyKey", null)
# Type: string Optional
# empty topology key is interpreted by the scheduler as 'all topologies'
dynamic "label_selector" { # Nesting Mode: list
for_each = contains(keys(required_during_scheduling_ignored_during_execution.value), "labelSelector") ? {item = required_during_scheduling_ignored_during_execution.value["labelSelector"]} : {}
content {
match_labels = lookup(label_selector.value, "matchLabels", null)
# Type: ['map', 'string'] Optional
# A map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of `match_expressions`, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
dynamic "match_expressions" { # Nesting Mode: list
for_each = lookup(label_selector.value, "matchExpressions", {})
content {
key = lookup(match_expressions.value, "key", null)
# Type: string Optional
# The label key that the selector applies to.
operator = lookup(match_expressions.value, "operator", null)
# Type: string Optional
# A key's relationship to a set of values. Valid operators ard `In`, `NotIn`, `Exists` and `DoesNotExist`.
values = lookup(match_expressions.value, "values", null)
# Type: ['set', 'string'] Optional
# An array of string values. If the operator is `In` or `NotIn`, the values array must be non-empty. If the operator is `Exists` or `DoesNotExist`, the values array must be empty. This array is replaced during a strategic merge patch.
}
}
}
}
}
}
}
}
}
}
dynamic "container" { # Nesting Mode: list
for_each = lookup(spec.value, "containers", {})
content {
args = lookup(container.value, "args", null)
# Type: ['list', 'string'] Optional
# Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. 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). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/containers#containers-and-commands
command = lookup(container.value, "command", null)
# Type: ['list', 'string'] Optional
# 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. 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). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/containers#containers-and-commands
image = lookup(container.value, "image", null)
# Type: string Optional
# Docker image name. More info: http://kubernetes.io/docs/user-guide/images
image_pull_policy = lookup(container.value, "imagePullPolicy", null)
# Type: string Optional Computed
# Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/images#updating-images
name = lookup(container.value, "name", null)
# Type: string Required
# Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.
stdin = lookup(container.value, "stdin", null)
# Type: bool Optional
# Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF.
stdin_once = lookup(container.value, "stdinOnce", null)
# Type: bool Optional
# Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF.
termination_message_path = lookup(container.value, "terminationMessagePath", null)
# Type: string Optional
# Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Defaults to /dev/termination-log. Cannot be updated.
termination_message_policy = lookup(container.value, "terminationMessagePolicy", null)
# Type: string Optional Computed
# Optional: Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.
tty = lookup(container.value, "tty", null)
# Type: bool Optional
# Whether this container should allocate a TTY for itself
working_dir = lookup(container.value, "workingDir", null)
# Type: string Optional
# 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.
dynamic "env" { # Nesting Mode: list
for_each = lookup(container.value, "env", {})
content {
name = lookup(env.value, "name", null)
# Type: string Required
# Name of the environment variable. Must be a C_IDENTIFIER
value = lookup(env.value, "value", null)
# Type: string Optional
# Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. 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). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to "".
dynamic "value_from" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(env.value), "valueFrom") ? {item = env.value["valueFrom"]} : {}
content {
dynamic "config_map_key_ref" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(value_from.value), "configMapKeyRef") ? {item = value_from.value["configMapKeyRef"]} : {}
content {
key = lookup(config_map_key_ref.value, "key", null)
# Type: string Optional
# The key to select.
name = lookup(config_map_key_ref.value, "name", null)
# Type: string Optional
# Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names
optional = lookup(config_map_key_ref.value, "optional", null)
# Type: bool Optional
# Specify whether the ConfigMap or its key must be defined.
}
}
dynamic "field_ref" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(value_from.value), "fieldRef") ? {item = value_from.value["fieldRef"]} : {}
content {
api_version = lookup(field_ref.value, "apiVersion", null)
# Type: string Optional
# Version of the schema the FieldPath is written in terms of, defaults to "v1".
field_path = lookup(field_ref.value, "fieldPath", null)
# Type: string Optional
# Path of the field to select in the specified API version
}
}
dynamic "resource_field_ref" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(value_from.value), "resourceFieldRef") ? {item = value_from.value["resourceFieldRef"]} : {}
content {
container_name = lookup(resource_field_ref.value, "containerName", null)
# Type: string Optional
resource = lookup(resource_field_ref.value, "resource", null)
# Type: string Required
# Resource to select
}
}
dynamic "secret_key_ref" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(value_from.value), "secretKeyRef") ? {item = value_from.value["secretKeyRef"]} : {}
content {
key = lookup(secret_key_ref.value, "key", null)
# Type: string Optional
# The key of the secret to select from. Must be a valid secret key.
name = lookup(secret_key_ref.value, "name", null)
# Type: string Optional
# Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names
optional = lookup(secret_key_ref.value, "optional", null)
# Type: bool Optional
# Specify whether the Secret or its key must be defined.
}
}
}
}
}
}
dynamic "env_from" { # Nesting Mode: list
for_each = lookup(container.value, "envFrom", {})
content {
prefix = lookup(env_from.value, "prefix", null)
# Type: string Optional
# An optional identifer to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.
dynamic "config_map_ref" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(env_from.value), "configMapRef") ? {item = env_from.value["configMapRef"]} : {}
content {
name = lookup(config_map_ref.value, "name", null)
# Type: string Required
# Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names
optional = lookup(config_map_ref.value, "optional", null)
# Type: bool Optional
# Specify whether the ConfigMap must be defined
}
}
dynamic "secret_ref" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(env_from.value), "secretRef") ? {item = env_from.value["secretRef"]} : {}
content {
name = lookup(secret_ref.value, "name", null)
# Type: string Required
# Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
optional = lookup(secret_ref.value, "optional", null)
# Type: bool Optional
# Specify whether the Secret must be defined
}
}
}
}
dynamic "lifecycle" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(container.value), "lifecycle") ? {item = container.value["lifecycle"]} : {}
content {
dynamic "post_start" { # Nesting Mode: list
for_each = lookup(lifecycle.value, "postStart", {})
content {
dynamic "exec" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(post_start.value), "exec") ? {item = post_start.value["exec"]} : {}
content {
command = lookup(exec.value, "command", null)
# Type: ['list', 'string'] Optional
# Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.
}
}
dynamic "http_get" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(post_start.value), "httpGet") ? {item = post_start.value["httpGet"]} : {}
content {
host = lookup(http_get.value, "host", null)
# Type: string Optional
# Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead.
path = lookup(http_get.value, "path", null)
# Type: string Optional
# Path to access on the HTTP server.
port = lookup(http_get.value, "port", null)
# Type: string Optional
# Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
scheme = lookup(http_get.value, "scheme", null)
# Type: string Optional
# Scheme to use for connecting to the host.
dynamic "http_header" { # Nesting Mode: list
for_each = lookup(http_get.value, "httpHeaders", {})
content {
name = lookup(http_header.value, "name", null)
# Type: string Optional
# The header field name
value = lookup(http_header.value, "value", null)
# Type: string Optional
# The header field value
}
}
}
}
dynamic "tcp_socket" { # Nesting Mode: list
for_each = lookup(post_start.value, "tcpSocket", {})
content {
port = lookup(tcp_socket.value, "port", null)
# Type: string Required
# Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
}
}
}
}
dynamic "pre_stop" { # Nesting Mode: list
for_each = lookup(lifecycle.value, "preStop", {})
content {
dynamic "exec" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(pre_stop.value), "exec") ? {item = pre_stop.value["exec"]} : {}
content {
command = lookup(exec.value, "command", null)
# Type: ['list', 'string'] Optional
# Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.
}
}
dynamic "http_get" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(pre_stop.value), "httpGet") ? {item = pre_stop.value["httpGet"]} : {}
content {
host = lookup(http_get.value, "host", null)
# Type: string Optional
# Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead.
path = lookup(http_get.value, "path", null)
# Type: string Optional
# Path to access on the HTTP server.
port = lookup(http_get.value, "port", null)
# Type: string Optional
# Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
scheme = lookup(http_get.value, "scheme", null)
# Type: string Optional
# Scheme to use for connecting to the host.
dynamic "http_header" { # Nesting Mode: list
for_each = lookup(http_get.value, "httpHeaders", {})
content {
name = lookup(http_header.value, "name", null)
# Type: string Optional
# The header field name
value = lookup(http_header.value, "value", null)
# Type: string Optional
# The header field value
}
}
}
}
dynamic "tcp_socket" { # Nesting Mode: list
for_each = lookup(pre_stop.value, "tcpSocket", {})
content {
port = lookup(tcp_socket.value, "port", null)
# Type: string Required
# Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
}
}
}
}
}
}
dynamic "liveness_probe" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(container.value), "livenessProbe") ? {item = container.value["livenessProbe"]} : {}
content {
failure_threshold = lookup(liveness_probe.value, "failureThreshold", null)
# Type: number Optional
# Minimum consecutive failures for the probe to be considered failed after having succeeded.
initial_delay_seconds = lookup(liveness_probe.value, "initialDelaySeconds", null)
# Type: number Optional
# Number of seconds after the container has started before liveness probes are initiated. More info: http://kubernetes.io/docs/user-guide/pod-states#container-probes
period_seconds = lookup(liveness_probe.value, "periodSeconds", null)
# Type: number Optional
# How often (in seconds) to perform the probe
success_threshold = lookup(liveness_probe.value, "successThreshold", null)
# Type: number Optional
# Minimum consecutive successes for the probe to be considered successful after having failed.
timeout_seconds = lookup(liveness_probe.value, "timeoutSeconds", null)
# Type: number Optional
# Number of seconds after which the probe times out. More info: http://kubernetes.io/docs/user-guide/pod-states#container-probes
dynamic "exec" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(liveness_probe.value), "exec") ? {item = liveness_probe.value["exec"]} : {}
content {
command = lookup(exec.value, "command", null)
# Type: ['list', 'string'] Optional
# Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.
}
}
dynamic "http_get" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(liveness_probe.value), "httpGet") ? {item = liveness_probe.value["httpGet"]} : {}
content {
host = lookup(http_get.value, "host", null)
# Type: string Optional
# Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead.
path = lookup(http_get.value, "path", null)
# Type: string Optional
# Path to access on the HTTP server.
port = lookup(http_get.value, "port", null)
# Type: string Optional
# Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
scheme = lookup(http_get.value, "scheme", null)
# Type: string Optional
# Scheme to use for connecting to the host.
dynamic "http_header" { # Nesting Mode: list
for_each = lookup(http_get.value, "httpHeaders", {})
content {
name = lookup(http_header.value, "name", null)
# Type: string Optional
# The header field name
value = lookup(http_header.value, "value", null)
# Type: string Optional
# The header field value
}
}
}
}
dynamic "tcp_socket" { # Nesting Mode: list
for_each = lookup(liveness_probe.value, "tcpSocket", {})
content {
port = lookup(tcp_socket.value, "port", null)
# Type: string Required
# Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
}
}
}
}
dynamic "port" { # Nesting Mode: list
for_each = lookup(container.value, "ports", {})
content {
container_port = lookup(port.value, "containerPort", null)
# Type: number Required
# Number of port to expose on the pod's IP address. This must be a valid port number, 0 < x < 65536.
host_ip = lookup(port.value, "hostIP", null)
# Type: string Optional
# What host IP to bind the external port to.
host_port = lookup(port.value, "hostPort", null)
# Type: number Optional
# Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.
name = lookup(port.value, "name", null)
# Type: string Optional
# If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services
protocol = lookup(port.value, "protocol", null)
# Type: string Optional
# Protocol for port. Must be UDP or TCP. Defaults to "TCP".
}
}
dynamic "readiness_probe" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(container.value), "readinessProbe") ? {item = container.value["readinessProbe"]} : {}
content {
failure_threshold = lookup(readiness_probe.value, "failureThreshold", null)
# Type: number Optional
# Minimum consecutive failures for the probe to be considered failed after having succeeded.
initial_delay_seconds = lookup(readiness_probe.value, "initialDelaySeconds", null)
# Type: number Optional
# Number of seconds after the container has started before liveness probes are initiated. More info: http://kubernetes.io/docs/user-guide/pod-states#container-probes
period_seconds = lookup(readiness_probe.value, "periodSeconds", null)
# Type: number Optional
# How often (in seconds) to perform the probe
success_threshold = lookup(readiness_probe.value, "successThreshold", null)
# Type: number Optional
# Minimum consecutive successes for the probe to be considered successful after having failed.
timeout_seconds = lookup(readiness_probe.value, "timeoutSeconds", null)
# Type: number Optional
# Number of seconds after which the probe times out. More info: http://kubernetes.io/docs/user-guide/pod-states#container-probes
dynamic "exec" { # Nesting Mode: list Max Items : 1
for_each = contains(keys(readiness_probe.value), "exec") ? {item = readiness_probe.value["exec"]} : {}
content {