A hierarchy repository is an Anthos Config Management (ACM) policy repository whose directories organize Kubernetes objects by purpose and scope. Hierarchy is the default policy-directory format; unstructured is the other supported format. The ACM operator examines the objects and applies the appropriate ones to connected clusters. The format is set with `spec.sourceFormat` in the operator configuration. section 11.2.1
Four top-level directories divide the policy directory:
- `system` holds repository configuration, such as the deployed configuration version. section 11.2.1
- `clusterregistry` holds Cluster definitions and ClusterSelectors for selecting subsets of clusters. section 11.2.1
- `cluster` holds cluster-wide objects other than namespaces. section 11.2.1
- `namespaces` holds namespace-scoped objects, Namespace definitions and NamespaceSelectors. section 11.2.1
Within `namespaces`, an abstract namespace groups actual namespaces that should share objects. An object placed in an abstract namespace is copied to its descendants; nested abstract namespaces provide additional layers. A NamespaceSelector can narrow that inheritance—for example, applying a shared ConfigMap only to namespaces labeled for finance applications. section 11.2.1
Cloud and data-center policy layout
A deployment spanning GKE on GCP and GKE on VMware can define both clusters and their selectors in `clusterregistry`, place ClusterRoles and Policy Controller constraints in `cluster`, and organize application namespaces beneath `namespaces`. A cloud ClusterSelector restricts a cloud database configuration to the cloud cluster. Hierarchy Controller can separately propagate Secrets and ConfigMaps from a central namespace, allowing those Secrets to be applied there without checking them into Git. Database replication itself requires separate configuration. section 11.3.2
<Git Repo Parent>
├── bin
└── policy_directory
├── namespaces
│ ├── rbac.yaml
│ ├── central
│ │ ├── namespace.yaml
│ │ └── database_location_config.yaml
│ ├── applications
│ │ ├── service_account.yaml
│ │ ├── website
│ │ │ ├── namespace.yaml
│ │ │ ├── hierarchy.yaml
│ │ │ └── repo-sync.yaml
│ │ └── inventory
│ │ ├── namespace.yaml
│ │ ├── hierarchy.yaml
│ │ └── repo-sync.yaml
│ └── village-linen-ac15e6
│ ├── namespace.yaml
│ ├── hierarchy.yaml
│ └── repo-sync.yaml
├── cluster
│ ├── rbac.yaml
│ ├── hierarchy.yaml
│ └── constraints.yaml
├── clusterregistry
│ ├── data center.yaml
│ ├── cloud.yaml
│ └── selectors.yaml
└── system
└── repo.yaml
The repository tree shows the four directories alongside central, application and project namespace configurations. section 11.3.2
With multiple repositories, one root repository may use hierarchy or unstructured format; each additional repository configures objects in a single namespace. Keep that distinction in mind when dividing policy ownership across repositories. section 11.2.1
