@@ -405,34 +405,52 @@ EOF
405
405
406
406
<a name =" use-managed-labels " />
407
407
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
409
409
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. ***
411
411
412
412
If 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:
417
417
418
418
```
419
419
apiVersion: hnc.x-k8s.io/v1alpha2
420
420
kind: HierarchyConfiguration
421
421
metadata:
422
422
name: hierarchy
423
423
namespace: child
424
- … < other stuff > …
424
+ ... < other stuff > ...
425
425
spec:
426
426
labels: # add
427
427
- key: env # add
428
428
value: prod # add
429
429
```
430
430
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
434
452
[ 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 ) .
436
454
437
455
<a name =" admin " />
438
456
@@ -448,24 +466,14 @@ and webhooks) that were only introduced in v1.16.
448
466
There is no need to uninstall HNC before upgrading it unless specified in the
449
467
release notes for that version.
450
468
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
+
451
472
#### Prerequisites
452
473
453
474
Ensure ` kube-system ` , ` kube-public ` and ` kube-node-lease ` namespaces are listed
454
475
in the [ argument list] ( #admin-cli-args ) with the option ` --excluded-namespace ` .
455
476
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
-
469
477
If you wish, you may also [ exclude additional namespaces from
470
478
HNC] ( #admin-excluded-namespaces ) , but be aware that only the three namespaces
471
479
listed above can be excluded _ by default_ .
@@ -505,7 +513,7 @@ make deploy
505
513
To temporarily disable HNC, simply delete its deployment and webhooks:
506
514
507
515
``` bash
508
- kubectl -n hnc-system delete deployment hnc-controller-manager
516
+ kubectl -n hnc-system delete deployment --all
509
517
kubectl delete validatingwebhookconfiguration.admissionregistration.k8s.io hnc-validating-webhook-configuration
510
518
```
511
519
@@ -534,16 +542,16 @@ relationships and configuration settings:
534
542
# the finalizers first.
535
543
kubectl get crds | grep .hnc.x-k8s.io | awk ' {print $1}' | xargs kubectl delete crd
536
544
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:
538
548
kubectl delete -f https://github.com/kubernetes-sigs/hierarchical-namespaces/releases/download/hnc-${HNC_VERSION} /hnc-manager.yaml
539
549
```
540
550
541
551
<a name =" admin-excluded-namespaces " />
542
552
543
553
### Including and excluding namespaces from HNC
544
554
545
- *** Included namespaces are only available in HNC v0.9 and higher.***
546
-
547
555
HNC installs a validating webhook on _ all_ objects in your cluster. If HNC
548
556
itself is damaged or inaccessible, this could result in all changes to all
549
557
objects in your cluster being rejected, making it difficult to repair your
@@ -560,7 +568,7 @@ protecting your cluster's stability.
560
568
HNC supports two methods of specifying which namespaces should be managed, both
561
569
of which are accessed from the HNC [ argument list] ( #admin-cli-args ) :
562
570
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
564
572
only cover the namespaces included in this regex. For example, setting this
565
573
parameter to ` test-.* ` will ensure that HNC only manages namespaces that begin
566
574
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):
575
583
` --excluded-namespace ` option, which can be specified multiple times, one
576
584
namespace per option.
577
585
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
-
586
586
587
587
<a name =" admin-backup-restore " />
588
588
@@ -759,9 +759,10 @@ edit the `config` object directly, which will bypass this protection.
759
759
760
760
761
761
762
- # ## Ask HNC to manage certain labels and annotations
762
+ # ## (Beta) Ask HNC to manage certain labels and annotations
763
763
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.***
765
766
766
767
See [here](concepts.md#admin-managed-labels) for the background on managed
767
768
labels and annotations. In order to get HNC to manage a label or annotation, use
@@ -881,9 +882,10 @@ gcloud auth list
881
882
# # Modify command-line arguments
882
883
883
884
HNC'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.
887
889
888
890
To modify these parameters, you may :
889
891
@@ -897,12 +899,14 @@ with significant caution.
897
899
898
900
Interesting parameters include :
899
901
900
- * `--included-namespace-regex=` (HNC v0.9+ only) : limits which
902
+ * `--included-namespace-regex=`: limits which
901
903
namespaces are [managed by HNC](#admin-excluded-namespaces). Defaults to `.*`,
902
904
and may only be specified once.
903
905
* `--excluded-namespace=`: allows you to
904
906
[exclude a namespace](#admin-excluded-namespaces) from HNC. May be specified
905
907
multiple times, one namespace per option.
908
+ * `--managed-namespace-label` and `--managed-namespace-annotation`: see [managed
909
+ labels and annotations](#admin-managed-labels).
906
910
* `--unpropagated-annotation=`: empty by default, this argument
907
911
can be specified multiple times, with each parameter representing an
908
912
annotation name, such as `example.com/foo`. When HNC propagates objects from
0 commit comments