The way cue handles exports using -e flag to just give output of specific element, cuestomize should also provide a way to filter out resources from the final output.
Use case
Suppose we have 1 resource that needs to be created beforehand as part of bootstrap. Then we can apply other resources on the cluster.
outputs dumps all the resources in 1 single file by default.
Currently, the way to do using cuestomize are the following
yq split and search and write our own custom logic for that filtering
slice all the resources in a folder and again write logic to filter out specific resources
- Have multiple modules exported separately based on the usecase. (I think this adds additional files but cleaner than above 2).
Suppose we have main.cue as follows
...
outputs: {
cm: #ConfigMap
deployment: #Deployment
....
}
...
I can simply do this via vanilla cue cli
cue export -e outputs.cm --out yaml
cue export -e outputs.deployment--out yaml
Similar thing is not possible currently here.
Proposals
I propose 2 types of solutions. Both has pros and cons. But it makes filtering easier.
- Output multiple outputs as keys than can be used to filter out on client side.
Example:
outputs: {
controllerResources: {
cm: #ConfigMap
deployment: #Deployment
}
baseResources: {
sa: #SA
role: #Role
}
}
This can be further refined if accepted.
2. Similar to includes feature, we also have filter spec than can filter out fields to give final output.
Example:
apiVersion: cuestomize.dev/v1alpha1
kind: Cuestomization
...
filter:
- group: apps
version: v1
kind: Deployment
name: manager
namespace: default
This will only give deployment spec with that filter match. This will be client side filtering.
The way
cuehandles exports using-eflag to just give output of specific element,cuestomizeshould also provide a way to filter out resources from the final output.Use case
Suppose we have 1 resource that needs to be created beforehand as part of bootstrap. Then we can apply other resources on the cluster.
outputsdumps all the resources in 1 single file by default.Currently, the way to do using
cuestomizeare the followingyqsplit and search and write our own custom logic for that filteringsliceall the resources in a folder and again write logic to filter out specific resourcesSuppose we have
main.cueas followsI can simply do this via vanilla
cuecliSimilar thing is not possible currently here.
Proposals
I propose 2 types of solutions. Both has pros and cons. But it makes filtering easier.
Example:
This can be further refined if accepted.
2. Similar to
includesfeature, we also havefilterspec than can filter out fields to give final output.Example:
This will only give
deploymentspec with that filter match. This will be client side filtering.