Skip to content

Commit

Permalink
patch(kustomization): add sortOptions field (#3890)
Browse files Browse the repository at this point in the history
* patch(kustomization): add sortOptions field

Docs: https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/sortoptions/

Closes #3825

* support legacySortOptions for all

* support legacySortOptions for legacy only
  • Loading branch information
thiagowfx authored Jun 26, 2024
1 parent 2fbdd07 commit 008b0f1
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/negative_test/kustomization/3825.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kind: Kustomization
sortOptions:
order: fifo
legacySortOptions:
orderFirst:
- Namespace
orderLast:
- Deployment
35 changes: 35 additions & 0 deletions src/schemas/json/kustomization.json
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,41 @@
},
"type": "array"
},
"sortOptions": {
"description": "sortOptions is used to sort the resources kustomize outputs",
"oneOf": [
{
"properties": {
"order": {
"enum": ["legacy"]
},
"legacySortOptions": {
"properties": {
"orderFirst": {
"type": "array"
},
"orderLast": {
"type": "array"
}
},
"additionalProperties": false,
"type": "object"
}
},
"additionalProperties": false,
"type": "object"
},
{
"properties": {
"order": {
"enum": ["fifo"]
}
},
"additionalProperties": false,
"type": "object"
}
]
},
"transformers": {
"description": "Transformers is a list of files containing transformers",
"items": {
Expand Down
8 changes: 8 additions & 0 deletions src/test/kustomization/3825.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kind: Kustomization
sortOptions:
order: legacy
legacySortOptions:
orderFirst:
- Namespace
orderLast:
- Deployment

0 comments on commit 008b0f1

Please sign in to comment.