kustomize build does not preserve filename lexical order

Created on 19 Oct 2018  路  4Comments  路  Source: kubernetes-sigs/kustomize

one of the kubectl features is to apply configurations sequentially following filename lexical order. This is useful for instance to create a namespace before applying the rest of the configuration. kustomize build breaks this feature as it generates a single specification.

One possible solution is to allow kustomize build -o directory/ && kubectl apply -f directory/. It's not as nice as piping the configuration but at least that would solve the problem stated above.

Most helpful comment

All other types, including CRD instances, are sorted according to their group, version, kind, name. In the output, they will be appended to the end of the resources in the predefined list.
This has been available since 1.0.7.

All 4 comments

kustomize build output has a predefined order to handle this concern. The output will follow this order

    "Namespace",
    "CustomResourceDefinition",
    "ServiceAccount",
    "Role",
    "ClusterRole",
    "RoleBinding",
    "ClusterRoleBinding",
    "ConfigMap",
    "Secret",
    "Service",
    "Deployment",
    "StatefulSet",
    "CronJob",
    "PodDisruptionBudget",

If it doesn't satisfy your usage, let us know which order is missing.

is this implemented in v1.0.8? That should work except for CRD instances (not mentioned in your list), as it takes some time for the CRDs to be online.

All other types, including CRD instances, are sorted according to their group, version, kind, name. In the output, they will be appended to the end of the resources in the predefined list.
This has been available since 1.0.7.

thanks for the explanation. It's working as expected after fixing a typo.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Liujingfang1 picture Liujingfang1  路  6Comments

davidsbond picture davidsbond  路  3Comments

karlmutch picture karlmutch  路  5Comments

pst picture pst  路  4Comments

bcbrockway picture bcbrockway  路  5Comments