@@ -405,34 +405,52 @@ EOF
405405
406406<a name =" use-managed-labels " />
407407
408- ### Add a label or annotation to all namespaces in a subtree
408+ ### (Beta) Add a label or annotation to all namespaces in a subtree
409409
410- *** Managed labels and annotations are planned for HNC v1.0+ ***
410+ *** Managed labels and annotations are new in HNC v1.0; please use with caution. ***
411411
412412If your administrator has [ created managed labels or
413- annotations] ( #admin-managed-labels ) , you may set them on any namespace where you
414- have permission to edit the ` hierarchyconfigurations/hierarchy ` object. For
415- example, if your admin has set ` env ` as a managed label, you may set it on your
416- namespace as follows:
413+ annotations] ( #admin-managed-labels ) , you may set them on any _ full _ namespace
414+ where you have permission to edit the ` hierarchyconfigurations/hierarchy `
415+ object. For example, if your admin has set ` env ` as a managed label, you may set
416+ it on your namespace as follows:
417417
418418```
419419apiVersion: hnc.x-k8s.io/v1alpha2
420420kind: HierarchyConfiguration
421421metadata:
422422 name: hierarchy
423423 namespace: child
424- … < other stuff > …
424+ ... < other stuff > ...
425425spec:
426426 labels: # add
427427 - key: env # add
428428 value: prod # add
429429```
430430
431- You may similarly set managed annotations via the ` .spec.annotations ` list. Note
432- that any label or annotation that conflicts with one set in an ancestor
433- namespace will be silently ignored (this will eventually
431+ You may similarly set managed annotations via the ` .spec.annotations ` list.
432+
433+ For subnamespaces, you must set managed labels/annotations on the anchor in the
434+ parent namespace; any changes you make to the ` HierarchyConfiguration ` will be
435+ ignored and overwritten. The format on the anchors is the same as on the config:
436+
437+ ```
438+ apiVersion: hnc.x-k8s.io/v1alpha2
439+ kind: SubnamespaceAnchor
440+ metadata:
441+ name: subns-name
442+ namespace: subns-parent
443+ ... < other stuff > ...
444+ spec:
445+ labels: # add
446+ - key: env # add
447+ value: prod # add
448+ ```
449+
450+ Note that any label or annotation that conflicts with one set in an ancestor
451+ namespace will be silently ignored. This will eventually
434452[ be] ( https://github.com/kubernetes-sigs/hierarchical-namespaces/issues/143 )
435- [ improved] ( https://github.com/kubernetes-sigs/hierarchical-namespaces/issues/144 ) ) .
453+ [ improved] ( https://github.com/kubernetes-sigs/hierarchical-namespaces/issues/144 ) .
436454
437455<a name =" admin " />
438456
@@ -448,24 +466,14 @@ and webhooks) that were only introduced in v1.16.
448466There is no need to uninstall HNC before upgrading it unless specified in the
449467release notes for that version.
450468
469+ _ Note: HNC has ** experimental** support for HA deployments in v1.0. Please
470+ contact us on Slack to discuss if you want to try it out._
471+
451472#### Prerequisites
452473
453474Ensure ` kube-system ` , ` kube-public ` and ` kube-node-lease ` namespaces are listed
454475in the [ argument list] ( #admin-cli-args ) with the option ` --excluded-namespace ` .
455476
456- ** In HNC v0.8 (not applicable in HNC v0.9 and later)** , prior to installing HNC,
457- add the ` hnc.x-k8s.io/excluded-namespaces ` label to your critical system
458- namespaces:
459-
460- ```
461- kubectl label ns kube-system hnc.x-k8s.io/excluded-namespace=true
462- kubectl label ns kube-public hnc.x-k8s.io/excluded-namespace=true
463- kubectl label ns kube-node-lease hnc.x-k8s.io/excluded-namespace=true
464- ```
465-
466- Failure to do so may result in HNC being unable to start, and your cluster's
467- operations being degraded until you delete HNC or apply the labels.
468-
469477If you wish, you may also [ exclude additional namespaces from
470478HNC] ( #admin-excluded-namespaces ) , but be aware that only the three namespaces
471479listed above can be excluded _ by default_ .
@@ -505,7 +513,7 @@ make deploy
505513To temporarily disable HNC, simply delete its deployment and webhooks:
506514
507515``` bash
508- kubectl -n hnc-system delete deployment hnc-controller-manager
516+ kubectl -n hnc-system delete deployment --all
509517kubectl delete validatingwebhookconfiguration.admissionregistration.k8s.io hnc-validating-webhook-configuration
510518```
511519
@@ -534,16 +542,16 @@ relationships and configuration settings:
534542# the finalizers first.
535543kubectl get crds | grep .hnc.x-k8s.io | awk ' {print $1}' | xargs kubectl delete crd
536544
537- # Delete the rest of HNC.
545+ # Delete the rest of HNC. For HNC v1.0 and later:
546+ kubectl delete -f https://github.com/kubernetes-sigs/hierarchical-namespaces/releases/download/hnc-${HNC_VERSION} /default.yaml
547+ # For versions earlier than HNC v1.0:
538548kubectl delete -f https://github.com/kubernetes-sigs/hierarchical-namespaces/releases/download/hnc-${HNC_VERSION} /hnc-manager.yaml
539549```
540550
541551<a name =" admin-excluded-namespaces " />
542552
543553### Including and excluding namespaces from HNC
544554
545- *** Included namespaces are only available in HNC v0.9 and higher.***
546-
547555HNC installs a validating webhook on _ all_ objects in your cluster. If HNC
548556itself is damaged or inaccessible, this could result in all changes to all
549557objects in your cluster being rejected, making it difficult to repair your
@@ -560,7 +568,7 @@ protecting your cluster's stability.
560568HNC supports two methods of specifying which namespaces should be managed, both
561569of which are accessed from the HNC [ argument list] ( #admin-cli-args ) :
562570
563- * ** Included namespace regex (HNC v0.9+ only) :** If set, this will limit HNC to
571+ * ** Included namespace regex:** If set, this will limit HNC to
564572 only cover the namespaces included in this regex. For example, setting this
565573 parameter to ` test-.* ` will ensure that HNC only manages namespaces that begin
566574 with the prefix ` test- ` (HNC adds an implied ` ^...$ ` to the regex). If
@@ -575,14 +583,6 @@ of which are accessed from the HNC [argument list](#admin-cli-args):
575583 ` --excluded-namespace ` option, which can be specified multiple times, one
576584 namespace per option.
577585
578- ** In HNC v0.8 only (not applicable in HNC v0.9 and later):** In addition to
579- specifying excluded namespaces on the command line, you must _ also_ add the
580- ` hnc.x-k8s.io/excluded-namespace=true ` label to all excluded namespaces, _ after_
581- you have restarted HNC with the correct parameter. If you attempt to apply this
582- label to any namespace that is not _ also_ listed in the command line args, HNC
583- will not allow the change, or will remove the label when it is started. This
584- label has no effect in HNC v0.9 or later.
585-
586586
587587<a name =" admin-backup-restore " />
588588
@@ -759,9 +759,10 @@ edit the `config` object directly, which will bypass this protection.
759759
760760<a name="admin-managed-labels"/>
761761
762- # ## Ask HNC to manage certain labels and annotations
762+ # ## (Beta) Ask HNC to manage certain labels and annotations
763763
764- ***Managed labels and annotations are planned for HNC v1.0+***
764+ ***Managed labels and annotations are new in HNC v1.0; please use with
765+ caution.***
765766
766767See [here](concepts.md#admin-managed-labels) for the background on managed
767768labels and annotations. In order to get HNC to manage a label or annotation, use
@@ -881,9 +882,10 @@ gcloud auth list
881882# # Modify command-line arguments
882883
883884HNC's default manifest file (available as part of each release with the name
884- ` hnc-manager.yaml` ) includes a set of reasonable default command-line arguments
885- for HNC. These parameters are part of the `hnc-controller-manager` Deployment
886- object in the `hnc-system` namespace.
885+ ` hnc-manager.yaml` prior to HNC v1.0, and `default.yaml` after HNC v1.0)
886+ includes a set of reasonable default command-line arguments for HNC. These
887+ parameters are part of the `hnc-controller-manager` Deployment object in the
888+ ` hnc-system` namespace.
887889
888890To modify these parameters, you may :
889891
@@ -897,12 +899,14 @@ with significant caution.
897899
898900Interesting parameters include :
899901
900- * `--included-namespace-regex=<pattern>` (HNC v0.9+ only) : limits which
902+ * `--included-namespace-regex=<pattern>`: limits which
901903 namespaces are [managed by HNC](#admin-excluded-namespaces). Defaults to `.*`,
902904 and may only be specified once.
903905* `--excluded-namespace=<namespace>`: allows you to
904906 [exclude a namespace](#admin-excluded-namespaces) from HNC. May be specified
905907 multiple times, one namespace per option.
908+ * `--managed-namespace-label` and `--managed-namespace-annotation`: see [managed
909+ labels and annotations](#admin-managed-labels).
906910* `--unpropagated-annotation=<string>`: empty by default, this argument
907911 can be specified multiple times, with each parameter representing an
908912 annotation name, such as `example.com/foo`. When HNC propagates objects from
0 commit comments