Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 3964a2f

Browse files
authored
Merge pull request #1496 from adrianludwin/docs-v08
Update docs for upcoming v0.8
2 parents e1cbb6c + 0fbc404 commit 3964a2f

File tree

4 files changed

+96
-31
lines changed

4 files changed

+96
-31
lines changed

incubator/hnc/docs/user-guide/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# HNC User Guide v0.7 (and v0.6)
1+
# HNC User Guide v0.8 (and v0.7)
22

33
Authors: [email protected] and other contributors from wg-multitenancy
44

@@ -12,7 +12,7 @@ This guide explains how to use hierarchical namespaces, explains some of the
1212
concepts behind them for a more in-depth understanding, and covers some best
1313
practices.
1414

15-
**Note: this doc covers HNC v0.7.x and v0.6.x.** For older versions of HNC,
15+
**Note: this doc covers HNC v0.8.x and v0.7.x.** For older versions of HNC,
1616
see below.
1717

1818
## Table of contents
@@ -25,6 +25,7 @@ see below.
2525

2626
## Older user guides
2727

28+
* [HNC v0.6](https://github.com/kubernetes-sigs/multi-tenancy/tree/hnc-v0.6/incubator/hnc/docs/user-guide)
2829
* [HNC v0.5](https://github.com/kubernetes-sigs/multi-tenancy/tree/hnc-v0.5/incubator/hnc/docs/user-guide)
2930
* [HNC v0.4](https://github.com/kubernetes-sigs/multi-tenancy/tree/hnc-v0.4/incubator/hnc/docs/user-guide)
3031
* [HNC v0.3](https://docs.google.com/document/d/1XVVv1ha4j1WUaszu3mmlACeWPUJXbJhA6zntxswrsco)

incubator/hnc/docs/user-guide/concepts.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,6 @@ application.
318318

319319
### Exceptions and propagation control
320320

321-
***Exceptions are only available in HNC v0.7***
322-
323321
By default, HNC propagates _all_ objects of a [specified type](how-to.md#admin-resources)
324322
from ancestor namespaces to descendant namespaces. However, sometimes this is
325323
too restrictive, and you need to create ***exceptions*** to certain policies. For example:
@@ -537,18 +535,8 @@ We are considering replacing this with the standard
537535

538536
This label should be added to namespaces such as `kube-system` and `kube-public`
539537
so that HNC's validating webhook cannot accidentally prevent operations in these
540-
namespaces and block critical cluster operations.
541-
542-
Before installing HNC, users can customize the excluded namespace list in the HNC
543-
deployment with a container arg called `excluded-namespace` in
544-
`config/manager/manager.yaml` and then set this label on the excluded namespaces.
545-
Setting this label on namespaces that are not
546-
listed in the HNC deployment as an `excluded-namespace` is not allowed.
547-
548-
As of March 2021, the default excluded namespaces listed in [config/manager/manager.yaml](https://github.com/kubernetes-sigs/multi-tenancy/blob/master/incubator/hnc/config/manager/manager.yaml)
549-
are `kube-system`, `kube-public`, `hnc-system` and
550-
`kube-node-lease`. HNC adds this label to `hnc-system` namespace by default, so
551-
users will have to add this label to other excluded namespaces manually.
538+
namespaces and block critical cluster operations. See [Excluding namespaces from
539+
HNC](how-to.md#admin-excluded-namespaces) for more information.
552540

553541
<a name="admin-labels-set">
554542

incubator/hnc/docs/user-guide/how-to.md

Lines changed: 90 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This document describes common tasks you might want to accomplish using HNC.
1818
* [Administer HNC](#admin)
1919
* [Install or upgrade HNC on a cluster](#admin-install)
2020
* [Uninstall HNC from a cluster](#admin-uninstall)
21+
* [Excluding namespaces from HNC](#admin-excluded-namespaces)
2122
* [Backing up and restoring HNC data](#admin-backup-restore)
2223
* [Administer who has access to HNC properties](#admin-access)
2324
* [Modify the resources propagated by HNC](#admin-resources)
@@ -343,8 +344,6 @@ $ kubectl hns set --root <namespace>
343344

344345
### Limit the propagation of an object to descendant namespaces
345346

346-
***Exceptions are only available in HNC v0.7***
347-
348347
To limit the propagation of an object, annotate it with an ***exception***. You
349348
can use any of the following annotations:
350349

@@ -414,6 +413,26 @@ and webhooks) that were only introduced in v1.16.
414413
There is no need to uninstall HNC before upgrading it unless specified in the
415414
release notes for that version.
416415

416+
#### Prerequisite
417+
418+
***These prerequisites apply to HNC v0.8 and higher***
419+
420+
Prior to installing HNC, add the `hnc.x-k8s.io/excluded-namespaces` label to
421+
your critical system namespaces:
422+
423+
```
424+
kubectl label ns kube-system hnc.x-k8s.io/excluded-namespace=true
425+
kubectl label ns kube-public hnc.x-k8s.io/excluded-namespace=true
426+
kubectl label ns kube-node-lease hnc.x-k8s.io/excluded-namespace=true
427+
```
428+
429+
Failure to do so may result in HNC being unable to start, and your cluster's
430+
operations being degraded until you delete HNC or apply the labels.
431+
432+
If you wish, you may also [exclude additional namespaces from
433+
HNC](#admin-excluded-namespaces), but be aware that only the three namespaces
434+
listed above can be excluded _by default_.
435+
417436
#### Install an official release and the kubectl plugin
418437

419438
[The most recent official release is
@@ -478,6 +497,52 @@ kubectl get crds | grep .hnc.x-k8s.io | awk '{print $1}' | xargs kubectl delete
478497
kubectl delete -f https://github.com/kubernetes-sigs/multi-tenancy/releases/download/hnc-${HNC_VERSION}/hnc-manager.yaml
479498
```
480499

500+
<a name="admin-excluded-namespaces"/>
501+
502+
### Excluding namespaces from HNC
503+
504+
***The following instructions are only required for HNC v0.8.x and higher***
505+
506+
HNC installs a validating webhook on _all_ objects in your cluster. If HNC
507+
itself is damaged or inaccessible, this could result in all changes to all
508+
objects in your cluster being rejected, making it difficult to repair your
509+
cluster or even re-install HNC.
510+
511+
512+
In order to prevent HNC from damaging your cluster, you can exclude certain
513+
namespaces from some of HNC's webhooks. Excluded namespace cannot be the
514+
parent or child of any other namespace; any attempts to change the hierarchy of
515+
an excluded namespace, or create a subnamespace within it, will be rejected by
516+
HNC. However, the critical webhooks will not operate in the excluded namespace,
517+
protecting your cluster's stability.
518+
519+
In order to exclude namespaces from HNC _before_ installing it:
520+
521+
1. Add the `hnc.x-k8s.io/excluded-namespace` label with the value of `true` to
522+
all critical namespaces. At a minimum, this label should be applied to
523+
`kube-system`, `kube-public`, and `kube-node-lease` as described in the
524+
[installation instructions](#admin-install), but you may add additional
525+
namespaces if you wish.
526+
2. Ensure that all the namespaces you have excluded are also listed in the
527+
[argument list](#admin-cli-args) with the option `--excluded-namespace`. By
528+
default, the HNC manifests include all the critical system namespaces listed
529+
above, but you can exclude any namespace you like.
530+
3. Apply the HNC manifest.
531+
532+
To exclude an additional namespace from HNC _after_ it has been installed,
533+
follow these steps:
534+
535+
1. Add the namespace to the list of `--excluded-namespace` [command line
536+
args](#admin-cli-args).
537+
2. Apply the `hnc.x-k8s.io/excluded-namespace=true` label to the namespace.
538+
539+
If you attempt to apply the `hnc.x-k8s.io/excluded-namespace` label to any
540+
namespace that is not _also_ listed in the command line args, HNC will not allow
541+
the change, or will remove the label when it is started. This prevents users
542+
with edit access to a single namespace from removing themselves from HNC without
543+
permission of the HNC administrator.
544+
545+
481546
<a name="admin-backup-restore"/>
482547

483548
### Backing up and restoring HNC data
@@ -750,13 +815,32 @@ gcloud auth list
750815

751816
HNC's default manifest file (available as part of each release with the name
752817
`hnc-manager.yaml`) includes a set of reasonable default command-line arguments
753-
for HNC, but you can tweak certain parameters to modify how HNC behaves. These
754-
parameters are different from those controlled by `HNCConfiguration` - they
755-
should only be modified extremely rarely, and only with significant caution.
818+
for HNC. These parameters are part of the `hnc-controller-manager` Deployment
819+
object in the `hnc-system` namespace.
820+
821+
To modify these parameters, you may:
822+
823+
* Modify the manifest file and re-apply it with `kubectl apply -f`
824+
* Directly edit the Deployment via `kubectl edit -n hnc-system deploy
825+
hnc-controller-manager`.
826+
827+
Note that these parameters are different from those controlled by
828+
`HNCConfiguration` - they should only be modified extremely rarely, and only
829+
with significant caution.
756830

757831
Interesting parameters include:
758832

759-
* `--apiserver-qps-throttle=&lt;integer&gt;`: set to 50 by default, this limits how many
833+
* `--excluded-namespace=<namespace>`: allows you to
834+
[exclude a namespace](#admin-excluded-namespaces) from HNC.
835+
* `--unpropagated-annotation=<string>`: empty by default, this argument
836+
can be specified multiple times, with each parameter representing an
837+
annotation name, such as `example.com/foo`. When HNC propagates objects from
838+
ancestor to descendant namespaces, it will strip these annotations out of the
839+
metadata of the _copy_ of the object, if it exists. For example, this can be
840+
used to remove an annotation on the source object that's has a special meaning
841+
to another system, such as GKE Config Sync. If you restart HNC after changing
842+
this arg, all _existing_ propagated objects will also be updated.
843+
* `--apiserver-qps-throttle=<integer>`: set to 50 by default, this limits how many
760844
requests HNC will send to the Kubernetes apiserver per second in the steady
761845
state (it may briefly allow up to 50% more than this number). Setting this
762846
value too high can overwhelm the apiserver and prevent it from serving
@@ -777,11 +861,3 @@ Interesting parameters include:
777861
load on your metrics database (through increased metric cardinality) and also
778862
by increasing how carefully you need to guard your metrics against
779863
unauthorized viewers.
780-
* `--unpropagated-annotation=&lt;string&gt;`: empty by default, this argument
781-
can be specified multiple times, with each parameter representing an
782-
annotation name, such as `example.com/foo`. When HNC propagates objects from
783-
ancestor to descendant namespaces, it will strip these annotations out of the
784-
metadata of the _copy_ of the object, if it exists. For example, this can be
785-
used to remove an annotation on the source object that's has a special meaning
786-
to another system, such as GKE Config Sync. If you restart HNC after changing
787-
this arg, all _existing_ propagated objects will also be updated.

incubator/hnc/docs/user-guide/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ also show up in the HNC logs, and in its [metrics](how-to.md#admin-metrics).
630630

631631
<a name="exceptions"/>
632632

633-
## Keeping objects out of certain namespaces (v0.7 only)
633+
## Keeping objects out of certain namespaces
634634

635635
_Demonstrates: exceptions_
636636

0 commit comments

Comments
 (0)