@@ -14,12 +14,13 @@ namespaces are, and _why_ they behave the way they do.
1414 * [ Parents, children, trees and forests] ( #basic-trees )
1515 * [ Full namespaces and subnamespaces] ( #basic-subns )
1616 * [ Policy inheritance and object propagation] ( #basic-propagation )
17- * [ Namespace labels and non-propagated policies] ( #basic-labels )
17+ * [ Tree labels and non-propagated policies] ( #basic-labels )
1818 * [ Exceptions and propagation control] ( #basic-exceptions )
1919* [ Administration] ( #admin )
2020 * [ Hierarchical Configuration] ( #admin-hc )
2121 * [ Namespaces administrators] ( #admin-admin )
2222 * [ Conditions] ( #admin-conditions )
23+ * [ Namespace label and annotation propagation] ( #admin-managed-labels )
2324 * [ Labels and annotations read by HNC] ( #admin-labels-read )
2425 * [ Labels and annotations set by HNC] ( #admin-labels-set )
2526
@@ -291,7 +292,7 @@ following three labels applied to it:
291292* ` team-a.tree.hnc.x-k8s.io/depth: 1 `
292293* ` division-x.tree.hnc.x-k8s.io/depth: 2 `
293294
294- Due to their suffixes, these are known as ** _ tree labels _ ** .
295+ Due to their suffixes, these are known as *** tree labels * ** .
295296
296297Tree labels can be used in two ways. Firstly, any policy that uses namespace
297298label selectors may use them directly - even if those policies are not
@@ -314,6 +315,9 @@ whichever labels they like. However, HNC will overwrite any changes made to
314315these labels, so other applications can trust these labels for policy
315316application.
316317
318+ * Note: in HNC v1.0, [ managed labels] ( #admin-managed-labels ) may also be trusted
319+ for policy purposes.*
320+
317321<a name =" basic-exceptions " />
318322
319323### Exceptions and propagation control
@@ -353,21 +357,12 @@ be replaced.
353357There are some built-in exceptions to prevent certain known (auto-generated)
354358objects from being propagated by HNC.
355359
356- If ConfigMaps propagation is enabled, any ConfigMaps named ` istio-ca-root-cert `
357- or ` kube-root-ca.crt ` will not be propagated. These are auto-created in new
358- namespaces by Istio and Kubernetes respectively. As they are auto-generated,
359- adding annotations is not possible and HNC will by default exclude them.
360-
361- Similarly, Kubernetes ServiceAccount Secrets will also by default be excluded
362- from propagation.
363-
364- In addition, propagation exclusions are also used for Rancher-managed Kubernetes
365- clusters. Rancher uses a "project" concept that bundles namespaces and thus sets
366- roles, rolebindings, etc. for all namespaces of a project. This leads to
367- conflicts with HNC, so all resources created by Rancher (which are automatically
368- labeled with ` "cattle.io/creator": "norman" ` by Rancher, cf. [ their
369- docs] ( https://rancher.com/docs/rancher/v2.6/en/system-tools/#remove ) ) are
370- excluded from propagation.
360+ * Kubernetes Service Account Secrets
361+ * ConfigMaps named ` istio-ca-root-cert ` or ` kube-root-ca.crt ` , which are
362+ auto-created in new namespaces by Istio and Kubernetes respectively
363+ * * Planned for HNC v1.0+:* Any objects with the label
364+ ` cattle.io/creator:norman ` , which are [ inserted by Rancher to support
365+ Projects] ( https://rancher.com/docs/rancher/v2.6/en/system-tools/#remove ) )
371366
372367<a name =" admin " />
373368
@@ -505,6 +500,40 @@ can either query such objects directly, or via `kubectl hns describe NAMESPACE`.
505500The event will include machine-readable and human-readable information about the
506501problem, and will generally require human intervention to resolve.
507502
503+ <a name =" admin-managed-labels " />
504+
505+ ### Managed labels and annotations
506+
507+ *** Managed labels and annotations are planned for HNC v1.0+***
508+
509+ Just as certain objects can be propagated from parent namespaces to their
510+ descendants, so can certain labels and annotations on namespaces. For example,
511+ an admin may define a ` mycorp.com/environment:prod ` label on a parent namespace,
512+ and ensure that it will be automatically propagated to all descendants of that
513+ namespace.
514+
515+ However, managed labels (and annotations - the remainder of this section applies
516+ to both) cannot be used simply by putting a label on a parent namespace, for
517+ several reasons:
518+
519+ * Users may not intend HNC to overwrite their existing labels simply because one
520+ of their ancestors has a conflicting label.
521+ * When a namespace's ancestors change, it's unclear which labels should be
522+ removed because they were propagated from an ancestor, and which were
523+ intended to be applied to the namespace itself.
524+
525+ Therefore, by default, HNC will _ not_ propagate any labels on namespaces; the
526+ HNC admin must define which labels are _ managed_ by modifying the command-line
527+ options of HNC and restarting HNC.
528+
529+ In addition, managed labels may _ never_ be set simply by adding them to a
530+ namespace, as it would be impossible to distinguish between a "source" label and
531+ a "propagated" label (unlike propagated objects, which are annotated by
532+ ` hnc.x-k8s.io/inherited-from ` ). Instead, they must be added in the
533+ ` HierarchyConfiguration ` object.
534+
535+ See [ here] ( how-to.md#admin-managed-labels ) for more details.
536+
508537<a name =" admin-labels-read " >
509538
510539### Labels and annotations read by HNC
@@ -514,8 +543,8 @@ objects, in addition to using the custom resources it defines.
514543
515544#### propagate.hnc.x-k8s.io/TYPE (annotation on objects)
516545
517- These annotations may be added to any namespaced object to define exceptions to
518- propagation rules. More information to come .
546+ These annotations may be added to any namespaced object to define
547+ [ exceptions ] ( #basic-exceptions ) to propagation rules .
519548
520549#### hnc.x-k8s.io/managed-by (annotation on namespaces)
521550
@@ -567,6 +596,9 @@ HNC annotates and labels objects in several circumstances. Typically, most users
567596(or admins) will never need to care about these, but occasionally they may cause
568597some odd changes in behaviour that you need to be aware of.
569598
599+ See also [ managed labels and annotations] ( #admin-managed-labels ) , which are
600+ defined by admins, not by HNC itself.
601+
570602#### app.kubernetes.io/managed-by (label on objects)
571603
572604HNC sets this label on any object that it propagates, taking the place of any
0 commit comments