info:To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Advanced Kubernetes resource management
There are special situations where the out-of-the-box resource ordering or configuration options are not good enough for a specific use case. The GitOps engine behind the GitLab agent for Kubernetes provides annotations in order to achieve:
-**Sorting**: adds optional resource sorting functionality to apply or delete objects in a particular order.
-**Apply Time Mutation**: adds optional functionality to dynamically substitute fields from one resource config into another.
While a [sane, default ordering](https://github.com/kubernetes-sigs/cli-utils/blob/d7d63f4b62897f584ca9e02b6faf4d2f327a9b09/pkg/ordering/sort.go#L74) is provided by the agent out of the box, annotations allow more fine-tuned ordering and even apply time value injection.
The GitLab agent for Kubernetes is based on the `cli-utils` library, a Kubernetes SIG project. You can read more about the `cli-utils` library and its advanced functions in [the project repository](https://github.com/kubernetes-sigs/cli-utils/). The following is based on the `cli-utils` documentation.
## Apply Sort Ordering
Adding an optional `config.kubernetes.io/depends-on: <OBJECT>` annotation to a
resource config provides apply ordering functionality. After manually specifying
the dependency relationship among applied resources with this annotation, the
library will sort the resources and apply/prune them in the correct order.
Importantly, the library will wait for an object to reconcile successfully within
the cluster before applying dependent resources. Prune (deletion) ordering is
the opposite of apply ordering.
In the following example, the `config.kubernetes.io/depends-on` annotation
identifies that `pod-c` must be successfully applied prior to `pod-a`