@@ -509,42 +509,49 @@ kubectl delete -f https://github.com/kubernetes-sigs/hierarchical-namespaces/rel
509509
510510<a name =" admin-excluded-namespaces " />
511511
512- ### Excluding namespaces from HNC
512+ ### Including and excluding namespaces from HNC
513513
514- *** The following instructions are only required for HNC v0.8.x and higher***
514+ *** Excluded namespaces are only available in HNC v0.8 and higher. Included
515+ namespaces are only available in HNC v0.9 and higher.***
515516
516517HNC installs a validating webhook on _ all_ objects in your cluster. If HNC
517518itself is damaged or inaccessible, this could result in all changes to all
518519objects in your cluster being rejected, making it difficult to repair your
519- cluster or even re-install HNC.
520+ cluster or even re-install HNC, without first deleting the webhook (webhook
521+ configs are not themselves affected by webhooks).
520522
521-
522- In order to prevent HNC from damaging your cluster, you can exclude certain
523- namespaces from some of HNC's webhooks. Excluded namespace cannot be the
524- parent or child of any other namespace; any attempts to change the hierarchy of
525- an excluded namespace, or create a subnamespace within it, will be rejected by
523+ In order to prevent HNC from damaging your cluster, you can limit which
524+ namespaces are managed by HNC. Unmanaged namespaces cannot be the parent or
525+ child of any other namespace; any attempts to change the hierarchy of an
526+ unmanaged namespace, or create a subnamespace within it, will be rejected by
526527HNC. However, the critical webhooks will not operate in the excluded namespace,
527528protecting your cluster's stability.
528529
529- In order to exclude namespaces from HNC:
530- 1 . Determine the namespaces you want to exclude. At a minimum, you should exclude
531- ` kube-system ` , ` kube-public ` , and ` kube-node-lease ` as described in the
532- [ installation instructions] ( #admin-install ) . By default, the HNC manifests
533- exclude all these critical system namespaces listed above, but you can exclude
534- any namespace you like.
535- 1 . ** This is required in HNC v0.8 only, but not applicable in HNC v0.9 and later** - Add the
536- ` hnc.x-k8s.io/excluded-namespace ` label with the value of ` true ` to all the
537- excluded namespaces.
538- 1 . Ensure that all the namespaces you want to exclude are listed in the
539- [ argument list] ( #admin-cli-args ) with the option ` --excluded-namespace ` .
540- 1 . Apply the HNC manifest.
541-
542- ** In HNC v0.8 only (not applicable in HNC v0.9 and later)** - If you attempt to
543- apply the ` hnc.x-k8s.io/excluded-namespace ` label to any namespace that is
544- not _ also_ listed in the command line args, HNC will not allow the change, or
545- will remove the label when it is started. This prevents users with edit access
546- to a single namespace from removing themselves from HNC without permission of
547- the HNC administrator.
530+ HNC supports two methods of specifying which namespaces should be managed, both
531+ of which are accessed from the HNC [ argument list] ( #admin-cli-args ) :
532+
533+ * ** Included namespace regex (HNC v0.9+ only):** If set, this will limit HNC to
534+ only cover the namespaces included in this regex. For example, setting this
535+ parameter to ` test-.* ` will ensure that HNC only manages namespaces that begin
536+ with the prefix ` test- ` (HNC adds an implied ` ^...$ ` to the regex). If
537+ omitted, HNC will manage _ all_ namespaces in the cluster unless they are
538+ specifically excluded. The included namespace regex is set using the
539+ ` --included-namespace-regex ` , which can only be used once.
540+ * ** Excluded namespaces:** These namespaces are excluded even if they match the
541+ included namespace regex. The default installation of HNC excludes
542+ ` kube-system ` , ` kube-public ` , and ` kube-node-lease ` , as described in the
543+ [ installation instructions] ( #admin-install ) . But you can exclude
544+ any namespace you like. Excluded namespaces are specified using the
545+ ` --excluded-namespace ` option, which can be specified multiple times, one
546+ namespace per option.
547+
548+ ** In HNC v0.8 only (not applicable in HNC v0.9 and later):** In addition to
549+ specifying excluded namespaces on the command line, you must _ also_ add the
550+ ` hnc.x-k8s.io/excluded-namespace=true ` label to all excluded namespaces, _ after_
551+ you have restarted HNC with the correct parameter. If you attempt to apply this
552+ label to any namespace that is not _ also_ listed in the command line args, HNC
553+ will not allow the change, or will remove the label when it is started. This
554+ label has no effect in HNC v0.9 or later.
548555
549556
550557<a name =" admin-backup-restore " />
@@ -834,8 +841,12 @@ with significant caution.
834841
835842Interesting parameters include :
836843
844+ * `--included-namespace-regex=<pattern>` (HNC v0.9+ only): limits which
845+ namespaces are [managed by HNC](#admin-excluded-namespaces). Defaults to `.*`,
846+ and may only be specified once.
837847* `--excluded-namespace=<namespace>`: allows you to
838- [exclude a namespace](#admin-excluded-namespaces) from HNC.
848+ [exclude a namespace](#admin-excluded-namespaces) from HNC. May be specified
849+ multiple times, one namespace per option.
839850* `--unpropagated-annotation=<string>`: empty by default, this argument
840851 can be specified multiple times, with each parameter representing an
841852 annotation name, such as `example.com/foo`. When HNC propagates objects from
0 commit comments