@@ -14,12 +14,13 @@ namespaces are, and _why_ they behave the way they do.
14
14
* [ Parents, children, trees and forests] ( #basic-trees )
15
15
* [ Full namespaces and subnamespaces] ( #basic-subns )
16
16
* [ 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 )
18
18
* [ Exceptions and propagation control] ( #basic-exceptions )
19
19
* [ Administration] ( #admin )
20
20
* [ Hierarchical Configuration] ( #admin-hc )
21
21
* [ Namespaces administrators] ( #admin-admin )
22
22
* [ Conditions] ( #admin-conditions )
23
+ * [ Namespace label and annotation propagation] ( #admin-managed-labels )
23
24
* [ Labels and annotations read by HNC] ( #admin-labels-read )
24
25
* [ Labels and annotations set by HNC] ( #admin-labels-set )
25
26
@@ -291,7 +292,7 @@ following three labels applied to it:
291
292
* ` team-a.tree.hnc.x-k8s.io/depth: 1 `
292
293
* ` division-x.tree.hnc.x-k8s.io/depth: 2 `
293
294
294
- Due to their suffixes, these are known as ** _ tree labels _ ** .
295
+ Due to their suffixes, these are known as *** tree labels * ** .
295
296
296
297
Tree labels can be used in two ways. Firstly, any policy that uses namespace
297
298
label 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
314
315
these labels, so other applications can trust these labels for policy
315
316
application.
316
317
318
+ * Note: in HNC v1.0, [ managed labels] ( #admin-managed-labels ) may also be trusted
319
+ for policy purposes.*
320
+
317
321
<a name =" basic-exceptions " />
318
322
319
323
### Exceptions and propagation control
@@ -353,21 +357,12 @@ be replaced.
353
357
There are some built-in exceptions to prevent certain known (auto-generated)
354
358
objects from being propagated by HNC.
355
359
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 ) )
371
366
372
367
<a name =" admin " />
373
368
@@ -505,6 +500,40 @@ can either query such objects directly, or via `kubectl hns describe NAMESPACE`.
505
500
The event will include machine-readable and human-readable information about the
506
501
problem, and will generally require human intervention to resolve.
507
502
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
+
508
537
<a name =" admin-labels-read " >
509
538
510
539
### Labels and annotations read by HNC
@@ -514,8 +543,8 @@ objects, in addition to using the custom resources it defines.
514
543
515
544
#### propagate.hnc.x-k8s.io/TYPE (annotation on objects)
516
545
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 .
519
548
520
549
#### hnc.x-k8s.io/managed-by (annotation on namespaces)
521
550
@@ -567,6 +596,9 @@ HNC annotates and labels objects in several circumstances. Typically, most users
567
596
(or admins) will never need to care about these, but occasionally they may cause
568
597
some odd changes in behaviour that you need to be aware of.
569
598
599
+ See also [ managed labels and annotations] ( #admin-managed-labels ) , which are
600
+ defined by admins, not by HNC itself.
601
+
570
602
#### app.kubernetes.io/managed-by (label on objects)
571
603
572
604
HNC sets this label on any object that it propagates, taking the place of any
0 commit comments