Context Resolution¶
How Hydra decides whether a directory is a group, context, cluster, root-app, or child-app.
Why This Matters¶
Most hydra local and hydra gitops commands start from HYDRA_CONTEXT or --hydra-context.
Hydra does not identify that directory by name alone. It resolves the hierarchy using global.hydra.type values from values.yaml files.
Type Inference¶
Allowed type values are:
groupcontextclusterroot-appchild-app
Hydra infers child levels automatically:
That means a parent directory can define the type for descendants.
Example:
If test/values.yaml contains:
then developer1/ resolves as a context automatically.
If you want developer1/ to define itself directly as the context instead, set this in developer1/values.yaml:
Recommended Pattern¶
For layouts like clusters/<group>/<context>/, prefer marking the parent as group:
Why this is recommended:
- It describes the hierarchy explicitly at the shared parent level.
- Every child directory under that parent can resolve consistently as a
context. - It avoids repeating
type: contextin every context directory.
Common Failure Case¶
Suppose you set:
and developer1/ contains in-cluster/ and values.yaml, but Hydra still rejects it.
The most common reasons are:
developer1/values.yamlexists, but noglobal.hydra.typecan be resolved tocontext.developer1/values.yamldeclares the wrong type, for examplecluster.developer1/values.yamlis missing, so Hydra cannot mark that directory ascontext.
In that situation, keep the chosen HYDRA_CONTEXT and fix the hierarchy markers instead.
Recommended fix:
- Set
global.hydra.type: groupin the parentvalues.yaml
Alternative fix:
- Set
global.hydra.type: contextin the selected context directory'svalues.yaml
Parent Lookup¶
Hydra looks upward through parent directories unless a level disables that:
This is true by default.
Special case:
groupdefaults toparent: falsewhenparentis omitted
That makes group a natural boundary for context resolution.