Kustomize Patch

    1. +---------+---------------------------------------------------------------+-----------------------+----------+---------+
    2. | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
    3. +---------+---------------------------------------------------------------+-----------------------+----------+---------+
    4. | patches | a list of StrategicMerge or JSON6902 patch to selected target | [[]patches](#patches) | true | |
    5. +---------+---------------------------------------------------------------+-----------------------+----------+---------+
    6. ## patches
    7. +--------+---------------------------------------------------+-------------------+----------+---------+
    8. | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
    9. +--------+---------------------------------------------------+-------------------+----------+---------+
    10. | patch | Inline patch string, in yaml style | string | true | |
    11. | target | Specify the target the patch should be applied to | [target](#target) | true | |
    12. +--------+---------------------------------------------------+-------------------+----------+---------+
    13. ### target
    14. +--------------------+-------------+--------+----------+---------+
    15. | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
    16. +--------------------+-------------+--------+----------+---------+
    17. | name | | string | false | |
    18. | group | | string | false | |
    19. | version | | string | false | |
    20. | kind | | string | false | |
    21. | namespace | | string | false | |
    22. | annotationSelector | | string | false | |
    23. | labelSelector | | string | false | |
    24. +--------------------+-------------+--------+----------+---------+
    1. apiVersion: core.oam.dev/v1beta1
    2. kind: Application
    3. metadata:
    4. name: bucket-app
    5. spec:
    6. components:
    7. - name: bucket-comp
    8. type: kustomize
    9. # ... omitted for brevity
    10. traits:
    11. - type: kustomize-patch
    12. properties:
    13. patches:
    14. - patch: |-
    15. apiVersion: v1
    16. kind: Pod
    17. metadata:
    18. name: not-used
    19. labels:
    20. target:
    21. labelSelector: "app=podinfo"

    kustomize-json-patch Specification

    1. # Properties
    2. +-------------+---------------------------+-------------------------------+----------+---------+
    3. | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
    4. +-------------+---------------------------+-------------------------------+----------+---------+
    5. | patchesJson | A list of JSON6902 patch. | [[]patchesJson](#patchesJson) | true | |
    6. +-------------+---------------------------+-------------------------------+----------+---------+
    7. ## patchesJson
    8. +--------+-------------+-------------------+----------+---------+
    9. | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
    10. +--------+-------------+-------------------+----------+---------+
    11. | patch | | [patch](#patch) | true | |
    12. | target | | [target](#target) | true | |
    13. +--------+-------------+-------------------+----------+---------+
    14. #### target
    15. +--------------------+-------------+--------+----------+---------+
    16. | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
    17. +--------------------+-------------+--------+----------+---------+
    18. | name | | string | false | |
    19. | group | | string | false | |
    20. | version | | string | false | |
    21. | kind | | string | false | |
    22. | namespace | | string | false | |
    23. | annotationSelector | | string | false | |
    24. | labelSelector | | string | false | |
    25. +--------------------+-------------+--------+----------+---------+
    26. ### patch
    27. +-------+-------------+--------+----------+---------+
    28. | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
    29. +-------+-------------+--------+----------+---------+
    30. | path | | string | true | |
    31. | op | | string | true | |
    32. | value | | string | false | |
    33. +-------+-------------+--------+----------+---------+
    1. apiVersion: core.oam.dev/v1beta1
    2. kind: Application
    3. metadata:
    4. name: bucket-app
    5. components:
    6. - name: bucket-comp
    7. type: kustomize
    8. # ... omitted for brevity
    9. traits:
    10. - type: kustomize-json-patch
    11. properties:
    12. patchesJson:
    13. - target:
    14. version: v1
    15. kind: Deployment
    16. name: podinfo
    17. patch:
    18. - op: add
    19. path: /metadata/annotations/key
    20. value: value
    1. # Properties
    2. +-----------------------+-----------------------------------------------------------+---------------------------------------------------+----------+---------+
    3. | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
    4. +-----------------------+-----------------------------------------------------------+---------------------------------------------------+----------+---------+
    5. | patchesStrategicMerge | a list of strategicmerge, defined as inline yaml objects. | [[]patchesStrategicMerge](#patchesStrategicMerge) | true | |
    6. +-----------------------+-----------------------------------------------------------+---------------------------------------------------+----------+---------+
    7. ## patchesStrategicMerge
    8. +-----------+-------------+--------------------------------------------------------+----------+---------+
    9. | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
    10. +-----------+-------------+--------------------------------------------------------+----------+---------+
    11. | undefined | | map[string](null|bool|string|bytes|{...}|[...]|number) | true | |
    1. apiVersion: core.oam.dev/v1beta1
    2. kind: Application
    3. metadata:
    4. name: bucket-app
    5. spec:
    6. components:
    7. - name: bucket-comp
    8. type: kustomize
    9. # ... omitted for brevity
    10. traits:
    11. - type: kustomize-strategy-merge
    12. properties:
    13. patchesStrategicMerge:
    14. - apiVersion: apps/v1
    15. kind: Deployment
    16. metadata:
    17. name: podinfo
    18. spec:
    19. template:
    20. spec: