-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy path_kustomize
862 lines (824 loc) · 28.6 KB
/
_kustomize
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
#compdef kustomize
# -----------------------------------------------------------------------------
# The BSD-3-Clause License
#
# Copyright (c) 2018, Koichi Shiraishi
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of que nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
#
# sigs.k8s.io/kustomize
#
# -----------------------------------------------------------------------------
#
# Manages declarative configuration of Kubernetes.
# See https://sigs.k8s.io/kustomize
#
# Usage:
# kustomize [command]
#
# Available Commands:
# build Print configuration per contents of kustomization.yaml
# config Config Kustomize transformers
# create Create a new kustomization in the current directory
# edit Edits a kustomization file
# help Help about any command
# version Prints the kustomize version
#
# Flags:
# -h, --help help for kustomize
#
# Use "kustomize [command] --help" for more information about a command.
#
# -----------------------------------------------------------------------------
#
# Print configuration per contents of kustomization.yaml
#
# Usage:
# kustomize build {path} [flags]
# kustomize build [command]
#
# Examples:
#
# To generate the resources specified in 'someDir/kustomization.yaml', run
#
# kustomize build someDir
#
# The default argument to 'build' is '.' (the current working directory).
#
# The argument can be a URL resolving to a directory
# with a kustomization.yaml file, e.g.
#
# kustomize build \
# github.com/kubernetes-sigs/kustomize//examples/multibases/dev/?ref=v1.0.6
#
# The URL should be formulated as described at
# https://github.com/hashicorp/go-getter#url-format
#
#
# Available Commands:
# alpha-inventory Print the inventory object which contains a list of all other objects
#
# Flags:
# --enable_alpha_plugins enable plugins, an alpha feature.
# See https://github.com/kubernetes-sigs/kustomize/blob/master/docs/plugins.md
#
# -h, --help help for build
# --load_restrictor string if set to 'none', local kustomizations may load files from outside their root. This does, however, break the relocatability of the kustomization. (default "rootOnly")
# -o, --output string If specified, write the build output to this path.
# --reorder string Reorder the resources just before output. Use 'legacy' to apply a legacy reordering (Namespaces first, Webhooks last, etc). Use 'none' to suppress a final reordering. (default "legacy")
#
# Use "kustomize build [command] --help" for more information about a command.
#
# -----------------------------------------------------------------------------
#
# Print the inventory object which contains a list of all other objects
#
# Usage:
# kustomize build alpha-inventory [path] [flags]
#
# Examples:
#
# To generate the resources specified in 'someDir/kustomization.yaml', run
#
# kustomize build someDir
#
# The default argument to 'build' is '.' (the current working directory).
#
# The argument can be a URL resolving to a directory
# with a kustomization.yaml file, e.g.
#
# kustomize build \
# github.com/kubernetes-sigs/kustomize//examples/multibases/dev/?ref=v1.0.6
#
# The URL should be formulated as described at
# https://github.com/hashicorp/go-getter#url-format
#
#
# Flags:
# -h, --help help for alpha-inventory
#
# -----------------------------------------------------------------------------
# Config Kustomize transformers
#
# Usage:
# kustomize config [command]
#
# Examples:
#
# # Save the default transformer configurations to a local directory
# kustomize config save -d ~/.kustomize/config
#
#
# Available Commands:
# save Save default kustomize transformer configurations to a local directory
#
# Flags:
# -h, --help help for config
#
# Use "kustomize config [command] --help" for more information about a command.
#
# -----------------------------------------------------------------------------
#
# Save default kustomize transformer configurations to a local directory
#
# Usage:
# kustomize config save [flags]
#
# Examples:
#
# # Save the default transformer configurations to a local directory
# save -d ~/.kustomize/config
#
#
#
# Flags:
# -d, --directory string Directory to save the default transformer configurations
# -h, --help help for save
#
# -----------------------------------------------------------------------------
#
# Create a new kustomization in the current directory
#
# Usage:
# kustomize create [flags]
#
# Examples:
#
# # Create a new overlay from the base '../base".
# kustomize create --resources ../base
#
# # Create a new kustomization detecting resources in the current directory.
# kustomize create --autodetect
#
# # Create a new kustomization with multiple resources and fields set.
# kustomize create --resources deployment.yaml,service.yaml,../base --namespace staging --nameprefix acme-
#
#
# Flags:
# --annotations string Add one or more common annotations.
# --autodetect Search for kubernetes resources in the current directory to be added to the kustomization file.
# -h, --help help for create
# --labels string Add one or more common labels.
# --nameprefix string Sets the value of the namePrefix field in the kustomization file.
# --namespace string Set the value of the namespace field in the customization file.
# --namesuffix string Sets the value of the nameSuffix field in the kustomization file.
# --recursive Enable recursive directory searching for resource auto-detection.
# --resources string Name of a file containing a file to add to the kustomization file.
#
# -----------------------------------------------------------------------------
#
# Edits a kustomization file
#
# Usage:
# kustomize edit [command]
#
# Examples:
#
# # Adds a configmap to the kustomization file
# kustomize edit add configmap NAME --from-literal=k=v
#
# # Sets the nameprefix field
# kustomize edit set nameprefix <prefix-value>
#
# # Sets the namesuffix field
# kustomize edit set namesuffix <suffix-value>
#
#
# Available Commands:
# add Adds an item to the kustomization file.
# fix Fix the missing fields in kustomization file
# remove Removes items from the kustomization file.
# set Sets the value of different fields in kustomization file.
#
# Flags:
# -h, --help help for edit
#
# Use "kustomize edit [command] --help" for more information about a command.
#
# -----------------------------------------------------------------------------
#
# Adds an item to the kustomization file.
#
# Usage:
# kustomize edit add [command]
#
# Examples:
#
# # Adds a secret to the kustomization file
# kustomize edit add secret NAME --from-literal=k=v
#
# # Adds a configmap to the kustomization file
# kustomize edit add configmap NAME --from-literal=k=v
#
# # Adds a resource to the kustomization
# kustomize edit add resource <filepath>
#
# # Adds a patch to the kustomization
# kustomize edit add patch <filepath>
#
# # Adds one or more base directories to the kustomization
# kustomize edit add base <filepath>
# kustomize edit add base <filepath1>,<filepath2>,<filepath3>
#
# # Adds one or more commonLabels to the kustomization
# kustomize edit add label {labelKey1:labelValue1},{labelKey2:labelValue2}
#
# # Adds one or more commonAnnotations to the kustomization
# kustomize edit add annotation {annotationKey1:annotationValue1},{annotationKey2:annotationValue2}
#
#
# Available Commands:
# annotation Adds one or more commonAnnotations to kustomization.yaml
# base Adds one or more bases to the kustomization.yaml in current directory
# configmap Adds a configmap to the kustomization file.
# label Adds one or more commonLabels to kustomization.yaml
# patch Add the name of a file containing a patch to the kustomization file.
# resource Add the name of a file containing a resource to the kustomization file.
# secret Adds a secret to the kustomization file.
#
# Flags:
# -h, --help help for add
#
# Use "kustomize edit add [command] --help" for more information about a command.
#
# -----------------------------------------------------------------------------
#
# Adds one or more commonAnnotations to kustomization.yaml
#
# Usage:
# kustomize edit add annotation [flags]
#
# Examples:
#
# add annotation {annotationKey1:annotationValue1},{annotationKey2:annotationValue2}
#
# Flags:
# -f, --force overwrite commonAnnotation if it already exists
# -h, --help help for annotation
#
# -----------------------------------------------------------------------------
#
# Adds one or more bases to the kustomization.yaml in current directory
#
# Usage:
# kustomize edit add base [flags]
#
# Examples:
#
# add base {filepath1},{filepath2}
#
# Flags:
# -h, --help help for base
#
# -----------------------------------------------------------------------------
#
# Adds a configmap to the kustomization file.
#
# Usage:
# kustomize edit add configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [flags]
#
# Examples:
#
# # Adds a configmap to the kustomization file (with a specified key)
# kustomize edit add configmap my-configmap --from-file=my-key=file/path --from-literal=my-literal=12345
#
# # Adds a configmap to the kustomization file (key is the filename)
# kustomize edit add configmap my-configmap --from-file=file/path
#
# # Adds a configmap from env-file
# kustomize edit add configmap my-configmap --from-env-file=env/path.env
#
#
# Flags:
# --from-env-file string Specify the path to a file to read lines of key=val pairs to create a configmap (i.e. a Docker .env file).
# --from-file strings Key file can be specified using its file path, in which case file basename will be used as configmap key, or optionally with a key and file path, in which case the given key will be used. Specifying a directory will iterate each named file in the directory whose basename is a valid configmap key.
# --from-literal stringArray Specify a key and literal value to insert in configmap (i.e. mykey=somevalue)
# -h, --help help for configmap
#
# -----------------------------------------------------------------------------
#
# Adds one or more commonLabels to kustomization.yaml
#
# Usage:
# kustomize edit add label [flags]
#
# Examples:
#
# add label {labelKey1:labelValue1},{labelKey2:labelValue2}
#
# Flags:
# -f, --force overwrite commonLabel if it already exists
# -h, --help help for label
#
# -----------------------------------------------------------------------------
#
# Add the name of a file containing a patch to the kustomization file.
#
# Usage:
# kustomize edit add patch [flags]
#
# Examples:
#
# add patch {filepath}
#
# Flags:
# -h, --help help for patch
#
# -----------------------------------------------------------------------------
#
# Add the name of a file containing a resource to the kustomization file.
#
# Usage:
# kustomize edit add resource [flags]
#
# Examples:
#
# add resource {filepath}
#
# Flags:
# -h, --help help for resource
#
# -----------------------------------------------------------------------------
# Adds a secret to the kustomization file.
#
# Usage:
# kustomize edit add secret NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--type=Opaque|kubernetes.io/tls] [flags]
#
# Examples:
#
# # Adds a secret to the kustomization file (with a specified key)
# kustomize edit add secret my-secret --from-file=my-key=file/path --from-literal=my-literal=12345
#
# # Adds a secret to the kustomization file (key is the filename)
# kustomize edit add secret my-secret --from-file=file/path
#
# # Adds a secret from env-file
# kustomize edit add secret my-secret --from-env-file=env/path.env
#
#
# Flags:
# --from-env-file string Specify the path to a file to read lines of key=val pairs to create a secret (i.e. a Docker .env file).
# --from-file strings Key file can be specified using its file path, in which case file basename will be used as secret key, or optionally with a key and file path, in which case the given key will be used. Specifying a directory will iterate each named file in the directory whose basename is a valid secret key.
# --from-literal stringArray Specify a key and literal value to insert in secret (i.e. mykey=somevalue)
# -h, --help help for secret
# --type string Specify the secret type this can be 'Opaque' (default), or 'kubernetes.io/tls' (default "Opaque")
#
# -----------------------------------------------------------------------------
#
# Fix the missing fields in kustomization file
#
# Usage:
# kustomize edit fix [flags]
#
# Examples:
#
# # Fix the missing and deprecated fields in kustomization file
# kustomize edit fix
#
#
#
# Flags:
# -h, --help help for fix
#
# -----------------------------------------------------------------------------
#
# Removes items from the kustomization file.
#
# Usage:
# kustomize edit remove [command]
#
# Examples:
#
# # Removes resources from the kustomization file
# kustomize edit remove resource {filepath} {filepath}
# kustomize edit remove resource {pattern}
#
# # Removes one or more patches from the kustomization file
# kustomize edit remove patch <filepath>
#
# # Removes one or more commonLabels from the kustomization file
# kustomize edit remove label {labelKey1},{labelKey2}
#
# # Removes one or more commonAnnotations from the kustomization file
# kustomize edit remove annotation {annotationKey1},{annotationKey2}
#
#
# Available Commands:
# annotation Removes one or more commonAnnotations from kustomization.yaml
# label Removes one or more commonLabels from kustomization.yaml
# patch Removes one or more patches from kustomization.yaml
# resource Removes one or more resource file paths from kustomization.yaml
#
# Flags:
# -h, --help help for remove
#
# Use "kustomize edit remove [command] --help" for more information about a command.
#
# -----------------------------------------------------------------------------
#
# Sets the value of different fields in kustomization file.
#
# Usage:
# kustomize edit set [command]
#
# Examples:
#
# # Sets the nameprefix field
# kustomize edit set nameprefix <prefix-value>
#
# # Sets the namesuffix field
# kustomize edit set namesuffix <suffix-value>
#
#
# Available Commands:
# image Sets images and their new names, new tags or digests in the kustomization file
# nameprefix Sets the value of the namePrefix field in the kustomization file.
# namespace Sets the value of the namespace field in the kustomization file
# namesuffix Sets the value of the nameSuffix field in the kustomization file.
#
# Flags:
# -h, --help help for set
#
# Use "kustomize edit set [command] --help" for more information about a command.
#
# -----------------------------------------------------------------------------
#
# Sets images and their new names, new tags or digests in the kustomization file
#
# Usage:
# kustomize edit set image [flags]
#
# Examples:
#
# The command
# set image postgres=eu.gcr.io/my-project/postgres:latest my-app=my-registry/my-app@sha256:24a0c4b4a4c0eb97a1aabb8e29f18e917d05abfe1b7a7c07857230879ce7d3d3
# will add
#
# images:
# - name: postgres
# newName: eu.gcr.io/my-project/postgres
# newTag: latest
# - digest: sha256:24a0c4b4a4c0eb97a1aabb8e29f18e917d05abfe1b7a7c07857230879ce7d3d3
# name: my-app
# newName: my-registry/my-app
#
# to the kustomization file if it doesn't exist,
# and overwrite the previous ones if the image name exists.
#
# The command
# set image node:8.15.0 mysql=mariadb alpine@sha256:24a0c4b4a4c0eb97a1aabb8e29f18e917d05abfe1b7a7c07857230879ce7d3d3
# will add
#
# images:
# - name: node
# newTag: 8.15.0
# - name: mysql
# newName: mariadb
# - digest: sha256:24a0c4b4a4c0eb97a1aabb8e29f18e917d05abfe1b7a7c07857230879ce7d3d3
# name: alpine
#
# to the kustomization file if it doesn't exist,
# and overwrite the previous ones if the image name exists.
#
#
# Flags:
# -h, --help help for image
#
# -----------------------------------------------------------------------------
#
# Sets the value of the namePrefix field in the kustomization file.
#
# Usage:
# kustomize edit set nameprefix [flags]
#
# Examples:
#
# The command
# set nameprefix acme-
# will add the field "namePrefix: acme-" to the kustomization file if it doesn't exist,
# and overwrite the value with "acme-" if the field does exist.
#
#
# Flags:
# -h, --help help for nameprefix
#
# -----------------------------------------------------------------------------
#
# Sets the value of the namespace field in the kustomization file
#
# Usage:
# kustomize edit set namespace [flags]
#
# Examples:
#
# The command
# set namespace staging
# will add the field "namespace: staging" to the kustomization file if it doesn't exist,
# and overwrite the value with "staging" if the field does exist.
#
#
# Flags:
# -h, --help help for namespace
#
# -----------------------------------------------------------------------------
#
# Sets the value of the nameSuffix field in the kustomization file.
#
# Usage:
# kustomize edit set namesuffix [flags]
#
# Examples:
#
# The command
# set namesuffix -- -acme
# will add the field "nameSuffix: -acme" to the kustomization file if it doesn't exist,
# and overwrite the value with "-acme" if the field does exist.
#
#
# Flags:
# -h, --help help for namesuffix
#
# -----------------------------------------------------------------------------
#
# Help provides help for any command in the application.
# Simply type kustomize help [path to command] for full details.
#
# Usage:
# kustomize help [command] [flags]
#
# Flags:
# -h, --help help for help
#
# -----------------------------------------------------------------------------
#
# Prints the kustomize version
#
# Usage:
# kustomize version [flags]
#
# Examples:
# kustomize version
#
# Flags:
# -h, --help help for version
# --short print just the version number
#
# -----------------------------------------------------------------------------
function _kustomize() {
local context curcontext=$curcontext state line ret=1
declare -A opt_args
_go_packages() {
local -a gopaths
gopaths=("${(s/:/)$(go env GOPATH)}")
gopaths+=("$(go env GOROOT)")
for p in $gopaths; do
_alternative ':go packages:_path_files -W "$p/src" -/'
done
}
local -a commands
commands=(
'build:Print configuration per contents of kustomization.yaml'
'config:Config Kustomize transformers'
'create:Create a new kustomization in the current directory'
'edit:Edits a kustomization file'
'help:Help about any command'
'version:Prints the kustomize version'
)
_arguments -C \
"1: :{_describe 'kustomize command' commands}" \
'*:: :->args' \
&& ret=0
case $words[1] in
build)
local -a build_cmds
build_cmds=(
'alpha-inventory:Print the inventory object which contains a list of all other objects'
)
_arguments \
'--enable_alpha_plugins[enable plugins, an alpha feature.]' \
"--load_restrictor[if set to 'none', local kustomizations may load files from outside their root.]:load restrictor:(none rootOnly)" \
{-o,--output}'[If specified, write the build output to this path.]:output path:_files' \
"--reorder[Reorder the resources just before output. Use 'legacy' to apply a legacy reordering]:reorder type:(namespaces webhooks none legacy)" \
{-h,--help}'[help for kustomize]' \
'*:path:_files'
# TODO(zchee): add alpha-inventory after the stable
# "1: :{_describe 'build command' build_cmds}" \
# '*:: :->args'
#
# case $words[1] in
# *)
# _arguments '*:file:_files'
# ;;
#
# alpha-inventory)
# _arguments \
# '*:path:_files'
# ;;
# esac
;;
config)
local -a config_cmds
config_cmds=(
'save:Save default kustomize transformer configurations to a local directory'
)
_arguments \
{-h,--help}'[help for kustomize]' \
"1: :{_describe 'kustomize config command' config_cmds}" \
'*:: :->args'
case $words[1] in
save)
_arguments \
{-h,--help}'[help for kustomize]' \
{-d,--directory}'[Directory to save the default transformer configurations]:directory:_directories'
;;
esac
;;
create)
_arguments \
{-h,--help}'[help for kustomize]' \
'--annotations[Add one or more common annotations.]:annotationss' \
'--autodetect[Search for kubernetes resources in the current directory to be added to the kustomization file.]' \
'--labels[Add one or more common labels.]:labels' \
'--nameprefix[Sets the value of the namePrefix field in the kustomization file.]:prefix name' \
'--namespace[Set the value of the namespace field in the customization file.]:namespace' \
'--namesuffix[Sets the value of the nameSuffix field in the kustomization file.]:suffix name' \
'--recursive[Enable recursive directory searching for resource auto-detection.]' \
'--resources[Name of a file containing a file to add to the kustomization file.]:resources file:_files'
;;
edit)
local -a edit_cmds
edit_cmds=(
'add:Adds an item to the kustomization file.'
'fix:Fix the missing fields in kustomization file'
'remove:Removes items from the kustomization file.'
'set:Sets the value of different fields in kustomization file.'
)
_arguments \
{-h,--help}'[help for kustomize]' \
"1: :{_describe 'kustomize edit command' edit_cmds}" \
'*:: :->args'
case $words[1] in
add)
local -a edit_add_cmds
edit_add_cmds=(
'annotation:Adds one or more commonAnnotations to kustomization.yaml'
'base:Adds one or more bases to the kustomization.yaml in current directory'
'configmap:Adds a configmap to the kustomization file.'
'label:Adds one or more commonLabels to kustomization.yaml'
'patch:Add the name of a file containing a patch to the kustomization file.'
'resource:Add the name of a file containing a resource to the kustomization file.'
'secret:Adds a secret to the kustomization file.'
)
_arguments \
{-h,--help}'[help for kustomize]' \
"1: :{_describe 'kustomize edit add commands' edit_add_cmds}" \
'*:: :->args'
case $words[1] in
annotation)
_arguments \
{-h,--help}'[help for kustomize]' \
{-f,--force}'[overwrite commonAnnotation if it already exists]' \
'*:annotations'
;;
base)
_arguments \
{-h,--help}'[help for kustomize]' \
'*:filepath:_files'
;;
configmap)
_arguments \
'--from-env-file[Specify the path to a file to read lines of key=val pairs to create a configmap]:env file:_files' \
'--from-file[Key file can be specified using its file path, in which case file basename will be used as configmap key, or optionally with a key and file path, in which case the given key will be used.]:key file:_files' \
'--from-literal[Specify a key and literal value to insert in configmap]:key and literal' \
;;
label)
_arguments \
{-h,--help}'[help for kustomize]' \
{-f,--force}'[overwrite commonAnnotation if it already exists]' \
'*:label'
;;
(patch|resource)
_arguments \
{-h,--help}'[help for kustomize]' \
'*:filepath:_files'
;;
secret)
_arguments \
{-h,--help}'[help for kustomize]' \
'--from-env-file[Specify the path to a file to read lines of key=val pairs to create a secret]:env file:_files' \
'--from-file[Key file can be specified using its file path, in which case file basename will be used as secret key, or optionally with a key and file path, in which case the given key will be used.]:key file:_files' \
'--from-literal[Specify a key and literal value to insert in secret]:key and literal' \
'--type[Specify the secret type]:secret type:(Opaque kubernetes.io/tls)' \
'*:secret name'
;;
esac
;;
fix)
_arguments \
{-h,--help}'[help for kustomize]'
;;
remove)
local -a edit_remove_cmds
edit_remove_cmds=(
'annotation:Removes one or more commonAnnotations from kustomization.yaml'
'label:Removes one or more commonLabels from kustomization.yaml'
'patch:Removes one or more patches from kustomization.yaml'
'resource:Removes one or more resource file paths from kustomization.yaml'
)
_arguments \
{-h,--help}'[help for kustomize]' \
"1: :{_describe 'kustomize remove commands' edit_remove_cmds}" \
'*:: :->args'
case $words[1] in
annotation)
_arguments \
{-h,--help}'[help for kustomize]' \
{-f,--force}'[overwrite commonAnnotation if it already exists]' \
'*:annotations'
;;
label)
_arguments \
{-h,--help}'[help for kustomize]' \
{-f,--force}'[overwrite commonAnnotation if it already exists]' \
'*:label'
;;
(patch|resource)
_arguments \
{-h,--help}'[help for kustomize]' \
'*:filepath:_files'
;;
esac
;;
set)
local -a edit_set_cmds
edit_set_cmds=(
'image:Sets images and their new names, new tags or digests in the kustomization file'
'nameprefix:Sets the value of the namePrefix field in the kustomization file.'
'namespace:Sets the value of the namespace field in the kustomization file'
'namesuffix:Sets the value of the nameSuffix field in the kustomization file.'
)
_arguments \
{-h,--help}'[help for kustomize]' \
"1: :{_describe 'kustomize edit set commands' edit_set_cmds}" \
'*:: :->args'
case $words[1] in
image)
;;
nameprefix)
_arguments \
{-h,--help}'[help for kustomize]' \
'1:prefix name'
;;
namespace)
_arguments \
{-h,--help}'[help for kustomize]' \
'1:namespace name'
;;
namesuffix)
_arguments \
{-h,--help}'[help for kustomize]' \
'1:suffix name'
;;
esac
;;
esac
;;
help)
_arguments \
"1: :{_describe 'command' commands}"
;;
version)
_arguments \
'--short[print just the version number]'
;;
esac
return ret
}
_kustomize "$*"
# vim:ft=zsh:et:sts=2:sw=2