Patch Your Kubernetes Deployment (Advanced)
Patch or Add resources using Kustomize
TrueFoundry allows you to tweak the most common parameters of the deployment through the service spec. However, there might be situations in which you might want to override some fields that are not exposed in the TrueFoundry Service spec. You can then use Kustomize to add, patch or delete the Kubernetes resources that TrueFoundry deploys on the cluster.
Kustomize enables you to
- Patch the rendered Kubernetes resources generated by the TrueFoundry Application. E.g. Adding extra annotations for Prometheus / Datadog
- Add extra Kubernetes resources along with your TrueFoundry Application. E.g. Adding extra ConfigMap, Secret, Istio VirtualService, etc
Supported Application Types
- Service
- Job
- Helm
Using Kustomize
You can add patches and resources using the kustomize
field of the spec
Resources are patched/added in the same namespace
Patches and new resources are applied to the same namespace as the application
Here is an example that
- Adds Prometheus scrape annotations to the pod spec patches in Kubernetes
Deployment
resource that will be generated for theService
. Here we use thepatch
section of thekustomize
because we only want to add extra annotations to an existing resource. - Adds a new complete ConfigMap resource. Here we use
additions
as we define the complete spec of the new resource.
Viewing Resources Generated by TrueFoundry
You can view all the resources rendered by the Application in the Application Spec
Tab and then selecting Applied K8s Manifest
Data Types
kustomize.patch
is an object. The most commonly used key under it ispatchesStrategicMerge
which is a list of strings. Each string member is a patch in YAML formatkustomize.additions
is a list of objects. Each object is a Kubernetes resource definition.
You can configure the same using the UI by enabling the Advanced Fields
and then enabling Kustomize